X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/eb4e516dd9774b4d14abedd8229dc4c9bcff8439..fed485e0946d9cff74fce6afdb169796d90a99f2:/utils/wxMMedia/snduss.cpp diff --git a/utils/wxMMedia/snduss.cpp b/utils/wxMMedia/snduss.cpp index 9a03817bed..100cd2a855 100644 --- a/utils/wxMMedia/snduss.cpp +++ b/utils/wxMMedia/snduss.cpp @@ -106,8 +106,6 @@ bool wxUssSound::DoInput(wxSndBuffer *buf) wxSoundCodec *codec = buf->GetCurrentCodec(); m_sndbuf->ResetBuffer(); - codec->SetInStream(m_sndbuf); - codec->InitIO(m_ussformat); bufsize = codec->Available(); if (bufsize > m_max_bufsize) @@ -152,11 +150,18 @@ bool wxUssSound::InitBuffer(wxSndBuffer *buf) } codec = buf->GetCurrentCodec(); - codec->SetOutStream(m_sndbuf); - codec->InitIO(m_ussformat); - // TODO: We need more tests here. - codec->InitMode((m_mode == wxSND_OUTPUT) ? wxSoundCodec::DECODING : wxSoundCodec::ENCODING); - + switch (m_mode) { + case wxSND_INPUT: + codec->SetInStream(m_sndbuf); + codec->InitIO(m_ussformat); + codec->InitMode(wxSoundCodec::ENCODING); + break; + case wxSND_OUTPUT: + codec->SetOutStream(m_sndbuf); + codec->InitIO(m_ussformat); + codec->InitMode(wxSoundCodec::DECODING); + break; + } return TRUE; }