SDL_mixer seems to work differently on the emulator from the device. Using the emulator I can play both .wav and .ogg files without a problem using SDL_mixer, but on my device no sound comes out.
My sound initialisation function: void InitSound() { const int NUM_CHANNELS = 16; int rate = 44100; Uint16 format = AUDIO_S16SYS; int channels = 2; int bufferSize = 1024; if ( Mix_OpenAudio(rate, format, channels, bufferSize) == 0 ) Mix_AllocateChannels(NUM_CHANNELS); else Debug::DbgOutF( "Mix_OpenAudio: %s\n", Mix_GetError() ); } My call for playing: Mix_Music* pMusic = Mix_LoadMUS( filename ); <- for .ogg and other music files Mix_Chunk* pSound = Mix_LoadWAV( filename ); <- for .wav files And then I call different SDL_mixer function for playing the above files bool repeat; <- true or false depending if I want one time play or infinite Mix_PlayMusic(pMusic, repeat?-1:0); <- for .ogg and other music files Mix_PlayChannel(-1, pSound, repeat?-1:0 ) <- for .wav files For code clarity above I haven't included my checks if pointers and return value of SDL_mixer calls are valid, but in my actual game I check that either pMusic or pSound are not NULL depending on my sound file and that the return value of the Mix_* calls is 0 according to the documentation. I haven't tested the sample from https://github.com/thp/sdl2-opengles-test yet, but don't expect different results.
_______________________________________________ SailfishOS.org Devel mailing list