Hi, guys!
VSTGUI 4
By default knobs are changed by circular mouse movements..
How to change it to linear?
Linear default knob mode in VSTGUI 4? (vs circular)
- KVRAF
- 12555 posts since 7 Dec, 2004
I'm not familiar with VSTGUI, but checking the source knob.cpp is probably a good bet:
https://github.com/steinbergmedia/vstgu ... /cknob.cpp
Seems to be bool CKnobBase::MouseEditingState::modeLinear, from line #137 cknob.cpp:
... so we need to find where mode is defined and use the accessor such as knob->setMode(kLinearMode | knob->getMode()); or something similar. VSTGUI is one nasty bit of code and the first thing I'd do if I had to use it is a major refactor almost completely rewriting some significant portions.
Ah I see it was right there, line #125 it does some ridiculous shuffling from getFrame()->getKnobMode();
So this tells me there may not be any way to set the mode or parameters for specific widgets/controls in VSTGUI which isn't surprising really. You probably want to call getFrame()->setKnobMode(kLinearMode) or similar during construction/population of the GUI where you have access to this "frame" object which is I guess a dumb name for a window or region? I assume if the widget has a pointer or reference it must've been assigned during construction at some point.
You'll probably find that the mode you set manually is overridden elsewhere though, so even if you did set it in the constructor it might have no effect. Now you get to dig around in the VSTGUI code until you can figure out all the convoluted paths and structures and functions involved for this one simple parameter.
https://github.com/steinbergmedia/vstgu ... /cknob.cpp
Seems to be bool CKnobBase::MouseEditingState::modeLinear, from line #137 cknob.cpp:
Code: Select all
if (mode == kLinearMode)
{
if (buttons & kZoomModifier)
mouseState.range *= zoomFactor;
mouseState.lastPoint = where;
mouseState.modeLinear = true;
Ah I see it was right there, line #125 it does some ridiculous shuffling from getFrame()->getKnobMode();
So this tells me there may not be any way to set the mode or parameters for specific widgets/controls in VSTGUI which isn't surprising really. You probably want to call getFrame()->setKnobMode(kLinearMode) or similar during construction/population of the GUI where you have access to this "frame" object which is I guess a dumb name for a window or region? I assume if the widget has a pointer or reference it must've been assigned during construction at some point.
You'll probably find that the mode you set manually is overridden elsewhere though, so even if you did set it in the constructor it might have no effect. Now you get to dig around in the VSTGUI code until you can figure out all the convoluted paths and structures and functions involved for this one simple parameter.
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
-
- KVRist
- Topic Starter
- 59 posts since 4 Aug, 2007
Somehow I've done it (not sure if it's right way to do it)
Added line
in myplugincontrolller.cpp (I created project with VST3 Project Generator with VSTGUI checkbox on)
Added line
Code: Select all
setKnobMode(Steinberg::Vst::KnobModes::kLinearMode);
Code: Select all
//------------------------------------------------------------------------
IPlugView* PLUGIN_API AlexGainController::createView (FIDString name)
{
// Here the Host wants to open your editor (if you have one)
if (FIDStringsEqual (name, Vst::ViewType::kEditor))
{
// create your editor here and return a IPlugView ptr of it
auto* view = new VSTGUI::VST3Editor (this, "view", "myplugineditor.uidesc");
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
setKnobMode(Steinberg::Vst::KnobModes::kLinearMode);
return view;
}
return nullptr;
}