garvalf wrote:The manual also says "Any patterns not used in the sequence will not be saved in your module file, and will be lost when you exit Bintracker or load another track.".
I find this very dangerous! Deflemask is doing the same and I've already lost some patterns because of this. Is there a reason you can't keep it in the mdal file? It wouldn't cost much space in the source file. I would find this more secure. Yet, when I've loaded my mdal file, all my cloned patterns, which are not used in the sequence, were still present in the file.
I realize now that this is a much more significant problem than I thought. The problem is this: When you save a song in bintracker, it will iterate over the existing blocks (patterns/tables/etc) and save all of them to the file, whether they are used or not. However, when you load that file back into bintracker, MDAL does the parsing, and MDAL determines the block type from the usage context, which means for blocks that aren't referenced either in the sequence or by a command, the block type cannot be determined. So consequently those non-referenced blocks will be ignored, and will be lost the next time you save your song.
This is something that needs to be addressed in the upcoming new MDAL version 2 standard, but I haven't found a good solution to the problem yet. Actually in MDAL2 things will be worse, since there will be a new abstraction layer between user input and data output. Eg. right now, an input block is directly converted into an output block, but in MDAL2 this will be different. There will be abstract "input blocks" which are then converted into "output blocks" in multiple ways. Take for example PhaseSqueek: Right now, writing FxTables is very inconvenient, because the entire set of commands is affected. With the new abstraction layer, you will be able to write seperate tables for each channel or maybe even each command, and MDAL will take care of merging them into the actual FxTable blocks. tl;dr, we'll see a lot more different blocktypes in MDAL2.
So, as I said, I'm still looking for a solution for this problem, and I'd very much appreciate some input on this issue. Right now I'm leaning towards
requiring MDAL block names to be prefixed with the input blocktype name, eg. instead of ":pattern1", you'd write something like "PATTERNS:pattern1". Probably even go further and ditch pattern names (can you imagine writing a sequence for ZX-16 using pattern names?), so the new syntax would be something like "PATTERNS:01". (Actual pattern names would be implemented as a command, in this case.) However, this could get rather messy and unintuitive for users, considering that there might be a large number of input block types, and implementations will vary quite a bit depending on the engine. Eg. in ZX-16, there should be one single input blocktype (called eg. PATTERNS, containing one NOTE command and one SLIDE command), which can be used for each of the 16 channels. In engines with channels that have different capabilities (think Phaser1 for example), there could be different input blocktypes for each channel. So then we'd have "PATTERNS_CH1:xx", "PATTERNS_CH2:xx", and so forth - not exactly user-friendly imo. On the other hand, it'd be easier to avoid namespace clashes that way, which is actually a thing in MDAL1: It's perfectly legal to give the same name to a pattern and an non-pattern block, and theoretically the parser should magically figure out which is which, which doesn't happen of course.
Another solution would be to generate a list of unused blocks for each blocktype when saving a module. However, as mentioned before, I believe named patterns should probably go, because there are several problems with them.