From 315ebf688c0e69bed47cd3149158198b781b5f65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Mon, 2 Feb 2004 13:42:04 +0000 Subject: [PATCH] renamed wxWave to wxSound git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25475 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- build/bakefiles/files.bkl | 12 ++-- docs/latex/wx/classes.tex | 2 +- docs/latex/wx/libs.tex | 2 +- docs/latex/wx/{wave.tex => sound.tex} | 22 +++---- docs/latex/wx/tsamples.tex | 2 +- src/mac/carbon/{wave.cpp => sound.cpp} | 26 ++++---- src/mac/{wave.cpp => sound.cpp} | 26 ++++---- src/msw/{wave.cpp => sound.cpp} | 85 ++++++++++++-------------- src/os2/{wave.cpp => sound.cpp} | 22 +++---- src/os2/wx25.def | 34 +++++------ 10 files changed, 113 insertions(+), 120 deletions(-) rename docs/latex/wx/{wave.tex => sound.tex} (72%) rename src/mac/carbon/{wave.cpp => sound.cpp} (91%) rename src/mac/{wave.cpp => sound.cpp} (91%) rename src/msw/{wave.cpp => sound.cpp} (60%) rename src/os2/{wave.cpp => sound.cpp} (87%) diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index 2e5cf6e313..f9856c82ac 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -2004,31 +2004,31 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/common/taskbarcmn.cpp src/msw/joystick.cpp + src/msw/sound.cpp src/msw/taskbar.cpp - src/msw/wave.cpp wx/msw/joystick.h + wx/msw/sound.h wx/msw/taskbar.h - wx/msw/wave.h src/mac/joystick.cpp - src/mac/wave.cpp + src/mac/sound.cpp wx/mac/joystick.h - wx/mac/wave.h + wx/mac/sound.h src/os2/joystick.cpp - src/os2/wave.cpp + src/os2/sound.cpp wx/os2/joystick.h - wx/os2/wave.h + wx/os2/sound.h diff --git a/docs/latex/wx/classes.tex b/docs/latex/wx/classes.tex index b432699b23..fdaf96afe9 100644 --- a/docs/latex/wx/classes.tex +++ b/docs/latex/wx/classes.tex @@ -330,7 +330,7 @@ \input view.tex \input vlbox.tex \input vscroll.tex -\input wave.tex +\input sound.tex \input window.tex \input windowdc.tex \input wnddisbl.tex diff --git a/docs/latex/wx/libs.tex b/docs/latex/wx/libs.tex index 30634cb479..72664bdc15 100644 --- a/docs/latex/wx/libs.tex +++ b/docs/latex/wx/libs.tex @@ -68,7 +68,7 @@ More advanced or rarely used GUI classes: \item{ \helpref{wxSplashScreen}{wxsplashscreen} } \item{ \helpref{wxTaskBarIcon}{wxtaskbaricon} } \item{ wxTipDialog } -\item{ \helpref{wxWave}{wxwave} } +\item{ \helpref{wxSound}{wxsound} } \item{ \helpref{wxWizard}{wxwizard} } \item{ \helpref{wxSashLayoutWindow}{wxsashlayoutwindow} } \item{ \helpref{wxSashWindow}{wxsashwindow} } diff --git a/docs/latex/wx/wave.tex b/docs/latex/wx/sound.tex similarity index 72% rename from docs/latex/wx/wave.tex rename to docs/latex/wx/sound.tex index 208ebcf7c8..4d6ee2e498 100644 --- a/docs/latex/wx/wave.tex +++ b/docs/latex/wx/sound.tex @@ -1,4 +1,4 @@ -\section{\class{wxWave}}\label{wxwave} +\section{\class{wxSound}}\label{wxsound} This class represents a short wave file, in Windows WAV format, that can be stored in memory and played. Currently this class is implemented @@ -14,15 +14,15 @@ on Windows and Linux only. \latexignore{\rtfignore{\wxheading{Members}}} -\membersection{wxWave::wxWave}\label{wxwaveconstr} +\membersection{wxSound::wxSound}\label{wxsoundconstr} -\func{}{wxWave}{\void} +\func{}{wxSound}{\void} Default constructor. -\func{}{wxWave}{\param{const wxString\&}{ fileName}, \param{bool}{ isResource = false}} +\func{}{wxSound}{\param{const wxString\&}{ fileName}, \param{bool}{ isResource = false}} -Constructs a wave object from a file or resource. Call \helpref{wxWave::IsOk}{wxwaveisok} to +Constructs a wave object from a file or resource. Call \helpref{wxSound::IsOk}{wxsoundisok} to determine whether this succeeded. \wxheading{Parameters} @@ -31,13 +31,13 @@ determine whether this succeeded. \docparam{isResource}{true if {\it fileName} is a resource, false if it is a filename.} -\membersection{wxWave::\destruct{wxWave}} +\membersection{wxSound::\destruct{wxSound}} -\func{}{\destruct{wxWave}}{\void} +\func{}{\destruct{wxSound}}{\void} -Destroys the wxWave object. +Destroys the wxSound object. -\membersection{wxWave::Create}\label{wxwavecreate} +\membersection{wxSound::Create}\label{wxsoundcreate} \func{bool}{Create}{\param{const wxString\&}{ fileName}, \param{bool}{ isResource = false}} @@ -53,13 +53,13 @@ Constructs a wave object from a file or resource. true if the call was successful, false otherwise. -\membersection{wxWave::IsOk}\label{wxwaveisok} +\membersection{wxSound::IsOk}\label{wxsoundisok} \constfunc{bool}{IsOk}{\void} Returns true if the object contains a successfully loaded file or resource, false otherwise. -\membersection{wxWave::Play}\label{wxwaveplay} +\membersection{wxSound::Play}\label{wxsoundplay} \constfunc{bool}{Play}{\param{bool}{ async = true}, \param{bool}{ looped = false}} diff --git a/docs/latex/wx/tsamples.tex b/docs/latex/wx/tsamples.tex index 9a920e766e..223b473389 100644 --- a/docs/latex/wx/tsamples.tex +++ b/docs/latex/wx/tsamples.tex @@ -438,7 +438,7 @@ The sockets sample is work in progress. Some things to do: \subsection{Sound sample}\label{samplesound} -The {\tt sound} sample shows how to use \helpref{wxWave}{wxwave} for simple +The {\tt sound} sample shows how to use \helpref{wxSound}{wxsound} for simple audio output (e.g. notifications). diff --git a/src/mac/carbon/wave.cpp b/src/mac/carbon/sound.cpp similarity index 91% rename from src/mac/carbon/wave.cpp rename to src/mac/carbon/sound.cpp index 35accb9167..d6d13bb595 100644 --- a/src/mac/carbon/wave.cpp +++ b/src/mac/carbon/sound.cpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wave.cpp -// Purpose: wxWave class implementation: optional +// Name: sound.cpp +// Purpose: wxSound class implementation: optional // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 @@ -10,14 +10,14 @@ ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ -#pragma implementation "wave.h" +#pragma implementation "sound.h" #endif #include "wx/object.h" #include "wx/string.h" -#include "wx/wave.h" +#include "wx/sound.h" -#if wxUSE_WAVE +#if wxUSE_SOUND #ifdef __WXMAC__ #include "wx/mac/private.h" @@ -26,30 +26,30 @@ #endif #endif -wxWave::wxWave() +wxSound::wxSound() : m_sndChan(0), m_hSnd(NULL), m_waveLength(0), m_isResource(true) { } -wxWave::wxWave(const wxString& sFileName, bool isResource) +wxSound::wxSound(const wxString& sFileName, bool isResource) : m_sndChan(0), m_hSnd(NULL), m_waveLength(0), m_isResource(true) { Create(sFileName, isResource); } -wxWave::~wxWave() +wxSound::~wxSound() { FreeData(); } -wxWave::wxWave(int size, const wxByte* data) +wxSound::wxSound(int size, const wxByte* data) : m_sndChan(0), m_hSnd(NULL), m_waveLength(0), m_isResource(false) { //TODO convert data } -bool wxWave::Create(const wxString& fileName, bool isResource) +bool wxSound::Create(const wxString& fileName, bool isResource) { bool ret = false; m_sndname = fileName; @@ -133,7 +133,7 @@ bool wxWave::Create(const wxString& fileName, bool isResource) //don't know what to do with looped, wth -bool wxWave::Play(bool async, bool looped) const +bool wxSound::DoPlay(unsigned flags) const { bool ret = false; @@ -145,7 +145,7 @@ bool wxWave::Play(bool async, bool looped) const hSnd = (SndListHandle) GetNamedResource('snd ', snd); - if ((hSnd != NULL) && (SndPlay((SndChannelPtr)m_sndChan, (SndListHandle) hSnd, async) == noErr)) + if ((hSnd != NULL) && (SndPlay((SndChannelPtr)m_sndChan, (SndListHandle) hSnd, (flags & wxSOUND_ASYNC)) == noErr)) ret = true; } @@ -153,7 +153,7 @@ bool wxWave::Play(bool async, bool looped) const } -bool wxWave::FreeData() +bool wxSound::FreeData() { bool ret = false; diff --git a/src/mac/wave.cpp b/src/mac/sound.cpp similarity index 91% rename from src/mac/wave.cpp rename to src/mac/sound.cpp index 35accb9167..d6d13bb595 100644 --- a/src/mac/wave.cpp +++ b/src/mac/sound.cpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wave.cpp -// Purpose: wxWave class implementation: optional +// Name: sound.cpp +// Purpose: wxSound class implementation: optional // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 @@ -10,14 +10,14 @@ ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ -#pragma implementation "wave.h" +#pragma implementation "sound.h" #endif #include "wx/object.h" #include "wx/string.h" -#include "wx/wave.h" +#include "wx/sound.h" -#if wxUSE_WAVE +#if wxUSE_SOUND #ifdef __WXMAC__ #include "wx/mac/private.h" @@ -26,30 +26,30 @@ #endif #endif -wxWave::wxWave() +wxSound::wxSound() : m_sndChan(0), m_hSnd(NULL), m_waveLength(0), m_isResource(true) { } -wxWave::wxWave(const wxString& sFileName, bool isResource) +wxSound::wxSound(const wxString& sFileName, bool isResource) : m_sndChan(0), m_hSnd(NULL), m_waveLength(0), m_isResource(true) { Create(sFileName, isResource); } -wxWave::~wxWave() +wxSound::~wxSound() { FreeData(); } -wxWave::wxWave(int size, const wxByte* data) +wxSound::wxSound(int size, const wxByte* data) : m_sndChan(0), m_hSnd(NULL), m_waveLength(0), m_isResource(false) { //TODO convert data } -bool wxWave::Create(const wxString& fileName, bool isResource) +bool wxSound::Create(const wxString& fileName, bool isResource) { bool ret = false; m_sndname = fileName; @@ -133,7 +133,7 @@ bool wxWave::Create(const wxString& fileName, bool isResource) //don't know what to do with looped, wth -bool wxWave::Play(bool async, bool looped) const +bool wxSound::DoPlay(unsigned flags) const { bool ret = false; @@ -145,7 +145,7 @@ bool wxWave::Play(bool async, bool looped) const hSnd = (SndListHandle) GetNamedResource('snd ', snd); - if ((hSnd != NULL) && (SndPlay((SndChannelPtr)m_sndChan, (SndListHandle) hSnd, async) == noErr)) + if ((hSnd != NULL) && (SndPlay((SndChannelPtr)m_sndChan, (SndListHandle) hSnd, (flags & wxSOUND_ASYNC)) == noErr)) ret = true; } @@ -153,7 +153,7 @@ bool wxWave::Play(bool async, bool looped) const } -bool wxWave::FreeData() +bool wxSound::FreeData() { bool ret = false; diff --git a/src/msw/wave.cpp b/src/msw/sound.cpp similarity index 60% rename from src/msw/wave.cpp rename to src/msw/sound.cpp index 1ee0083801..795b1a9cbe 100644 --- a/src/msw/wave.cpp +++ b/src/msw/sound.cpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wave.cpp -// Purpose: wxWave +// Name: sound.cpp +// Purpose: wxSound // Author: Julian Smart // Modified by: // Created: 04/01/98 @@ -10,7 +10,7 @@ ///////////////////////////////////////////////////////////////////////////// #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "wave.h" +#pragma implementation "sound.h" #endif // For compilers that support precompilation, includes "wx.h". @@ -20,14 +20,14 @@ #pragma hdrstop #endif -#if wxUSE_WAVE +#if wxUSE_SOUND #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include "wx/file.h" -#include "wx/msw/wave.h" +#include "wx/sound.h" #include "wx/msw/private.h" #include @@ -38,29 +38,29 @@ #include #endif -wxWave::wxWave() - : m_waveData(NULL), m_waveLength(0), m_isResource(FALSE) +wxSound::wxSound() + : m_waveData(NULL), m_waveLength(0), m_isResource(false) { } -wxWave::wxWave(const wxString& sFileName, bool isResource) +wxSound::wxSound(const wxString& sFileName, bool isResource) : m_waveData(NULL), m_waveLength(0), m_isResource(isResource) { Create(sFileName, isResource); } -wxWave::wxWave(int size, const wxByte* data) - : m_waveData(NULL), m_waveLength(0), m_isResource(FALSE) +wxSound::wxSound(int size, const wxByte* data) + : m_waveData(NULL), m_waveLength(0), m_isResource(false) { Create(size, data); } -wxWave::~wxWave() +wxSound::~wxSound() { Free(); } -bool wxWave::Create(const wxString& fileName, bool isResource) +bool wxSound::Create(const wxString& fileName, bool isResource) { Free(); @@ -69,17 +69,9 @@ bool wxWave::Create(const wxString& fileName, bool isResource) m_isResource = TRUE; HRSRC hresInfo; -#if defined(__WIN32__) -#ifdef _UNICODE - hresInfo = ::FindResourceW((HMODULE) wxhInstance, fileName, wxT("WAVE")); -#else - hresInfo = ::FindResourceA((HMODULE) wxhInstance, fileName, wxT("WAVE")); -#endif -#else hresInfo = ::FindResource((HMODULE) wxhInstance, fileName, wxT("WAVE")); -#endif if (!hresInfo) - return FALSE; + return false; HGLOBAL waveData = ::LoadResource((HMODULE) wxhInstance, hresInfo); @@ -89,65 +81,61 @@ bool wxWave::Create(const wxString& fileName, bool isResource) m_waveLength = (int) ::SizeofResource((HMODULE) wxhInstance, hresInfo); } - return (m_waveData ? TRUE : FALSE); + return (m_waveData ? true : false); } else { - m_isResource = FALSE; + m_isResource = false; wxFile fileWave; if (!fileWave.Open(fileName, wxFile::read)) - return FALSE; + return false; m_waveLength = (int) fileWave.Length(); m_waveData = (wxByte*)GlobalLock(GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, m_waveLength)); if (!m_waveData) - return FALSE; + return false; fileWave.Read(m_waveData, m_waveLength); - return TRUE; + return true; } } -bool wxWave::Create(int size, const wxByte* data) +bool wxSound::Create(int size, const wxByte* data) { Free(); - m_isResource = FALSE; + m_isResource = true; m_waveLength=size; m_waveData = (wxByte*)GlobalLock(GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, m_waveLength)); if (!m_waveData) - return FALSE; + return false; for (int i=0; i #include -wxWave::wxWave() +wxSound::wxSound() : m_waveData(NULL), m_waveLength(0), m_isResource(FALSE) { } -wxWave::wxWave(const wxString& sFileName, bool isResource) +wxSound::wxSound(const wxString& sFileName, bool isResource) : m_waveData(NULL), m_waveLength(0), m_isResource(isResource) { Create(sFileName, isResource); } -wxWave::wxWave(int size, const wxByte* data) +wxSound::wxSound(int size, const wxByte* data) : m_waveData(NULL), m_waveLength(0), m_isResource(FALSE) { Create(size, data); } -wxWave::~wxWave() +wxSound::~wxSound() { Free(); } -bool wxWave::Create(const wxString& fileName, bool isResource) +bool wxSound::Create(const wxString& fileName, bool isResource) { Free(); @@ -108,7 +108,7 @@ bool wxWave::Create(const wxString& fileName, bool isResource) } } -bool wxWave::Create(int size, const wxByte* data) +bool wxSound::Create(int size, const wxByte* data) { Free(); m_isResource = FALSE; @@ -121,7 +121,7 @@ bool wxWave::Create(int size, const wxByte* data) return TRUE; } -bool wxWave::Play(bool async, bool looped) const +bool wxSound::DoPlay(unsigned flags) const { if (!IsOk()) return FALSE; @@ -133,7 +133,7 @@ bool wxWave::Play(bool async, bool looped) const return FALSE; } -bool wxWave::Free() +bool wxSound::Free() { if (m_waveData) { diff --git a/src/os2/wx25.def b/src/os2/wx25.def index d41cfac510..ea187e4c2a 100644 --- a/src/os2/wx25.def +++ b/src/os2/wx25.def @@ -13989,23 +13989,23 @@ EXPORTS wxExecute__FRC8wxStringiP9wxProcess ;From object file: ..\os2\wave.cpp ;PUBDEFs (Symbols available from object file): - ;wxWave::Create(const wxString&,unsigned long) - Create__6wxWaveFRC8wxStringUl - __vft6wxWave8wxObject - ;wxWave::~wxWave() - __dt__6wxWaveFv - ;wxWave::Free() - Free__6wxWaveFv - ;wxWave::wxWave(const wxString&,unsigned long) - __ct__6wxWaveFRC8wxStringUl - ;wxWave::wxWave(int,const unsigned char*) - __ct__6wxWaveFiPCUc - ;wxWave::Create(int,const unsigned char*) - Create__6wxWaveFiPCUc - ;wxWave::Play(unsigned long,unsigned long) const - Play__6wxWaveCFUlT1 - ;wxWave::wxWave() - __ct__6wxWaveFv + ;wxSound::Create(const wxString&,unsigned long) + Create__6wxSoundFRC8wxStringUl + __vft6wxSound8wxObject + ;wxSound::~wxSound() + __dt__6wxSoundFv + ;wxSound::Free() + Free__6wxSoundFv + ;wxSound::wxSound(const wxString&,unsigned long) + __ct__6wxSoundFRC8wxStringUl + ;wxSound::wxSound(int,const unsigned char*) + __ct__6wxSoundFiPCUc + ;wxSound::Create(int,const unsigned char*) + Create__6wxSoundFiPCUc + ;wxSound::Play(unsigned long,unsigned long) const + Play__6wxSoundCFUlT1 + ;wxSound::wxSound() + __ct__6wxSoundFv ;From object file: ..\os2\window.cpp ;PUBDEFs (Symbols available from object file): ;wxFindWinFromHandle(unsigned long)