void play(struct audio_chunk *new_chunk, int channel) { struct audio_chunk *cp; struct audio_channel *chp; assert(channel >= 0 && channel < AV_NUM_CHANNELS); chp = &Channels[channel]; if (!have_audio) return; SDL_LockAudio(); for (cp = chp->chunk; cp; cp = cp->next) { if (cp == new_chunk) { DEBUG1("attempt to do add duplicate chunk"); av_silence(channel); break; } } new_chunk->next = NULL; *chp->chunk_tailp = new_chunk; SDL_UnlockAudio(); }
void av_silence(int channel) { int i = channel; if (channel == AV_ALL_CHANNELS) { for (i = 0; i < AV_NUM_CHANNELS; ++i) { av_silence(i); } } else { assert(channel >= 0 && channel < AV_NUM_CHANNELS); if (Channels[channel].chunk) { SDL_LockAudio(); Channels[channel].chunk = NULL; Channels[channel].chunk_tailp = &Channels[channel].chunk; Channels[channel].offset = 0; SDL_UnlockAudio(); } } }
void StopVoice(void) { av_silence(AV_SOUND_CHANNEL); }
void KillVoice(void) { av_silence(AV_SOUND_CHANNEL); }
void StopAudio(char mode) { av_silence(AV_SOUND_CHANNEL); }