summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2019-07-26 00:25:30 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2019-10-14 22:04:13 +0200
commit1f7d744819968aec3c82035f730558cb73e0bd18 (patch)
treea899777609cfc7740638ab66998ca06fa2cfca6b
parentc4397e38f1ba24993445867791ccd61b4bd1b0f8 (diff)
Add support for normalized samples in the engine.
This is untested and also the part of the parser is missing.
-rw-r--r--src/drumgizmo.cc2
-rw-r--r--src/inputprocessor.cc7
-rw-r--r--src/settings.h9
3 files changed, 16 insertions, 2 deletions
diff --git a/src/drumgizmo.cc b/src/drumgizmo.cc
index dcbb7bd..e6dbf55 100644
--- a/src/drumgizmo.cc
+++ b/src/drumgizmo.cc
@@ -357,7 +357,7 @@ void DrumGizmo::getSamples(int ch, int pos, sample_t* s, size_t sz)
if((af.mainState() == main_state_t::is_not_main) &&
enable_bleed_control)
{
- evt.scale = master_bleed;
+ evt.scale *= master_bleed;
}
evt.buffer_size = initial_chunksize;
diff --git a/src/inputprocessor.cc b/src/inputprocessor.cc
index 819a3c7..eb45f4b 100644
--- a/src/inputprocessor.cc
+++ b/src/inputprocessor.cc
@@ -207,9 +207,14 @@ bool InputProcessor::processOnset(event_t& event,
else
{
//DEBUG(inputprocessor, "Adding event %d.\n", event.offset);
- Event* evt = new EventSample(ch.num, 1.0, af, instr->getGroup(),
+ auto evt = new EventSample(ch.num, 1.0, af, instr->getGroup(),
instrument_id);
evt->offset = (event.offset + pos) * resample_ratio;
+ if(settings.normalized_samples.load())
+ {
+ evt->scale *= event.velocity;
+ }
+
activeevents[ch.num].push_back(evt);
}
}
diff --git a/src/settings.h b/src/settings.h
index 97b1cf1..ece78ee 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -112,6 +112,8 @@ struct Settings
Atomic<float> master_bleed{1.0f};
Atomic<bool> has_bleed_control{false};
+ Atomic<bool> normalized_samples{false};
+
Atomic<bool> enable_latency_modifier{false};
//! Maximum "early hits" introduces latency in milliseconds.
@@ -198,6 +200,8 @@ struct SettingsGetter
SettingRef<float> master_bleed;
SettingRef<bool> has_bleed_control;
+ SettingRef<bool> normalized_samples;
+
SettingRef<bool> enable_latency_modifier;
SettingRef<float> latency_max_ms;
SettingRef<float> latency_laid_back_ms;
@@ -246,6 +250,7 @@ struct SettingsGetter
, enable_bleed_control{settings.enable_bleed_control}
, master_bleed{settings.master_bleed}
, has_bleed_control{settings.has_bleed_control}
+ , normalized_samples{settings.normalized_samples}
, enable_latency_modifier{settings.enable_latency_modifier}
, latency_max_ms{settings.latency_max_ms}
, latency_laid_back_ms{settings.latency_laid_back_ms}
@@ -307,6 +312,8 @@ public:
Notifier<float> master_bleed;
Notifier<bool> has_bleed_control;
+ Notifier<bool> normalized_samples;
+
Notifier<bool> enable_latency_modifier;
Notifier<float> latency_max_ms;
Notifier<float> latency_laid_back_ms;
@@ -367,6 +374,8 @@ public:
EVAL(master_bleed);
EVAL(has_bleed_control);
+ EVAL(normalized_samples);
+
EVAL(enable_latency_modifier);
EVAL(latency_max_ms);
EVAL(latency_laid_back_ms);