commit 6e05377736dd809a7ff3975c1f9023ca15ab1dfe
parent f489f6ac8a132eeb24b0bcbf648b9bb2f0c83f3d
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Thu, 26 May 2022 02:52:03 +0200
fix broken parameter binding
Diffstat:
4 files changed, 8 insertions(+), 50 deletions(-)
diff --git a/source/jucePlugin/VirusParameter.cpp b/source/jucePlugin/VirusParameter.cpp
@@ -1,27 +0,0 @@
-#include "VirusParameter.h"
-
-namespace Virus
-{
- Parameter::Parameter(pluginLib::Controller& _controller, const pluginLib::Description& _desc, uint8_t _partNum, int _uniqueId)
- : pluginLib::Parameter(_controller, _desc, _partNum, _uniqueId)
- {
- }
-
- float Parameter::getDefaultValue() const
- {
- const auto& desc = getDescription();
-
- // default value should probably be in description instead of hardcoded like this.
- if (desc.index == 21 || desc.index == 31) // osc keyfollows
- return (64.0f + 32.0f) / 127.0f;
- if (desc.index == 36) // osc vol / saturation
- return 0.5f;
- if (desc.index == 40) // filter1 cutoffs
- return 1.0f;
- if(desc.index == 41) //filter 2
- return 0.5f;
- if(desc.index == 91) // patch volume
- return 100.0f / 127.0f;
- return desc.isBipolar ? 0.5f : 0.0f; /* maybe return from ROM state? */
- }
-}
diff --git a/source/jucePlugin/VirusParameter.h b/source/jucePlugin/VirusParameter.h
@@ -1,15 +0,0 @@
-#pragma once
-
-#include "../jucePluginLib/parameter.h"
-
-namespace Virus
-{
- class Controller;
-
- class Parameter : public pluginLib::Parameter
- {
- public:
- Parameter(pluginLib::Controller& _controller, const pluginLib::Description& _desc, uint8_t _partNum, int _uniqueId);
- float getDefaultValue() const override;
- };
-} // namespace Virus
diff --git a/source/jucePlugin/VirusParameterBinding.cpp b/source/jucePlugin/VirusParameterBinding.cpp
@@ -1,5 +1,5 @@
#include "VirusParameterBinding.h"
-#include "VirusParameter.h"
+
#include "PluginProcessor.h"
class Parameter;
@@ -74,7 +74,7 @@ void VirusParameterBinding::bind(juce::Slider &_slider, uint32_t _param)
}
void VirusParameterBinding::bind(juce::Slider &_slider, uint32_t _param, const uint8_t _part)
{
- const auto v = dynamic_cast<Virus::Parameter*>(m_processor.getController().getParameter(_param, _part == CurrentPart ? m_processor.getController().getCurrentPart() : _part));
+ const auto v = m_processor.getController().getParameter(_param, _part == CurrentPart ? m_processor.getController().getCurrentPart() : _part);
if (!v)
{
@@ -108,7 +108,7 @@ void VirusParameterBinding::bind(juce::ComboBox& _combo, uint32_t _param)
void VirusParameterBinding::bind(juce::ComboBox& _combo, const uint32_t _param, uint8_t _part)
{
- const auto v = dynamic_cast<Virus::Parameter*>(m_processor.getController().getParameter(_param, _part == CurrentPart ? m_processor.getController().getCurrentPart() : _part));
+ const auto v = m_processor.getController().getParameter(_param, _part == CurrentPart ? m_processor.getController().getCurrentPart() : _part);
if (!v)
{
assert(false && "Failed to find parameter");
@@ -152,7 +152,7 @@ void VirusParameterBinding::bind(juce::ComboBox& _combo, const uint32_t _param,
void VirusParameterBinding::bind(juce::Button &_btn, const uint32_t _param)
{
- const auto v = dynamic_cast<Virus::Parameter*>(m_processor.getController().getParameter(_param, m_processor.getController().getCurrentPart()));
+ const auto v = m_processor.getController().getParameter(_param, m_processor.getController().getCurrentPart());
if (!v)
{
assert(false && "Failed to find parameter");
diff --git a/source/jucePlugin/VirusParameterBinding.h b/source/jucePlugin/VirusParameterBinding.h
@@ -1,6 +1,6 @@
#pragma once
-#include "VirusParameter.h"
+#include "../jucePluginLib/parameter.h"
namespace juce {
class Value;
@@ -11,9 +11,9 @@ class Parameter;
class VirusParameterBindingMouseListener : public juce::MouseListener
{
public:
- VirusParameterBindingMouseListener(Virus::Parameter* _param, juce::Slider &_slider) : m_param(_param), m_slider(&_slider) {
+ VirusParameterBindingMouseListener(pluginLib::Parameter* _param, juce::Slider &_slider) : m_param(_param), m_slider(&_slider) {
}
- Virus::Parameter *m_param;
+ pluginLib::Parameter *m_param;
juce::Slider* m_slider;
void mouseDown(const juce::MouseEvent &event) override { m_param->beginChangeGesture(); }
void mouseUp(const juce::MouseEvent &event) override { m_param->endChangeGesture(); }
@@ -45,7 +45,7 @@ private:
struct BoundParameter
{
- Virus::Parameter* parameter = nullptr;
+ pluginLib::Parameter* parameter = nullptr;
juce::Component* component = nullptr;
uint32_t type = 0xffffffff;
uint8_t part = CurrentPart;