Trogs Knob (Bitmap)
Posted: Fri Sep 20, 2013 12:26 am
Following on from this thread, where we noticed that the new FS animated knob works rather differently than the old SM one...
Here's a new one that I've just built that uses the same method of reading the bitmap as the old SM one - so should be compatible with all those Knobman stiprs that we've collected over the years.
It also sees the return of some old SM features that have gone missing from the FS stock knob, and a couple of new ones as well.
(NB - Requires at least FS version 3.0.3 Raindrop)
Animation cells work like they used to - every frame gets used as the knob moves from min to max.
Here's a quick run-down of the features/properties...
Load bitmap - erm, loads a bitmap.
Cells - the number of cells - it works out from the bitmap dimensions whether they are arranged horizontally or vertically. To make it even easier to switch between strips, include the cell count in between square brackets in the filename, (e.g. [64]) - the number will then be automatically set.
Frames per sec - there's a redraw speed limiter in there to help keep the GDI CPU load down. This sets the maximum speed that the GUI will get updated.
Mouse sense - how fast the knob moves when you move the mouse. Hold SHIFT while dragging for extra fine control.
Default - the default value; CTRL-click the knob to quickly set the default.
Min, max - the range of the output value (NB - VST automation uses the correct 0..1 range)
Steps, No. Steps - give the knob 'click stops' at regularly spaced values.
Midi - turns Midi Control on. It will respond to whichever controller is set in the CC Number box, on any MIDI channel.
Catchup - enables 'Midi catchup' where you have to move your controller past the current value if iyour hardware starts out pointing in the wrong direction.
Preset name - must be unique!! Also has a wireless String input called 'Preset', so that you can easily prefix the name of a parent module.
Preset, Automate - turn on VST preset memory and/or automation.
Label - a GUI name for the knob. Double click the label to set a new knob value by typing it in. If you leave the label property blank, all the the label related features get disabled to save CPU.
Font & colour for the label.
Position - where the label appears relative to the knob.
Units, Places - if you have set a label, moving the knob or sending Midi will show the current value for a moment in the label area. These properties set the number of decimal places to show and units to follow the number These settings are also sent to the VST 'display' input, so your host can show meaningful values.
Although the Ruby code looks quite long, it's designed so that as little as possible is processed when the value changes - so there should only be the redraws and output triggers that are absolutely necessary. Most of the code is just memorising a load of calculations that happen when the properties or bitmap are changed.
The little 'REFRESH BITMAPS' module will connect wirelessly to as many knobs as you like - a quick way to refresh the graphics if you've edited the image files (so long as you keep the same filenames!).
NB) Something not mentioned in the manual that was catching me out...
In the Ruby section about 'Mouse capture and dragging', there's an example to show how you use the 'mouseCapture' and 'releaseMouse' commands - and it isn't quite right.
It shows 'releaseMouse' used inside the 'MouseLUp' method - but this doesn't work properly, because mouseLUp only gets called if the mouse is actually over the current mouse area. If you drag outside that area and then release the mouse, 'mouseLUp' doesn't happen
The correct method to use is 'mouseLUpCaptured(x,y)' - that one WILL get called no matter where you are on screen when the drag ends!
Here's a new one that I've just built that uses the same method of reading the bitmap as the old SM one - so should be compatible with all those Knobman stiprs that we've collected over the years.
It also sees the return of some old SM features that have gone missing from the FS stock knob, and a couple of new ones as well.
(NB - Requires at least FS version 3.0.3 Raindrop)
Animation cells work like they used to - every frame gets used as the knob moves from min to max.
Here's a quick run-down of the features/properties...
Load bitmap - erm, loads a bitmap.
Cells - the number of cells - it works out from the bitmap dimensions whether they are arranged horizontally or vertically. To make it even easier to switch between strips, include the cell count in between square brackets in the filename, (e.g. [64]) - the number will then be automatically set.
Frames per sec - there's a redraw speed limiter in there to help keep the GDI CPU load down. This sets the maximum speed that the GUI will get updated.
Mouse sense - how fast the knob moves when you move the mouse. Hold SHIFT while dragging for extra fine control.
Default - the default value; CTRL-click the knob to quickly set the default.
Min, max - the range of the output value (NB - VST automation uses the correct 0..1 range)
Steps, No. Steps - give the knob 'click stops' at regularly spaced values.
Midi - turns Midi Control on. It will respond to whichever controller is set in the CC Number box, on any MIDI channel.
Catchup - enables 'Midi catchup' where you have to move your controller past the current value if iyour hardware starts out pointing in the wrong direction.
Preset name - must be unique!! Also has a wireless String input called 'Preset', so that you can easily prefix the name of a parent module.
Preset, Automate - turn on VST preset memory and/or automation.
Label - a GUI name for the knob. Double click the label to set a new knob value by typing it in. If you leave the label property blank, all the the label related features get disabled to save CPU.
Font & colour for the label.
Position - where the label appears relative to the knob.
Units, Places - if you have set a label, moving the knob or sending Midi will show the current value for a moment in the label area. These properties set the number of decimal places to show and units to follow the number These settings are also sent to the VST 'display' input, so your host can show meaningful values.
Although the Ruby code looks quite long, it's designed so that as little as possible is processed when the value changes - so there should only be the redraws and output triggers that are absolutely necessary. Most of the code is just memorising a load of calculations that happen when the properties or bitmap are changed.
The little 'REFRESH BITMAPS' module will connect wirelessly to as many knobs as you like - a quick way to refresh the graphics if you've edited the image files (so long as you keep the same filenames!).
NB) Something not mentioned in the manual that was catching me out...
In the Ruby section about 'Mouse capture and dragging', there's an example to show how you use the 'mouseCapture' and 'releaseMouse' commands - and it isn't quite right.
It shows 'releaseMouse' used inside the 'MouseLUp' method - but this doesn't work properly, because mouseLUp only gets called if the mouse is actually over the current mouse area. If you drag outside that area and then release the mouse, 'mouseLUp' doesn't happen
The correct method to use is 'mouseLUpCaptured(x,y)' - that one WILL get called no matter where you are on screen when the drag ends!