RAW FloatingTile & Listener from Connection instead of sliderValueChanged
-
@Christoph-Hart How can we use the listener from a connection (when the slider is updated from outside, not by click/drag)
class ExternalTestComponent : public hise::FloatingTileContent, public juce::Component, public juce::Slider::Listener { public: SET_PANEL_NAME("ExternalTestComponent"); ExternalTestComponent(juce::FloatingTile* parent) : FloatingTileContent(parent), gainSlider("Gain"), gainConnection(&gainSlider, getMainController(), "Sine Wave Generator1") { addAndMakeVisible(gainSlider); gainSlider.setSliderStyle(Slider::RotaryHorizontalVerticalDrag); gainSlider.setTextBoxStyle(Slider::NoTextBox, false, 80, 40); gainSlider.setRange(0.0, 1.0); gainSlider.addListener(this); } ~ExternalTestComponent() { gainSlider.removeListener(this); } void resized() override { auto area = getLocalBounds(); gainSlider.setBounds(area.withSizeKeepingCentre(80, 120)); } void paint(Graphics& g) override { g.fillAll(Colours::red.withMultipliedAlpha(0.3)); g.setColour(Colours::blue); float barWidth = gainSlider.getValue() * 480.0; Rectangle<float> area (10.0, 10.0, barWidth, 40.0); g.fillRect(area); } void sliderValueChanged(juce::Slider* slider) override { if (slider == &gainSlider) { repaint(); } } juce::Slider gainSlider; hise::raw::UIConnection::Slider<SineSynth::Gain> gainConnection; }; };
-
@ustk I'd like to do this ideally from a DSP parameter with a unidirectional connection... Or better, is there a way to make a connection directly from a
core.peak
node, that would be killer :)EDIT: I just realized that for my needs I will still need a timer, so it's not advantageous compared to drawing with Hise script...