On Wed, 5 Apr 2023 16:29:19 +0200
Kristian Amlie <[email protected]> wrote:

>On 04.04.2023 23:05, Will Godfrey wrote:
>> This is a topic that's been mentioned before.
>> 
>> We do have this in place, but with hindsight I think I went about it the 
>> wrong
>> way.
>> 
>> My suggestion for an alternative would be a static header file with mini
>> functions that would take three parameters by reference and return them as 
>> min,
>> max, default. These would have to be floats to handle all types. At the same
>> time they could return a char with the bits set to denote whether this is to 
>> be
>> regarded as an integer and whether it is MIDI learnable. If I understand this
>> right the calling function could also send NULL for entries it wasn't
>> interested in.
>> 
>> Like this it would be readable everywhere without significant overhead.
>> 
>> e.g.
>> 
>> // some function
>> float default;
>> char flags = limits::partvolume(NULL, NULL, default);
>> // other stuff
>> 
>> // another function
>> float min, max;
>> limits::voicedetune(min, max, NULL);
>> // other stuff
>> 
>> Does this seem workable?
>> Could it be done better?  
>
>I'm afraid I don't recall the original discussion, so it's possible I'm 
>completely off the mark here, but won't it suffice to simply have a 
>struct of values? Then you can access them directly where you need them, 
>instead of first having to declare a variable, then assign to it, then 
>use it.
>
>So like this:
>
>```
>static-header-file.h:
>
>struct MixMaxDefault {
>   float min;
>   float max;
>   float default;
>};
>
>struct Limits {
>   MinMaxDefault partvolume {0, 127, 64};
>   MinMaxDefault voicedetune {-64, 64, 0};
>};
>
>--------------
>
>ui-file.fl
>function() {
>   SetVolume(Limits.partvolume.default);
>}
>
>```
>
>MinMaxDefault could also be a template if you need more types than just 
>floats.
>

Ah yes!
Sometimes one doesn't see the wood for the trees :P
It would need anther char (or maybe two bools) for the 'learnable' and 'regard
as int' flags.

-- 
Will J Godfrey {apparently now an 'elderly'}
https://willgodfrey.bandcamp.com/
http://yoshimi.github.io
Say you have a poem and I have a tune.
Exchange them and we can both have a poem, a tune, and a song.


_______________________________________________
Yoshimi-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/yoshimi-devel

Reply via email to