From dcefce17513c5b7cef329030b3216cf9a069a3f4 Mon Sep 17 00:00:00 2001 From: jatinchowdhury18 Date: Wed, 25 Nov 2020 10:02:44 -0800 Subject: [PATCH] More preset updates --- res/presets/Crazy.chowpreset | 283 ++++++++++++++++------------- res/presets/Default.chowpreset | 60 +++--- res/presets/Lush.chowpreset | 311 ++++++++++++++++++-------------- res/presets/Rhythmic.chowpreset | 106 ++++++----- src/ChowMatrix.cpp | 4 +- src/dsp/BaseNode.cpp | 3 + src/dsp/Delay/DelayProc.cpp | 2 +- src/dsp/Delay/VariableDelay.cpp | 2 +- src/dsp/DelayNode.cpp | 22 +-- src/dsp/InputNode.cpp | 20 ++ src/dsp/InputNode.h | 3 + 11 files changed, 462 insertions(+), 354 deletions(-) diff --git a/res/presets/Crazy.chowpreset b/res/presets/Crazy.chowpreset index 73fad4a..8ad3610 100644 --- a/res/presets/Crazy.chowpreset +++ b/res/presets/Crazy.chowpreset @@ -10,161 +10,186 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - + - - - + + - - - - - - - - - - - - - - - + + + - - + + - + - - + + + + - + - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/presets/Default.chowpreset b/res/presets/Default.chowpreset index ed6ddc1..f640ce4 100644 --- a/res/presets/Default.chowpreset +++ b/res/presets/Default.chowpreset @@ -10,31 +10,39 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/presets/Lush.chowpreset b/res/presets/Lush.chowpreset index ed09d1e..8cbeccb 100644 --- a/res/presets/Lush.chowpreset +++ b/res/presets/Lush.chowpreset @@ -10,190 +10,225 @@ - - - - - - - - - - - + + + + - - - + + + - - - + + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - + + - - - - - - - - - - - + + + + + + + + + + + + + + + + - - + + - + - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + - + - + - - + - - - - - - - - - - - + + - - + + - - - + + + + + - + - - + - - - - - - - - - - - + + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + - - - - - - - - - - - - - - - - + + + + + + + diff --git a/res/presets/Rhythmic.chowpreset b/res/presets/Rhythmic.chowpreset index 2b61e18..c23cc4f 100644 --- a/res/presets/Rhythmic.chowpreset +++ b/res/presets/Rhythmic.chowpreset @@ -10,62 +10,76 @@ - - - - - - - - - - - + + + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + + + + + + + + + + + + + - - + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + diff --git a/src/ChowMatrix.cpp b/src/ChowMatrix.cpp index 59c3228..5c7837b 100644 --- a/src/ChowMatrix.cpp +++ b/src/ChowMatrix.cpp @@ -151,7 +151,7 @@ std::unique_ptr ChowMatrix::stateToXml() std::unique_ptr xml = std::make_unique ("state"); xml->addChildElement (state.createXml().release()); - std::unique_ptr childrenXml = std::make_unique ("children"); + std::unique_ptr childrenXml = std::make_unique ("nodes"); for (auto& node : inputNodes) childrenXml->addChildElement (node.saveXml()); @@ -170,7 +170,7 @@ void ChowMatrix::stateFromXml (XmlElement* xmlState) if (vtsXml == nullptr) // invalid ValueTreeState return; - auto childrenXml = xmlState->getChildByName ("children"); + auto childrenXml = xmlState->getChildByName ("nodes"); if (childrenXml == nullptr) // invalid children XML return; diff --git a/src/dsp/BaseNode.cpp b/src/dsp/BaseNode.cpp index a298198..44906d8 100644 --- a/src/dsp/BaseNode.cpp +++ b/src/dsp/BaseNode.cpp @@ -80,6 +80,9 @@ void BaseNode::setParent (BaseNode* newParent) template XmlElement* BaseNode::saveXml() { + if (children.isEmpty()) + return new XmlElement ("no_children"); + std::unique_ptr xml = std::make_unique ("children"); for (auto* child : children) xml->addChildElement (child->saveXml()); diff --git a/src/dsp/Delay/DelayProc.cpp b/src/dsp/Delay/DelayProc.cpp index d93602f..c0fcd6e 100644 --- a/src/dsp/Delay/DelayProc.cpp +++ b/src/dsp/Delay/DelayProc.cpp @@ -8,7 +8,7 @@ void DelayProc::prepare (const dsp::ProcessSpec& spec) feedback.reset (spec.sampleRate, 0.05 * spec.numChannels); inGain.reset (spec.sampleRate, 0.05 * spec.numChannels); - delaySmooth.reset (spec.sampleRate, 0.05 * spec.numChannels); + delaySmooth.reset (spec.sampleRate, 0.15 * spec.numChannels); state.resize (spec.numChannels, 0.0f); reset(); diff --git a/src/dsp/Delay/VariableDelay.cpp b/src/dsp/Delay/VariableDelay.cpp index 1bd0629..736a328 100644 --- a/src/dsp/Delay/VariableDelay.cpp +++ b/src/dsp/Delay/VariableDelay.cpp @@ -29,7 +29,7 @@ void VariableDelay::setDelayType (DelayType newType) void VariableDelay::prepare (const juce::dsp::ProcessSpec& spec) { - delaySmooth.reset (spec.sampleRate, 0.05); + delaySmooth.reset (spec.sampleRate, 0.1); for (auto* delay : delays) delay->prepare (spec); diff --git a/src/dsp/DelayNode.cpp b/src/dsp/DelayNode.cpp index 1cc0a2e..5b3a581 100644 --- a/src/dsp/DelayNode.cpp +++ b/src/dsp/DelayNode.cpp @@ -179,29 +179,26 @@ std::unique_ptr DelayNode::createNodeEditor (GraphView* view) XmlElement* DelayNode::saveXml() { + std::unique_ptr xml = std::make_unique ("delay_node"); + auto state = params.copyState(); - std::unique_ptr xml (state.createXml()); + std::unique_ptr xmlState (state.createXml()); + xmlState->setAttribute ("locked", lockedParams.joinIntoString (",") + ","); + xml->addChildElement (xmlState.release()); xml->addChildElement (DBaseNode::saveXml()); - xml->setAttribute ("locked", lockedParams.joinIntoString (",") + ","); return xml.release(); } -void DelayNode::loadXml (XmlElement* xmlState) +void DelayNode::loadXml (XmlElement* xml) { - if (xmlState == nullptr) + if (xml == nullptr) return; - if (xmlState->hasTagName (params.state.getType())) + if (auto* xmlState = xml->getChildByName (params.state.getType())) { params.replaceState (ValueTree::fromXml (*xmlState)); - forEachXmlChildElementWithTagName (*xmlState, child, "children") - { - if (child->getNumChildElements() > 0) - DBaseNode::loadXml (child); - } - lockedParams.clear(); auto lockedParamsString = xmlState->getStringAttribute ("locked", String()); while (lockedParamsString.isNotEmpty()) @@ -215,6 +212,9 @@ void DelayNode::loadXml (XmlElement* xmlState) } } + if (auto* childrenXml = xml->getChildByName ("children")) + DBaseNode::loadXml (childrenXml); + repaintEditors(); } diff --git a/src/dsp/InputNode.cpp b/src/dsp/InputNode.cpp index 6f23f28..b24b5d5 100644 --- a/src/dsp/InputNode.cpp +++ b/src/dsp/InputNode.cpp @@ -1,6 +1,26 @@ #include "InputNode.h" #include "../gui/MatrixView/InputNodeComponent.h" +XmlElement* InputNode::saveXml() +{ + std::unique_ptr xml = std::make_unique ("input_node"); + xml->addChildElement (DBaseNode::saveXml()); + + return xml.release(); +} + +void InputNode::loadXml (XmlElement* xmlState) +{ + if (xmlState == nullptr) + return; + + if (xmlState->hasTagName ("input_node")) + { + if (auto* childrenXml = xmlState->getChildByName ("children")) + DBaseNode::loadXml (childrenXml); + } +} + std::unique_ptr InputNode::createNodeEditor (GraphView* view) { auto editorPtr = std::make_unique (*this, view); diff --git a/src/dsp/InputNode.h b/src/dsp/InputNode.h index f0b3329..9275de7 100644 --- a/src/dsp/InputNode.h +++ b/src/dsp/InputNode.h @@ -10,6 +10,9 @@ class InputNode : public DBaseNode public: InputNode() = default; + XmlElement* saveXml() override; + void loadXml (XmlElement*) override; + std::unique_ptr createNodeEditor (GraphView*) override; private: