From d679803caeff0f959d861eb166d3c808cbe43c97 Mon Sep 17 00:00:00 2001 From: gregrecco67 <127459177+gregrecco67@users.noreply.github.com> Date: Sat, 13 Jul 2024 11:23:56 -0400 Subject: [PATCH] handling more presets differently --- Source/AuxSynthVoice.cpp | 8 +- Source/PluginProcessor.cpp | 72 +++--------------- Source/PluginProcessor.h | 1 - assets/Buzz Pad.xml | 82 ++++++++++++++++++++ assets/Clarinet Section.xml | 88 ++++++++++++++++++++++ assets/Drone Scene.xml | 129 +++++++++++++++++++++++++++++++ assets/Have One On Me.xml | 98 ++++++++++++++++++++++++ assets/Let Banjo Ring.xml | 85 +++++++++++++++++++++ assets/Nasty Sub.xml | 82 ++++++++++++++++++++ assets/Shadow Bones.xml | 146 ++++++++++++++++++++++++++++++++++++ assets/Space Lead.xml | 108 ++++++++++++++++++++++++++ assets/Victory Fanfare.xml | 73 ++++++++++++++++++ modules/gin | 2 +- 13 files changed, 905 insertions(+), 69 deletions(-) create mode 100644 assets/Buzz Pad.xml create mode 100644 assets/Clarinet Section.xml create mode 100644 assets/Drone Scene.xml create mode 100644 assets/Have One On Me.xml create mode 100644 assets/Let Banjo Ring.xml create mode 100644 assets/Nasty Sub.xml create mode 100644 assets/Shadow Bones.xml create mode 100644 assets/Space Lead.xml create mode 100644 assets/Victory Fanfare.xml diff --git a/Source/AuxSynthVoice.cpp b/Source/AuxSynthVoice.cpp index 35f75ed..de68b67 100644 --- a/Source/AuxSynthVoice.cpp +++ b/Source/AuxSynthVoice.cpp @@ -416,7 +416,7 @@ void AuxSynthVoice::updateParams(int blockSize) p.sync = (!(mode == 0)); p.repeat = (!(mode == 0)); if (mode == 1) { p.sync = true; - p.syncduration = gin::NoteDuration::getNoteDurations()[size_t(getValue(proc.env1Params.duration))].toSeconds(proc.playhead); + p.syncduration = gin::NoteDuration::getNoteDurations()[size_t(proc.env1Params.duration->getProcValue())].toSeconds(proc.playhead); } if (mode == 2) { p.sync = true; @@ -435,7 +435,7 @@ void AuxSynthVoice::updateParams(int blockSize) p.sync = (mode != 0); p.repeat = (mode != 0); if (mode == 1) { p.sync = true; - p.syncduration = gin::NoteDuration::getNoteDurations()[size_t(getValue(proc.env2Params.duration))].toSeconds(proc.playhead); + p.syncduration = gin::NoteDuration::getNoteDurations()[size_t(proc.env2Params.duration->getProcValue())].toSeconds(proc.playhead); } if (mode == 2) { p.sync = true; @@ -454,7 +454,7 @@ void AuxSynthVoice::updateParams(int blockSize) p.sync = (!(mode == 0)); p.repeat = (!(mode == 0)); if (mode == 1) { p.sync = true; - p.syncduration = gin::NoteDuration::getNoteDurations()[size_t(getValue(proc.env3Params.duration))].toSeconds(proc.playhead); + p.syncduration = gin::NoteDuration::getNoteDurations()[size_t(proc.env3Params.duration->getProcValue())].toSeconds(proc.playhead); } if (mode == 2) { p.sync = true; @@ -472,7 +472,7 @@ void AuxSynthVoice::updateParams(int blockSize) p.sync = (!(mode == 0)); p.repeat = (!(mode == 0)); if (mode == 1) { p.sync = true; - p.syncduration = gin::NoteDuration::getNoteDurations()[size_t(getValue(proc.env4Params.duration))].toSeconds(proc.playhead); + p.syncduration = gin::NoteDuration::getNoteDurations()[size_t(proc.env4Params.duration->getProcValue())].toSeconds(proc.playhead); } if (mode == 2) { p.sync = true; diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index aabb875..1d4ead3 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -668,6 +668,14 @@ APAudioProcessor::APAudioProcessor() : gin::Processor( getOptions() ), synth(APSynth(*this)), auxSynth(AuxSynth(*this)), sampler(APSampler(*this)) { + { + auto sz = 0; + for (auto i = 0; i < BinaryData::namedResourceListSize; i++) + if (juce::String(BinaryData::originalFilenames[i]).endsWith(".xml")) + if (auto data = BinaryData::getNamedResource(BinaryData::namedResourceList[i], sz)) + extractProgram(BinaryData::originalFilenames[i], data, sz); + } + // poly params osc1Params.setup(*this, juce::String{ "1" }); osc2Params.setup(*this, juce::String{ "2" }); @@ -732,73 +740,11 @@ APAudioProcessor::APAudioProcessor() : gin::Processor( setupModMatrix(); init(); - - - addFactoryPreset(juce::XmlDocument(juce::String(BinaryData::Brass_Section_xml, BinaryData::Brass_Section_xmlSize))); - addFactoryPreset(juce::XmlDocument(juce::String(BinaryData::Caustic_Lead_xml, BinaryData::Caustic_Lead_xmlSize))); - addFactoryPreset(juce::XmlDocument(juce::String(BinaryData::Clashing_Strings_xml, BinaryData::Clashing_Strings_xmlSize))); - addFactoryPreset(juce::XmlDocument(juce::String(BinaryData::Endurance_Like_the_Liberty_Bell_xml, BinaryData::Endurance_Like_the_Liberty_Bell_xmlSize))); - addFactoryPreset(juce::XmlDocument(juce::String(BinaryData::Foreign_Keypad_xml, BinaryData::Foreign_Keypad_xmlSize))); - addFactoryPreset(juce::XmlDocument(juce::String(BinaryData::Gentle_Horn_Section_xml, BinaryData::Gentle_Horn_Section_xmlSize))); - addFactoryPreset(juce::XmlDocument(juce::String(BinaryData::Metal_Pan_xml, BinaryData::Metal_Pan_xmlSize))); - addFactoryPreset(juce::XmlDocument(juce::String(BinaryData::Metallic_Keys_xml, BinaryData::Metallic_Keys_xmlSize))); - addFactoryPreset(juce::XmlDocument(juce::String(BinaryData::Muted_Brass_xml, BinaryData::Muted_Brass_xmlSize))); - addFactoryPreset(juce::XmlDocument(juce::String(BinaryData::Pulsating_Pad_xml, BinaryData::Pulsating_Pad_xmlSize))); - addFactoryPreset(juce::XmlDocument(juce::String(BinaryData::Rando_Buzz_xml, BinaryData::Rando_Buzz_xmlSize))); - addFactoryPreset(juce::XmlDocument(juce::String(BinaryData::Spacy_Bell_xml, BinaryData::Spacy_Bell_xmlSize))); - addFactoryPreset(juce::XmlDocument(juce::String(BinaryData::Swell_Keys_xml, BinaryData::Swell_Keys_xmlSize))); - addFactoryPreset(juce::XmlDocument(juce::String(BinaryData::Swell_Lead_xml, BinaryData::Swell_Lead_xmlSize))); - addFactoryPreset(juce::XmlDocument(juce::String(BinaryData::Venus_Dawn_xml, BinaryData::Venus_Dawn_xmlSize))); - addFactoryPreset(juce::XmlDocument(juce::String(BinaryData::Wanderer_xml, BinaryData::Wanderer_xmlSize))); - addFactoryPreset(juce::XmlDocument(juce::String(BinaryData::Wet_Snare_xml, BinaryData::Wet_Snare_xmlSize))); - - + modMatrix.setMonoValue(randSrc1Mono, 0.0f); modMatrix.setMonoValue(randSrc2Mono, 0.0f); } -void APAudioProcessor::addFactoryPreset(juce::XmlDocument doc) { - gin::Program* program = new gin::Program(); - - std::unique_ptr rootE (doc.getDocumentElement()); - if (rootE) - { - program->states.clear(); - - program->name = rootE->getStringAttribute ("name").trim(); - program->author = rootE->getStringAttribute ("author").trim(); - program->tags = juce::StringArray::fromTokens (rootE->getStringAttribute ("tags"), " ", ""); - - - if (auto s = rootE->getChildByName ("state")) - { - program->state = juce::ValueTree::fromXml (*s); - } - else - { - auto stateXml = rootE->getStringAttribute ("valueTree"); - program->state = juce::ValueTree::fromXml (stateXml); - } - - auto paramE = rootE->getChildByName ("param"); - while (paramE) - { - juce::String uid = paramE->getStringAttribute ("uid"); - float val = (float) paramE->getDoubleAttribute ("val"); - - gin::Parameter::ParamState s; - s.uid = uid; - s.value = val; - program->states.add (s); - - paramE = paramE->getNextElementWithTagName ("param"); - } - - } - program->fullyLoaded = true; - programs.add(program); -} - APAudioProcessor::~APAudioProcessor() { juce::LookAndFeel::setDefaultLookAndFeel(nullptr); diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index 831da55..215633d 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -55,7 +55,6 @@ class APAudioProcessor : public gin::Processor void updateState() override; void updatePitchbend(); - void addFactoryPreset(juce::XmlDocument); //============================================================================== diff --git a/assets/Buzz Pad.xml b/assets/Buzz Pad.xml new file mode 100644 index 0000000..1fc8538 --- /dev/null +++ b/assets/Buzz Pad.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/Clarinet Section.xml b/assets/Clarinet Section.xml new file mode 100644 index 0000000..dc4699e --- /dev/null +++ b/assets/Clarinet Section.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/Drone Scene.xml b/assets/Drone Scene.xml new file mode 100644 index 0000000..edde18d --- /dev/null +++ b/assets/Drone Scene.xml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/Have One On Me.xml b/assets/Have One On Me.xml new file mode 100644 index 0000000..fd6ad00 --- /dev/null +++ b/assets/Have One On Me.xml @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/Let Banjo Ring.xml b/assets/Let Banjo Ring.xml new file mode 100644 index 0000000..746c7d7 --- /dev/null +++ b/assets/Let Banjo Ring.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/Nasty Sub.xml b/assets/Nasty Sub.xml new file mode 100644 index 0000000..8415802 --- /dev/null +++ b/assets/Nasty Sub.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/Shadow Bones.xml b/assets/Shadow Bones.xml new file mode 100644 index 0000000..d20e970 --- /dev/null +++ b/assets/Shadow Bones.xml @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/Space Lead.xml b/assets/Space Lead.xml new file mode 100644 index 0000000..b4c7891 --- /dev/null +++ b/assets/Space Lead.xml @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/Victory Fanfare.xml b/assets/Victory Fanfare.xml new file mode 100644 index 0000000..0fc65e1 --- /dev/null +++ b/assets/Victory Fanfare.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/gin b/modules/gin index fa1eb88..b476376 160000 --- a/modules/gin +++ b/modules/gin @@ -1 +1 @@ -Subproject commit fa1eb88f69b241c0342858b2a6470403c21816ef +Subproject commit b4763762f35d6524be280690234e53a3f1866cf1