I've poured through the advanced GUI tutorials - and created tons of errors trying to find a way to make a new instance of the XY Pad in order to make it transparent, so I can overlay it on top of a grid or some other graphic. I also wanted to tweak the puck or maybe even exchange it for another .png to make it fit the GUI better, but I have no clue where to start.
Does anybody know if there is a way to do this - or at least can point me to a tutorial I may have missed?
You can set the background of the XY-Pad with any PNG. I did that in the synth book for the VectorSynth and AniSynth, overlaying a grid on top of it. You just call setBackground( ) and pass it a CBitmap* - it is defined in the CView:
void CView::setBackground (CBitmap* background)
The puck is kind of interesting. Its size is based on the setting for the round-rect attribute, which rounds the corners of the XYPad outline (frame). As you make the round-rect radius larger, the puck grows in size and is not based on a PNG image. You can find all this in the draw() function for CXYPad. The puck is drawn with the primitive drawing method called ellipse( ). See line 20 of xypad.cpp (that is the line number in the latest version of VSTGUI which is 4.6).
void CXYPad::draw (CDrawContext* context)
You can definitely customize this control. If you wanted to use a PNG file for the puck, you would need to override draw( ) for sure, and you'd need to use a CustomView and a subclassed CXYPad, with a mechanism for getting the PNG into the object.Â
If you export your plugin as a VST3 with RackAFX, you can find my own subclass of CXYPad in the XYPadWP.h and .cpp files. I altered it to be able to draw the pad in a diamond shape, the same as the original vector joystick on the ProphetVS and Wavestation synths. You can also find where it is instantiated as a CustomView.Â
Thank you for the detailed answer!
That is a lot more of a cohesive way versus trying to do it via editing the .xml file. Though I did set the background color to transparent (by setting its rgba values from ....ff to ....00), it would be easier to just insert the bitmap directly (plus resizing won't be as nightmarish).
I'll have to get more familiar with subclassing, so your example derived from the VST3 export sounds perfect.
Actually, you can do it in XML by setting the "bitmap" attribute of the XYPad:
<view back-color="~ BlackCColor" background-offset="1, 0" bitmap="vsjstick2" class="CXYPad" default-value="0.5" font="~ SystemFont" -- blah blah blah
The bitmap here isÂ vsjstick2 and is declared in the bitmap chunk of the XML file:
<bitmap name="vsjstick2" path="vsjstick2.png"/>
That is handy! I'm comfortable messing with the .xml files, so that can make life easier.
On a semi-related note, I noticed that since I gave some controls to the XY pad, I can no longer save the settings in my DAW as a preset. I assume the DAW maybe doesn't get the parameters from the XY Pad.
Is there a way to set it up so parameters can be saved in an arbitrary DAW?
It turned out to be an error on my part. I had set up a preset dropdown, however I had not resolved the default behavior correctly. Once I temporarily commented out that part of the code it worked perfectly. Sorry - I may have created some undue concern. So far I have only been messing with developing VSTs.
Nevertheless, any concern I have about the API (real or imagined) I'll share it for whatever fix is needed or so I could learn from my mistakes - whichever is applicable at the time. Definitely the latter applies in this particular case.
Thanks for the help!
Most Users Ever Online: 152
Currently Browsing this Page:
Guest Posters: 2
Moderators: W Pirkle: 693