X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4d6306eb4da8cdac4b5dee9784959672c233eec8..7d255c9c341f4bdc3b1fb1adcca8ff6087533de9:/utils/wxMMedia/sndfile.cpp diff --git a/utils/wxMMedia/sndfile.cpp b/utils/wxMMedia/sndfile.cpp index 798969a6c9..0a5c031b6e 100644 --- a/utils/wxMMedia/sndfile.cpp +++ b/utils/wxMMedia/sndfile.cpp @@ -60,8 +60,9 @@ void wxSndFileCodec::Play(wxSound& snd) if (m_fstate != wxSFILE_STOPPED || IsSet(wxSND_BUFLOCKED)) return; - if (!(m_fsize = PrepareToPlay())) - return; + if (m_fstate != wxSFILE_PREPARED_TO_PLAY) + if (!(m_fsize = PrepareToPlay())) + return; m_fpos = 0; m_fstate = wxSFILE_PLAYING; @@ -193,7 +194,7 @@ wxMMtime wxSndFileCodec::GetPosition() wxMMtime wxSndFileCodec::GetLength() { if (m_sndtime.hours == -1 && m_istream) - PrepareToPlay(); + m_fsize = PrepareToPlay(); return m_sndtime; } @@ -202,7 +203,6 @@ bool wxSndFileCodec::TranslateBuffer(wxSndBuffer& buf) { #define TMP_BUFSIZE 10240 - wxUint32 buf_size; wxStreamBuffer *tmp_buf; wxSoundCodec *codec_in, *codec_out; wxSoundDataFormat std_format; @@ -283,6 +283,8 @@ wxUint32 wxSndFileCodec::GetSize() const wxUint32 wxSndFileCodec::Available() const { + if (m_fstate == wxSFILE_STOPPED) + return 0; return m_fsize-m_fpos; }