From 324502145b2a5fec38928509c8b3d9f8eb8bf47d Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 23 Mar 2016 22:38:44 +0100 Subject: Settings. --- drumgizmo/drumgizmoc.cc | 3 +- plugin/drumgizmo_plugin.cc | 2 +- plugin/drumgizmo_plugin.h | 2 + plugingui/dgwindow.cc | 31 ++++--- plugingui/dgwindow.h | 7 +- plugingui/plugingui.cc | 90 +++++++++++++++++++- plugingui/plugingui.h | 24 ++++-- src/drumgizmo.cc | 10 ++- src/drumgizmo.h | 8 +- src/drumkitloader.cc | 16 ++-- src/drumkitloader.h | 4 +- src/drumkitparser.cc | 7 +- src/drumkitparser.h | 3 +- src/instrument.cc | 205 ++++++++++++++++++++++----------------------- src/instrument.h | 50 ++++++----- src/settings.h | 94 +++++++++++++-------- 16 files changed, 354 insertions(+), 202 deletions(-) diff --git a/drumgizmo/drumgizmoc.cc b/drumgizmo/drumgizmoc.cc index 14a71b3..3164c2e 100644 --- a/drumgizmo/drumgizmoc.cc +++ b/drumgizmo/drumgizmoc.cc @@ -372,7 +372,8 @@ int CliMain::run(int argc, char* argv[]) printf("Using kitfile: %s\n", kitfile.c_str()); - DrumGizmo gizmo(oe.get(), ie.get()); + Settings settings; + DrumGizmo gizmo(settings, oe.get(), ie.get()); gizmo.setFrameSize(oe->getBufferSize()); diff --git a/plugin/drumgizmo_plugin.cc b/plugin/drumgizmo_plugin.cc index 2a7e556..6563dcc 100644 --- a/plugin/drumgizmo_plugin.cc +++ b/plugin/drumgizmo_plugin.cc @@ -59,7 +59,7 @@ DrumGizmoPlugin::DrumGizmoPlugin() { init(); - drumgizmo = std::make_shared(&output, &input); + drumgizmo = std::make_shared(settings, &output, &input); resizeWindow(370, 330); drumgizmo->setFreeWheel(true); drumgizmo->setSamplerate(44100); diff --git a/plugin/drumgizmo_plugin.h b/plugin/drumgizmo_plugin.h index 4a4ec13..5d4a648 100644 --- a/plugin/drumgizmo_plugin.h +++ b/plugin/drumgizmo_plugin.h @@ -154,6 +154,8 @@ private: Output output{*this}; const std::vector* output_samples{nullptr}; + Settings settings; + std::shared_ptr plugin_gui; std::shared_ptr drumgizmo; }; diff --git a/plugingui/dgwindow.cc b/plugingui/dgwindow.cc index 86a985d..25cbdf0 100644 --- a/plugingui/dgwindow.cc +++ b/plugingui/dgwindow.cc @@ -120,10 +120,11 @@ public: }; DGWindow::DGWindow(void* native_window, MessageHandler& messageHandler, - Config& config) + Config& config, Settings& settings) : Window(native_window) , messageHandler(messageHandler) , config(config) + , settings(settings) { int vlineSpacing = 16; @@ -233,11 +234,12 @@ void DGWindow::repaintEvent(RepaintEvent* repaintEvent) void DGWindow::attackValueChanged(float value) { - ChangeSettingMessage *msg = - new ChangeSettingMessage(ChangeSettingMessage::velocity_modifier_weight, - value); + //ChangeSettingMessage *msg = + // new ChangeSettingMessage(ChangeSettingMessage::velocity_modifier_weight, + // value); + //messageHandler.sendMessage(MSGRCV_ENGINE, msg); - messageHandler.sendMessage(MSGRCV_ENGINE, msg); + settings.velocity_modifier_weight.store(value); #ifdef STANDALONE int i = value * 4; @@ -253,10 +255,12 @@ void DGWindow::attackValueChanged(float value) void DGWindow::falloffValueChanged(float value) { - ChangeSettingMessage *msg = - new ChangeSettingMessage(ChangeSettingMessage::velocity_modifier_falloff, - value); - messageHandler.sendMessage(MSGRCV_ENGINE, msg); + //ChangeSettingMessage *msg = + // new ChangeSettingMessage(ChangeSettingMessage::velocity_modifier_falloff, + // value); + //messageHandler.sendMessage(MSGRCV_ENGINE, msg); + + settings.velocity_modifier_falloff.store(value); #ifdef STANDALONE drumkitFileProgress->setProgress(value); @@ -265,10 +269,11 @@ void DGWindow::falloffValueChanged(float value) void DGWindow::velocityCheckClick(bool checked) { - ChangeSettingMessage *msg = - new ChangeSettingMessage(ChangeSettingMessage::enable_velocity_modifier, - checked); - messageHandler.sendMessage(MSGRCV_ENGINE, msg); +// ChangeSettingMessage *msg = +// new ChangeSettingMessage(ChangeSettingMessage::enable_velocity_modifier, +// checked); +// messageHandler.sendMessage(MSGRCV_ENGINE, msg); + settings.enable_velocity_modifier.store(checked); } void DGWindow::kitBrowseClick() diff --git a/plugingui/dgwindow.h b/plugingui/dgwindow.h index 605e87a..c4fbeab 100644 --- a/plugingui/dgwindow.h +++ b/plugingui/dgwindow.h @@ -37,6 +37,8 @@ #include "filebrowser.h" #include "layout.h" +#include + class MessageHandler; namespace GUI { @@ -47,7 +49,8 @@ class File; class DGWindow : public Window { public: - DGWindow(void* native_window, MessageHandler& messageHandler, Config& config); + DGWindow(void* native_window, MessageHandler& messageHandler, Config& config, + Settings& settings); Header* header; @@ -85,6 +88,8 @@ private: Image back{":bg.png"}; Image logo{":logo.png"}; + + Settings& settings; }; } // GUI:: diff --git a/plugingui/plugingui.cc b/plugingui/plugingui.cc index e34c471..9bac007 100644 --- a/plugingui/plugingui.cc +++ b/plugingui/plugingui.cc @@ -31,6 +31,8 @@ #include "pluginconfig.h" #include "messagehandler.h" +#include + namespace GUI { PluginGUI::PluginGUI(void* native_window) @@ -116,7 +118,68 @@ bool PluginGUI::processEvents() } window->eventHandler()->processEvents(); - handleMessages(); + //handleMessages(); + + static bool foo = false; + static int t = 0; + if(t != time(nullptr)) + { + t = time(nullptr); + foo = !foo; + float v = settings.velocity_modifier_falloff.load(); + v += 0.1f; + settings.velocity_modifier_falloff.store(v); + } + + Painter p(*window); + + // Run through all settings one at a time propagate changes to the UI. + if(getter.enable_velocity_modifier.hasChanged()) + { + enable_velocity_modifier_notifier(getter.enable_velocity_modifier.getValue()); + } + + if(getter.velocity_modifier_falloff.hasChanged()) + { + velocity_modifier_falloff_notifier(getter.velocity_modifier_falloff.getValue()); + } + + if(getter.velocity_modifier_weight.hasChanged()) + { + velocity_modifier_weight_notifier(getter.velocity_modifier_weight.getValue()); + } + + if(getter.enable_velocity_randomiser.hasChanged()) + { + enable_velocity_randomiser_notifier(getter.enable_velocity_randomiser.getValue()); + } + + if(getter.velocity_randomiser_weight.hasChanged()) + { + velocity_randomiser_weight_notifier(getter.velocity_randomiser_weight.getValue()); + } + + if(getter.samplerate.hasChanged()) + { + samplerate_notifier(getter.samplerate.getValue()); + } + + if(getter.enable_resampling.hasChanged()) + { + enable_resampling_notifier(getter.enable_resampling.getValue()); + } + + if(getter.number_of_files.hasChanged() || + getter.number_of_files_loaded.hasChanged()) + { + drumkit_file_progress_notifier((float)getter.number_of_files_loaded.getValue() / + (float)getter.number_of_files.getValue()); + } + + //if(getter.current_file.hasChanged()) + //{ + // current_file_notifier(getter.current_file.getValue()); + //} if(closing) { @@ -135,7 +198,30 @@ void PluginGUI::init() config = new Config(); config->load(); - window = new DGWindow(native_window, msghandler, *config); + window = new DGWindow(native_window, msghandler, *config, settings); + + CONNECT(this, enable_velocity_modifier_notifier, + window->velocityCheck, &CheckBox::setChecked); + + CONNECT(this, velocity_modifier_falloff_notifier, + window->falloffKnob, &Knob::setValue); + CONNECT(this, velocity_modifier_weight_notifier, + window->attackKnob, &Knob::setValue); + + + //CONNECT(this, enable_velocity_randomiser_notifier, + // window->velocityCheck, &CheckBox::setChecked); + //CONNECT(this, velocity_randomiser_weight_notifier, + // window->velocityCheck, &CheckBox::setChecked); + + //CONNECT(this, samplerate_notifier, + // window->velocityCheck, &CheckBox::setChecked); + + //CONNECT(this, enable_resampling_notifier, + // window->velocityCheck, &CheckBox::setChecked); + + CONNECT(this, drumkit_file_progress_notifier, + window->drumkitFileProgress, &ProgressBar::setProgress); auto eventHandler = window->eventHandler(); CONNECT(eventHandler, closeNotifier, this, &PluginGUI::closeEventHandler); diff --git a/plugingui/plugingui.h b/plugingui/plugingui.h index f441696..ca31c41 100644 --- a/plugingui/plugingui.h +++ b/plugingui/plugingui.h @@ -31,9 +31,7 @@ #include "pluginconfig.h" - -#include "thread.h" -#include "semaphore.h" +#include #include "messagereceiver.h" #include "notifier.h" @@ -68,6 +66,21 @@ public: Notifier<> closeNotifier; + // Setting notifiers: + Notifier enable_velocity_modifier_notifier; + Notifier velocity_modifier_falloff_notifier; + Notifier velocity_modifier_weight_notifier; + + Notifier enable_velocity_randomiser_notifier; + Notifier velocity_randomiser_weight_notifier; + + Notifier samplerate_notifier; + + Notifier enable_resampling_notifier; + + Notifier drumkit_file_progress_notifier; + //Notifier current_file_notifier; + // Support old interface a little while longer.. void setWindowClosedCallback(void (*handler)(void*), void* ptr); @@ -80,11 +93,12 @@ private: volatile bool closing{false}; volatile bool initialised{false}; - Semaphore sem{"plugingui"}; - // For the old-style notifier. void (*windowClosedHandler)(void *){nullptr}; void *windowClosedPtr{nullptr}; + + Settings settings; + SettingsGetter getter{settings}; }; } // GUI:: diff --git a/src/drumgizmo.cc b/src/drumgizmo.cc index 51cee18..2658754 100644 --- a/src/drumgizmo.cc +++ b/src/drumgizmo.cc @@ -46,18 +46,20 @@ #include "nolocale.h" -DrumGizmo::DrumGizmo(AudioOutputEngine *o, AudioInputEngine *i) +DrumGizmo::DrumGizmo(Settings& settings, + AudioOutputEngine *o, AudioInputEngine *i) : MessageReceiver(MSGRCV_ENGINE) - , loader() + , loader(settings) , oe(o) , ie(i) , framesize(0) , freewheel(false) , events{} + , settings(settings) { is_stopping = false; audioCache.init(10000); // start thread - + events.reserve(1000); } @@ -81,7 +83,7 @@ bool DrumGizmo::loadkit(std::string file) // Delete all Channels, Instruments, Samples and AudioFiles. kit.clear(); - DrumKitParser parser(kit); + DrumKitParser parser(settings, kit); if(parser.parseFile(file)) { ERR(drumgizmo, "Drumkit parser failed: %s\n", file.c_str()); diff --git a/src/drumgizmo.h b/src/drumgizmo.h index 632d5fc..63348da 100644 --- a/src/drumgizmo.h +++ b/src/drumgizmo.h @@ -50,6 +50,8 @@ #include "configfile.h" +#include "settings.h" + #define MAX_NUM_CHANNELS 64 #define REFSFILE "refs.conf" #define RESAMPLER_INPUT_BUFFER 64 @@ -58,7 +60,8 @@ class DrumGizmo : public MessageReceiver { public: - DrumGizmo(AudioOutputEngine *outputengine, AudioInputEngine *inputengine); + DrumGizmo(Settings& settings, + AudioOutputEngine *outputengine, AudioInputEngine *inputengine); virtual ~DrumGizmo(); bool loadkit(std::string kitfile); @@ -106,6 +109,7 @@ protected: size_t framesize; bool freewheel; - + std::vector events; + Settings& settings; }; diff --git a/src/drumkitloader.cc b/src/drumkitloader.cc index ff489ea..3cb4b68 100644 --- a/src/drumkitloader.cc +++ b/src/drumkitloader.cc @@ -31,9 +31,10 @@ #include "drumkitparser.h" #include "drumgizmo.h" -DrumKitLoader::DrumKitLoader() +DrumKitLoader::DrumKitLoader(Settings& settings) : semaphore("drumkitloader") , framesize(0) + , settings(settings) { run(); run_semaphore.wait(); // Wait for the thread to actually start. @@ -187,11 +188,14 @@ void DrumKitLoader::thread_main() if(loaded % fraction == 0 || loaded == total_num_audiofiles) { - LoadStatusMessage *ls = new LoadStatusMessage(); - ls->number_of_files = total_num_audiofiles; - ls->numer_of_files_loaded = loaded; - ls->current_file = filename; - msghandler.sendMessage(MSGRCV_UI, ls); + //LoadStatusMessage *ls = new LoadStatusMessage(); + //ls->number_of_files = total_num_audiofiles; + //ls->numer_of_files_loaded = loaded; + //ls->current_file = filename; + //msghandler.sendMessage(MSGRCV_UI, ls); + settings.number_of_files.store(total_num_audiofiles); + settings.number_of_files_loaded.store(loaded); + //settings.current_file.store(filename); } } diff --git a/src/drumkitloader.h b/src/drumkitloader.h index 3656839..2410074 100644 --- a/src/drumkitloader.h +++ b/src/drumkitloader.h @@ -34,6 +34,7 @@ #include "mutex.h" #include "drumkit.h" +#include "settings.h" //! This class is responsible for loading the drumkits in its own thread. //! All interaction calls are simply modifying queues and not doing any @@ -45,7 +46,7 @@ class DrumKitLoader { public: //! The constrcutor starts the loader thread. - DrumKitLoader(); + DrumKitLoader(Settings& settings); //! The destructor signals the thread to stop and waits to merge before //! returning (ie. deleting the object will garantuee that the thread has @@ -82,4 +83,5 @@ protected: size_t fraction{1}; size_t loaded{0}; size_t framesize{0}; + Settings& settings; }; diff --git a/src/drumkitparser.cc b/src/drumkitparser.cc index 92230cc..1210611 100644 --- a/src/drumkitparser.cc +++ b/src/drumkitparser.cc @@ -34,9 +34,10 @@ #include "path.h" #include "drumgizmo.h" -DrumKitParser::DrumKitParser(DrumKit& kit) - : kit(kit) +DrumKitParser::DrumKitParser(Settings& setting, DrumKit& k) + : kit(k) , refs(REFSFILE) + , settings(settings) { } @@ -182,7 +183,7 @@ void DrumKitParser::endTag(const std::string& name) { if(name == "instrument") { - Instrument* instrument = new Instrument(); + Instrument* instrument = new Instrument(settings); instrument->setGroup(instr_group); InstrumentParser parser(*instrument); diff --git a/src/drumkitparser.h b/src/drumkitparser.h index f857590..b3cf0a6 100644 --- a/src/drumkitparser.h +++ b/src/drumkitparser.h @@ -34,7 +34,7 @@ class DrumKitParser : public SAXParser { public: - DrumKitParser(DrumKit& kit); + DrumKitParser(Settings& setting, DrumKit& kit); virtual int parseFile(const std::string& filename) override; @@ -52,4 +52,5 @@ private: std::string instr_group; ConfigFile refs; + Settings& settings; }; diff --git a/src/instrument.cc b/src/instrument.cc index 96a6bfd..eeaa956 100644 --- a/src/instrument.cc +++ b/src/instrument.cc @@ -34,147 +34,142 @@ #include "sample.h" #include "configuration.h" -Instrument::Instrument() +Instrument::Instrument(Settings& settings) + : settings(settings) { - DEBUG(instrument, "new %p\n", this); - mod = 1.0; - lastpos = 0; + DEBUG(instrument, "new %p\n", this); + mod = 1.0; + lastpos = 0; - magic = this; + magic = this; } Instrument::~Instrument() { - magic = NULL; - - DEBUG(instrument, "delete %p\n", this); - std::vector::iterator i = audiofiles.begin(); - while(i != audiofiles.end()) { - delete *i; - i++; - } + magic = NULL; + + DEBUG(instrument, "delete %p\n", this); + std::vector::iterator i = audiofiles.begin(); + while(i != audiofiles.end()) + { + delete *i; + i++; + } } bool Instrument::isValid() { - return this == magic; + return this == magic; } Sample *Instrument::sample(level_t level, size_t pos) { - Sample *sample = NULL; - - if(Conf::enable_velocity_modifier == false) { - mod = 1.0; - lastpos = 0; - } - - if(Conf::enable_velocity_randomiser) { - float r = (float)rand() / (float)RAND_MAX; // random number: [0;1] - r -= 0.5; // random number [-0.5;0.5] - r *= Conf::velocity_randomiser_weight * 2; // ex. random number [-0.1;0.1] - level += r; - if(level > 1.0) level = 1.0; - if(level < 0.0) level = 0.0; - } - - if(Conf::enable_velocity_modifier) { - mod += (pos - lastpos) / - (Conf::samplerate * Conf::velocity_modifier_falloff); - if(mod > 1.0) mod = 1.0; - } - - if(version >= VersionStr("2.0")) { - // Version 2.0 - sample = powerlist.get(level * mod); - } else { - // Version 1.0 - std::vector s = samples.get(level * mod); - if(s.size() == 0) return NULL; - size_t idx = rand()%(s.size()); - sample = s[idx]; - } - - if(Conf::enable_velocity_modifier) { - lastpos = pos; - mod *= Conf::velocity_modifier_weight; - } - - return sample; + Sample *sample = NULL; + + // Read out all values from settings. + auto enable_velocity_randomiser = settings.enable_velocity_randomiser.load(); + auto velocity_randomiser_weight = settings.velocity_randomiser_weight.load(); + auto samplerate = settings.samplerate.load(); + auto velocity_modifier_falloff = settings.velocity_modifier_falloff.load(); + auto enable_velocity_modifier = settings.enable_velocity_modifier.load(); + auto velocity_modifier_weight = settings.velocity_modifier_weight.load(); + + if(enable_velocity_modifier == false) + { + mod = 1.0; + lastpos = 0; + } + + if(enable_velocity_randomiser) + { + float r = (float)rand() / (float)RAND_MAX; // random number: [0;1] + r -= 0.5; // random number [-0.5;0.5] + r *= velocity_randomiser_weight * 2; // ex. random number [-0.1;0.1] + level += r; + if(level > 1.0) + { + level = 1.0; + } + + if(level < 0.0) + { + level = 0.0; + } + } + + if(enable_velocity_modifier) + { + mod += (pos - lastpos) / + (samplerate * velocity_modifier_falloff); + if(mod > 1.0) + { + mod = 1.0; + } + } + + if(version >= VersionStr("2.0")) + { + // Version 2.0 + sample = powerlist.get(level * mod); + } + else + { + // Version 1.0 + std::vector s = samples.get(level * mod); + if(s.size() == 0) + { + return NULL; + } + + size_t idx = rand()%(s.size()); + sample = s[idx]; + } + + if(enable_velocity_modifier) + { + lastpos = pos; + mod *= velocity_modifier_weight; + } + + return sample; } void Instrument::addSample(level_t a, level_t b, Sample *s) { - samples.insert(a, b, s); + samples.insert(a, b, s); } void Instrument::finalise() { - if(version >= VersionStr("2.0")) { - std::vector::iterator s = samplelist.begin(); - while(s != samplelist.end()) { - powerlist.add(*s); - s++; - } - - powerlist.finalise(); - } + if(version >= VersionStr("2.0")) + { + std::vector::iterator s = samplelist.begin(); + while(s != samplelist.end()) + { + powerlist.add(*s); + s++; + } + + powerlist.finalise(); + } } std::string Instrument::name() { - return _name; + return _name; } std::string Instrument::description() { - return _description; + return _description; } std::string Instrument::group() { - return _group; + return _group; } void Instrument::setGroup(std::string g) { - _group = g; + _group = g; } - -#ifdef TEST_INSTRUMENT -//deps: channel.cc sample.cc audiofile.cc -//cflags: $(SNDFILE_CFLAGS) -//libs: $(SNDFILE_LIBS) -#include "test.h" - -TEST_BEGIN; - -Instrument i("test"); - -Sample *a = new Sample(); -i.addSample(0.0, 1.0, a); - -Sample *b = new Sample(); -i.addSample(0.0, 1.0, b); - -Sample *c = new Sample(); -i.addSample(1.5, 1.7, c); - -TEST_EQUAL(i.sample(0.0), b, "?"); -TEST_EQUAL(i.sample(0.0), a, "?"); -TEST_EQUAL(i.sample(0.0), b, "?"); -TEST_EQUAL(i.sample(0.0), b, "?"); -TEST_EQUAL(i.sample(0.0), b, "?"); -TEST_EQUAL(i.sample(0.0), b, "?"); -TEST_EQUAL(i.sample(0.0), a, "?"); -TEST_EQUAL(i.sample(0.0), a, "?"); - -TEST_EQUAL(i.sample(2.0), NULL, "?"); - -TEST_EQUAL(i.sample(1.6), c, "?"); -TEST_EQUAL(i.sample(1.6), c, "?"); -TEST_EQUAL(i.sample(1.6), c, "?"); - -TEST_END; - -#endif/*TEST_INSTRUMENT*/ diff --git a/src/instrument.h b/src/instrument.h index e880d8d..549a5a4 100644 --- a/src/instrument.h +++ b/src/instrument.h @@ -36,46 +36,50 @@ #include "sample.h" #include "versionstr.h" +#include "settings.h" + class InstrumentParser; class Instrument { - friend class InstrumentParser; + friend class InstrumentParser; public: - Instrument(); - ~Instrument(); + Instrument(Settings& settings); + ~Instrument(); - Sample *sample(level_t level, size_t pos); + Sample *sample(level_t level, size_t pos); - std::string name(); - std::string description(); - std::string group(); + std::string name(); + std::string description(); + std::string group(); - void setGroup(std::string group); + void setGroup(std::string group); - // std::map channelmap; + // std::map channelmap; - std::vector audiofiles; + std::vector audiofiles; - bool isValid(); + bool isValid(); private: - void *magic; + void *magic; + + std::string _group; + std::string _name; + std::string _description; - std::string _group; - std::string _name; - std::string _description; + VersionStr version; - VersionStr version; + RangeMap samples; + PowerList powerlist; - RangeMap samples; - PowerList powerlist; + void addSample(level_t a, level_t b, Sample *s); + void finalise(); ///< Signal instrument that no more samples will be added. - void addSample(level_t a, level_t b, Sample *s); - void finalise(); ///< Signal instrument that no more samples will be added. + std::vector samplelist; - std::vector samplelist; + size_t lastpos; + float mod; - size_t lastpos; - float mod; + Settings& settings; }; //typedef std::map< std::string, Instrument > Instruments; diff --git a/src/settings.h b/src/settings.h index 74c432d..4eb7dba 100644 --- a/src/settings.h +++ b/src/settings.h @@ -27,14 +27,40 @@ #pragma once #include +#include #include +class MyString { +public: + std::string value; +}; + +//! Engine settings +struct Settings +{ + std::atomic enable_velocity_modifier; + std::atomic velocity_modifier_falloff; + std::atomic velocity_modifier_weight; + + std::atomic enable_velocity_randomiser; + std::atomic velocity_randomiser_weight; + + std::atomic samplerate; + + std::atomic enable_resampling; + + std::atomic number_of_files; + std::atomic number_of_files_loaded; + //std::atomic current_file; + +}; + +//! Getter utility class. template class SettingRef { public: SettingRef(std::atomic& value) - : value{value} - , cache{} + : value(value) { // string isn't lock free either assert((std::is_same::value || value.is_lock_free())); @@ -57,20 +83,7 @@ private: std::atomic cache; }; -struct Settings -{ - std::atomic enable_velocity_modifier; - std::atomic velocity_modifier_falloff; - std::atomic velocity_modifier_weight; - - std::atomic enable_velocity_randomiser; - std::atomic velocity_randomiser_weight; - - std::atomic samplerate; - - std::atomic enable_resampling; -}; - +//! Combined getter class. struct SettingsGetter { SettingRef enable_velocity_modifier; @@ -80,10 +93,14 @@ struct SettingsGetter SettingRef enable_velocity_randomiser; SettingRef velocity_randomiser_weight; - SettingRef samplerate; + SettingRef samplerate; SettingRef enable_resampling; + SettingRef number_of_files; + SettingRef number_of_files_loaded; + //SettingRef current_file; + SettingsGetter(Settings& settings) : enable_velocity_modifier{settings.enable_velocity_modifier} , velocity_modifier_falloff{settings.velocity_modifier_falloff} @@ -92,6 +109,9 @@ struct SettingsGetter , velocity_randomiser_weight{settings.velocity_randomiser_weight} , samplerate{settings.samplerate} , enable_resampling{settings.enable_resampling} + , number_of_files{settings.number_of_files} + , number_of_files_loaded{settings.number_of_files_loaded} + //, current_file{settings.current_file} { } }; @@ -99,29 +119,35 @@ struct SettingsGetter // lovely reminder: NO, GLOCKE. NOOOO!! /* enum class IntParams { - Foo = 0 + Foo = 0 }; -struct Settings { - std::array, 5> ints; +struct Settings +{ + std::array, 5> ints; - Settings() - : ints{} { - //get(IntParams::Foo).store(3); - } + Settings() + : ints{} + { + //get(IntParams::Foo).store(3); + } - std::atomic& get(IntParams param) { - return ints[(size_t)param]; - } + std::atomic& get(IntParams param) + { + return ints[(size_t)param]; + } }; -struct SettingsGetter { - std::vector> ints; +struct SettingsGetter +{ + std::vector> ints; - SettingsGetter(Settings& parent) { - for (auto& atomic: parent.ints) { - ints.emplace_back(atomic); - } - } + SettingsGetter(Settings& parent) + { + for(auto& atomic: parent.ints) + { + ints.emplace_back(atomic); + } + } }; */ -- cgit v1.2.3