X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/83f7f12df24a6699fbff014c8c2cc642a1d206ce..28756ab9c52aba43c99409cea3a9faedb1bccf6a:/include/wx/unix/sound.h?ds=sidebyside diff --git a/include/wx/unix/sound.h b/include/wx/unix/sound.h index c038dfcde1..797eacd1fa 100644 --- a/include/wx/unix/sound.h +++ b/include/wx/unix/sound.h @@ -1,12 +1,12 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wave.h +// Name: wx/unix/sound.h // Purpose: wxSound class // Author: Julian Smart, Vaclav Slavik // Modified by: // Created: 25/10/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart, Vaclav Slavik -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_SOUND_H_ @@ -14,11 +14,7 @@ #include "wx/defs.h" -#if wxUSE_WAVE - -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma interface "sound.h" -#endif +#if wxUSE_SOUND #include "wx/object.h" @@ -26,18 +22,18 @@ // wxSound: simple audio playback class // ---------------------------------------------------------------------------- -class wxSoundBackend; -class wxSound; -class wxDynamicLibrary; +class WXDLLIMPEXP_FWD_ADV wxSoundBackend; +class WXDLLIMPEXP_FWD_ADV wxSound; +class WXDLLIMPEXP_FWD_BASE wxDynamicLibrary; /// Sound data, as loaded from .wav file: -class wxSoundData +class WXDLLIMPEXP_ADV wxSoundData { public: wxSoundData() : m_refCnt(1) {} void IncRef(); void DecRef(); - + // .wav header information: unsigned m_channels; // num of channels (mono:1, stereo:2) unsigned m_samplingRate; @@ -45,7 +41,7 @@ public: // samples (wxUint8), if 16 then signed 16bit // (wxInt16) unsigned m_samples; // length in samples: - + // wave data: size_t m_dataBytes; wxUint8 *m_data; // m_dataBytes bytes of data @@ -59,13 +55,13 @@ private: /// Simple sound class: -class wxSound : public wxSoundBase +class WXDLLIMPEXP_ADV wxSound : public wxSoundBase { public: wxSound(); wxSound(const wxString& fileName, bool isResource = false); wxSound(int size, const wxByte* data); - ~wxSound(); + virtual ~wxSound(); // Create from resource or file bool Create(const wxString& fileName, bool isResource = false); @@ -73,23 +69,23 @@ public: bool Create(int size, const wxByte* data); bool IsOk() const { return m_data != NULL; } - + // Stop playing any sound static void Stop(); // Returns true if a sound is being played static bool IsPlaying(); - + // for internal use static void UnloadBackend(); - + protected: - bool DoPlay(unsigned flags); + bool DoPlay(unsigned flags) const; static void EnsureBackend(); void Free(); bool LoadWAV(const wxUint8 *data, size_t length, bool copyData); - + static wxSoundBackend *ms_backend; #if wxUSE_LIBSDL && wxUSE_PLUGINS // FIXME - temporary, until we have plugins architecture @@ -102,14 +98,14 @@ private: // ---------------------------------------------------------------------------- -// wxSoundBackend: +// wxSoundBackend: // ---------------------------------------------------------------------------- // This is interface to sound playing implementation. There are multiple -// sound architectures in use on Unix platforms and wxWindows can use several +// sound architectures in use on Unix platforms and wxWidgets can use several // of them for playback, depending on their availability at runtime; hence -// the need for backends. This class is for use by wxWindows and people writing -// additional backends only, it is _not_ for use by applications! +// the need for backends. This class is for use by wxWidgets and people writing +// additional backends only, it is _not_ for use by applications! // Structure that holds playback status information struct wxSoundPlaybackStatus @@ -121,11 +117,11 @@ struct wxSoundPlaybackStatus }; // Audio backend interface -class wxSoundBackend +class WXDLLIMPEXP_ADV wxSoundBackend { public: virtual ~wxSoundBackend() {} - + // Returns the name of the backend (e.g. "Open Sound System") virtual wxString GetName() const = 0; @@ -137,11 +133,11 @@ public: virtual bool IsAvailable() const = 0; // Returns true if the backend is capable of playing sound asynchronously. - // If false, then wxWindows creates a playback thread and handles async + // If false, then wxWidgets creates a playback thread and handles async // playback, otherwise it is left up to the backend (will usually be more // effective). virtual bool HasNativeAsyncPlayback() const = 0; - + // Plays the sound. flags are same flags as those passed to wxSound::Play. // The function should periodically check the value of // status->m_stopRequested and terminate if it is set to true (it may @@ -159,6 +155,7 @@ public: }; -#endif // wxUSE_WAVE +#endif // wxUSE_SOUND + +#endif // _WX_SOUND_H_ -#endif