Simple transport examples?

i was wondering if anyone could provide me some insight on the best way of handling transport controls, AudioPlayhead and AudioPlayhead::PositionInfo related things in a plugin?

a juce plugin thats run in standalone has no real notion of a timeline, bpm or any timecode information (which is fair enough as the standalone filter is only using a simple AudioProcessorPlayer to get things moving), so from a code/design perspective and as plugin developers, should we be responsible for managing a Transport type class ourselves?

i’m trying to think of the best way to handle a plugin which uses a host’s playhead position info for various reasons (eg to update a sequencer position, an internal timeline/arrangement editor, play an arpeggiator or something thats tempo synced, delay etc) - but could also handle cases where it uses its own position info or playhead if needed, i guess something that would be like a sync to host or un-sync option.

are there any tutorials, tips or examples out there anyone would be happy to share? i’ve tried having a look at Tracktion’s implementation of a transport but theres a lot going on and I’m struggling to pull it apart and put it in the context of a plugin so ideally looking for something really stripped back

I’m also really struggling to get my head around what is used for what, when to use something and why. should i be subclassing my own playhead to use for a transport or should i just be managing my own position info?

apologies in advance for the repost, i posted this as a pure juce question but thought it would be worth reposting as a tracktion question as you guys have had more experience developing this type of thing

Here is an example how to run tracktion_engine inside a plugin tracktion_engine/examples/EngineInPluginDemo at develop · Tracktion/tracktion_engine · GitHub

Here is a class you’re after tracktion_ExternalPlayheadSynchroniser.h. It will sync Edit’s playhead position to the Host.

1 Like

thanks for this! i must’ve missed them. i’m still a little bit confused though and don’t really feel this fully answered my question

The best way to wrap your head around traction_engine is to play with a Waveform DAW. It has a nice GUI which closely represents model used by the engine.

There are at least few ways how you can build an arpegiator with traction.

  • Build custom Arpegiator Plugin extending te::Plugin and handle syncing to host just like in simple juce plugin
  • Build te::RackType and use Step Modifier for sequencer
  • Use te::Clips and routing between multiple Tracks

I advice you to try to build what you looking for in Waveform first. I makes it easy to break down where you need to start with traction_engine. What step exactly are need to implement what you want to achieve.

Hi @jaketyler1993, I’m not sure what your specific problem is as @dikadk13 shared, the EngineInPluginDemo shows exactly how to sync a Tracktion Engine playhead with a juce:: AudioPlayhead.

The simplest answer is that TE has it’s own Transport/Playhead and you need to sync it up (by starting/stopping/setting position etc.) to your own app in whatever way makes the most sense to you.

As you can see from the EngineInPlugin demo, that syncs the TE transport to the juce::AudioPlayhead transport in the plugin’s audio callback. For apps, you probably just want to control the TE TransportControl directly as it’s relatively high level.