summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2018-06-08 22:17:20 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2018-08-12 11:13:49 +0200
commit2da458423c1fa95d3000d94105f215c6a603094b (patch)
tree13db7d1b4104a5d3b60c73854d5d26396ba40fc1 /src
parent592f05fa549c7e680e502f569c27e71177361ad6 (diff)
Add tab for drumkit.
Diffstat (limited to 'src')
-rw-r--r--src/drumgizmo.cc19
-rw-r--r--src/settings.h19
2 files changed, 38 insertions, 0 deletions
diff --git a/src/drumgizmo.cc b/src/drumgizmo.cc
index d389cc2..d15b192 100644
--- a/src/drumgizmo.cc
+++ b/src/drumgizmo.cc
@@ -137,6 +137,25 @@ bool DrumGizmo::run(size_t pos, sample_t *samples, size_t nsamples)
{
resample_ratio = 1.0;
}
+
+ if (settings_getter.audition_counter.hasChanged())
+ {
+ settings_getter.audition_counter.getValue();
+ auto instrument_name = settings.audition_instrument.load();
+ auto velocity = settings.audition_velocity.load();
+
+ std::size_t instrument_index = 0;
+ for (std::size_t i = 0; i < kit.instruments.size(); ++i)
+ {
+ if (instrument_name == kit.instruments[i]->getName())
+ {
+ instrument_index = i;
+ }
+ }
+
+ events.emplace_back(event_t{TYPE_ONSET, instrument_index, 0, velocity});
+ }
+
bool active_events_left =
input_processor.process(events, pos, resample_ratio);
diff --git a/src/settings.h b/src/settings.h
index 5137809..13bb956 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -128,6 +128,10 @@ struct Settings
// Current latency offset in ms - for UI
Atomic<float> latency_current{0};
+
+ Atomic<std::size_t> audition_counter{0};
+ Atomic<std::string> audition_instrument;
+ Atomic<float> audition_velocity;
};
//! Settings getter class.
@@ -179,6 +183,10 @@ struct SettingsGetter
SettingRef<float> latency_regain;
SettingRef<float> latency_current;
+ SettingRef<std::size_t> audition_counter;
+ SettingRef<std::string> audition_instrument;
+ SettingRef<float> audition_velocity;
+
SettingsGetter(Settings& settings)
: drumkit_file(settings.drumkit_file)
, drumkit_load_status(settings.drumkit_load_status)
@@ -216,6 +224,9 @@ struct SettingsGetter
, latency_stddev{settings.latency_stddev}
, latency_regain{settings.latency_regain}
, latency_current{settings.latency_current}
+ , audition_counter{settings.audition_counter}
+ , audition_instrument{settings.audition_instrument}
+ , audition_velocity{settings.audition_velocity}
{
}
};
@@ -270,6 +281,10 @@ public:
Notifier<float> latency_regain;
Notifier<float> latency_current;
+ Notifier<std::size_t> audition_counter;
+ Notifier<std::string> audition_instrument;
+ Notifier<int> audition_velocity;
+
void evaluate()
{
#define EVAL(x) if(settings.x.hasChanged()) { x(settings.x.getValue()); }
@@ -319,6 +334,10 @@ public:
EVAL(latency_stddev);
EVAL(latency_regain);
EVAL(latency_current);
+
+ EVAL(audition_counter);
+ EVAL(audition_instrument);
+ EVAL(audition_velocity);
}
SettingsNotifier(Settings& settings)