diff options
author | John Glover <j@johnglover.net> | 2012-06-30 18:48:33 +0100 |
---|---|---|
committer | John Glover <j@johnglover.net> | 2012-06-30 18:48:33 +0100 |
commit | 1ef9783c3faed6a18e8cc2fba34f48b50bedd08a (patch) | |
tree | ba0c26de48baa85614b417643dd71bcab8e941c4 /src/sndobj | |
parent | 53d3a19792635869eac66115dbc006c3a0f23a58 (diff) | |
download | simpl-1ef9783c3faed6a18e8cc2fba34f48b50bedd08a.tar.gz simpl-1ef9783c3faed6a18e8cc2fba34f48b50bedd08a.tar.bz2 simpl-1ef9783c3faed6a18e8cc2fba34f48b50bedd08a.zip |
[sndobj] Make ErrorMessage method const char*
Diffstat (limited to 'src/sndobj')
-rw-r--r-- | src/sndobj/FFT.cpp | 4 | ||||
-rw-r--r-- | src/sndobj/HammingTable.cpp | 5 | ||||
-rw-r--r-- | src/sndobj/HammingTable.h | 2 | ||||
-rw-r--r-- | src/sndobj/HarmTable.cpp | 11 | ||||
-rw-r--r-- | src/sndobj/HarmTable.h | 2 | ||||
-rw-r--r-- | src/sndobj/SndIO.cpp | 9 | ||||
-rw-r--r-- | src/sndobj/SndIO.h | 2 | ||||
-rw-r--r-- | src/sndobj/SndObj.cpp | 31 | ||||
-rw-r--r-- | src/sndobj/SndObj.h | 3 | ||||
-rw-r--r-- | src/sndobj/Table.h | 2 |
10 files changed, 13 insertions, 58 deletions
diff --git a/src/sndobj/FFT.cpp b/src/sndobj/FFT.cpp index cee737d..10ec76f 100644 --- a/src/sndobj/FFT.cpp +++ b/src/sndobj/FFT.cpp @@ -244,7 +244,6 @@ FFT::DoProcess(){ void FFT::fft(double* signal){ - // FFT function rfftw_one(m_plan, signal, m_ffttmp); @@ -259,7 +258,4 @@ FFT::fft(double* signal){ m_output[i] = m_ffttmp[i2]/m_norm; m_output[i+1] = m_ffttmp[m_fftsize-(i2)]/m_norm; } - - } - diff --git a/src/sndobj/HammingTable.cpp b/src/sndobj/HammingTable.cpp index 20c37b5..f63c43c 100644 --- a/src/sndobj/HammingTable.cpp +++ b/src/sndobj/HammingTable.cpp @@ -77,10 +77,10 @@ HammingTable :: MakeTable(){ ///////////////// ERROR HANDLING /////////////////////////////// -char* +const char* HammingTable::ErrorMessage(){ - char* message; + const char* message; switch(m_error){ @@ -95,5 +95,4 @@ HammingTable::ErrorMessage(){ } return message; - } diff --git a/src/sndobj/HammingTable.h b/src/sndobj/HammingTable.h index 9a054ec..c65e55b 100644 --- a/src/sndobj/HammingTable.h +++ b/src/sndobj/HammingTable.h @@ -38,7 +38,7 @@ class HammingTable : public Table { public: void SetParam(long L, double alpha=.54); - char* ErrorMessage(); + const char* ErrorMessage(); short MakeTable(); HammingTable(); HammingTable(long L, double alpha); diff --git a/src/sndobj/HarmTable.cpp b/src/sndobj/HarmTable.cpp index 28fcd09..a858efa 100644 --- a/src/sndobj/HarmTable.cpp +++ b/src/sndobj/HarmTable.cpp @@ -129,10 +129,10 @@ HarmTable :: MakeTable(){ ///////////////// ERROR HANDLING /////////////////////////////// -char* +const char* HarmTable::ErrorMessage(){ - char* message; + const char* message; switch(m_error){ @@ -150,11 +150,4 @@ HarmTable::ErrorMessage(){ } return message; - } - - - - - - diff --git a/src/sndobj/HarmTable.h b/src/sndobj/HarmTable.h index 98671df..dfe1096 100644 --- a/src/sndobj/HarmTable.h +++ b/src/sndobj/HarmTable.h @@ -44,7 +44,7 @@ class HarmTable : public Table { void SetHarm(int harm, int type); - char* ErrorMessage(); + const char* ErrorMessage(); short MakeTable(); HarmTable(); void SetPhase(double phase){ m_phase = (double)(phase*TWOPI); } diff --git a/src/sndobj/SndIO.cpp b/src/sndobj/SndIO.cpp index 6f79feb..dfa790c 100644 --- a/src/sndobj/SndIO.cpp +++ b/src/sndobj/SndIO.cpp @@ -115,9 +115,9 @@ SndIO::SndIO(short channels, short bits, SndObj** inputlist, return 1; } - char* SndIO::ErrorMessage(){ +const char* SndIO::ErrorMessage(){ - char* message; + const char* message; switch(m_error){ @@ -148,7 +148,4 @@ SndIO::SndIO(short channels, short bits, SndObj** inputlist, } return message; - - } - - +} diff --git a/src/sndobj/SndIO.h b/src/sndobj/SndIO.h index ad9456e..78a9ac0 100644 --- a/src/sndobj/SndIO.h +++ b/src/sndobj/SndIO.h @@ -128,7 +128,7 @@ class SndIO { virtual ~SndIO(); virtual short Read(); virtual short Write(); - virtual char* ErrorMessage(); + virtual const char* ErrorMessage(); int Error() { return m_error; } }; diff --git a/src/sndobj/SndObj.cpp b/src/sndobj/SndObj.cpp index a111426..e5b557c 100644 --- a/src/sndobj/SndObj.cpp +++ b/src/sndobj/SndObj.cpp @@ -201,36 +201,7 @@ SndObj::operator<<(SndIO& in){ for(int n=0;n<m_vecsize;n++) m_output[n]=in.Output(n,1); } - -char* SndObj::ErrorMessage(){ - - char* message; - - switch(m_error){ - - case 0: - message = "No error\n"; - break; - - case 1: - message = "Failed to allocate vector memory\n"; - break; - - case 3: - message = "DoProcess() failed: no input object \n"; - break; - - default: - message = "Undefined error\n"; - break; - - } - - return message; - -} - -const char* SndObj::CErrorMessage(){ +const char* SndObj::ErrorMessage(){ switch(m_error){ diff --git a/src/sndobj/SndObj.h b/src/sndobj/SndObj.h index ce1986e..81e93c2 100644 --- a/src/sndobj/SndObj.h +++ b/src/sndobj/SndObj.h @@ -265,8 +265,7 @@ class SndObj { #endif virtual ~SndObj(); - virtual char* ErrorMessage(); - virtual const char* CErrorMessage(); + virtual const char* ErrorMessage(); virtual short DoProcess(); }; diff --git a/src/sndobj/Table.h b/src/sndobj/Table.h index f20a2bd..f89029b 100644 --- a/src/sndobj/Table.h +++ b/src/sndobj/Table.h @@ -53,7 +53,7 @@ class Table { } virtual ~Table(){}; - virtual char* ErrorMessage() = 0; + virtual const char* ErrorMessage() = 0; virtual short MakeTable() = 0; |