I found a way. Keep in mind you should only use it for singlecomponent.
It is very complicated. You need a custom control which is mapped to a custom controller. You can map a pointer to the synth in MyController. When the view is created you map a pointer to the pointer.
class MyController : public VSTGUI::IController
{
public:
/** KnobLinkController constructor
\param _parentController - pointer to the parent controller so we can forward messages to it
*/
MyController(IController* _parentController, T2Audio* synpointer, VSTGUI::VST3Editor* editorpointer)
{
parentController = _parentController; // --- save the parent listener
syn = synpointer;
editor = editorpointer;
}
//--- is called when a view is created -----
VSTGUI::CView* verifyView (VSTGUI::CView* view, const VSTGUI::UIAttributes& ,const VSTGUI::IUIDescription* ) override
{
/*
if (VSTGUI::CTextEdit* te = dynamic_cast<VSTGUI::CTextEdit*> (view))
{
// this allows us to keep a pointer of the text edit view
//textEdit = te;
// add this as listener in order to get viewWillDelete and viewLostFocus calls
//textEdit->registerViewListener(this);
//textEdit->setText(str.text8());
}*/
if (VSTGUI::COptionMenu* om = dynamic_cast<VSTGUI::COptionMenu*> (view))
{
if (om->getTag() == kPatchSelect) om->setNbItemsPerColumn(32);
if (om->getTag() == kFilterType) om->setNbItemsPerColumn(22);
if (om->getTag() == kOsc1Wave || om->getTag() == kOsc1Wave) om->setNbItemsPerColumn(29);
}
if (VSTGUI::MyWavedisplay* wd = dynamic_cast<VSTGUI::MyWavedisplay*> (view))
{
if (wd->getTag() == kOsc1Wave)
{
wd->waveformpointer = syn->wtblf[0];
wd->pwmpointer = &syn->currentPwmDisplay1;
wd->partialspointer = &syn->currentPartialsDisplay1;
wd->phasepointer = &syn->currentPhaseDisplay1;
wd->waveformNRpointer = &syn->currentWaveformNRDisplay1;
wd->modNRpointer = &syn->currentModNRDisplay1;
}
if (wd->getTag() == kOsc2Wave)
{
wd->waveformpointer = syn->wtblf[1];
wd->pwmpointer = &syn->currentPwmDisplay2;
wd->partialspointer = &syn->currentPartialsDisplay2;
wd->phasepointer = &syn->currentPhaseDisplay2;
wd->waveformNRpointer = &syn->currentWaveformNRDisplay2;
wd->modNRpointer = &syn->currentModNRDisplay2;
}
}
return view;
}
Just for your interest: This solution may show your waveform display out of time (much earlier than it comes out of the speakers) if your plug-in is in a graph with high latency. A solution that compensate for latency is possible, but indeed something not that easy.
@MarkusK I suppose I misunderstood what you were trying to do. I thought you had data in the RT code that you wanted to share in the UI and unless I am mistaken that is not what you are doing. Or is it?
What is this T2Audio* pointer? How do you get it? Is it shared between RT code and UI? If so how do you do that? The only way I have found to share data was to send messages.
class T2Audio : public SingleComponentEffect, public VSTGUI::VST3EditorDelegate, public IMidiMapping
it’s like the ADelay from the single-component version.
class MyController : public VSTGUI::IController
{
public:
/** KnobLinkController constructor
\param _parentController - pointer to the parent controller so we can forward messages to it /
MyController(IController _parentController, T2Audio* synpointer, VSTGUI::VST3Editor* editorpointer)
{
parentController = _parentController; // — save the parent listener
syn = synpointer;
editor = editorpointer;
}
…