void audio_StreamSource_stop(audio_StreamSource *source) { if(source->common.state == audio_SourceState_stopped) { return; } for(int i = 0; i < moduleData.playingStreamCount; ++i) { if(moduleData.playingStreams[i] == source) { --moduleData.playingStreamCount; moduleData.playingStreams[i] = moduleData.playingStreams[moduleData.playingStreamCount]; break; } } audio_SourceCommon_stop(&source->common); ALint count; alGetSourcei(source->common.source, AL_BUFFERS_PROCESSED, &count); for(int j = 0; j < count; ++j) { ALuint buf; alSourceUnqueueBuffers(source->common.source, 1, &buf); } source->decoder->rewind(source->decoderData); source->decoder->flush(source->decoderData); initialPreload(source); }
static void audio_StreamSource_stop1(audio_StreamSource *source) { // Remove from list of active streams for(int i = 0; i < moduleData.playingStreamCount; ++i) { if(moduleData.playingStreams[i] == source) { --moduleData.playingStreamCount; moduleData.playingStreams[i] = moduleData.playingStreams[moduleData.playingStreamCount]; break; } } audio_SourceCommon_stop(&source->common); ALint count; alGetSourcei(source->common.source, AL_BUFFERS_PROCESSED, &count); for(int j = 0; j < count; ++j) { ALuint buf; alSourceUnqueueBuffers(source->common.source, 1, &buf); } }
void audio_SourceCommon_free(audio_SourceCommon *source) { audio_SourceCommon_stop(source); alDeleteSources(1, &source->source); }
void audio_StaticSource_stop(audio_StaticSource *source) { audio_SourceCommon_stop(&source->common); audio_StaticSource_rewind(source); }
void audio_StaticSource_free(audio_StaticSource *source) { audio_SourceCommon_stop(&source->common); alSourcei(source->common.source, AL_BUFFER, AL_NONE); audio_StaticBuffer_unref(source->buffer); audio_SourceCommon_free(&source->common); }