[SailfishDevel] SDL_mixer: different behaviour between emulator and actual device

Iosif Hamlatzis i.hamlatzis at gmail.com
Mon Apr 14 19:30:00 UTC 2014


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20140414/03da0227/attachment.html>


More information about the Devel mailing list