From 2a040d3f0708e859f812cc10ed1b391d4ca89a07 Mon Sep 17 00:00:00 2001 From: Guilhem Lavaux Date: Sat, 26 Dec 1998 15:36:45 +0000 Subject: [PATCH] * Fixes (AIF works on Linux) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1265 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/list.cpp | 3 ++- src/common/stream.cpp | 3 +++ utils/wxMMedia/Makefile.in | 4 ++-- utils/wxMMedia/sndfrmt.cpp | 10 ++++++++++ utils/wxMMedia/sndfrmt.h | 9 +++++++++ utils/wxMMedia/sndmulaw.cpp | 9 +++++++++ utils/wxMMedia/sndsnd.cpp | 2 -- utils/wxMMedia/snduss.cpp | 19 ++++++++++++------- 8 files changed, 47 insertions(+), 12 deletions(-) diff --git a/src/common/list.cpp b/src/common/list.cpp index a98385159d..c4c2e2078a 100644 --- a/src/common/list.cpp +++ b/src/common/list.cpp @@ -620,9 +620,10 @@ void wxStringList::Sort() { size_t N = GetCount(); char **array = new char *[N]; + wxStringListNode *node; size_t i = 0; - for ( wxStringListNode *node = GetFirst(); node; node = node->GetNext() ) + for ( node = GetFirst(); node; node = node->GetNext() ) { array[i++] = node->GetData(); } diff --git a/src/common/stream.cpp b/src/common/stream.cpp index 4f24cfc97a..8754cc7c3a 100644 --- a/src/common/stream.cpp +++ b/src/common/stream.cpp @@ -136,6 +136,7 @@ void wxStreamBuffer::SetBufferIO(size_t bufsize) void wxStreamBuffer::ResetBuffer() { + m_stream->m_lasterror = wxStream_NOERROR; if (m_mode == read) m_buffer_pos = m_buffer_end; else @@ -285,6 +286,7 @@ size_t wxStreamBuffer::Read(void *buffer, size_t size) // Buffering disabled // ------------------ + m_stream->m_lasterror = wxStream_NOERROR; m_stream->m_lastcount = GetWBack((char *)buffer, size); size -= m_stream->m_lastcount; if (size == 0) @@ -345,6 +347,7 @@ size_t wxStreamBuffer::Write(const void *buffer, size_t size) // Buffering disabled // ------------------ + m_stream->m_lasterror = wxStream_NOERROR; if (!m_buffer_size) return (m_stream->m_lastcount = m_stream->OnSysWrite(buffer, size)); diff --git a/utils/wxMMedia/Makefile.in b/utils/wxMMedia/Makefile.in index e4effa22d3..8c4c7ac9b1 100644 --- a/utils/wxMMedia/Makefile.in +++ b/utils/wxMMedia/Makefile.in @@ -17,9 +17,9 @@ ADPCM_SRC=\ g711.cpp g721.cpp g723_24.cpp g723_40.cpp g72x.cpp MMEDIA_SRC=\ -mmdata.cpp mmfile.cpp mmsolve.cpp sndsnd.cpp sndfrmt.cpp sndpcm.o \ +mmdata.cpp mmfile.cpp mmsolve.cpp sndsnd.cpp sndfrmt.cpp sndpcm.cpp \ snduss.cpp sndfile.cpp sndwav.cpp mmriff.cpp vidbase.cpp vidxanm.cpp \ -cdbase.cpp cdunix.cpp +cdbase.cpp cdunix.cpp sndaiff.cpp sndmulaw.cpp sndau.cpp LIB_SRC= $(ADPCM_SRC:%.cpp=adpcm/%.cpp) $(MMEDIA_SRC) diff --git a/utils/wxMMedia/sndfrmt.cpp b/utils/wxMMedia/sndfrmt.cpp index 750f17c83b..2c446375ea 100644 --- a/utils/wxMMedia/sndfrmt.cpp +++ b/utils/wxMMedia/sndfrmt.cpp @@ -1,3 +1,12 @@ +//////////////////////////////////////////////////////////////////////////////// +// Name: sndfrmt.cpp +// Purpose: wxMMedia +// Author: Guilhem Lavaux +// Created: 1998 +// Updated: December 1998 +// Copyright: (C) 1997, 1998, Guilhem Lavaux +// License: wxWindows license +//////////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ #pragma implementation "sndfrmt.h" #endif @@ -81,6 +90,7 @@ wxSoundCodec *wxSoundDataFormat::GetCodec() m_codchange = FALSE; m_codec = wxSoundCodec::Get(m_codno); + CodecChange(); return m_codec; } diff --git a/utils/wxMMedia/sndfrmt.h b/utils/wxMMedia/sndfrmt.h index bb95535089..69635c0e6d 100644 --- a/utils/wxMMedia/sndfrmt.h +++ b/utils/wxMMedia/sndfrmt.h @@ -1,3 +1,12 @@ +//////////////////////////////////////////////////////////////////////////////// +// Name: sndfrmt.h +// Purpose: wxMMedia +// Author: Guilhem Lavaux +// Created: 1998 +// Updated: December 1998 +// Copyright: (C) 1997, 1998, Guilhem Lavaux +// License: wxWindows license +//////////////////////////////////////////////////////////////////////////////// #ifndef __SNDFRMT_H__ #define __SNDFRMT_H__ diff --git a/utils/wxMMedia/sndmulaw.cpp b/utils/wxMMedia/sndmulaw.cpp index 0cb1823077..3f45098f40 100644 --- a/utils/wxMMedia/sndmulaw.cpp +++ b/utils/wxMMedia/sndmulaw.cpp @@ -1,3 +1,12 @@ +//////////////////////////////////////////////////////////////////////////////// +// Name: sndmulaw.cpp +// Purpose: wxMMedia +// Author: Guilhem Lavaux +// Created: 1997 +// Updated: December 1998 +// Copyright: (C) 1997, 1998, Guilhem Lavaux +// License: wxWindows license +//////////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ #pragma implementation "sndmulaw.h" #endif diff --git a/utils/wxMMedia/sndsnd.cpp b/utils/wxMMedia/sndsnd.cpp index 3422b7249f..b938f0a0b0 100644 --- a/utils/wxMMedia/sndsnd.cpp +++ b/utils/wxMMedia/sndsnd.cpp @@ -101,8 +101,6 @@ void wxSndBuffer::HardUnlock() void wxSndBuffer::ChangeCodec(int no) { - wxDELETE(m_sndcodec); - m_sndformat.SetCodecNo(no); m_sndcodec = m_sndformat.GetCodec(); m_sndcodec->SetIOBuffer(this); 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; } -- 2.45.2