sound.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/os2/sound.h
  3. // Purpose: wxSound class (loads and plays short Windows .wav files).
  4. // Optional on non-Windows platforms.
  5. // Author: David Webster
  6. // Modified by:
  7. // Created: 10/17/99
  8. // Copyright: (c) David Webster
  9. // Licence: wxWindows licence
  10. /////////////////////////////////////////////////////////////////////////////
  11. #ifndef _WX_SOUND_H_
  12. #define _WX_SOUND_H_
  13. #include "wx/object.h"
  14. class wxSound : public wxSoundBase
  15. {
  16. public:
  17. wxSound();
  18. wxSound(const wxString& fileName, bool isResource = FALSE);
  19. wxSound(size_t size, const void* data);
  20. virtual ~wxSound();
  21. public:
  22. // Create from resource or file
  23. bool Create(const wxString& fileName, bool isResource = FALSE);
  24. // Create from data
  25. bool Create(size_t size, const void* data);
  26. bool IsOk() const { return (m_waveData ? TRUE : FALSE); }
  27. protected:
  28. bool Free();
  29. bool DoPlay(unsigned flags) const;
  30. private:
  31. wxByte* m_waveData;
  32. int m_waveLength;
  33. bool m_isResource;
  34. };
  35. #endif
  36. // _WX_SOUND_H_