/ VST Home / Technical Documentation

[3.8.1] Transport Control

On this page:

Related pages:


Introduction

This interface Vst:: ITransportControl allows a plug-in to request transport-related actions from the host.

Typical use cases include:

  • Jumping (locating) to a position
  • Starting or stopping playback or recording
  • Adjusting loop/cycle regions
  • Enabling or disabling cycle playback

All calls must be made from the UI thread. Hosts may accept or deny requests depending on their internal policies or the current editing mode (e.g., offline rendering, write-protected state, etc.).

Example

In mycontroller.cpp

bool mycontroller::startPlayback ()
{
    // the hostContext was given in the function ComponentBase::initialize (FUnknown* context)
    if (!hostContext)
        return false;

    Vst::ITransportControl* transportControl = nullptr;
    hostContext->queryInterface (Vst::ITransportControl::iid, (void**)&transportControl);

	if (transportControl && transportControl->isActionSupported (Vst::ITransportControl::PlaybackStart) == kResultTrue)
	{
        transportControl->requestAction (Vst::ITransportControl::PlaybackStart);
        return true;
    }
    return false;
}