summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/configuration.cc17
-rw-r--r--src/configuration.h2
-rw-r--r--src/drumgizmo.cc41
3 files changed, 28 insertions, 32 deletions
diff --git a/src/configuration.cc b/src/configuration.cc
index 965dcf9..5c733ee 100644
--- a/src/configuration.cc
+++ b/src/configuration.cc
@@ -35,19 +35,4 @@ float Conf::velocity_randomiser_weight = 0.1;
int Conf::samplerate = 44100;
-#ifdef TEST_CONFIGURATION
-//Additional dependency files
-//deps:
-//Required cflags (autoconf vars may be used)
-//cflags:
-//Required link options (autoconf vars may be used)
-//libs:
-#include "test.h"
-
-TEST_BEGIN;
-
-// TODO: Put some testcode here (see test.h for usable macros).
-
-TEST_END;
-
-#endif/*TEST_CONFIGURATION*/
+bool Conf::enable_resampling = true;
diff --git a/src/configuration.h b/src/configuration.h
index c49f997..b8be49f 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -36,6 +36,8 @@ namespace Conf {
extern float velocity_randomiser_weight;
extern int samplerate;
+
+ extern bool enable_resampling;
};
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) {
/*