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

Method Stop

stream_audio/streamaudio.cpp:705–742  ·  view source on GitHub ↗

causes a rewind to start of stream, if on_measure is true, stop occurs when measure ends

Source from the content-addressed store, hash-verified

703}
704// causes a rewind to start of stream, if on_measure is true, stop occurs when measure ends
705void AudioStream::Stop(bool on_measure, int *stop_flag) {
706 if (!m_ll_sndsys) {
707 return;
708 }
709 m_start_on_frame = false;
710 if (m_state == STRM_INVALID) {
711 if (stop_flag) {
712 *stop_flag = true;
713 }
714 return;
715 }
716 if (m_state != STRM_STOPPED) {
717 if (!on_measure) {
718 if (m_state == STRM_PLAYING || m_state == STRM_PAUSED || m_state == STRM_STOPPING) {
719 m_ll_sndsys->StopSound(m_llshandle, SKT_STOP_IMMEDIATELY);
720 m_state = STRM_STOPPED;
721 m_readahead = m_readahead_finished_loop = true;
722 DeactivateStream(this);
723 m_llshandle = -1;
724 m_curmeasure = 0;
725 }
726 } else {
727 // handle soft stopping.
728 m_stopflag = stop_flag;
729 if (m_stopflag) {
730 *m_stopflag = false;
731 }
732 m_stopnextmeasure = on_measure;
733 }
734 } else {
735 DeactivateStream(this);
736 m_llshandle = -1;
737 m_curmeasure = 0;
738 if (m_stopflag) {
739 *m_stopflag = true;
740 }
741 }
742}
743// performs a clean stop and play when switching to next stream
744void AudioStream::Reset() {
745 m_archive.Rewind();

Callers 2

FrameMethod · 0.45
StreamStopFunction · 0.45

Calls 1

StopSoundMethod · 0.45

Tested by

no test coverage detected