#include "LuaListComponent.h" LuaListComponent::LuaListComponent(OscirenderAudioProcessor& p, Effect& effect) { effectComponent = std::make_shared(p, effect); effectComponent->slider.onValueChange = [this, &effect, &p] { effect.setValue(effectComponent->slider.getValue()); }; addAndMakeVisible(*effectComponent); } LuaListComponent::~LuaListComponent() {} void LuaListComponent::resized() { effectComponent->setBounds(getLocalBounds()); } void paintListBoxItem(int sliderNum, juce::Graphics& g, int width, int height, bool rowIsSelected) {} int LuaListBoxModel::getNumRows() { return audioProcessor.luaEffects.size(); } void LuaListBoxModel::paintListBoxItem(int rowNumber, juce::Graphics& g, int width, int height, bool rowIsSelected) {} juce::Component* LuaListBoxModel::refreshComponentForRow(int rowNum, bool isRowSelected, juce::Component *existingComponentToUpdate) { // TODO: We should REALLY be locking here but it causes a deadlock :( works fine without..... // juce::SpinLock::ScopedLockType lock1(audioProcessor.effectsLock); std::unique_ptr item(dynamic_cast(existingComponentToUpdate)); if (juce::isPositiveAndBelow(rowNum, getNumRows())) { item = std::make_unique(audioProcessor, *audioProcessor.luaEffects[rowNum]); } return item.release(); }