[SDL] SDL 2.0.4, MacOsX and 32 Bits: sound problem solved. It's not SDL but Hatari code.
vernet.jerome at wanadoo.fr
Mon Sep 19 22:41:44 PDT 2016
Found the problem. It's not (really) SDL problem but in Hatari.
When using SDL_OpenAudio, you NEED to pass as second parameter a
SDL_AudioSpec, NOT null. SDL return in this SDL_AudioSpec what it get,
NO MORE in the first parameter.
In 32 Bit, on MacOsX, desiredAudioSpec.size is not initialized and take
So the code have to be:
if (SDL_OpenAudio(&desiredAudioSpec, &obtained)) /* Open audio device */
fprintf(stderr, "Can't use audio: %s\n", SDL_GetError());
bSoundWorking = false;
ConfigureParams.Sound.bEnableSound = false;
SoundBufferSize = obtained.size; /* May be different than the
requested one! */
SoundBufferSize /= 4; /* bytes -> samples (16 bit
signed stereo -> 4 bytes per sample) */
if (SoundBufferSize > MIXBUFFER_SIZE/2)
fprintf(stderr, "Warning: Soundbuffer size is too big!\n");
More information about the SDL