From e9e23cb531e6967b6262c2cacf17fb53eb622193 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sun, 1 Feb 2004 18:27:25 +0000 Subject: [PATCH] renamed wxWave to wxSound git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25456 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/sound.h | 82 ++++++++++++++++++++++++++++++++++++++++++++++ include/wx/wave.h | 31 ++++++++++-------- 2 files changed, 100 insertions(+), 13 deletions(-) create mode 100644 include/wx/sound.h diff --git a/include/wx/sound.h b/include/wx/sound.h new file mode 100644 index 0000000000..c96dc74cfc --- /dev/null +++ b/include/wx/sound.h @@ -0,0 +1,82 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/sound.h +// Purpose: wxSoundBase class +// Author: Vaclav Slavik +// Modified by: +// Created: 2004/02/01 +// RCS-ID: $Id$ +// Copyright: (c) 2004, Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SOUND_H_BASE_ +#define _WX_SOUND_H_BASE_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "soundbase.h" +#endif + +#include "wx/object.h" + +// ---------------------------------------------------------------------------- +// wxSoundBase: common wxSound code and interface +// ---------------------------------------------------------------------------- + +// Flags for wxSound::Play +enum wxSoundFlags +{ + wxSOUND_SYNC = 0, + wxSOUND_ASYNC = 1, + wxSOUND_LOOP = 2 | wxSOUND_ASYNC +}; + +class wxSoundBase : public wxObject +{ +public: + // Play the sound: + bool Play(unsigned flags = wxSOUND_ASYNC) + { + return DoPlay(flags); + } +#if WXWIN_COMPATIBILITY_2_4 + wxDEPRECATED( bool Play(bool async = true, bool looped = false) ); +#endif + +protected: + virtual bool DoPlay(unsigned flags) = 0; +}; + +#if WXWIN_COMPATIBILITY_2_4 +inline bool wxSoundBase::Play(bool async, bool looped) +{ + unsigned flags = 0; + if (async) flags |= wxSOUND_ASYNC; + if (looped) flags |= wxSOUND_LOOP; + return DoPlay(flags); +} +#endif + +// ---------------------------------------------------------------------------- +// wxSound class implementation +// ---------------------------------------------------------------------------- + +#if defined(__WXMSW__) +#include "wx/msw/wave.h" +#elif defined(__UNIX__) +#include "wx/unix/sound.h" +#elif defined(__WXMAC__) +#include "wx/mac/wave.h" +#elif defined(__WXPM__) +#include "wx/os2/wave.h" +#endif + +// wxSound used to be called wxWave before wxWindows 2.5.1: +#ifdef __UNIX__ // FIXME: on all platforms when everything is renamed + #if WXWIN_COMPATIBILITY_2_4 + typedef wxSound wxWave; + #endif +#else + typedef wxWave wxSound; +#endif + +#endif // _WX_SOUND_H_BASE_ diff --git a/include/wx/wave.h b/include/wx/wave.h index d766cc341e..582841f7e9 100644 --- a/include/wx/wave.h +++ b/include/wx/wave.h @@ -1,19 +1,24 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/wave.h +// Purpose: wxSound compatibility header +// Author: Vaclav Slavik +// Modified by: +// Created: 2004/02/01 +// RCS-ID: $Id$ +// Copyright: (c) 2004, Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + #ifndef _WX_WAVE_H_BASE_ #define _WX_WAVE_H_BASE_ -#if defined(__WXMSW__) -#include "wx/msw/wave.h" -#elif defined(__WXGTK__) -#include "wx/unix/wave.h" -#elif defined(__WXX11__) -#include "wx/unix/wave.h" -#elif defined(__WXMOTIF__) -#include "wx/unix/wave.h" -#elif defined(__WXMAC__) -#include "wx/mac/wave.h" -#elif defined(__WXPM__) -#include "wx/os2/wave.h" +#include "wx/setup.h" + +#if WXWIN_COMPATIBILITY_2_4 + #warning "wx/wave.h header is deprecated, use wx/sound.h and wxSound" + #include "wx/sound.h" +#else + #error "wx/wave.h is only available in compatibility mode" #endif #endif - // _WX_TREECTRL_H_BASE_ -- 2.45.2