Forum

    • Register
    • Login
    • Search
    • Categories

    Expanded AudioPlayHead functionality

    Feature Requests
    5
    11
    320
    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.
    • dustbro
      dustbro last edited by

      Any chance we can have access to the AudioPlayHead?
      I see we have:

      Engine.getPlayHead()
      

      I think I'm looking for

      getCurrentPosition()
      

      so I can grab the ppqPosition of the Playback Head.

      Dan Korneff - Producer / Mixer / Audio Nerd

      ulrik 1 Reply Last reply Reply Quote 0
      • ulrik
        ulrik @dustbro last edited by

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

        MIDIPlay.getPlaybackPosition()
        

        Hise Develop branch
        MacOs 12.3.1, Xcode 13.0
        http://musikboden.se

        dustbro 1 Reply Last reply Reply Quote 1
        • dustbro
          dustbro @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

          ulrik 1 Reply Last reply Reply Quote 0
          • ulrik
            ulrik @dustbro last edited by

            @dustbro ok, I understand. 👍

            Hise Develop branch
            MacOs 12.3.1, Xcode 13.0
            http://musikboden.se

            1 Reply Last reply Reply Quote 0
            • d.healey
              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

              dustbro 2 Replies Last reply Reply Quote 0
              • dustbro
                dustbro @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
                • dustbro
                  dustbro @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

                  lalalandsynth 1 Reply Last reply Reply Quote 0
                  • lalalandsynth
                    lalalandsynth @dustbro last edited by

                    @dustbro Has this been implemented , kind of essential.

                    https://lalalandaudio.com/

                    https://lalalandsynth.com/

                    https://www.facebook.com/lalalandaudio

                    https://www.facebook.com/lalalandsynth

                    Christoph Hart dustbro 2 Replies Last reply Reply Quote 1
                    • Christoph Hart
                      Christoph Hart @lalalandsynth last edited by

                      @lalalandsynth

                      https://docs.hise.audio/scripting/scripting-api/transporthandler/index.html

                      lalalandsynth 1 Reply Last reply Reply Quote 2
                      • lalalandsynth
                        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/lalalandaudio

                        https://www.facebook.com/lalalandsynth

                        1 Reply Last reply Reply Quote 0
                        • dustbro
                          dustbro @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
                          • First post
                            Last post

                          6
                          Online

                          732
                          Users

                          5.4k
                          Topics

                          50.2k
                          Posts