Skip to content
Snippets Groups Projects
Commit f918c402 authored by deuce's avatar deuce
Browse files

Add an SDL beep to allow the first beep to not block the console.

(successive beeps currently still will)
parent 5b1f0487
No related branches found
No related tags found
No related merge requests found
......@@ -195,6 +195,7 @@ static int try_sdl_init(int mode)
cio_api.set_modepalette=bitmap_set_modepalette;
cio_api.map_rgb = bitmap_map_rgb;
cio_api.replace_font = bitmap_replace_font;
cio_api.beep = sdl_beep;
return(1);
}
return(0);
......
......@@ -1392,3 +1392,15 @@ int sdl_initciolib(int mode)
sdl_keylock=sdl.SDL_CreateMutex();
return(sdl_init(mode));
}
void
sdl_beep(void)
{
static unsigned char wave[2206];
if (wave[2205] == 0) {
xptone_makewave(440, wave, 2205, WAVE_SHAPE_SINE_SAW_HARM);
wave[2205] = 1;
}
xp_play_sample(wave, 2205, TRUE);
}
......@@ -37,6 +37,7 @@ int sdl_get_window_info(int *width, int *height, int *xpos, int *ypos);
int sdl_setpalette(uint32_t index, uint16_t r, uint16_t g, uint16_t b);
void sdl_setwinsize(int w, int h);
void sdl_setwinposition(int x, int y);
void sdl_beep(void);
#ifdef __cplusplus
}
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment