HISE Logo Forum
    • Categories
    • Register
    • Login

    Help with Button to ramp a Knob value up and down 0.- 1. > 1. - 0.

    Scheduled Pinned Locked Moved Scripting
    2 Posts 1 Posters 64 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.
    • R
      Rognvald
      last edited by

      Is there any simple function for this, or using Timer?
      Can anyone provide an example? :)

      R 1 Reply Last reply Reply Quote 0
      • R
        Rognvald @Rognvald
        last edited by

        @Rognvald I found this as a starting point.. :)

        const var Knob = Content.getComponent("Knob");
        
        
        const TH = Engine.createTransportHandler();
        
        //	18 = tempo factor = 1/64T
        TH.setEnableGrid(true, 18);
        
        
        //	Set sync mode Internal or External
        TH.setSyncMode(TH.PreferExternal);
        
        //	ON GRID CHANGE FUNCTION
        //	You start and stop this using "TH.startInternalClock" & TH.stopInternalClock
        inline function GridChange(clock, arg2, arg3)
        {
        	local v = (clock % 200) / 100;
        	
        	local value = v < 1.0 ? v : 2 - v;
        	
        	//	Trigger the knob
        	Knob.setValue(value);
        	Knob.changed();
        };
        
        TH.setOnGridChange(true, GridChange);
        
        
        inline function onKnobControl(component, value)
        {
        	Console.print(value);
        };
        
        Content.getComponent("Knob").setControlCallback(onKnobControl);
        
        
        //	START STOP INTERNAL CLOCK
        inline function onStartInternalClockControl(component, value)
        {
        	if (value)
        		TH.startInternalClock(0);
        	else
        		TH.stopInternalClock(0);
        };
        
        Content.getComponent("StartInternalClock").setControlCallback(onStartInternalClockControl);
        
        
        
        1 Reply Last reply Reply Quote 0
        • First post
          Last post

        22

        Online

        1.9k

        Users

        12.5k

        Topics

        108.8k

        Posts