MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / Close

Method Close

stream_audio/streamaudio.cpp:392–418  ·  view source on GitHub ↗

deallocates all stream buffers and decoder.

Source from the content-addressed store, hash-verified

390}
391// deallocates all stream buffers and decoder.
392void AudioStream::Close() {
393 int i;
394 if (m_archive.Opened()) {
395 // stop the stream, close the archive, close the decoder.
396 AudioStream::Stop();
397 m_archive.Close();
398 m_curid = -1;
399 // free streaming buffers and decoder if we need to.
400 for (i = 0; i < STRM_BUFCOUNT; i++) {
401 if (m_buffer[i].data) {
402 mem_free(m_buffer[i].data);
403 m_buffer[i].data = NULL;
404 m_buffer[i].nbytes = 0;
405 m_buffer[i].flags = 0;
406 m_buffer[i].id = -1;
407 }
408 }
409
410 if (m_decoder) {
411 delete m_decoder;
412 m_decoder = NULL;
413 }
414 }
415 m_playcount = 0;
416 m_nbufs = 0;
417 m_state = STRM_INVALID;
418}
419// has stream finished with its readahead of current loop?
420bool AudioStream::ReadAheadFinishedLoop() {
421 if (m_readahead_finished_loop) {

Callers 4

ShutdownMethod · 0.45
FrameMethod · 0.45
StreamPlayFunction · 0.45
StreamStopFunction · 0.45

Calls 1

OpenedMethod · 0.80

Tested by

no test coverage detected