summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/simpl/base.cpp23
-rw-r--r--src/simpl/base.h2
-rw-r--r--src/simpl/synthesis.cpp5
3 files changed, 18 insertions, 12 deletions
diff --git a/src/simpl/base.cpp b/src/simpl/base.cpp
index 9683df3..c97e8bc 100644
--- a/src/simpl/base.cpp
+++ b/src/simpl/base.cpp
@@ -63,20 +63,27 @@ void Frame::init() {
void Frame::create_arrays() {
_audio = new sample[_size];
- _synth = new sample[_synth_size];
_residual = new sample[_size];
- _synth_residual = new sample[_synth_size];
-
memset(_audio, 0.0, sizeof(sample) * _size);
- memset(_synth, 0.0, sizeof(sample) * _synth_size);
memset(_residual, 0.0, sizeof(sample) * _size);
- memset(_synth_residual, 0.0, sizeof(sample) * _synth_size);
+ create_synth_arrays();
}
void Frame::destroy_arrays() {
delete [] _audio;
- delete [] _synth;
delete [] _residual;
+ destroy_synth_arrays();
+}
+
+void Frame::create_synth_arrays() {
+ _synth = new sample[_synth_size];
+ _synth_residual = new sample[_synth_size];
+ memset(_synth, 0.0, sizeof(sample) * _synth_size);
+ memset(_synth_residual, 0.0, sizeof(sample) * _synth_size);
+}
+
+void Frame::destroy_synth_arrays() {
+ delete [] _synth;
delete [] _synth_residual;
}
@@ -214,8 +221,8 @@ void Frame::synth_size(int new_size) {
_synth_size = new_size;
if(_alloc_memory) {
- destroy_arrays();
- create_arrays();
+ destroy_synth_arrays();
+ create_synth_arrays();
}
}
diff --git a/src/simpl/base.h b/src/simpl/base.h
index 5a3bf5b..cfa139c 100644
--- a/src/simpl/base.h
+++ b/src/simpl/base.h
@@ -60,6 +60,8 @@ class Frame {
bool _alloc_memory;
void create_arrays();
void destroy_arrays();
+ void create_synth_arrays();
+ void destroy_synth_arrays();
public:
Frame();
diff --git a/src/simpl/synthesis.cpp b/src/simpl/synthesis.cpp
index 5784522..3f48c78 100644
--- a/src/simpl/synthesis.cpp
+++ b/src/simpl/synthesis.cpp
@@ -51,10 +51,7 @@ void Synthesis::synth_frame(Frame* frame) {
Frames Synthesis::synth(Frames frames) {
for(int i = 0; i < frames.size(); i++) {
- sample* synth_audio = new sample[_frame_size];
- memset(synth_audio, 0.0, sizeof(sample) * _frame_size);
- frames[i]->synth(synth_audio);
- frames[i]->synth_size(_frame_size);
+ frames[i]->synth_size(_hop_size);
synth_frame(frames[i]);
}
return frames;