X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cbb8c1d34c68feaeb5861aa91bdbf715b2d963b0..88594d02eb59a55ac85d3210a49d02918124617b:/src/gtk/wave.cpp?ds=sidebyside diff --git a/src/gtk/wave.cpp b/src/gtk/wave.cpp index a5255b57b9..382c1db09b 100644 --- a/src/gtk/wave.cpp +++ b/src/gtk/wave.cpp @@ -13,6 +13,10 @@ #pragma implementation "wave.h" #endif +#include "wx/setup.h" + +#if wxUSE_WAVE + // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -33,110 +37,118 @@ #include "wx/file.h" #include "wx/wave.h" +//----------------------------------------------------------------- +// wxWave +//----------------------------------------------------------------- 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); + 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); + Create(size, data); } wxWave::~wxWave() { - Free(); + Free(); } bool wxWave::Create(const wxString& fileName, bool isResource) { - Free(); + Free(); - if (isResource) - { - // todo - - return (m_waveData ? TRUE : FALSE); - } - else - { - m_isResource = FALSE; + if (isResource) + { + // todo + return (m_waveData ? TRUE : FALSE); + } + else + { + m_isResource = FALSE; - wxFile fileWave; - if (!fileWave.Open(fileName, wxFile::read)) - return FALSE; + wxFile fileWave; + if (!fileWave.Open(fileName, wxFile::read)) + { + return FALSE; + } - m_waveLength = (int) fileWave.Length(); + m_waveLength = (int) fileWave.Length(); - m_waveData = new byte[m_waveLength]; - if (!m_waveData) - return FALSE; + m_waveData = new wxByte[m_waveLength]; + if (!m_waveData) + { + return FALSE; + } - fileWave.Read(m_waveData, m_waveLength); + fileWave.Read(m_waveData, m_waveLength); - return TRUE; - } + return TRUE; + } } -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]; - if (!m_waveData) - return FALSE; + Free(); + m_isResource = FALSE; + m_waveLength=size; + m_waveData = new wxByte[size]; + if (!m_waveData) + { + return FALSE; + } - for (int i=0; i