mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-11-13 06:15:07 +01:00
[SDL] don't accept alternate audio formats
On my PC, the SDL2 build doesn't 'obtain' the S16 format it requests, but since the rest of the SDL2 frontend expects S16, this causes the audio to fail. So, instead, I force SDL to accept S16, and just convert to the native format implicitly. I also applied this to every sound format setting, since I imagine the frontend doesn't support obtaining only one channel, or a non 48kHz frequency.
This commit is contained in:
parent
aeb3a98df2
commit
cb5b682872
@ -66,7 +66,7 @@ static void sdl_sound_callback(void *userdata, Uint8 *stream, int len)
|
||||
static int sdl_sound_init()
|
||||
{
|
||||
int n;
|
||||
SDL_AudioSpec as_desired, as_obtained;
|
||||
SDL_AudioSpec as_desired;
|
||||
|
||||
if(SDL_Init(SDL_INIT_AUDIO) < 0) {
|
||||
MessageBox(NULL, "SDL Audio initialization failed", "Error", 0);
|
||||
@ -79,16 +79,11 @@ static int sdl_sound_init()
|
||||
as_desired.samples = SOUND_SAMPLES_SIZE;
|
||||
as_desired.callback = sdl_sound_callback;
|
||||
|
||||
if(SDL_OpenAudio(&as_desired, &as_obtained) == -1) {
|
||||
if(SDL_OpenAudio(&as_desired, NULL) == -1) {
|
||||
MessageBox(NULL, "SDL Audio open failed", "Error", 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(as_desired.samples != as_obtained.samples) {
|
||||
MessageBox(NULL, "SDL Audio wrong setup", "Error", 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
sdl_sound.current_emulated_samples = 0;
|
||||
n = SOUND_SAMPLES_SIZE * 2 * sizeof(short) * 20;
|
||||
sdl_sound.buffer = (char*)malloc(n);
|
||||
|
@ -69,7 +69,7 @@ static void sdl_sound_callback(void *userdata, Uint8 *stream, int len)
|
||||
static int sdl_sound_init()
|
||||
{
|
||||
int n;
|
||||
SDL_AudioSpec as_desired, as_obtained;
|
||||
SDL_AudioSpec as_desired;
|
||||
|
||||
if(SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) {
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", "SDL Audio initialization failed", sdl_video.window);
|
||||
@ -82,16 +82,11 @@ static int sdl_sound_init()
|
||||
as_desired.samples = SOUND_SAMPLES_SIZE;
|
||||
as_desired.callback = sdl_sound_callback;
|
||||
|
||||
if(SDL_OpenAudio(&as_desired, &as_obtained) == -1) {
|
||||
if(SDL_OpenAudio(&as_desired, NULL) == -1) {
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", "SDL Audio open failed", sdl_video.window);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(as_desired.samples != as_obtained.samples) {
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", "SDL Audio wrong setup", sdl_video.window);
|
||||
return 0;
|
||||
}
|
||||
|
||||
sdl_sound.current_emulated_samples = 0;
|
||||
n = SOUND_SAMPLES_SIZE * 2 * sizeof(short) * 20;
|
||||
sdl_sound.buffer = (char*)malloc(n);
|
||||
|
Loading…
Reference in New Issue
Block a user