VST and Mouse

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

Post

I've been writing a control for a VST plugin, but I'm having a bit of trouble trying to figure out the best way of capturing mouse events.

The VST gui library 'calls' functions when there are things like a mouse click or a mouse wheel event, but not when there is a mouse move event.

What I need to do is figure out when the mouse is hovering over a particular region of the screen (e.g. a handle on an envelope), avoiding using platform specific messages / functions.

I've wondered if you might be able to do this in the 'idle()' function, and check the mouse position at each call, figure out if it has changed, and then call some function to elucidate which control/area the mouse is over.

The problem is that I can't figure out what the most efficient way of doing this is? Some sort of tree hierachy / clustering?

One other (possibly related) thing I want to avoid is trapping the gui in some 'do loop' when doing an edit - like the standard vstgui knob does. I don't think it looks too good when the entire gui gets stalled just because you are editing a parameter. In FL Studio, the entire GUI in the rest of the app stops updating when this happens.

Post

anyone?

Post

anything you do should be based on simple windows messaging (sending/handling messages).

VSTGUI should be banned as it indeed dumbly enters a loop (in the main thread!) when you tweak a knob, preventing the app itself to keep running. This is very bad and, I suspect, Mac-style.

Post

Thanks for the response gol!

I do want to try and make it platform independent though, so was thinking of doing some sort of polling scheme using the idle() function? Or is this fundamentally floored in some way? I'm thinking of writing some classes for Qt for doing VST (or FL plugin) gui's, so could use the signal/slot mechanism (similar effect to _closure pointers in borlands c++).

The main thing I'm not sure on is how to rapidly figure out what control the mouse is hovering over.

Gol, do you know how Robert Conde did it in the WaveTraveller when adjusting the spline? Is each handle a window?

Post

polling scheme using the idle() function? Or is this fundamentally floored in some way?
yes, it sucks
it should work on messages. Windows apps are basically a running message polling loop in themselves (for their main GUI thread).
The main thing I'm not sure on is how to rapidly figure out what control the mouse is hovering over
you just, whenever the mouse is moved, check what's under it. Unless you have 10.000 points you shouldn't care about optimizing that

Post

I've discovered that Qt has a QMouseEvent class that will give a mouse move event if QWidget::setMouseTracking() has been called, and it is totally platform independent. I'll use that and let it find the controls for me.

Don't know why the vstgui library doesnt have mouse move events. Madness.

Post Reply

Return to “DSP and Plugin Development”