/ VST Home / Technical Documentation
Provide a RunLoop on Linux
On this page:
On Linux, there is no global event run loop like on Windows and macOS. For this reason, the plug-in can query for an Linux::IRunLoop which must be provided by the host application in two different ways.
Query IRunLoop from IPlugFrame
The host application must provide the Linux::IRunLoop via IPlugFrame (by calling IPlugView::setFrame).
// Plug-in implementation
tresult PLUGIN_API MyPlugView::setFrame (Steinberg::IPlugFrame* frame)
{
...
Steinberg::FUnknownPtr<Steinberg::Linux::IRunLoop> runLoop (plugFrame);
if (runLoop)
{
runLoop->registerEventHandler (...);
}
...
}
Query IRunLoop from the host context of IPlugFactory3
A plug-in also needs a way to query for an Linux::IRunLoop without IPlugFrame. This allows to register timers in case the editor is closed or unavailable.
These timers can be used inside Vst::IAudioProcessor for extra computations or sending messages within the UI thread.
The host application must call Vst::IPlugFactory3::setHostContext (context) for this and provide a context
. This context
can be used to query an Linux::IRunLoop interface.
// Plug-in implementation
tresult PLUGIN_API MyPlugFactory::setHostContext (FUnknown* context)
{
...
Steinberg::FUnknownPtr<Steinberg::Linux::IRunLoop> runLoop (context);
if (runLoop)
{
runLoop->registerTimer (...);
}
...
}