[yoshimi] Re: Use units when showing values of parameters

  • From: Will Godfrey <willgodfrey@xxxxxxxxxxxxxxx>
  • To: yoshimi@xxxxxxxxxxxxx
  • Date: Sat, 26 Nov 2016 15:24:44 +0000

On Sat, 26 Nov 2016 15:46:29 +0100
Jörn Eichler <joerneichler@xxxxxxx> wrote:

At the end of dev_notes/ToDo.txt I found this:
"LFO frequency should be stated in Hz."

I gave it a try and I have a working version for LFO freq.
The code can be found on my showLFOFrequencyInHz branch on github:
https://github.com/Yoshimi/yoshimi/compare/21d982f6c92fc076399ccaeaeb41907fb7c82e06...heuchi:showLFOFrequencyInHz

I added a function to WidgetPDial, which I called show_custom_value(string). 
This function can be used in the callback code for the controls.

float lfofreq = (powf(2.0f, o->value() * 10.0f) - 1.0f) / 12.0f;
ostringstream oss;
oss.precision(3);
oss << lfofreq << " Hz";
o->show_custom_value(string(oss.str()));

This doesn't look very nice yet, because of the string generation. We might 
add a helper in Misc/MiscFuncs to simplify it. Something like: 

string valueWithUnit(float value, string unit);

Some more controls this could be used for:

Amplitude LFO depth in %
Frequency LFO depth in cents.
Attack, Decay, Release Times in ms

Comments welcome.

Jörn

I will have a look at this one very soon. It's something that's been requested
several times!

-- 
Will J Godfrey
http://www.musically.me.uk
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 source code is available from either: 
http://sourceforge.net/projects/yoshimi
Or: https://github.com/Yoshimi/yoshimi
Our list archive is at: https://www.freelists.org/archive/yoshimi
To post, email to yoshimi@xxxxxxxxxxxxx

Other related posts: