From ec6a7f3ead0b746268b47afc16d1880a2c3669dd Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sat, 11 Nov 2017 00:27:54 -0500 Subject: [PATCH] Added Model tags --- include/plugin.hpp | 59 +++++++++++++++++++++++++++++++++++++++++++--- include/rack.hpp | 5 ++-- src/core/core.cpp | 16 ++++++------- src/plugin.cpp | 48 ++++++++++++++++++++++++++++++++++++- 4 files changed, 114 insertions(+), 14 deletions(-) diff --git a/include/plugin.hpp b/include/plugin.hpp index 01b51242..d2ca606c 100644 --- a/include/plugin.hpp +++ b/include/plugin.hpp @@ -6,6 +6,54 @@ namespace rack { +enum ModelTag { + AMPLIFIER_TAG, + ATTENUATOR_TAG, + BLANK_TAG, + CLOCK_TAG, + CONTROLLER_TAG, + DELAY_TAG, + DIGITAL_TAG, + DISTORTION_TAG, + DRUM_TAG, + DUAL_TAG, + DYNAMICS_TAG, + EFFECT_TAG, + ENVELOPE_FOLLOWER_TAG, + ENVELOPE_GENERATOR_TAG, + EQUALIZER_TAG, + EXTERNAL_TAG, + FILTER_TAG, + FUNCTION_GENERATOR_TAG, + GRANULAR_TAG, + LFO_TAG, + LOGIC_TAG, + LOW_PASS_GATE_TAG, + MIDI_TAG, + MIXER_TAG, + MULTIPLE_TAG, + NOISE_TAG, + OSCILLATOR_TAG, + PANNING_TAG, + QUAD_TAG, + QUANTIZER_TAG, + RANDOM_TAG, + REVERB_TAG, + RING_MODULATOR_TAG, + SAMPLE_AND_HOLD_TAG, + SAMPLER_TAG, + SEQUENCER_TAG, + SLEW_LIMITER_TAG, + SWITCH_TAG, + SYNTH_VOICE_TAG, + TUNER_TAG, + UTILITY_TAG, + VISUAL_TAG, + WAVESHAPER_TAG, + NUM_TAGS +}; + + struct ModuleWidget; struct Model; @@ -40,14 +88,13 @@ struct Model { std::string manufacturerSlug; /** Human readable name for the manufacturer, e.g. "Foo Modular" */ std::string manufacturerName; + /** List of tags representing the function(s) of the module */ + std::list tags; virtual ~Model() {} virtual ModuleWidget *createModuleWidget() { return NULL; } }; -extern std::list gPlugins; -extern std::string gToken; - void pluginInit(); void pluginDestroy(); void pluginLogIn(std::string email, std::string password); @@ -60,6 +107,12 @@ float pluginGetDownloadProgress(); std::string pluginGetDownloadName(); std::string pluginGetLoginStatus(); + +extern std::list gPlugins; +extern std::string gToken; +extern std::string gTagNames[NUM_TAGS]; + + } // namespace rack diff --git a/include/rack.hpp b/include/rack.hpp index 9593d29f..b1bb3150 100644 --- a/include/rack.hpp +++ b/include/rack.hpp @@ -18,8 +18,8 @@ namespace rack { //////////////////// -template -Model *createModel(std::string manufacturerSlug, std::string manufacturerName, std::string slug, std::string name) { +template +Model *createModel(std::string manufacturerSlug, std::string manufacturerName, std::string slug, std::string name, Tags... tags) { struct TModel : Model { ModuleWidget *createModuleWidget() override { ModuleWidget *moduleWidget = new TModuleWidget(); @@ -32,6 +32,7 @@ Model *createModel(std::string manufacturerSlug, std::string manufacturerName, s model->name = name; model->manufacturerSlug = manufacturerSlug; model->manufacturerName = manufacturerName; + model->tags = {tags...}; return model; } diff --git a/src/core/core.cpp b/src/core/core.cpp index e16461fc..8dcefa14 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -3,15 +3,15 @@ void init(rack::Plugin *p) { p->slug = "Core"; - p->addModel(createModel("Core", "Core", "AudioInterface", "Audio Interface")); - p->addModel(createModel("Core", "Core", "MIDIToCVInterface", "MIDI-to-CV Interface")); + p->addModel(createModel("Core", "Core", "AudioInterface", "Audio Interface", EXTERNAL_TAG)); + p->addModel(createModel("Core", "Core", "MIDIToCVInterface", "MIDI-to-CV Interface", MIDI_TAG, EXTERNAL_TAG)); - p->addModel(createModel("Core", "Core", "MIDICCToCVInterface", "MIDI CC-to-CV Interface")); - p->addModel(createModel("Core", "Core", "MIDIClockToCVInterface", "MIDI Clock-to-CV Interface")); - p->addModel(createModel("Core", "Core", "MIDITriggerToCVInterface", "MIDI Trigger-to-CV Interface")); - p->addModel(createModel("Core", "Core", "QuadMIDIToCVInterface", "Quad MIDI-to-CV Interface")); + p->addModel(createModel("Core", "Core", "MIDICCToCVInterface", "MIDI CC-to-CV Interface", MIDI_TAG, EXTERNAL_TAG)); + p->addModel(createModel("Core", "Core", "MIDIClockToCVInterface", "MIDI Clock-to-CV Interface", MIDI_TAG, EXTERNAL_TAG, CLOCK_TAG)); + p->addModel(createModel("Core", "Core", "MIDITriggerToCVInterface", "MIDI Trigger-to-CV Interface", MIDI_TAG, EXTERNAL_TAG)); + p->addModel(createModel("Core", "Core", "QuadMIDIToCVInterface", "Quad MIDI-to-CV Interface", MIDI_TAG, EXTERNAL_TAG, QUAD_TAG)); // p->addModel(createModel("Core", "Core", "Bridge", "Bridge")); - p->addModel(createModel("Core", "Core", "Blank", "Blank")); - p->addModel(createModel("Core", "Core", "Notes", "Notes")); + p->addModel(createModel("Core", "Core", "Blank", "Blank", BLANK_TAG)); + p->addModel(createModel("Core", "Core", "Notes", "Notes", BLANK_TAG)); } diff --git a/src/plugin.cpp b/src/plugin.cpp index 75f4519b..c30f54de 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -31,13 +31,59 @@ namespace rack { std::list gPlugins; std::string gToken; +std::string gTagNames[NUM_TAGS] = { + "Amplifier/VCA", + "Attenuator", + "Blank", + "Clock", + "Controller", + "Delay", + "Digital", + "Distortion", + "Drum", + "Dual/Stereo", + "Dynamics", + "Effect", + "Envelope Follower", + "Envelope Generator", + "Equalizer", + "External", + "Filter/VCF", + "Function Generator", + "Granular", + "LFO", + "Logic", + "Low Pass Gate", + "MIDI", + "Mixer", + "Multiple", + "Noise", + "Oscillator/VCO", + "Panning", + "Quad", + "Quantizer", + "Random", + "Reverb", + "Ring Modulator", + "Sample and Hold", + "Sampler", + "Sequencer", + "Slew Limiter", + "Switch", + "Synth Voice", + "Tuner", + "Utility", + "Visual", + "Waveshaper", +}; + + static bool isDownloading = false; static float downloadProgress = 0.0; static std::string downloadName; static std::string loginStatus; - Plugin::~Plugin() { for (Model *model : models) { delete model;