renamed wxWave to wxSound

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25475 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2004-02-02 13:42:04 +00:00
parent f156e20c8e
commit 315ebf688c
10 changed files with 113 additions and 120 deletions

View File

@ -2004,31 +2004,31 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
<set var="ADVANCED_MSW_SRC" hints="files">
src/common/taskbarcmn.cpp
src/msw/joystick.cpp
src/msw/sound.cpp
src/msw/taskbar.cpp
src/msw/wave.cpp
</set>
<set var="ADVANCED_MSW_HDR" hints="files">
wx/msw/joystick.h
wx/msw/sound.h
wx/msw/taskbar.h
wx/msw/wave.h
</set>
<set var="ADVANCED_MAC_SRC" hints="files">
src/mac/joystick.cpp
src/mac/wave.cpp
src/mac/sound.cpp
</set>
<set var="ADVANCED_MAC_HDR" hints="files">
wx/mac/joystick.h
wx/mac/wave.h
wx/mac/sound.h
</set>
<set var="ADVANCED_OS2_SRC" hints="files">
src/os2/joystick.cpp
src/os2/wave.cpp
src/os2/sound.cpp
</set>
<set var="ADVANCED_OS2_HDR" hints="files">
wx/os2/joystick.h
wx/os2/wave.h
wx/os2/sound.h
</set>
<set var="ADVANCED_UNIX_SRC" hints="files">

View File

@ -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

View File

@ -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} }

View File

@ -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}}

View File

@ -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).

View File

@ -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;

View File

@ -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;

View File

@ -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 <windowsx.h>
@ -38,29 +38,29 @@
#include <mmsystem.h>
#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<size; i++) m_waveData[i] = data[i];
return TRUE;
return true;
}
bool wxWave::Play(bool async, bool looped) const
bool wxSound::DoPlay(unsigned flags) const
{
if (!IsOk())
return FALSE;
return false;
#ifdef __WIN32__
return ( ::PlaySound((LPCTSTR)m_waveData, NULL, SND_MEMORY |
SND_NODEFAULT | (async ? SND_ASYNC : SND_SYNC) | (looped ? (SND_LOOP | SND_ASYNC) : 0)) != 0 );
#else
return ( ::sndPlaySound((LPCSTR)m_waveData, SND_MEMORY |
SND_NODEFAULT | (async ? SND_ASYNC : SND_SYNC) | (looped ? (SND_LOOP | SND_ASYNC) : 0)) != 0 );
#endif
return (::PlaySound((LPCTSTR)m_waveData, NULL,
SND_MEMORY | SND_NODEFAULT |
((flags & wxSOUND_ASYNC) ? SND_ASYNC : SND_SYNC) |
((flags & wxSOUND_LOOP) ? (SND_LOOP | SND_ASYNC) : 0))
!= 0);
}
bool wxWave::Free()
bool wxSound::Free()
{
if (m_waveData)
{
#ifdef __WXWINCE__
HGLOBAL waveData = (HGLOBAL) m_waveData;
#elif defined(__WIN32__)
HGLOBAL waveData = GlobalHandle(m_waveData);
#else
HGLOBAL waveData = GlobalPtrHandle(m_waveData);
HGLOBAL waveData = GlobalHandle(m_waveData);
#endif
if (waveData)
@ -164,10 +152,15 @@ bool wxWave::Free()
m_waveData = NULL;
m_waveLength = 0;
return TRUE;
return true;
}
}
return FALSE;
return false;
}
#endif // wxUSE_WAVE
/*static*/ void wxSound::Stop()
{
::PlaySound(NULL, NULL, 0);
}
#endif // wxUSE_SOUND

View File

@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wave.cpp
// Purpose: wxWave class implementation: optional
// Name: sound.cpp
// Purpose: wxSound class implementation: optional
// Author: David Webster
// Modified by:
// Created: 10/17/99
@ -17,7 +17,7 @@
#endif
#include "wx/file.h"
#include "wx/os2/wave.h"
#include "wx/sound.h"
#define INCL_32 /* force 32 bit compile */
#define INCL_GPIBITMAPS
#define INCL_DOSFILEMGR
@ -31,29 +31,29 @@
#include <os2medef.h>
#include <mmioos2.h>
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)
{

View File

@ -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)