BOOLEAN ChannelPlaying (COUNT WhichChannel) { audio_IntVal state; audio_GetSourcei (soundSource[WhichChannel].handle, audio_SOURCE_STATE, &state); if (state == audio_PLAYING) return TRUE; return FALSE; }
static void CheckFinishedChannels (void) { int i; for (i = FIRST_SFX_SOURCE; i <= LAST_SFX_SOURCE; ++i) { audio_IntVal state; audio_GetSourcei (soundSource[i].handle, audio_SOURCE_STATE, &state); if (state == audio_STOPPED) { CleanSource (i); // and if it failed... we still dont care audio_GetError(); } } }
// ResumeTrack should resume a paused track, and do nothing for a playing track void ResumeTrack (void) { audio_IntVal state; if (!sound_sample) return; // nothing to resume LockMutex (soundSource[SPEECH_SOURCE].stream_mutex); if (!cur_chunk) { // not playing anything, so no resuming UnlockMutex (soundSource[SPEECH_SOURCE].stream_mutex); return; } audio_GetSourcei (soundSource[SPEECH_SOURCE].handle, audio_SOURCE_STATE, &state); if (state == audio_PAUSED) ResumeStream (SPEECH_SOURCE); UnlockMutex (soundSource[SPEECH_SOURCE].stream_mutex); }