HISE Logo Forum
    • Categories
    • Register
    • Login

    Engine.getPlayhead() functionality

    Scheduled Pinned Locked Moved Feature Requests
    playheadtransport
    23 Posts 7 Posters 2.9k 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.
    • SimonS
      Simon @d.healey
      last edited by

      Assuming the doc entry is accurate, onBeatChange won't work as I need the exact position.

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

        @Simon The reason is that HISE splits up buffers bigger than 512 into chunks of 512 samples - above 512 there's hardly any CPU benefits but the memory consumption gets annoying (plus there are a few ugly edge cases with the audio buffer size conflicting with the streaming buffers).

        Now the problem is that for every 2048 sample buffer that comes in, it calls the internal processing function 4 times and each time the ppq is bumped to stay consistent with the actual DAW position - that is if the playback is running. If not, then it jitters around like you analysed.

        You can temporarily deactivate this by setting HISE_MAX_PROCESSING_BLOCKSIZE to a bigger value, but the real fix shouldn't be too hard. Please open a github issue and refer to this topic so that it doesn't get lost.

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

          @Christoph-Hart found the culprit:

                  // if this is non-zero it means that the buffer coming
                  // from the DAW was split into chunks for processing
                  // so we need to update the playhead to reflect the
                  // "real" position for the given buffer
                  if(offsetWithinProcessBuffer != 0)
                  {
                      newTime.timeInSamples += offsetWithinProcessBuffer;
                      newTime.timeInSeconds += (double)offsetWithinProcessBuffer / processingSampleRate;
                      
                      const auto numSamplesPerQuarter = (double)TempoSyncer::getTempoInSamples(newTime.bpm, processingSampleRate, 1.0f);
                      
                      newTime.ppqPosition += (double)offsetWithinProcessBuffer / numSamplesPerQuarter;
                  }
          1 Reply Last reply Reply Quote 2
          • First post
            Last post

          27

          Online

          1.8k

          Users

          12.0k

          Topics

          104.7k

          Posts