The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL 2.0.4, MacOsX and 32 Bits: sound problem solved. It's no
Jerome Vernet
Guest

Hello,

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
whatever value.

So the code have to be:

SDL_AudioSpec desiredAudioSpec,obtained;
...
if (SDL_OpenAudio(&desiredAudioSpec, &obtained)) /* Open audio device */
{
fprintf(stderr, "Can't use audio: %s\n", SDL_GetError());
bSoundWorking = false;
ConfigureParams.Sound.bEnableSound = false;
SDL_QuitSubSystem(SDL_INIT_AUDIO);
return;
}

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");
}

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org