Sunvox Lib: getting min and max values for controller?

Post Reply
turbobasic
Posts: 5
Joined: Fri Dec 06, 2019 5:22 pm

Sunvox Lib: getting min and max values for controller?

Post by turbobasic »

Getting the min and max values of each controller is not possible in current version of sunvox lib.

I found a particluarly nasty workaround: For each module and each controller i assign them min and max values through note pointers I get from sv_get_pattern_data. Then I check the values that actually got written with sv_get_module_ctl_value. I get the min and max value and I can send proper values to the controllers. The nastiness of this solution is surpassed only by its' kindaworkingflawlesslyness.

This would be way easier if something like sv_get_module_ctl_value_min and sv_get_module_ctl_value_max existed.

cheers!
maks
Posts: 43
Joined: Sat Mar 26, 2022 4:28 am

Re: Sunvox Lib: getting min and max values for controller?

Post by maks »

@NightRadio I just got stuck on this myself. It also seems to be a bit different for each controller what values they accept via sv_send_event
eg. for Analog Generator, I can set the "real" values (1,2,3 , etc) for the Waveform controller, but for the Panning controller it seems I can only send the "scaled" values (0-8000)

Does that sound correct or may I have missed something in the docs?

The reason I'm trying to do this is I'm sending values based on turning a dial on a midi controller, so my code currently gets the value with sv_get_module_ctl_value and then needs to increment/decrement it by a value and then set with sv_send_event but I can't seem to just inc/dec by 1 for all controllers, so of for Waveform but not for Panning.

Any help would be much appreciated.
maks
Posts: 43
Joined: Sat Mar 26, 2022 4:28 am

Re: Sunvox Lib: getting min and max values for controller?

Post by maks »

As a workaround I guess I can make a table of all the controller names to map which ones use "real" vs "scaled" values and using sv_get_module_ctl_name() decide on which type of value to use, but hoping there is a better way?
maks
Posts: 43
Joined: Sat Mar 26, 2022 4:28 am

Re: Sunvox Lib: getting min and max values for controller?

Post by maks »

Actually I think I'm going to need to setup this mapping for controllers and possible values in my code no matter what, as I need to be able to map from values for specific controllers to strings, for example in Analog Generators Waveform controller, I'll want to show "triangle", "saw", "square", etc not just 1,2,3.
User avatar
NightRadio
Site Admin
Posts: 3941
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: Sunvox Lib: getting min and max values for controller?

Post by NightRadio »

maks wrote: Mon Oct 17, 2022 6:52 am @NightRadio I just got stuck on this myself. It also seems to be a bit different for each controller what values they accept via sv_send_event
eg. for Analog Generator, I can set the "real" values (1,2,3 , etc) for the Waveform controller, but for the Panning controller it seems I can only send the "scaled" values (0-8000)

Does that sound correct or may I have missed something in the docs?
You are right. Some values are scaled to the range 0...0x8000, and some are not.
Open SunVox and check the controller slider. You will something like:
02.Waveform
square (2)

The value in brackets is what you have to write in the pattern's XXYY field or in the sv_send_event() function.
In the example above, this is the real value.
Another example:
03.Panning
12 (4600)

Here the value is scaled.

In the new version of the library the following functions will be added:
sv_set_module_ctl_value( int slot, int mod_num, int ctl_num, int val ) - set controller value, where the val is always real (not scaled).
sv_get_module_ctl_type( int slot, int mod_num, int ctl_num ) - return values: 0 - scaled; 1 - real;
maks
Posts: 43
Joined: Sat Mar 26, 2022 4:28 am

Re: Sunvox Lib: getting min and max values for controller?

Post by maks »

Brilliant, having those 2 new functions will make it much easier, thanks Alexander!

I won't ask when the new version of the library will be available, but I am *excitedly* looking forward to the next version! :-)
Post Reply