summaryrefslogtreecommitdiff
path: root/src/drumgizmo.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2015-02-12 22:18:39 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2015-02-12 22:18:39 +0100
commit087087e65c0ea0b19d21c4a8b44833bf0a951e86 (patch)
treec05b3cbbfe30d89d2d50934f51763478028529cc /src/drumgizmo.cc
parentfaa4ea3d5997590a235f90a25522a36b39930490 (diff)
Add 'enable_resampling' config option for runtime disabling of the resampler.
Diffstat (limited to 'src/drumgizmo.cc')
-rw-r--r--src/drumgizmo.cc41
1 files changed, 25 insertions, 16 deletions
diff --git a/src/drumgizmo.cc b/src/drumgizmo.cc
index 6b48cda..71043af 100644
--- a/src/drumgizmo.cc
+++ b/src/drumgizmo.cc
@@ -265,24 +265,26 @@ bool DrumGizmo::run(size_t pos, sample_t *samples, size_t nsamples)
//
// Write audio
//
-#ifndef WITH_RESAMPLER
- // No resampling needed
- for(size_t c = 0; c < kit.channels.size(); c++) {
- sample_t *buf = samples;
- bool internal = false;
- if(oe->getBuffer(c)) {
- buf = oe->getBuffer(c);
- internal = true;
- }
- if(buf) {
- memset(buf, 0, nsamples * sizeof(sample_t));
-
- getSamples(c, pos, buf, nsamples);
+#ifdef WITH_RESAMPLER
+ if(Conf::enable_resampling == false) { // No resampling needed
+#endif
+ for(size_t c = 0; c < kit.channels.size(); c++) {
+ sample_t *buf = samples;
+ bool internal = false;
+ if(oe->getBuffer(c)) {
+ buf = oe->getBuffer(c);
+ internal = true;
+ }
+ if(buf) {
+ memset(buf, 0, nsamples * sizeof(sample_t));
+
+ getSamples(c, pos, buf, nsamples);
- if(!internal) oe->run(c, samples, nsamples);
+ if(!internal) oe->run(c, samples, nsamples);
+ }
}
- }
-#else/*WITH_RESAMPLER*/
+#ifdef WITH_RESAMPLER
+ } else {
// Resampling needed
//
@@ -320,6 +322,8 @@ bool DrumGizmo::run(size_t pos, sample_t *samples, size_t nsamples)
for(size_t c = 0; c < kit.channels.size(); c++) {
oe->run(c, resampler_output_buffer[c], nsamples);
}
+
+ }
#endif/*WITH_RESAMPLER*/
ie->post();
@@ -528,6 +532,11 @@ bool DrumGizmo::setConfigString(std::string cfg)
str2float(p.value("velocity_randomiser_weight"));
}
+ if(p.value("enable_resampling") != "") {
+ Conf::enable_resampling =
+ p.value("enable_resampling") == "true";
+ }
+
std::string newkit = p.value("drumkitfile");
if(newkit != "" && kit.file() != newkit) {
/*