Page 1 of 1
Simple code to just loop a WAV file using SGDK
Posted: Wed Apr 25, 2012 5:00 pm
by sendbit
Hello, I was wondering if anyone had a very simple main.c example of looping a wave file using SGDK. I am not sure exactly what is the minimum required based on the sample sound file included with the toolchain. Thanks!
Posted: Wed Apr 25, 2012 5:49 pm
by sendbit
Thanks anyway.
I got it:
Code: Select all
if (SND_isPlaying_4PCM(SOUND_PCM_CH4_MSK)){SND_stopPlay_4PCM(SOUND_PCM_CH4);}
SND_startPlay_4PCM(__SOME_WAV_FILE__, sizeof(__SOME_WAV_FILE__), SOUND_PCM_CH4, 1);
SGDK is awesome
Posted: Wed Apr 25, 2012 8:45 pm
by Stef
Thanks ^^
You was quite fast to find the solution anyway !
There is severals "drivers" to play samples (WAV), the one you used permit to play simultaneously 4 samples but playback rate is then fixed to 16 Khz.
There is a sound test example in SGDK who demonstrate different drivers uses.
Posted: Thu Apr 26, 2012 8:38 am
by sendbit
Thanks for that additional info. Should I be using the driver that can only support one sample at a time if not using the other available sample slots?
Posted: Thu Apr 26, 2012 11:08 am
by Stef
sendbit wrote:Thanks for that additional info. Should I be using the driver that can only support one sample at a time if not using the other available sample slots?
Yeah i think it's better as the driver support several playback rate as it does support panning too. If you don't need that feature then you can go with the 4 channels player
