SDL for VST Instrument Plugin GUI

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

I am a newbie planning on writing a VST Instrument in C++. Have good ground in C++ and was wondering if SDL is ok for making the nice looking GUI from scratch.

Also I appreciate your suggestions on what image format (jpg, png etc) do I choose to use in the plugin be it the control knobs sliders etc?

Suggestions please

Post

Why would you ask that in the Instruments forum instead of in the DSP and Plug-in Development forum?
Last edited by helium on Thu Jun 12, 2014 8:50 am, edited 1 time in total.

Post

helium wrote:Why would you ask that in the Instruments forum instead of in the DSP and Plug-in Development forum?
This
http://www.lelotusbleu.fr Synth Presets

77 Exclusive Soundbanks for 23 synths, 8 Sound Designers, Hours of audio Demos. The Sound you miss might be there

Post

Welcome Vstplay to KVR, I hope you have a great time here.
Posting in the wrong place is an easy mistake to make when you're new to a site but you aren't that far wide of the mark, so you'll probably get some useful replies here anyway [EDIT; it was in instruments].

What the previous posters are saying is you may get a faster, more informed answer in the more relevant forum here; [EDIT; link removed as you have been repositioned here already]

Post

Vstplay wrote:I am a newbie planning on writing a VST Instrument in C++. Have good ground in C++ and was wondering if SDL is ok for making the nice looking GUI from scratch.
Trying to use SDL is probably going to create a lot more problems that it actually solves. You can't really have a custom message loop in any plugin and SDL in general isn't exactly geared towards GUI applications anyway as it's focus is on games, where you typically do things a bit differently. If you're going to be doing everything yourself, it's probably better idea to just wrap around the system directly.. or alternative you might want to consider one of the toolkits specifically designed for plugin purposes (wdl-ol, juce, etc).
Also I appreciate your suggestions on what image format (jpg, png etc) do I choose to use in the plugin be it the control knobs sliders etc?
PNG work well. Jpeg uses lossy compression that is mostly tuned to photographs (where the compression tends to be a bit less visible than with computer rendered graphics) and doesn't support alpha channels (which you might want).

Post

I investigated SDL for use as an openGL platform layer for a plugin UI. The two main issues i found with it were use of global state (so you'd have to compile that statically, and even then I'm not 100% sure you wouldn't run into issues loading multiple instance of the plugin) and lack of support for opening parented windows. I ended up writing all my own platform code.

Still not sure about the first issue, but you could probably hack around the second with a combination of SDL_GetWindowWMInfo() and various OS primitives for re-parenting windows (SetParent() on win32, some mess on OSX I'm sure).

From a cursory glance at the event handling primitives, I don't think you'll run into a ton of trouble there. You'll likely just want to set up an OS level timer (SetTimer() on win32, NSTimer stuff on OSX) to whatever framerate you want, then call SDL_PollEvents() and your draw function whenever the timer fires.

So, I think you could make it work, but it'll take a little manual labor to get things hooked up and playing nice with the VST SDK. If you have some success, report back, I'm curious.
owner/operator LHI Audio

Post

As mystran mentioned, png offers advantages with the alpha channel, for variable transparency overlay of gui elements.

For instance if you wish to make a pretty gui made up of lots of images tiled and stacked, it can be difficult to make a real smooth looking gui without transparency. It can look pretty good with simple masking and overlap, but the borders between image elements can appear pixellated and jaggy, unless you photoshop fine tune all the source images, to precisely fit together. Taking care that each element will not look jaggy when overlayed atop background elements. This can be a challenge if the overlayed images can move in response to user clicks or window resize. Requiring that the foreground elements need to "look like they match up" at many locations, not just a set location hand polished in photoshop.

That can invite extra work, if you decide to change one element, then if the element doesn't sit well with its neighbors, perhaps you end up having to edit the neighboring images as well.

Simple example, a slider control with a background track and a foreground slider thumb. Slider track is drawn atop background picture of the control panel, and slider thumb is drawn over both.

If the track image and slider image are given alpha channel drop shadows or "halos" around the opaque core of each image-- A pixel or three of partial transparency surrounding the control, which fades to full transparency. Full transparency surrounding the outside of each foreground or mid-ground image.

When these elements are drawn over background images, the transparent fades around each core image will smooth the transition between edges and help prevent edges of moving control elements from appearing pixellated and jaggy atop the background.

This can make a foreground control look "good" over a wider variety of backgrounds. So if you decide to move all the controls around or edit the background images, then maybe you will get lucky and not have to edit all the foreground images to fit the new background, or vice versa. :)

Post

Awesome guys, such a wonderful discussion.

I actually just caught up into coding SDL, plugins that AGML makes where strings vibration effects are included and lot of dynamic image loading. They are really sexy, what platform do I choose to begin with ?

I do like to make the elements in my instrument move. I actually hit upon the first google link to VST and SDL and working through that
https://learnvst.wordpress.com/tag/sdl/

I have enough coding experience to get started, I am absolutely fine hard coding every single piece of GUI myself, but the question of what do I even begin with?

GLUT ruled out - not much development
SDL - looks promising
OpenGL - a bit of a pain for the low levelness.

It's all about loading images and making the GUI elements load dynamically.

I will repost this in the DSP and Plugin development forum.... See you there :)

Post

Here's the forked thread of this discussion
http://www.kvraudio.com/forum/viewtopic ... 3&t=413665

Post Reply

Return to “DSP and Plugin Development”