-wxSound::wxSound(int size, const wxByte* data)
- : m_waveData(NULL), m_waveLength(0), m_isResource(false)
+ virtual bool IsOk() const { return GetPtr() != NULL; }
+ virtual DWORD GetSoundFlag() const { return SND_MEMORY; }
+ virtual LPCTSTR GetSoundData() const { return (LPCTSTR)GetPtr(); }
+
+private:
+ GlobalPtr m_waveData;
+ GlobalPtrLock m_waveDataPtr;
+
+ DECLARE_NO_COPY_CLASS(wxSoundDataMemory)
+};
+
+// class for sound files and resources
+class wxSoundDataFile : public wxSoundData
+{
+public:
+ wxSoundDataFile(const wxString& filename, bool isResource);
+
+ virtual bool IsOk() const { return !m_name.empty(); }
+ virtual DWORD GetSoundFlag() const
+ {
+ return m_isResource ? SND_RESOURCE : SND_FILENAME;
+ }
+ virtual LPCTSTR GetSoundData() const { return m_name.c_str(); }
+
+private:
+ const wxString m_name;
+ const bool m_isResource;
+
+ DECLARE_NO_COPY_CLASS(wxSoundDataFile)
+};
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wxSoundData-derived classes
+// ----------------------------------------------------------------------------
+
+wxSoundDataMemory::wxSoundDataMemory(int size, const wxByte *buf)
+ : m_waveData(size),
+ m_waveDataPtr(m_waveData)