Playback from position

Hmm, the more I think about this the more it seems like it might just be a problem with the logic in PlayHeadPositionNode. I don’t suppose you can hack that to always return the last stream time as a timeline time and see if that removes the jumping around?

Sure, I’ll try it!

Sorry, I didn’t quite understand how to do it… Did you mean that PlayHeadPositionNode::updatePlayHeadTime should set playHeadTime to the stream time?

Yes, sorry, that was a bit vague. Basically just this:

    void updatePlayHeadTime (int64_t)
    {
        int64_t referenceSamplePosition = getReferenceSampleRange().getStart();
        const int64_t timelinePosition = getPlayHead().referenceSamplePositionToTimelinePosition (referenceSamplePosition);
        const double time = tracktion_graph::sampleToTime (timelinePosition, getSampleRate());

        playHeadTime = time;
    }

Did you get around to trying the above at all?

I’ve been thinking about how to solve this for quite some time but I’m not sure it is solvable with the way it currently works. I think I’m going to have to change the API to avoid direct access to the position property and have an explicit setPosition method along with explicit getPlayHeadPosition and getAudiblePosition methods which return the position entering the audio graph and the audible position at the outputs respectively which could be different if the graph introduces latency.

This should mean we don’t have the circular reference problem I think you’re seeing. It would be a breaking change though so I want to see if that sounds right to you before doing it. If it does, I could do it on a branch to ensure it does indeed fix your problem (which I still haven’t been able to reproduce).

@dave96
Any update on this?

This is my understanding so far:
In order to update the tracktion position, the audio process block must run continuously. Logic often doesn’t call processBlock and so the playhead keeps jumping back when I try to move it from my plug-in GUI. Because, when you update the position in tracktion from the GUI, you are actually posting a position change message that needs to be picked up by the audio thread.

Could you recommend me a workaround or temporary fix?

Sorry, this thread is from a long time ago. Can you summarise the problem or maybe start a new thread? Then engine has had a few versions since the OP.

Why isn’t logic calling process block? Is it because your plugin is an audio effect and there are no regions feeding it?

1 Like