X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/321db4b6bf15df209942b9c0e6c744c8e7074d1b..c7527e3f2178b3a527c50ffda6bb059f8ff8acce:/src/msw/wave.cpp diff --git a/src/msw/wave.cpp b/src/msw/wave.cpp index 1f3ba0dd82..19b164f5a0 100644 --- a/src/msw/wave.cpp +++ b/src/msw/wave.cpp @@ -31,27 +31,31 @@ #include #include -#ifndef __GNUWIN32__ +#if !defined( __GNUWIN32__ ) || defined(wxUSE_NORLANDER_HEADERS) #include #endif +#ifndef __TWIN32__ #ifdef __GNUWIN32__ +#ifndef wxUSE_NORLANDER_HEADERS #include "wx/msw/gnuwin32/extra.h" #endif +#endif +#endif wxWave::wxWave() - : m_waveLength(0), m_isResource(FALSE), m_waveData(NULL) + : 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_waveLength(0), m_isResource(FALSE), m_waveData(NULL) +wxWave::wxWave(int size, const wxByte* data) + : m_waveData(NULL), m_waveLength(0), m_isResource(FALSE) { Create(size, data); } @@ -70,10 +74,14 @@ bool wxWave::Create(const wxString& fileName, bool isResource) m_isResource = TRUE; HRSRC hresInfo; -#ifdef __WIN32__ - hresInfo = ::FindResourceA((HMODULE) wxhInstance, fileName, "WAVE"); +#if defined(__WIN32__) && !defined(__TWIN32__) +#ifdef _UNICODE + hresInfo = ::FindResourceW((HMODULE) wxhInstance, fileName, _T("WAVE")); +#else + hresInfo = ::FindResourceA((HMODULE) wxhInstance, fileName, _T("WAVE")); +#endif #else - hresInfo = ::FindResource((HMODULE) wxhInstance, fileName, "WAVE"); + hresInfo = ::FindResource((HMODULE) wxhInstance, fileName, _T("WAVE")); #endif if (!hresInfo) return FALSE; @@ -82,7 +90,7 @@ bool wxWave::Create(const wxString& fileName, bool isResource) if (waveData) { - m_waveData= (byte*)::LockResource(waveData); + m_waveData= (wxByte*)::LockResource(waveData); m_waveLength = (int) ::SizeofResource((HMODULE) wxhInstance, hresInfo); } @@ -98,7 +106,7 @@ bool wxWave::Create(const wxString& fileName, bool isResource) m_waveLength = (int) fileWave.Length(); - m_waveData = (byte*)::GlobalLock(::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, m_waveLength)); + m_waveData = (wxByte*)::GlobalLock(::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, m_waveLength)); if (!m_waveData) return FALSE; @@ -108,12 +116,12 @@ bool wxWave::Create(const wxString& fileName, bool isResource) } } -bool wxWave::Create(int size, const byte* data) +bool wxWave::Create(int size, const wxByte* data) { Free(); m_isResource = FALSE; m_waveLength=size; - m_waveData = (byte*)::GlobalLock(::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, m_waveLength)); + m_waveData = (wxByte*)::GlobalLock(::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, m_waveLength)); if (!m_waveData) return FALSE; @@ -127,7 +135,7 @@ bool wxWave::Play(bool async, bool looped) const return FALSE; #ifdef __WIN32__ - return ( ::PlaySound((LPCSTR)m_waveData, NULL, SND_MEMORY | + return ( ::PlaySound((LPCTSTR)m_waveData, NULL, SND_MEMORY | SND_NODEFAULT | (async ? SND_ASYNC : SND_SYNC) | (looped ? (SND_LOOP | SND_ASYNC) : 0)) != 0 ); #else return ( ::sndPlaySound((LPCSTR)m_waveData, SND_MEMORY |