Open Andy2No opened 1 year ago
I have to check - normally, when you have implemented numberFromDump() it should take precedence over the running number during an import. Can you post your adaptation and maybe a dump file so I can give it a try?
I think you're on to something bigger here :-)
Some intermediate results:
What different type of numbers do we have?
We have different import methods, which count differently as well.
To fix this mess, we need to find all places where the PatchHolder class is created (this is the class that determines what is stored in the database).
Thanks. I only just read that, as I was about to add the dump and adaptation you asked for... Maybe I should put those in a discussion thread instead, since it's a universal behaviour, not specific to what I've done - just to any situation where there isn't a full set of consecutively numbered patches from the start up to the final one in a dump.
I think this is also probably going to apply to the Waldorf Pulse II, if I ever get any further with that one. At best, I expect patches missing where the init ones are. On mine that's a block of 80 or 90, towards the end of the range of patch numbers, with some non-blank ones at the high end.
I'll start a new discussion thread for the Pro-800 adaptation (such as it is) soon - I'm a bit tired now.
Wasp's nest. But I finally need to clean this up:
The fun really starts when looking at the names as well:
What is the expected behavior?
Uff.
I'd suggest let the adaptation decide how to display it, whenever that's an option. If it's in a list which doesn't display a number, then there's no need to ask the adaptation what to do, but otherwise I think it's best to pass the full "message" - as much of the database entry as an adaptation function can be shown, plus a context flag, to determine different cases.
For example, if friendlyProgramName() was passed the same "message" as numberFromDump(message), I would be able to show the actual bank and program slot number as appropriate for the synth - or any other. If it needs to display different things in different circumstances, that's where the context flag comes in - e.g. an enumerated type (or Python equivalent) or a short string constant or single character.
If the adaptation doesn't care about the context, then maybe it should be allowed to always show the same thing, if it wants to - if "message" is a program dump or an edit buffer dump then the adaptation will know what it wants to show, with the option of changing that behaviour based on the context.
Since existing adaptations already use friendlyProgramName(program), keep that as it is, but keep it optional and add another optional function with more flexibility, e.g.
def flexibleProgramName(program, message, context)
As for some synths having a program number within a bank, but no bank name / number, I think it's better for the adaptation to be able to decide what to do for that particular synth - e.g. just show the program number, without a bank.
So, to summarise, give the adaptation programmer the ability to do what he or she wants, for that particular adaptation, where appropriate. If there are circumstances where the Orm needs to override that, then fair enough, do that instead.
@Andy2No Good idea with the new program function taking the message. This is a bigger change - I tried to fix the original problem that for adaptations numberFromDump() was never called in the 2.0.6 release. Please give it a spin and see if it makes a difference for you!
Fantastic! It worked first time, without any modification to my adaptation code :)
The ones that have blank names here are supposed to be like that - that's how an edited patch looks when you import the dump. All the patches are correctly numbered. A0-99 are the stock ones, but can all be overwritten. I might add a leading zero to the single digit ones, to match the display on the synth, otherwise it does all it needs to do, for now, for that synth. Renaming still works too.
I started trying to make a partial adaptation for the Behringer Pro 800, initially intended to allow patches to be named, which can't be done from the synth. Most of the sysex details have been kept secret, so far, so it can't do everything that an adaptation should. Patches can only be exported from the synth by asking for a full dump, from the front panel Global Settings menu.
I found that the patch numbers shown in the Library tab don't correspond to the ones in the patch, and can't because friendlyProgramName(program) is only ever passed an arbitrary number during the import from file process, which is just a count of where the import is up to, not actually a real patch number. Blank / init patches are not included in the dump, so the count is wrong as soon as there's a gap.
What I would need, to make this work, is a way of being passed the whole patch (message), not just the potentially wrong number, so the python code can extract the actual patch number. Perhaps the best way to approach this would be to allow an optional function to do that, which is called in preference to friendlyProgramName() if defined, e.g.
def friendlyProgramNameFromPatch(message)
I started this as a discussion, and there are more details there - #258