1///////////////////////////////////////////////////////////////////////////// 2// Name: sound.h 3// Purpose: wxSound class (loads and plays short Windows .wav files). 4// Optional on non-Windows platforms. 5// Author: Ryan Norton, Stefan Csomor 6// Modified by: 7// Created: 1998-01-01 8// RCS-ID: $Id: sound.h 62181 2009-09-28 08:12:24Z JS $ 9// Copyright: (c) Ryan Norton, Stefan Csomor 10// Licence: wxWindows licence 11///////////////////////////////////////////////////////////////////////////// 12 13#ifndef _WX_SOUND_H_ 14#define _WX_SOUND_H_ 15 16#if wxUSE_SOUND 17 18#include "wx/object.h" 19 20class WXDLLEXPORT wxSound : public wxSoundBase 21{ 22public: 23 wxSound(); 24 wxSound(const wxString& fileName, bool isResource = false); 25 wxSound(int size, const wxByte* data); 26 virtual ~wxSound(); 27 28public: 29 bool Create(const wxString& fileName, bool isResource = false); 30 bool IsOk() const { return !m_sndname.IsEmpty() || m_hSnd; } 31 static void Stop(); 32 static bool IsPlaying(); 33 34 void* GetHandle(); 35protected: 36 bool DoPlay(unsigned flags) const; 37public: 38#if wxABI_VERSION >= 20811 39 bool Create(int size, const wxByte* data); 40#endif 41private: 42 wxString m_sndname; //file path 43 char* m_hSnd; //pointer to resource or memory location 44 int m_waveLength; //size of file in memory mode 45 void* m_pTimer; //timer 46 47 enum wxSoundType 48 { 49 wxSound_MEMORY, 50 wxSound_FILE, 51 wxSound_RESOURCE, 52 wxSound_NONE 53 } m_type; //mode 54}; 55 56#endif 57#endif 58 // _WX_SOUND_H_ 59