HISE Logo Forum
    • Categories
    • Register
    • Login

    Expanded AudioPlayHead functionality

    Scheduled Pinned Locked Moved Feature Requests
    13 Posts 6 Posters 856 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.
    • ulrikU
      ulrik @Dan Korneff
      last edited by

      @dustbro if you're referring to the MidiPlayer you have this:

      MIDIPlay.getPlaybackPosition()
      

      Hise Develop branch
      MacOs 15.3.1, Xcode 16.2
      http://musikboden.se

      Dan KorneffD 1 Reply Last reply Reply Quote 1
      • Dan KorneffD
        Dan Korneff @ulrik
        last edited by

        @ulrik I think that's the position of the midi player. Im trying to get the playback position of the DAW so i can synchronize the two.

        Dan Korneff - Producer / Mixer / Audio Nerd

        ulrikU 1 Reply Last reply Reply Quote 0
        • ulrikU
          ulrik @Dan Korneff
          last edited by

          @dustbro ok, I understand. 👍

          Hise Develop branch
          MacOs 15.3.1, Xcode 16.2
          http://musikboden.se

          1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey
            last edited by

            @dustbro

            Engine.getPlayHead() returns an object, any idea what properties the object has?

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            Dan KorneffD 2 Replies Last reply Reply Quote 0
            • Dan KorneffD
              Dan Korneff @d.healey
              last edited by

              @d-healey the scripting API says:

              Allows access to the data of the host (playing status, timeline, etc...). */
              

              The JUCE Audio Processor says:

                  /** Returns the current AudioPlayHead object that should be used to find
                      out the state and position of the playhead.
              
                      You can ONLY call this from your processBlock() method! Calling it at other
                      times will produce undefined behaviour, as the host may not have any context
                      in which a time would make sense, and some hosts will almost certainly have
                      multithreading issues if it's not called on the audio thread.
              
                      The AudioPlayHead object that is returned can be used to get the details about
                      the time of the start of the block currently being processed. But do not
                      store this pointer or use it outside of the current audio callback, because
                      the host may delete or re-use it.
              
                      If the host can't or won't provide any time info, this will return nullptr.
                  */
                  AudioPlayHead* getPlayHead() const noexcept                 { return playHead; }
              

              I think it's currently being used to get the sample position for processing audio. There's a whole subclass to the Audio Play Head that we don't have access to yet. It would allow us to:

              //==============================================================================
              /**
                  A subclass of AudioPlayHead can supply information about the position and
                  status of a moving play head during audio playback.
              
                  One of these can be supplied to an AudioProcessor object so that it can find
                  out about the position of the audio that it is rendering.
              
                  @see AudioProcessor::setPlayHead, AudioProcessor::getPlayHead
              
                  @tags{Audio}
              */
              class JUCE_API  AudioPlayHead
              {
              protected:
                  //==============================================================================
                  AudioPlayHead() = default;
              
              public:
                  virtual ~AudioPlayHead() = default;
              
                  //==============================================================================
                  /** Frame rate types. */
                  enum FrameRateType
                  {
                      fps23976        = 0,
                      fps24           = 1,
                      fps25           = 2,
                      fps2997         = 3,
                      fps30           = 4,
                      fps2997drop     = 5,
                      fps30drop       = 6,
                      fps60           = 7,
                      fps60drop       = 8,
                      fpsUnknown      = 99
                  };
              
                  //==============================================================================
                  /** This structure is filled-in by the AudioPlayHead::getCurrentPosition() method.
                  */
                  struct JUCE_API  CurrentPositionInfo
                  {
                      /** The tempo in BPM */
                      double bpm;
              
                      /** Time signature numerator, e.g. the 3 of a 3/4 time sig */
                      int timeSigNumerator;
                      /** Time signature denominator, e.g. the 4 of a 3/4 time sig */
                      int timeSigDenominator;
              
                      /** The current play position, in samples from the start of the timeline. */
                      int64 timeInSamples;
                      /** The current play position, in seconds from the start of the timeline. */
                      double timeInSeconds;
              
                      /** For timecode, the position of the start of the timeline, in seconds from 00:00:00:00. */
                      double editOriginTime;
              
                      /** The current play position, in units of quarter-notes. */
                      double ppqPosition;
              
                      /** The position of the start of the last bar, in units of quarter-notes.
              
                          This is the time from the start of the timeline to the start of the current
                          bar, in ppq units.
              
                          Note - this value may be unavailable on some hosts, e.g. Pro-Tools. If
                          it's not available, the value will be 0.
                      */
                      double ppqPositionOfLastBarStart;
              
                      /** The video frame rate, if applicable. */
                      FrameRateType frameRate;
              
                      /** True if the transport is currently playing. */
                      bool isPlaying;
              
                      /** True if the transport is currently recording.
              
                          (When isRecording is true, then isPlaying will also be true).
                      */
                      bool isRecording;
              
                      /** The current cycle start position in units of quarter-notes.
                          Note that not all hosts or plugin formats may provide this value.
                          @see isLooping
                      */
                      double ppqLoopStart;
              
                      /** The current cycle end position in units of quarter-notes.
                          Note that not all hosts or plugin formats may provide this value.
                          @see isLooping
                      */
                      double ppqLoopEnd;
              
                      /** True if the transport is currently looping. */
                      bool isLooping;
              

              Dan Korneff - Producer / Mixer / Audio Nerd

              1 Reply Last reply Reply Quote 0
              • Dan KorneffD
                Dan Korneff @d.healey
                last edited by

                @d-healey The subclass is currently commented out in HISE source code, and when i remove the comment, it doesn't compile 🤷

                Dan Korneff - Producer / Mixer / Audio Nerd

                lalalandsynthL 1 Reply Last reply Reply Quote 0
                • lalalandsynthL
                  lalalandsynth @Dan Korneff
                  last edited by

                  @dustbro Has this been implemented , kind of essential.

                  https://lalalandaudio.com/

                  https://lalalandsynth.com/

                  https://www.facebook.com/lalalandsynth

                  https://www.facebook.com/lalalandsynth

                  Christoph HartC Dan KorneffD 2 Replies Last reply Reply Quote 1
                  • Christoph HartC
                    Christoph Hart @lalalandsynth
                    last edited by

                    @lalalandsynth

                    Link Preview Image
                    HISE | Scripting | TransportHandler

                    A class that manages callbacks for host playback events

                    favicon

                    (docs.hise.audio)

                    lalalandsynthL d.healeyD 2 Replies Last reply Reply Quote 2
                    • lalalandsynthL
                      lalalandsynth @Christoph Hart
                      last edited by lalalandsynth

                      @christoph-hart great !
                      Maybe I am overlooking something but what I am looking for is timeline sync as in :

                      (Slow lfo starts playing at the correct phase position according to where you are in a "measure /beat" )

                      OR
                      (Drummachine w/sequencer would start at the right place in the sequence according to timeline position)

                      Would "setOnBeatChange" do that ?

                      https://lalalandaudio.com/

                      https://lalalandsynth.com/

                      https://www.facebook.com/lalalandsynth

                      https://www.facebook.com/lalalandsynth

                      1 Reply Last reply Reply Quote 0
                      • Dan KorneffD
                        Dan Korneff @lalalandsynth
                        last edited by

                        @lalalandsynth I haven't played with it since my last post on this thread. Let me know what you find.

                        Dan Korneff - Producer / Mixer / Audio Nerd

                        1 Reply Last reply Reply Quote 1
                        • d.healeyD
                          d.healey @Christoph Hart
                          last edited by d.healey

                          @Christoph-Hart Is it possible to find out exactly where the playhead is on the DAW timeline at a given moment? Regardless of the transport is started/stopped?

                          Edit: onBeatChanged seems to be the one

                          Libre Wave - Freedom respecting instruments and effects
                          My Patreon - HISE tutorials
                          YouTube Channel - Public HISE tutorials

                          SimonS 1 Reply Last reply Reply Quote 2
                          • SimonS
                            Simon @d.healey
                            last edited by Simon

                            @d-healey OnBeatChanged gives you the position in beats, Engine.getPlayHead().ppqPosition I think is the most accurate and probably the one you want (and works regardless of transport state)

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

                            24

                            Online

                            1.8k

                            Users

                            12.0k

                            Topics

                            104.2k

                            Posts