From 1f7d744819968aec3c82035f730558cb73e0bd18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Nusser?= Date: Fri, 26 Jul 2019 00:25:30 +0200 Subject: Add support for normalized samples in the engine. This is untested and also the part of the parser is missing. --- src/drumgizmo.cc | 2 +- src/inputprocessor.cc | 7 ++++++- src/settings.h | 9 +++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) (limited to 'src') 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 master_bleed{1.0f}; Atomic has_bleed_control{false}; + Atomic normalized_samples{false}; + Atomic enable_latency_modifier{false}; //! Maximum "early hits" introduces latency in milliseconds. @@ -198,6 +200,8 @@ struct SettingsGetter SettingRef master_bleed; SettingRef has_bleed_control; + SettingRef normalized_samples; + SettingRef enable_latency_modifier; SettingRef latency_max_ms; SettingRef 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 master_bleed; Notifier has_bleed_control; + Notifier normalized_samples; + Notifier enable_latency_modifier; Notifier latency_max_ms; Notifier 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); -- cgit v1.2.3