Skip to content

Improve handling of commands embedded in midi files #6

@kitlith

Description

@kitlith

GotaSequenceLib/SMF.cs

Lines 911 to 918 in c2c0510

if (dat.Contains(": ")) {
try {
SequenceCommand c = new SequenceCommand(); //THIS DOES NOT TAKE CARE OF JUMPS AS IT WILL JUMP TO THE MARKER TRACK.
if (int.Parse(dat.Split(':')[0]) == trackNum) {
c.FromString(dat.Substring(dat.IndexOf(":") + 2), labels, new Dictionary<string, int>());
commands.Add(c);
}
} catch { }

Ideally, this feature would:

  • Support jumps (referring to the comment, but i'm not really sure what it's talking about)
    • I'm not sure what the comment is on about, because it already seems to work fine (though it might not work if the label is located after the jump instruction)
    • I think I understand now. Some editors dump all markers onto a single track (or idk, maybe some dump on all of them?), and jumps only work if markers can be placed on specific tracks.
      • for that matter though, i think the command insertion only properly works if the marker is on the specific track as well -- it just doesn't insert the command if it's the wrong track.
  • Support multiple commands in a single marker (for i.e. a conditional jump cmp_eq 14, 10000; jump_if LS0)
  • Not require you to list the track number -- it's already in the middle of the track. (is there varying behavior by different midi editors?)
  • Support mentioning labels that occur after the current marker.

Random idea is to also support 'this command goes on every track' markers on track 0 with the ability to insert the current track number into the command somewhere. (this would essentially be a more powerful version of the commented out looping functionality)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions