GUI refresh fix
This commit is contained in:
parent
d73fcd8490
commit
29579de1c3
5 changed files with 56 additions and 13 deletions
|
@ -40,19 +40,29 @@ public:
|
||||||
public:
|
public:
|
||||||
class ButtonListAttachment : public juce::AudioProcessorValueTreeState::ComboBoxAttachment
|
class ButtonListAttachment : public juce::AudioProcessorValueTreeState::ComboBoxAttachment
|
||||||
{
|
{
|
||||||
|
RangedAudioParameter* parameter = nullptr;
|
||||||
|
ButtonList* buttonListToControl = nullptr;
|
||||||
public:
|
public:
|
||||||
ButtonListAttachment (juce::AudioProcessorValueTreeState& stateToControl,
|
ButtonListAttachment (juce::AudioProcessorValueTreeState& stateToControl,
|
||||||
const juce::String& parameterID,
|
const juce::String& parameterID,
|
||||||
ButtonList& buttonListToControl) : AudioProcessorValueTreeState::ComboBoxAttachment (stateToControl, parameterID, buttonListToControl)
|
ButtonList& buttonListToControl) : AudioProcessorValueTreeState::ComboBoxAttachment (stateToControl, parameterID, buttonListToControl), buttonListToControl(&buttonListToControl)
|
||||||
{
|
{
|
||||||
buttonListToControl.setParameter (stateToControl.getParameter (parameterID));
|
parameter = stateToControl.getParameter (parameterID);
|
||||||
|
buttonListToControl.setParameter (parameter);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
ButtonListAttachment (juce::AudioProcessorValueTreeState& stateToControl,
|
ButtonListAttachment (juce::AudioProcessorValueTreeState& stateToControl,
|
||||||
const juce::String& parameterID,
|
const juce::String& parameterID,
|
||||||
ComboBox& buttonListToControl) : AudioProcessorValueTreeState::ComboBoxAttachment (stateToControl, parameterID, buttonListToControl)
|
ComboBox& buttonListToControl) : AudioProcessorValueTreeState::ComboBoxAttachment (stateToControl, parameterID, buttonListToControl)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
void updateToSlider(){
|
||||||
|
float val = parameter->getValue();
|
||||||
|
buttonListToControl->setValue(val, NotificationType::dontSendNotification);
|
||||||
|
//buttonListToControl->setValue(parameter->convertFrom0to1(val0to1), NotificationType::dontSendNotification);
|
||||||
|
buttonListToControl->setValue(val, NotificationType::dontSendNotification);
|
||||||
|
}
|
||||||
|
|
||||||
virtual ~ButtonListAttachment() = default;
|
virtual ~ButtonListAttachment() = default;
|
||||||
};
|
};
|
||||||
|
|
|
@ -46,24 +46,35 @@ public:
|
||||||
public:
|
public:
|
||||||
class KnobAttachment : public juce::AudioProcessorValueTreeState::SliderAttachment
|
class KnobAttachment : public juce::AudioProcessorValueTreeState::SliderAttachment
|
||||||
{
|
{
|
||||||
|
RangedAudioParameter* parameter = nullptr;
|
||||||
|
Knob* sliderToControl = nullptr;
|
||||||
public:
|
public:
|
||||||
KnobAttachment (juce::AudioProcessorValueTreeState& stateToControl,
|
KnobAttachment (juce::AudioProcessorValueTreeState& stateToControl,
|
||||||
const juce::String& parameterID,
|
const juce::String& parameterID,
|
||||||
Knob& sliderToControl) : AudioProcessorValueTreeState::SliderAttachment (stateToControl, parameterID, sliderToControl)
|
Knob& sliderToControl) : AudioProcessorValueTreeState::SliderAttachment (stateToControl, parameterID, sliderToControl), sliderToControl(&sliderToControl)
|
||||||
{
|
{
|
||||||
sliderToControl.setParameter (stateToControl.getParameter (parameterID));
|
parameter = stateToControl.getParameter (parameterID);
|
||||||
|
sliderToControl.setParameter (parameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
KnobAttachment (juce::AudioProcessorValueTreeState& stateToControl,
|
|
||||||
|
/*KnobAttachment (juce::AudioProcessorValueTreeState& stateToControl,
|
||||||
const juce::String& parameterID,
|
const juce::String& parameterID,
|
||||||
Slider& sliderToControl) : AudioProcessorValueTreeState::SliderAttachment (stateToControl, parameterID, sliderToControl)
|
Slider& sliderToControl) : AudioProcessorValueTreeState::SliderAttachment (stateToControl, parameterID, sliderToControl)
|
||||||
{
|
{
|
||||||
|
}*/
|
||||||
|
|
||||||
|
void updateToSlider(){
|
||||||
|
float val = parameter->getValue();
|
||||||
|
//sliderToControl->setValue(parameter->convertFrom0to1(val0to1));
|
||||||
|
sliderToControl->setValue(val, NotificationType::dontSendNotification);
|
||||||
|
DBG(" Slider: " << sliderToControl->getName() << " " << sliderToControl->getValue() << " Parameter: "<< " " << parameter->getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~KnobAttachment() = default;
|
virtual ~KnobAttachment() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
void setParameter (const AudioProcessorParameter* p)
|
void setParameter (AudioProcessorParameter* p)
|
||||||
{
|
{
|
||||||
if (parameter == p)
|
if (parameter == p)
|
||||||
return;
|
return;
|
||||||
|
@ -84,5 +95,5 @@ private:
|
||||||
Image kni;
|
Image kni;
|
||||||
int fh, numFr;
|
int fh, numFr;
|
||||||
int w2, h2;
|
int w2, h2;
|
||||||
const AudioProcessorParameter* parameter {nullptr};
|
AudioProcessorParameter* parameter {nullptr};
|
||||||
};
|
};
|
||||||
|
|
|
@ -45,20 +45,26 @@ public:
|
||||||
public:
|
public:
|
||||||
class ToggleAttachment : public juce::AudioProcessorValueTreeState::ButtonAttachment
|
class ToggleAttachment : public juce::AudioProcessorValueTreeState::ButtonAttachment
|
||||||
{
|
{
|
||||||
|
RangedAudioParameter* parameter = nullptr;
|
||||||
|
TooglableButton* buttonToControl = nullptr;
|
||||||
public:
|
public:
|
||||||
ToggleAttachment (juce::AudioProcessorValueTreeState& stateToControl,
|
ToggleAttachment (juce::AudioProcessorValueTreeState& stateToControl,
|
||||||
const juce::String& parameterID,
|
const juce::String& parameterID,
|
||||||
TooglableButton& buttonToControl) : AudioProcessorValueTreeState::ButtonAttachment (stateToControl, parameterID, buttonToControl)
|
TooglableButton& buttonToControl) : AudioProcessorValueTreeState::ButtonAttachment (stateToControl, parameterID, buttonToControl), buttonToControl(&buttonToControl)
|
||||||
{
|
{
|
||||||
buttonToControl.setParameter (stateToControl.getParameter (parameterID));
|
parameter = stateToControl.getParameter (parameterID);
|
||||||
|
buttonToControl.setParameter (parameter);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
ToggleAttachment (juce::AudioProcessorValueTreeState& stateToControl,
|
ToggleAttachment (juce::AudioProcessorValueTreeState& stateToControl,
|
||||||
const juce::String& parameterID,
|
const juce::String& parameterID,
|
||||||
Button& buttonToControl) : AudioProcessorValueTreeState::ButtonAttachment (stateToControl, parameterID, buttonToControl)
|
Button& buttonToControl) : AudioProcessorValueTreeState::ButtonAttachment (stateToControl, parameterID, buttonToControl)
|
||||||
{
|
{
|
||||||
|
}*/
|
||||||
|
void updateToSlider(){
|
||||||
|
float val = parameter->getValue();
|
||||||
|
//buttonToControl->setValue(parameter->convertFrom0to1(val0to1), NotificationType::dontSendNotification);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~ToggleAttachment() = default;
|
virtual ~ToggleAttachment() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -442,6 +442,18 @@ void ObxdAudioProcessorEditor::rebuildComponents (ObxdAudioProcessor& ownerFilte
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
void ObxdAudioProcessorEditor::changeListenerCallback (ChangeBroadcaster* source)
|
void ObxdAudioProcessorEditor::changeListenerCallback (ChangeBroadcaster* source)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
for (int i = 0; i < knobAttachments.size(); i++){
|
||||||
|
knobAttachments[i]->updateToSlider();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < toggleAttachments.size(); i++){
|
||||||
|
toggleAttachments[i]->updateToSlider();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < buttonListAttachments.size(); i++){
|
||||||
|
buttonListAttachments[i]->updateToSlider();
|
||||||
|
}
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -415,6 +415,7 @@ void ObxdAudioProcessor::setStateInformation(const void* data, int sizeInBytes)
|
||||||
|
|
||||||
setCurrentProgram(xmlState->getIntAttribute(S("currentProgram"), 0));
|
setCurrentProgram(xmlState->getIntAttribute(S("currentProgram"), 0));
|
||||||
|
|
||||||
|
sendChangeMessage();
|
||||||
#if JUCE_VERSION <= JUCE_543
|
#if JUCE_VERSION <= JUCE_543
|
||||||
delete xmlState;
|
delete xmlState;
|
||||||
#endif
|
#endif
|
||||||
|
@ -443,7 +444,8 @@ void ObxdAudioProcessor::setCurrentProgramStateInformation(const void* data, in
|
||||||
programs.currentProgramPtr->name = e->getStringAttribute(S("programName"), S("Default"));
|
programs.currentProgramPtr->name = e->getStringAttribute(S("programName"), S("Default"));
|
||||||
|
|
||||||
setCurrentProgram(programs.currentProgram);
|
setCurrentProgram(programs.currentProgram);
|
||||||
|
|
||||||
|
sendChangeMessage();
|
||||||
#if JUCE_VERSION <= JUCE_543
|
#if JUCE_VERSION <= JUCE_543
|
||||||
delete e;
|
delete e;
|
||||||
#endif
|
#endif
|
||||||
|
@ -740,6 +742,8 @@ void ObxdAudioProcessor::setEngineParameterValue (int index, float newValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
programs.currentProgramPtr->values[index] = newValue;
|
programs.currentProgramPtr->values[index] = newValue;
|
||||||
|
apvtState.getParameter(getEngineParameterId(index))->setValue(newValue);
|
||||||
|
|
||||||
|
|
||||||
switch (index)
|
switch (index)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue