BOOL CPlayer::UnpreparePlayback(BOOL fEos, BOOL fError) { if (fEos) { if (m_pOutHdr) { OutputBuffer(m_pOutHdr, m_cbOutBuf - m_cbOutBufLeft); m_pOutHdr = NULL; m_cbOutBufLeft = 0; } while (!m_Output.IsFlushed()) { if (m_fPlay && GetStatus() == MAP_STATUS_PLAY) { m_Output.Pause(FALSE); m_fPlay = FALSE; } Sleep(1); if (m_fSeek) return FALSE; if (m_fStop) break; //UpdatePeek(); } } m_Output.Close(); m_Echo.Close(); m_Reverb.Close(); m_BassBoost.Close(); m_3DChorus.Close(); m_Decoder.Destroy(); if (!m_Options.fAlwaysOpenDevice || fError) m_Output.CloseAll(); m_pOutHdr = NULL; m_cbOutBufLeft = 0; m_nSeek = 0; m_fPlay = FALSE; m_fStop = FALSE; m_fSeek = FALSE; MpgStop(); return TRUE; }
BOOL CPlayer::UnpreparePlayback(BOOL fEos, BOOL fError) { if (fEos) { if (m_pOutHdr) { OutputBuffer(m_pOutHdr, m_cbOutBuf - m_cbOutBufLeft); m_pOutHdr = NULL; m_cbOutBufLeft = 0; } while (!m_Output.IsFlushed()) { if (m_fPlay && GetStatus() == MAP_STATUS_PLAY) { m_Output.Pause(FALSE); m_fPlay = FALSE; } Sleep(1); if (m_fSeek) return FALSE; if (m_fStop) break; UpdatePeek(); } } m_Output.Close(); m_Echo.Close(); m_Reverb.Close(); m_BassBoost.Close(); m_3DChorus.Close(); m_Decoder.Destroy(); if (!m_Options.fAlwaysOpenDevice || fError) m_Output.CloseAll(); if (m_fOpen == OPEN_URL) { m_Receiver.Disconnect(); m_StreamingStatus = MAP_STREAMING_DISCONNECTED; } m_pOutHdr = NULL; m_cbOutBufLeft = 0; m_nSeek = 0; m_fPlay = FALSE; m_fStop = FALSE; m_fSeek = FALSE; switch (m_fOpen) { case OPEN_PLUGIN: PlugInStop(); break; case OPEN_MPG_FILE: MpgStop(); break; case OPEN_OV_FILE: OvStop(); break; case OPEN_WAV_FILE: WavStop(); break; case OPEN_URL: NetStop(); break; } PostMessage(m_hwndMessage, MAP_MSG_PEEK, 0, 0); UpdateStatus(MAP_STATUS_STOP, fError); return TRUE; }