HISE Logo Forum
    • Categories
    • Register
    • Login

    Scheduled knob task after initialization

    Scheduled Pinned Locked Moved General Questions
    3 Posts 3 Posters 36 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.
    • JulesVJ
      JulesV
      last edited by

      After the plugin is initialized, a knob needs to be set to 20 after 1 second, and then set to -50 after waiting half a second.

      I tried the method below, and it works for the first 1 second, but I couldn't figure out how to do the second step after waiting half a second.

      HiseSnippet 1204.3oc0W0sTaaDEdEXQiTayjjgGfsbkRmLDavPfgIINXfTmT.OQ.o8llYszJ6MrZWORqnwIC20mm9LjWk9Fz2f1ytR1VFnfi6OSydgGume+1yd9YU6DY.MMUlfrbOZPeJx5qr8GHT8Z1ivDnV6frts89jTEMAmSZ6A8IoozPjk07OWSvxoBxr98mtMgSDAzwjPnSjr.52yhYpwTa23kLNeORH8HVbIoq2nUfTzTxkY.dl2tJpOI3TRW5ADsXyYi9NRZOj02Zu1JqFTO7QgqrxZatd.Yc5lQjnnZqFVu95arYsU2jTei0oUWCYsvtgLkLwWQTzTvnaKCG32S9yhbGbBKk0gS0apg7AOmSF0rGiG1dXvIEgrpzdbnZ97P0h16yBYinONjcGCC7XMJGzrl65fTsOAHYUBRUxgzcs8CRX8Ui4nwyWZ2R.2fQD3toLTxkEM2Kl2toDjPnVNlbJcuDXyHM7VsZ0Gfget+VtttvETpBeFIA6yh6yo5TfZ3GiMIMK2kp1MJhFn7VJmM1veoKn5KExNZkF5TPslx39RArwaICWsJLAmIn3nLQfhIEXovvRqUhj6ELTkG.FkmQuu6GbcJgpkSopmoTIrNYJpWYF5eGpzVtmuk60BDscJ7YSBm2AxI8lDJlim6kvKSvTuHSzml3AXyw0Ig1EqhSfS9thtfnKGjPgj.cUPxgcdqNtAlxADQ6SC4QdbnUAS4.mSvZN5PYRlPKGXRsV.92GJsX9THXGl5yfpwlxL8U4qnfIMlWqJKB6MT0mfqUEtcApZ65XNXZ+ehN93sRUiNEjC5QDcog41Qanbvpj8MnEniAhmCbNWKRwYQQRxOMdqoSivXGcPWud3C+F7iKsvsNn0QSPwsbTLWIXUJm3.ohdnNr.n28bW7EYEEck7Jt534WNWhcww4uVQOQVbGZR4bOsfPk3jk2KLck2A4YfkDTJZAm7C6SK1umjGpKa0++xMCPEov51BEHDDUYZJb6hlB9bVHMAw.i7E1l6SjA7PG3EVbXC6iasCQQFZFvhfWfXuhoOLV6POC5mm2qwwdGZ5ovUuQ1hpFX.xM5z2Mpk+GOtwfw8++oFopA5PyBFAQwrvPNssLkoC8kmp.yi56yduY1wGV7We9u89e4owkmE8ieLlL1MnsajlEEwdmYHRDiGmBsE52JFlsfrtm8woTbHMhjwU3zSA6.0wmRCORZjGc41rPCdYXFmnlrqutuRACMfK2pU2NU.GjAkmW9ILJn50NJXZg3csayTA8tZLN2UfQHO3eCLVL.8qsymVLFfUr26Gl0okUm9ok2ZzacFMUn3sNkGacMu0odicnbxDApWyBU8JkA13JdMTKwYPoTaImjbwv77+S8pfJSctf9Hg+6juVY5tLtgNWSIdumsIj+4DfMoDe9.36X2l7+gDhWIyTLQ28IPSZnks8AYw9vmD.OkAd8gfxAGYaMmdlW99p58Z.4SEglM+ArJXVSu2pfYsgL+OwGwjfD4aBxmFqKMukgBbtElOnwA9xJXOd7X3QsCfQer2DDLootjhqLqJt5rpX8YUw0lUEWeVU7QyphabyJp+7tmkojw40IHz9s207rIKqcEDHi2Txf9S.ERqNeC
      
      
      const var SimpleGain1 = Synth.getEffect("Simple Gain1");
      
      const var Knob1 = Content.getComponent("Knob1");
      inline function onKnob1Control(component, value)
      {
      	SimpleGain1.setAttribute(SimpleGain1.Gain, value);
      };
      Content.getComponent("Knob1").setControlCallback(onKnob1Control);
      
      
      
      
      inline function initJunper()
      {	
      	reg tmr = Engine.createTimerObject();
      	tmr.setTimerCallback(function()
      	{
      		
      		var runTime = tmr.getMilliSecondsSinceCounterReset();
      		
      		if (runTime > 1000)
      		{
      			Knob1.setValue(20);
      			Knob1.changed();
      			
      			tmr.stopTimer(); 
      		}	
      	});
      	
      	tmr.startTimer(500);  	
      };
      
      
      
      
      //! ============ INIT ============
      initJunper();
      
      
      
      
      d.healeyD 1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey @JulesV
        last edited by

        @JulesV said in Scheduled knob task after initialization:

        reg tmr = Engine.createTimerObject();

        The timer object should be created in onInit as a const, or if you're creating it in an inline function as a factory function then as a local, I didn't even know you could use reg in an inline function 😁

        But I think there is probably a simpler way in this case

        15109522-be5b-4b26-bcb7-c4b805a76dad-image.png

        Free HISE Bootcamp Full Course for beginners.
        YouTube Channel - Public HISE tutorials
        My Patreon - HISE tutorials

        ustkU 1 Reply Last reply Reply Quote 1
        • ustkU
          ustk @d.healey
          last edited by ustk

          An object timer could do as well, switching between two predefined timings and values

          HiseSnippet 983.3ocsV0uaaaCDmxIpqVaqXEXO.B8uTVKLjcbr8PWwRiiSmQqcLlRC1PQP.MEkEWjHMnnSmQQe+5qPeK5av1QJ4H4Fu9gAF+CCce+i2w6NOQJHzrLgDY4b1x4Tj02YGrjqh6GiYbzviQV2ydDNSQkt4rNZ4bbVFMDYYsyyzLrpuKxb9vudDNAyIzRVHz4BFg9BVJSUxcxgOmkjbBNjdFKsh1sObHQv6KRDK.7risOZNlbEdFcLVqVMazugyhQV+j89c6fiZ0sKkF0w+m61MpSWBtEk1d+1smFhm1pWORuC51CYcmAgLkPFnvJZF3ziDgKChEulmGfyYYroITMQST.D4b1n9wrjvIqRNYHj0tSJSU6jmp9Q6QrP1M7KSY+fQfaoEUSZV09TPp4WAjrp.ocygz8sCHR1bUoDMd9V6gbnBFggZSUnjqKp16qY2W.ZvUMRwWQOQBD2XgWGe+G4B+r2icbf5Slx8Zrz84bwzltOwckgynp9hz4BNP38.izG.VX9nQFUcNNYA0yugwMU7iB7w.9LFm1fHoPJQ+lPd5z+hRTdqGxyFNZ33mE3pOOw8UM80.6.e+KdbUbM9nKO+ou3kCBLJ0xnxE5XJoybIhEbcD80LbTZfYhWebRxT3wlWzBNQwDbu8bdiScULKqQlRL2njFN0cp+QWox.9Ji2uPqUtNjXLeFMrvNVjq2CeXNB9kUWlFIT9LU7dN0qCnQgk43wqPboKeqIusQc7uvHSeX7DHS5t5V3J3FjnKRRQhGYUE5QPtB.u4RBByDIzFykLnzkyGhWkZWg42jjV2qfxUh2XghdZQ5y4sNternnnMJqvWI5r7FDWj++uMziuHcJUV8doUDZLVua6NeYcaj7W0UTTvGxYpSmSKnOQjDp6hzee6dSTQaA70KGdLVg0sqE7.8lSkJlFNVGSuFFPl27V29XZ1UvqMitEUJj0cUFo2qn0NHgERkHFD6uw1TGP+c4LT1gKqRjhqH6OO70rPEL.015c.YLkMKVshJCeMcHehjB0a8rAzsGt.i0DgKRvp0m0o2BTH.JIqMfQODgmwTKqtk3qX.n+mb.3WJDuu8DlhDuYLVaCXDJV+efwh0Feu8fnHX5VI.209j+Xa2Q7YB+uKVnX7YivJICdJXOdQZ.rdkPgny4zjLc8ul9AaNsulVmABn7PCw+.mBgM0zVEBatRHJESjhKI4Mh5ES20vAvD2r3tN7OH.Z2lHSyY07bJrm7RBYcWcKCassFt+1ZX6s0vC1VC6rsF1caMr2m2P8ei4oKThz71FDZzjAloYVVC3X3En40J5eAbKVeyM
          

          Hise made me an F5 dude, browser just suffers...

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

          27

          Online

          2.1k

          Users

          12.9k

          Topics

          112.1k

          Posts