Simple code to just loop a WAV file using SGDK

SGDK only sub forum

Moderator: Stef

Post Reply
sendbit
Newbie
Posts: 7
Joined: Wed Apr 25, 2012 4:54 pm

Simple code to just loop a WAV file using SGDK

Post by sendbit » Wed Apr 25, 2012 5:00 pm

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!

sendbit
Newbie
Posts: 7
Joined: Wed Apr 25, 2012 4:54 pm

Post by sendbit » Wed Apr 25, 2012 5:49 pm

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

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Wed Apr 25, 2012 8:45 pm

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.

sendbit
Newbie
Posts: 7
Joined: Wed Apr 25, 2012 4:54 pm

Post by sendbit » Thu Apr 26, 2012 8:38 am

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?

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Thu Apr 26, 2012 11:08 am

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 :)

Post Reply