Please consider registering

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —

— Match —

— Forum Options —

Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Making a knob "snap" into set positions
No permission to create posts
September 8, 2016
6:14 am
Forum Posts: 46
Member Since:
November 19, 2015
sp_UserOfflineSmall Offline

Hi all,

I could have sworn I saw a post on here about making knobs snap to specific values as you turn it (as opposed to smooth turning) but I can't find it. Is that possible?


September 8, 2016
4:55 pm
W Pirkle
Forum Posts: 247
Member Since:
January 29, 2017
sp_UserOfflineSmall Offline

Yes, you can do this with the RackAFX GUI Designer for knobs or sliders that are connected to UINT variables for a "clicky" switch-like behavior. This only works for the UINT connected controls, where switch-like behavior would be acceptable. The way to do that is to set the CustomView attribute for the knob or slider in question. These are built-in CustomViews, one for each control:

Knob - set the CustomView attribute to "KnobSwitchView" (no quotes)

Slider - set the CustomView attribute to "SliderSwitchView" (no quotes)

I first implemented these built-in CustomViews because the default VSTGUI behavior was to limit knobs and sliders to the range [0, 1] even when the max variable was set to be >1. This caused the knob or slider graphic to disappear when moved past the 1 position (value).

However, this has been changed in VSTGUI4.3 where the knob or slider will take on the switch-like behavior by default, when linked to a UINT variable. So, the CustomView attributes above work for RackAFX, [Make AU] and [Make AAX]. In [Make VST] the CustomView setting is now ignored (starting with RackAFX v6.8.x and above). Use the [Make VST] operation (RackAFX v6.8.x) on any random project, and then search for "KnobSwitchView" in the processor.cpp file. You can see where I've commented out the behavior - I'm leaving the code intact in case something changes in a future version of VSTGUI4.

If you want to implement this behavior in your own "pure custom GUI" (i.e. not using the RackAFX GUI Designer) then you can copy what I'm doing by looking at the CKnobWP and CSliderWP objects that you get when you do a [Make XXX] operation (it doesn't matter which kind of project you export, they all produce the same set of GUI controls). Check the draw( ) method and look for the m_bSwitchKnob or m_bSwitchSlider flag. You will need to either lift my objects directly (I don't care - go for it), or create your own subclassed Knob or Slider objects to implement.

BTW: I should have the new CustomViewsFive project ready for you to look at that works correctly with VST parameter binding, AU Events and AAX parameter queueing, some time over the weekend. I am currently working on the documentation for it - the example project is complete.

- Will

September 9, 2016
8:23 pm
Forum Posts: 46
Member Since:
November 19, 2015
sp_UserOfflineSmall Offline

Thanks Will!

Forum Timezone: America/New_York

Most Users Ever Online: 36

Currently Online:
6 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Skyler: 48

Derek: 46

Peter: 41

Frodson: 40

clau_ste: 39

Gwen: 32

JimmyM: 30

TheSmile: 27

EZB: 24

lppier: 23

Member Stats:

Guest Posters: 1

Members: 522

Moderators: 1

Admins: 4

Forum Stats:

Groups: 11

Forums: 31

Topics: 545

Posts: 2134

Newest Members:

Bill, hill william, NAUN_SONAR, sufy, Diane, Richard, drvenkman, venkman, Jfx, drorh

Moderators: W Pirkle: 247

Administrators: Tom: 67, JD Young: 80, Will Pirkle: 0, W Pirkle: 247