#endif
#ifndef WX_PRECOMP
-#include <wx/wx.h>
+#include "wx/wx.h"
#endif
-#include <wx/file.h>
-#include <wx/msw/wave.h>
-#include <wx/msw/private.h>
+#include "wx/file.h"
+#include "wx/msw/wave.h"
+#include "wx/msw/private.h"
#include <windows.h>
#include <windowsx.h>
#endif
#ifdef __GNUWIN32__
-#include <wx/msw/gnuwin32/extra.h>
+#include "wx/msw/gnuwin32/extra.h"
#endif
-wxWave::wxWave(void)
- : m_waveLength(0), m_isResource(FALSE), m_waveData(NULL)
+wxWave::wxWave()
+ : m_waveData(NULL), m_waveLength(0), m_isResource(FALSE)
{
}
wxWave::wxWave(const wxString& sFileName, bool isResource)
- : m_waveLength(0), m_isResource(isResource), m_waveData(NULL)
+ : m_waveData(NULL), m_waveLength(0), m_isResource(isResource)
{
Create(sFileName, isResource);
}
+wxWave::wxWave(int size, const byte* data)
+ : m_waveData(NULL), m_waveLength(0), m_isResource(FALSE)
+{
+ Create(size, data);
+}
-wxWave::~wxWave(void)
+wxWave::~wxWave()
{
Free();
}
}
}
+bool wxWave::Create(int size, const byte* data)
+{
+ Free();
+ m_isResource = FALSE;
+ m_waveLength=size;
+ m_waveData = (byte*)::GlobalLock(::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, m_waveLength));
+ if (!m_waveData)
+ return FALSE;
+
+ for (int i=0; i<size; i++) m_waveData[i] = data[i];
+ return TRUE;
+}
+
bool wxWave::Play(bool async, bool looped) const
{
if (!IsOk())
#endif
}
-bool
-wxWave::Free(void)
+bool wxWave::Free()
{
if (m_waveData)
{