Hello! I’m updating a module to fix some backward-incompatibilities between older versions.
When loading older patches, an entry like this is added to the log file by VCV Rack:
[13.514 info src/engine/Module.cpp:167 fromJson] Patch created with voxglitch v1.32.0, currently using v2.21.1.
Is there any way that I can access this information from within the code? In other words, is there any function or callback which will alert me when an older version of my modules is being loaded?
I’d like to write code that says something like:
If a patch using voxglitch version less than 2.20.1 is being loaded, then...
If you already save your own json you are cool. read it back - if the schema number isn’t there, then it’s the OG 1.0 versions. Then for new stuff, just write back “schema”: 2 or something and your are cool.
If you just use params you can do the same thing, but there you need a params “schema” that is set to 1.0 from the get-to.
Unfortunately, the schema remained the same. The only difference was that the JSON value changed from an integer to a float. So, what I ended up doing, is checking if the value was greater than “1”, and if so, mapped it to the desired range from 0 to 1.0. This works great… unless the original integer is exactly 1, which is luckily unlikely.
Anyhow, my solution should work, but I was looking for something a bit more elegant.