summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Glover <j@johnglover.net>2012-09-11 16:02:16 +0200
committerJohn Glover <j@johnglover.net>2012-09-11 16:02:16 +0200
commitacb66816c83b2d8ce35bca015f2721d6aef5ad40 (patch)
treefadcb827e1e5fef3f0b8a48498dc2558a5fd5bfb /src
parent75bf8b0ba1d874b6af1b88ed5fffe27b3b25e70d (diff)
downloadsimpl-acb66816c83b2d8ce35bca015f2721d6aef5ad40.tar.gz
simpl-acb66816c83b2d8ce35bca015f2721d6aef5ad40.tar.bz2
simpl-acb66816c83b2d8ce35bca015f2721d6aef5ad40.zip
[residual] SMSResidual fix: don't call Frame.clear
as it now clears the audio buffer as well as peak/partial data. Remove some dead code.
Diffstat (limited to 'src')
-rw-r--r--src/simpl/residual.cpp17
-rw-r--r--src/simpl/residual.h3
2 files changed, 9 insertions, 11 deletions
diff --git a/src/simpl/residual.cpp b/src/simpl/residual.cpp
index 6d2c4c7..b74c1a6 100644
--- a/src/simpl/residual.cpp
+++ b/src/simpl/residual.cpp
@@ -129,15 +129,11 @@ void SMSResidual::num_stochastic_coeffs(int new_num_stochastic_coeffs) {
sms_initResidual(&_residual_params);
}
-// int SMSResidual::stochastic_type() {
-// return _residual_params.
-// }
-
-// void SMSResidual::stochastic_type(int new_stochastic_type) {
-// }
-
void SMSResidual::residual_frame(Frame* frame) {
- frame->clear();
+ frame->clear_peaks();
+ frame->clear_partials();
+ frame->clear_synth();
+
_pd.find_peaks_in_frame(frame);
_pt.update_partials(frame);
_synth.synth_frame(frame);
@@ -157,4 +153,9 @@ void SMSResidual::synth_frame(Frame* frame) {
sms_approxResidual(_hop_size, frame->residual(),
_hop_size, frame->synth_residual(),
&_residual_params);
+
+ // SMS stochastic component is currently a bit loud so scaled here
+ for(int i = 0; i < frame->synth_size(); i++) {
+ frame->synth_residual()[i] *= 0.2;
+ }
}
diff --git a/src/simpl/residual.h b/src/simpl/residual.h
index d3b7b59..8bdd316 100644
--- a/src/simpl/residual.h
+++ b/src/simpl/residual.h
@@ -67,9 +67,6 @@ class SMSResidual : public Residual {
int num_stochastic_coeffs();
void num_stochastic_coeffs(int new_num_stochastic_coeffs);
- // int stochastic_type();
- // void stochastic_type(int new_stochastic_type);
-
void residual_frame(Frame* frame);
void synth_frame(Frame* frame);
};