Merge pull request #71 from jameshball/lua-vst-fix

Fix lua values so they update when the interface is closed
pull/170/head
James H Ball 2023-09-16 14:00:21 +01:00 zatwierdzone przez GitHub
commit 9fa9d89cb7
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 24 dodań i 3 usunięć

Wyświetl plik

@ -112,6 +112,10 @@ OscirenderAudioProcessor::OscirenderAudioProcessor()
addLuaSlider();
}
for (auto& effect : luaEffects) {
effect->addListener(0, this);
}
allEffects = toggleableEffects;
allEffects.insert(allEffects.end(), permanentEffects.begin(), permanentEffects.end());
allEffects.insert(allEffects.end(), luaEffects.begin(), luaEffects.end());
@ -144,7 +148,11 @@ OscirenderAudioProcessor::OscirenderAudioProcessor()
synth.addSound(defaultSound);
}
OscirenderAudioProcessor::~OscirenderAudioProcessor() {}
OscirenderAudioProcessor::~OscirenderAudioProcessor() {
for (auto& effect : luaEffects) {
effect->removeListener(0, this);
}
}
const juce::String OscirenderAudioProcessor::getName() const {
return JucePlugin_Name;
@ -674,6 +682,18 @@ void OscirenderAudioProcessor::consumerStop(std::shared_ptr<BufferConsumer> cons
}
}
void OscirenderAudioProcessor::parameterValueChanged(int parameterIndex, float newValue) {
// call apply on lua effects
for (auto& effect : luaEffects) {
if (parameterIndex == effect->parameters[0]->getParameterIndex()) {
effect->apply();
return;
}
}
}
void OscirenderAudioProcessor::parameterGestureChanged(int parameterIndex, bool gestureIsStarting) {}
//==============================================================================
// This creates new instances of the plugin..

Wyświetl plik

@ -25,7 +25,7 @@
//==============================================================================
/**
*/
class OscirenderAudioProcessor : public juce::AudioProcessor
class OscirenderAudioProcessor : public juce::AudioProcessor, juce::AudioProcessorParameter::Listener
#if JucePlugin_Enable_ARA
, public juce::AudioProcessorARAExtension
#endif
@ -62,6 +62,8 @@ public:
std::shared_ptr<BufferConsumer> consumerRegister(std::vector<float>& buffer);
void consumerStop(std::shared_ptr<BufferConsumer> consumer);
void consumerRead(std::shared_ptr<BufferConsumer> consumer);
void parameterValueChanged(int parameterIndex, float newValue) override;
void parameterGestureChanged(int parameterIndex, bool gestureIsStarting) override;
int VERSION_HINT = 1;

Wyświetl plik

@ -6,7 +6,6 @@ LuaListComponent::LuaListComponent(OscirenderAudioProcessor& p, Effect& effect)
effectComponent->slider.onValueChange = [this, &effect, &p] {
effect.setValue(effectComponent->slider.getValue());
effect.apply(0, Vector2());
};
addAndMakeVisible(*effectComponent);