From 5bee458a0f61063fc142a50012261d8ac2c32e5a Mon Sep 17 00:00:00 2001 From: Guilhem Lavaux Date: Tue, 15 Feb 2000 18:49:25 +0000 Subject: [PATCH] * Added IsPaused() to wxSoundFileStream * Play/Pause/Resume should work in wxMMBoard git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6051 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- utils/wxMMedia2/Makefile.in | 1 + utils/wxMMedia2/board/mmbman.cpp | 6 ++++++ utils/wxMMedia2/board/mmbman.h | 1 + utils/wxMMedia2/board/mmboard.cpp | 9 +++++++++ utils/wxMMedia2/lib/sndcpcm.cpp | 2 +- utils/wxMMedia2/lib/sndfile.h | 1 + 6 files changed, 19 insertions(+), 1 deletion(-) diff --git a/utils/wxMMedia2/Makefile.in b/utils/wxMMedia2/Makefile.in index e9c58e47e9..5bbe72e939 100644 --- a/utils/wxMMedia2/Makefile.in +++ b/utils/wxMMedia2/Makefile.in @@ -1,3 +1,4 @@ all: cd lib; make cd sample; make + cd board; make diff --git a/utils/wxMMedia2/board/mmbman.cpp b/utils/wxMMedia2/board/mmbman.cpp index 95d8d67686..4197de80a5 100644 --- a/utils/wxMMedia2/board/mmbman.cpp +++ b/utils/wxMMedia2/board/mmbman.cpp @@ -76,6 +76,7 @@ public: MMBoardTime GetLength(); bool IsStopped(); + bool IsPaused(); wxString GetStringType(); wxString GetStringInformation(); @@ -157,6 +158,11 @@ bool MMBoardSoundFile::IsStopped() return m_file_stream->IsStopped(); } +bool MMBoardSoundFile::IsPaused() +{ + return m_file_stream->IsPaused(); +} + MMBoardTime MMBoardSoundFile::GetPosition() { wxUint32 length, seconds; diff --git a/utils/wxMMedia2/board/mmbman.h b/utils/wxMMedia2/board/mmbman.h index 7a31081f72..c8446fab8b 100644 --- a/utils/wxMMedia2/board/mmbman.h +++ b/utils/wxMMedia2/board/mmbman.h @@ -56,6 +56,7 @@ class MMBoardFile { virtual MMBoardTime GetLength() = 0; virtual bool IsStopped() = 0; + virtual bool IsPaused() = 0; virtual wxString GetStringType() = 0; virtual wxString GetStringInformation() = 0; diff --git a/utils/wxMMedia2/board/mmboard.cpp b/utils/wxMMedia2/board/mmboard.cpp index c0144f26aa..0c55510f1d 100644 --- a/utils/wxMMedia2/board/mmboard.cpp +++ b/utils/wxMMedia2/board/mmboard.cpp @@ -439,6 +439,15 @@ void MMBoardFrame::OnRefreshInfo(wxEvent& WXUNUSED(event)) void MMBoardFrame::OnPlay(wxCommandEvent& WXUNUSED(event)) { + m_stopButton->Enable(TRUE); + m_pauseButton->Enable(TRUE); + m_playButton->Enable(FALSE); + + if (m_opened_file->IsPaused()) { + m_opened_file->Resume(); + return; + } + m_refreshTimer->Start(1000, FALSE); m_opened_file->Play(); diff --git a/utils/wxMMedia2/lib/sndcpcm.cpp b/utils/wxMMedia2/lib/sndcpcm.cpp index add5ba1772..c81fc890db 100644 --- a/utils/wxMMedia2/lib/sndcpcm.cpp +++ b/utils/wxMMedia2/lib/sndcpcm.cpp @@ -121,7 +121,7 @@ wxSoundStream& wxSoundStreamPcm::Write(const void *buffer, wxUint32 len) len2 = (m_16_to_8) ? len / 2 : len; tmp_buf = new char[len2]; - m_function_out((const char *)buffer, tmp_buf, len); + m_function_out((const char *)buffer, tmp_buf, len2); m_sndio->Write(tmp_buf, len); delete[] tmp_buf; diff --git a/utils/wxMMedia2/lib/sndfile.h b/utils/wxMMedia2/lib/sndfile.h index 5499c4106f..7804f122ca 100644 --- a/utils/wxMMedia2/lib/sndfile.h +++ b/utils/wxMMedia2/lib/sndfile.h @@ -63,6 +63,7 @@ class wxSoundFileStream: public wxSoundStream { bool Resume(); bool IsStopped() const { return m_state == wxSOUND_FILE_STOPPED; } + bool IsPaused() const { return m_state == wxSOUND_FILE_PAUSED; } bool StartProduction(int evt); bool StopProduction(); -- 2.45.2