X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bbe0af5b15f8b8e95ed45abc2140fb3a1fac3c87..6dfaa4e5d9b8e6c741971884ec896f15f71712f4:/src/gtk1/wave.cpp diff --git a/src/gtk1/wave.cpp b/src/gtk1/wave.cpp index 2436c23461..b100588180 100644 --- a/src/gtk1/wave.cpp +++ b/src/gtk1/wave.cpp @@ -13,6 +13,10 @@ #pragma implementation "wave.h" #endif +#include + +#if wxUSE_WAVE + // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -38,18 +42,18 @@ //----------------------------------------------------------------- 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); } @@ -80,7 +84,7 @@ bool wxWave::Create(const wxString& fileName, bool isResource) m_waveLength = (int) fileWave.Length(); - m_waveData = new byte[m_waveLength]; + m_waveData = new wxByte[m_waveLength]; if (!m_waveData) { return FALSE; @@ -92,12 +96,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 = new byte[size]; + m_waveData = new wxByte[size]; if (!m_waveData) { return FALSE; @@ -165,7 +169,6 @@ typedef struct int wxWave::OpenDSP(void) { - wxString str; WAVEFORMAT waveformat; int dev=-1; unsigned long ul; @@ -175,14 +178,14 @@ int wxWave::OpenDSP(void) memcpy(&waveformat,&m_waveData[FMT_INDEX+4],sizeof(WAVEFORMAT)); - str= wxString(m_waveData,4); - if (str != "RIFF") return -1; - str= wxString(&m_waveData[WAVE_INDEX],4); - if (str != "WAVE") return -1; - str= wxString(&m_waveData[FMT_INDEX],4); - if (str != "fmt ") return -1; - str= wxString(&m_waveData[FMT_INDEX+waveformat.uiSize+8],4); - if(str != "data") return -1; + if (memcmp(m_waveData, "RIFF", 4) != 0) + return -1; + if (memcmp(&m_waveData[WAVE_INDEX], "WAVE", 4) != 0) + return -1; + if (memcmp(&m_waveData[FMT_INDEX], "fmt ", 4) != 0) + return -1; + if (memcmp(&m_waveData[FMT_INDEX+waveformat.uiSize+8], "data", 4) != 0) + return -1; memcpy(&ul,&m_waveData[FMT_INDEX+waveformat.uiSize+12],4); m_sizeData=ul; if ((int)(m_sizeData+FMT_INDEX+waveformat.uiSize+16) != m_waveLength) @@ -221,4 +224,5 @@ bool wxWave::InitDSP(int dev, int iDataBits, int iChannel,unsigned long ulSampli return TRUE; } +#endif