// pause/stop playback of the current song void org_stop(void) { if (song.playing) { song.playing = false; // cancel whichever buffer is playing SSAbortChannel(ORG_CHANNEL); } }
// aborts all sounds with a userdata value matching "ud". void SSAbortChannelByUserData(int ud) { int c; SSLockAudio(); for(c=0;c<SS_NUM_CHANNELS;c++) { if (SSChannelPlaying(c) && SSGetCurUserData(c)==ud) SSAbortChannel(c); } SSUnlockAudio(); }
// works like SSEnqueueChunk, only it does not enqueue. Instead, if a sound // is already playing on the channel, it is stopped and the new sound takes it's place. // if c==-1, it acts identically to SSEnqueueChunk since a "free channel" by definition // has no existing sound to be affected by a queueing operation. int SSPlayChunk(int c, signed short *buffer, int len, int userdata, void(*FinishedCB)(int, int)) { if (c != -1) SSAbortChannel(c); return SSEnqueueChunk(c, buffer, len, userdata, FinishedCB); }