On Sat, 15 Apr 2023 12:42:35 +0200
Kristian Amlie <krist...@amlie.name> wrote:

>On 13.04.2023 19:14, Will Godfrey wrote:
>> This latest deep dive I'm on has uncovered yet another anomaly :(
>> 
>> All the 0 to 127  value ranges as well as being received from MIDI as chars 
>> are
>> also saved in XML files as chars. Added to which the original defaults
>> are set as chars.
>> However, internally many of them are handled as floats (or were originally).
>> Unaware of this, over the years I've changed some of the GUI controls to 
>> chars
>> for (what I believed was) consistency. I think others have too on occasion -
>> leastways there are some I don't recognise.
>> 
>> The point is, (even without my changes) with all of these you were NEVER able
>> to recover exactly what you'd set! That goes right back to Zyn 2.2.1
>> 
>> Now while going through the limits stuff I can dig out and correct mistaken
>> changes but what do we do about the XML files?  
>
>Admittedly I've never looked into the details, but I've been pondering 
>about this in the past, and I naively assumed that we can distinguish 
>chars from floats in the XML by looking at whether it has a decimal 
>point. So I reckon we could just start storing all floats like this. 
>This should even be backwards compatible; the old client should be able 
>to load the floats, albeit at a somewhat reduced accuracy.
>
>But again, this is my naive idea, I've not actually tried this.

Unfortunately not. These are stored as a text representation with the type
specified. In fact, in the really old days reloading floats was a bit
hit-and-miss, as it's difficult to get accurate conversion of text to float.
Mark McCurry got round this by adding an extension representing the binary
equivalent, and these days, that's what we actually read (if it is there).

It may be possible to do something similar with chars. Possibly save the float
converted to char, but add the extension for the actual value. If I'm right, an
older version would just see the char, but newer ones could read the extension
instead.

When saving, we would then need to identify things like counters that really
are just chars, and simply not add the extension.

Seems a bit convoluted, but certainly do-able.

P.S.
I added a special bit for the tuning values in Scales, we display the
returned text in the window, but actually use the extension. This is done so
that people don't get confused when they save a file with (say) 0702.000000 but
previously it would come back as 0701.999851


-- 
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
Yoshimi-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/yoshimi-devel

Reply via email to