Parameter float and text! | VSTGUI4 | Forum

Avatar

Please consider registering
guest

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 Topic RSS sp_TopicIcon
Parameter float and text!
Avatar
Member
Members
February 28, 2020 - 11:31 am
Member Since: September 15, 2015
Forum Posts: 20
sp_UserOfflineSmall Offline

I have a parameter which goes from 0.0 to 4.0.  However, when displaying (in the GUI less front end and the GUI textedit) I want it to show 'off' when the value is 0.0 and the floating point value otherwise.

In the olden days of VST2 and VSTGUI3, I used to use setStringConvert to have a function that would provide the text for my textedit box, and setParameterDisplay in the VST2 code to provide the correctly formatted text (either number of text) for this.  

Using ASPiK and VSTGUI4, am I fixed to either a floating point value, or text enum type display or is there a way of providing more custom text for displaying?  Or do I need to make a new custom textedit that does what I want (which seems a bit overkill compared to VST2 and VSTGUI3)

Hope that makes sense!

cheers

Bruce

Avatar
Member
Members
February 28, 2020 - 11:56 am
Member Since: September 15, 2015
Forum Posts: 20
sp_UserOfflineSmall Offline

looking at the code....perhaps I could make a new Plugin Parameter class and override the

getControlValueAsString function........

Avatar
Member
Members
March 2, 2020 - 1:01 pm
Member Since: September 15, 2015
Forum Posts: 20
sp_UserOfflineSmall Offline

currently, I've got it working by adding code to catch the parameter ID and value in the bottom of the getControlValueAsString() function in pluginparameter.cpp

 (but this feels very wrong!)

    if(controlID==6 && value==0.0f)

        formattedString = "off";

    return formattedString;

Avatar
Admin
March 3, 2020 - 11:10 am
Member Since: January 29, 2017
Forum Posts: 689
sp_UserOfflineSmall Offline

Hey - yes that would be a case for doing a custom VSTGUI control to subclass CEditBox object. This would actually be fairly simple because you would only need to override the onDraw( ) feature and insert the OFF text when the value hits 0.0. I can look into this next week when we have spring break and I will have more free time. 

But it might make a nice exercise for you to get into the Custom View paradigm (there is an override of the CAnimKnob in the sample code). 

Will 

Avatar
Member
Members
March 4, 2020 - 9:15 am
Member Since: September 15, 2015
Forum Posts: 20
sp_UserOfflineSmall Offline

Thanks, Will.  I'm starting to understand the structure of it all a bit better now.  Your custom controls/views are very useful as examples :-). I'm currently playing with the XYPadEx control in order to limit the drawing of the puk to a circle, rather than the full square, which has been an interesting exercise. 

cheers

Bruce

Forum Timezone: America/New_York

Most Users Ever Online: 152

Currently Online:
5 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Chaes: 56

Skyler: 48

StevieD: 46

Derek: 46

Frodson: 45

Peter: 43

TheSmile: 43

Nickolai: 43

clau_ste: 39

jeanlecode: 37

Member Stats:

Guest Posters: 1

Members: 768

Moderators: 1

Admins: 6

Forum Stats:

Groups: 13

Forums: 42

Topics: 842

Posts: 3347

Moderators: W Pirkle: 689