X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e8482f24cfc00645607f8526fde38d39e0dcaa63..25b3661bd4cb44304418b93c0dee1d0dfb99765c:/contrib/src/mmedia/sndfile.cpp diff --git a/contrib/src/mmedia/sndfile.cpp b/contrib/src/mmedia/sndfile.cpp index ffe842706e..05a4acb8b9 100644 --- a/contrib/src/mmedia/sndfile.cpp +++ b/contrib/src/mmedia/sndfile.cpp @@ -4,8 +4,9 @@ // Date: 08/11/1999 // Author: Guilhem Lavaux (C) 1999, 2000 // CVSID: $Id$ +// wxWindows licence // -------------------------------------------------------------------------- -#include +#include "wx/wxprec.h" #ifndef WX_PRECOMP #include @@ -18,6 +19,7 @@ #include "wx/mmedia/sndcpcm.h" #include "wx/mmedia/sndulaw.h" #include "wx/mmedia/sndg72x.h" +#include "wx/mmedia/sndmsad.h" // -------------------------------------------------------------------------- // Sound codec router @@ -77,7 +79,7 @@ wxSoundStream& wxSoundRouterStream::Write(const void *buffer, wxUint32 len) // sound driver using the specified format. If this fails, it uses personnal // codec converters: for the moment there is a PCM converter (PCM to PCM: // with optional resampling, ...), an ULAW converter (ULAW to PCM), a G72X -// converter (G72X to PCM). If nothing works, it returns FALSE. +// converter (G72X to PCM). If nothing works, it returns false. // -------------------------------------------------------------------------- bool wxSoundRouterStream::SetSoundFormat(const wxSoundFormatBase& format) { @@ -88,12 +90,12 @@ bool wxSoundRouterStream::SetSoundFormat(const wxSoundFormatBase& format) if (m_sndio->SetSoundFormat(format)) { // We are lucky, it is working. wxSoundStream::SetSoundFormat(m_sndio->GetSoundFormat()); - return TRUE; + return true; } switch(format.GetType()) { case wxSOUND_NOFORMAT: - return FALSE; + return false; case wxSOUND_PCM: m_router = new wxSoundStreamPcm(*m_sndio); m_router->SetSoundFormat(format); @@ -106,12 +108,16 @@ bool wxSoundRouterStream::SetSoundFormat(const wxSoundFormatBase& format) m_router = new wxSoundStreamG72X(*m_sndio); m_router->SetSoundFormat(format); break; + case wxSOUND_MSADPCM: + m_router = new wxSoundStreamMSAdpcm(*m_sndio); + m_router->SetSoundFormat(format); + break; default: - return FALSE; + return false; } wxSoundStream::SetSoundFormat(m_router->GetSoundFormat()); - return TRUE; + return true; } // -------------------------------------------------------------------------- @@ -134,19 +140,19 @@ bool wxSoundRouterStream::StartProduction(int evt) { if (!m_router) { if (m_sndio->StartProduction(evt)) - return TRUE; + return true; m_snderror = m_sndio->GetError(); m_lastcount = m_sndio->GetLastAccess(); - return FALSE; + return false; } if (m_router->StartProduction(evt)) - return TRUE; + return true; m_snderror = m_router->GetError(); m_lastcount = m_router->GetLastAccess(); - return FALSE; + return false; } // -------------------------------------------------------------------------- @@ -156,19 +162,19 @@ bool wxSoundRouterStream::StopProduction() { if (!m_router) { if (m_sndio->StopProduction()) - return TRUE; + return true; m_snderror = m_sndio->GetError(); m_lastcount = m_sndio->GetLastAccess(); - return FALSE; + return false; } if (m_router->StopProduction()) - return TRUE; + return true; m_snderror = m_router->GetError(); m_lastcount = m_router->GetLastAccess(); - return FALSE; + return false; } // -------------------------------------------------------------------------- @@ -182,7 +188,7 @@ wxSoundFileStream::wxSoundFileStream(wxInputStream& stream, { m_length = 0; m_bytes_left = 0; - m_prepared = FALSE; + m_prepared = false; } wxSoundFileStream::wxSoundFileStream(wxOutputStream& stream, @@ -192,7 +198,7 @@ wxSoundFileStream::wxSoundFileStream(wxOutputStream& stream, { m_length = 0; m_bytes_left = 0; - m_prepared = FALSE; + m_prepared = false; } wxSoundFileStream::~wxSoundFileStream() @@ -204,51 +210,51 @@ wxSoundFileStream::~wxSoundFileStream() bool wxSoundFileStream::Play() { if (m_state != wxSOUND_FILE_STOPPED) - return FALSE; + return false; if (!m_prepared) if (!PrepareToPlay()) - return FALSE; + return false; m_state = wxSOUND_FILE_PLAYING; if (!StartProduction(wxSOUND_OUTPUT)) - return FALSE; + return false; - return TRUE; + return true; } bool wxSoundFileStream::Record(wxUint32 time) { if (m_state != wxSOUND_FILE_STOPPED) - return FALSE; + return false; if (!PrepareToRecord(time)) - return FALSE; + return false; FinishPreparation(m_sndformat->GetBytesFromTime(time)); m_state = wxSOUND_FILE_RECORDING; if (!StartProduction(wxSOUND_INPUT)) - return FALSE; + return false; - return TRUE; + return true; } bool wxSoundFileStream::Stop() { if (m_state == wxSOUND_FILE_STOPPED) - return FALSE; + return false; if (!StopProduction()) - return FALSE; + return false; - m_prepared = FALSE; + m_prepared = false; if (m_state == wxSOUND_FILE_RECORDING) if (!FinishRecording()) { m_state = wxSOUND_FILE_STOPPED; - return FALSE; + return false; } if (m_input) @@ -258,35 +264,35 @@ bool wxSoundFileStream::Stop() m_output->SeekO(0, wxFromStart); m_state = wxSOUND_FILE_STOPPED; - return TRUE; + return true; } bool wxSoundFileStream::Pause() { if (m_state == wxSOUND_FILE_PAUSED || m_state == wxSOUND_FILE_STOPPED) - return FALSE; + return false; if (!StopProduction()) - return FALSE; + return false; m_oldstate = m_state; m_state = wxSOUND_FILE_PAUSED; - return TRUE; + return true; } bool wxSoundFileStream::Resume() { if (m_state == wxSOUND_FILE_PLAYING || m_state == wxSOUND_FILE_RECORDING || m_state == wxSOUND_FILE_STOPPED) - return FALSE; + return false; if (!StartProduction( (m_oldstate == wxSOUND_FILE_PLAYING) ? wxSOUND_OUTPUT : wxSOUND_INPUT)) - return FALSE; + return false; m_state = m_oldstate; - return TRUE; + return true; } wxSoundStream& wxSoundFileStream::Read(void *buffer, wxUint32 len) @@ -316,9 +322,9 @@ bool wxSoundFileStream::StartProduction(int evt) m_sndio->SetEventHandler(this); if (!m_codec.StartProduction(evt)) - return FALSE; + return false; - return TRUE; + return true; } bool wxSoundFileStream::StopProduction() @@ -329,7 +335,7 @@ bool wxSoundFileStream::StopProduction() void wxSoundFileStream::FinishPreparation(wxUint32 len) { m_bytes_left = m_length = len; - m_prepared = TRUE; + m_prepared = true; } wxString wxSoundFileStream::GetCodecName() const