diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/simpl/base.cpp | 71 | ||||
-rw-r--r-- | src/simpl/base.h | 27 |
2 files changed, 52 insertions, 46 deletions
diff --git a/src/simpl/base.cpp b/src/simpl/base.cpp index 94a7936..16a0f8a 100644 --- a/src/simpl/base.cpp +++ b/src/simpl/base.cpp @@ -99,9 +99,9 @@ void Frame::init() _max_peaks = 100; _max_partials = 100; _audio = NULL; - _synth = NULL; - _residual = NULL; - _synth_residual = NULL; + // _synth = NULL; + // _residual = NULL; + // _synth_residual = NULL; } // Frame - peaks @@ -208,45 +208,51 @@ void Frame::size(int new_size) { _size = new_size; } -void Frame::audio(const number* new_audio) + +// void Frame::audio(const number* new_audio) +// { +// _audio = new_audio; +// } + +void Frame::audio(const samples& new_audio, const int offset) { - _audio = new_audio; + _audio = &new_audio + offset; } -const number* Frame::audio() +const samples* Frame::audio() { return _audio; } -void Frame::synth(const number* new_synth) -{ - _synth = new_synth; -} +// void Frame::synth(const number* new_synth) +// { +// _synth = new_synth; +// } -const number* Frame::synth() -{ - return _synth; -} +// const number* Frame::synth() +// { +// return _synth; +// } -void Frame::residual(const number* new_residual) -{ - _residual = new_residual; -} +// void Frame::residual(const number* new_residual) +// { +// _residual = new_residual; +// } -const number* Frame::residual() -{ - return _residual; -} +// const number* Frame::residual() +// { +// return _residual; +// } -void Frame::synth_residual(const number* new_synth_residual) -{ - _synth_residual = new_synth_residual; -} +// void Frame::synth_residual(const number* new_synth_residual) +// { +// _synth_residual = new_synth_residual; +// } -const number* Frame::synth_residual() -{ - return _synth_residual; -} +// const number* Frame::synth_residual() +// { +// return _synth_residual; +// } // --------------------------------------------------------------------------- // PeakDetection @@ -381,9 +387,8 @@ Frames* PeakDetection::find_peaks(const samples& audio) } // get the next frame - Frame f = Frame(); - f.size(_frame_size); - f.audio(&(audio[pos])); + Frame f = Frame(_frame_size); + f.audio(audio, pos); // find peaks Peaks* peaks = find_peaks_in_frame(f); diff --git a/src/simpl/base.h b/src/simpl/base.h index d8e31d2..6ca1b97 100644 --- a/src/simpl/base.h +++ b/src/simpl/base.h @@ -21,7 +21,6 @@ #include <vector> #include <string> - #include "exceptions.h" using namespace std; @@ -87,10 +86,10 @@ private: int _max_partials; Peaks _peaks; Partials _partials; - const number* _audio; - const number* _synth; - const number* _residual; - const number* _synth_residual; + const samples* _audio; + // const number* _synth; + // const number* _residual; + // const number* _synth_residual; void init(); public: @@ -119,14 +118,16 @@ public: // audio buffers int size(); void size(int new_size); - void audio(const number* new_audio); - const number* audio(); - void synth(const number* new_synth); - const number* synth(); - void residual(const number* new_residual); - const number* residual(); - void synth_residual(const number* new_synth_residual); - const number* synth_residual(); + // void audio(const number* new_audio); + void audio(const samples& new_audio, const int offset = 0); + const samples* audio(); + + // void synth(const number* new_synth); + // const number* synth(); + // void residual(const number* new_residual); + // const number* residual(); + // void synth_residual(const number* new_synth_residual); + // const number* synth_residual(); }; typedef std::vector<Frame> Frames; |