Transport Issues

Hi,
I updated my code from the current development branch to this commit : 682bee39e8c9290758fde396f12065cb1aca4437

and I noticed that the transport playhead is “discrete”.
To be clear:
when I call the edit->getTransport().play (true) method; and the transport starts playing, the value of the cached “position” is not smooth, but it has some kind of discrete update, so visually it looks like it has discrete steps… It doesn’t affect the engine (so clips are played correctly) but I don’t want this strange behavior.

N.B i get the playback position calling edit->getTransport()->getPosition();

I created a simple demo project with a minimal playhead position and a value tree viewer to clarify what I said

Using tagged version 2.1.0 this problem does not seem to occur, but I would really like to update my version of tracktion just because some bugs have been fixed here.

Using the develop branch updated to the last commit
tranport_issue

Using the tagged 2.1.0 version
tranport-issue

Is the develop brach stable enougth to use ? Or should i use the 2.1.0 version ?

Hmm, it shouldn’t be that stepped I’ll look in to it.

You can poll EditPlaybackContext::getAudibleTimelineTime() though for the most accurate time of what is actually being heard through the speakers. This takes in to account latency in the playback graph.

Hi @dave96 ,
even with EditPlaybackContext::getAudibleTimelineTime() i had the same effect… i hope you could resolve that issue ASAP, thank you

Are you sure it’s not the interval your your timer? audiblePlaybackTime is updated every block.

What buffer size are you using?

@dave96 This is the code of my play head component , it has a timer with 120Hz and :

void MyPlayHeadComponent::timerCallback() {

    if (auto transp = edit->getTransport()) {
        
        auto currentTime = transp->getCurrentPosition();

        repaint();

    }

}

The buffer size is the default one : 480 samples ( 10ms ) and the rate is 48khz.

As i told you with the same code using the tracktion module 2.1.0 this problem does not seem to occur… so i don’t really know what is going on…

Can you try running the demo runner? There are several demos that poll the transport position in there. Do any of those appear stepped for you?

Yes, i tried with the “MidiRecordingDemo” and in the demo the playhead seems to be smooth.

I copied the playhead component from the MidiRecordingDemo and put it in my code adding some DBG string in the timer callback just for display the current time and i still have this problem :
In my Code :
image

In the MidiRecordingDemo:
image

Should i set some flags ? i don’t really know what is going on… just putting a timer on 60Hz and getting the current time from transport it gives me stepped value…

Can I double check how you’re starting your timer?

The other thing to consider is if something else is holding up the message thread, that could potentially cause more irregular callbacks to your timer than you’ve requested. So for example if drawing is very slow/intensive or you’re doing some kind of sleep or wait?

Yes, good point @anthony-nicholls. @Fernando can you print the current time in your timer callback but also maybe your paint callback to check the paint interval isn’t really slow?

Yeah this worked for me.
I was drawing a Path to draw the beat grid behaind that was called so many times; i simplify the draw logic and this problem disappeared. Thank you so much !

1 Like