mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-16 11:06:49 +01:00
Fixed bug 3710 - SDL_OpenAudio(desired, obtained) doesn't update desired's size when obtained is NULL
David Ludwig I've created a new set of patches. I am happy to create more, if it would help. One version only copies 'size'. A second version copies both 'size' and 'silence'. When looking over the documentation for SDL_OpenAudio in SDL_audio.h, it mentioned that both 'size' and 'silence' were things that SDL_OpenAudio would calculate. Regarding *both* patches, I did notice that SDL 1.2 appears to have always modified desired's size and silence fields. The SDL wiki, at https://wiki.libsdl.org/SDL_OpenAudio#Remarks , does note:
This commit is contained in:
parent
003d491f86
commit
8e7998e19d
@ -1413,7 +1413,14 @@ SDL_OpenAudio(SDL_AudioSpec * desired, SDL_AudioSpec * obtained)
|
||||
id = open_audio_device(NULL, 0, desired, obtained,
|
||||
SDL_AUDIO_ALLOW_ANY_CHANGE, 1);
|
||||
} else {
|
||||
id = open_audio_device(NULL, 0, desired, NULL, 0, 1);
|
||||
SDL_AudioSpec _obtained;
|
||||
SDL_zero(_obtained);
|
||||
id = open_audio_device(NULL, 0, desired, &_obtained, 0, 1);
|
||||
/* On successful open, copy calculated values into 'desired'. */
|
||||
if (id > 0) {
|
||||
desired->size = _obtained.size;
|
||||
desired->silence = _obtained.silence;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_assert((id == 0) || (id == 1));
|
||||
|
Loading…
Reference in New Issue
Block a user