HISE Logo Forum
    • Categories
    • Register
    • Login

    RAW FloatingTile & Listener from Connection instead of sliderValueChanged

    Scheduled Pinned Locked Moved C++ Development
    2 Posts 1 Posters 164 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ustkU
      ustk
      last edited by ustk

      @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;
      };
      };
      

      Can't help pressing F5 in the forum...

      ustkU 1 Reply Last reply Reply Quote 0
      • ustkU
        ustk @ustk
        last edited by ustk

        @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...

        Can't help pressing F5 in the forum...

        1 Reply Last reply Reply Quote 0
        • First post
          Last post

        49

        Online

        1.7k

        Users

        11.7k

        Topics

        101.8k

        Posts