HISE Logo Forum
    • Categories
    • Register
    • Login

    setOnGridChange()

    Scheduled Pinned Locked Moved General Questions
    3 Posts 2 Posters 230 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.
    • toxonicT
      toxonic
      last edited by

      Has anyone experience with the setOnGridChange()function call?
      I tinkered around with it, and it seems to be interesting for building DAW synced sequenceres, like in the following example. You need to open it in HISE plugin inside a DAW.

      // Run in HISE Plugin inside a DAW
      Content.makeFrontInterface(600, 600);
      
      const var TH = Engine.createTransportHandler();
      TH.setSyncMode(TH.PreferExternal);
      TH.setEnableGrid(true, 8);
      
      var testArray = ["first",34,56,78,123,35,87,64];
      
      // output sequence to console, if DAW is playing
      TH.setOnGridChange(SyncNotification, gridChange);
      
      inline function gridChange(x,y,z)
      {
      	local index = x % 8;
      	Console.print(testArray[index]);
      }
      

      The function gridChangeneeds three parameters, otherweise HISE will complain about the parameter amount.
      The first parameter seems to receive the playhead position of the DAW in dependence to the grid you have to set via setEnableGrid()
      But what are the two other parameters for? Any ideas?

      Christoph HartC 1 Reply Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart @toxonic
        last edited by

        onGridChange(int gridIndex_, uint16 timestamp, bool firstGridInPlayback_)
        

        timestamp is the sample position of the grid event in the current buffer so you could pass this onto any message you create to assure sample-accuracy.

        firstGridInPlayback is true when the grid callback is the first that happened after the playback was started. The MIDI player eg. uses this information to resync the playhead and you could do something similar. Be aware that this currently does not respect loop points or seeking inside the DAW, so you have to stop and start the DAW playback for resyncing.

        toxonicT 1 Reply Last reply Reply Quote 1
        • toxonicT
          toxonic @Christoph Hart
          last edited by

          @Christoph-Hart Great! Thanks for the explanation! 😊

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

          48

          Online

          1.7k

          Users

          11.7k

          Topics

          101.8k

          Posts