carlito913 / editor-on-fire

Automatically exported from code.google.com/p/editor-on-fire
Other
0 stars 0 forks source link

MIDI Events Sorting Request #262

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
A user has requested we provide a way to control the order of exported MIDI 
events. This user wants the MIDI events to be written to the MIDI file in a 
predictable order with the ability to change the order of events that occur on 
a specific beat.

Original issue reported on code.google.com by xander4j...@yahoo.com on 3 Apr 2013 at 2:57

GoogleCodeExporter commented 8 years ago
Is there a particular reason this is necessary?  The current sorting has been 
set to be in the style of Rock Band charts, with some concessions for Phase 
Shift, in this order:
1.  Delta time
2.  Sysex Events
3.  Lyric overdrive markers
4.  Lyric phrase markers
5.  Lyric events
6.  Pro drum phrase markers
7.  MIDI note pitch

Changing the quick sort function for an entire chart/track can be do-able, but 
changing the sorting part-way through a MIDI track seems very awkward and 
without a justification for this, I don't see why it would be useful.

Original comment by raynebc on 4 Apr 2013 at 6:17

GoogleCodeExporter commented 8 years ago
The user is referring to events that are added manually in the events dialog. 
The order of other events doesn't really matter. It is for another rhythm game.

I don't see why we couldn't add another criterion to the sorting function. For 
generic text events, the index could be used as a secondary criterion if the 
delta times are the same.

That being said, I may discuss this in more detail with this user to see if 
there is another way. It could be that they are just not getting creative 
enough.

Original comment by xander4j...@yahoo.com on 4 Apr 2013 at 8:35

GoogleCodeExporter commented 8 years ago
In that case it should be pretty easy, we can change eof_add_midi_text_event() 
to accept a priority parameter (which event index it is for its assigned beat) 
that is stored as a value in the EOF_MIDI_EVENT structure.  The sort could take 
this into account so that between two events that are at the same timestamp and 
are the same event type, the one with the lower priority number is sorted 
first.  All other events could be stored with a priority of 255 (no priority).

Original comment by raynebc on 4 Apr 2013 at 9:08

GoogleCodeExporter commented 8 years ago
I think it would be easier to just store the index in the EOF_MIDI_EVENT 
structure and take it into account when sorting. For all events added by the 
user using the Events dialog, store the index of that event in the song's 
events array and take it into account when sorting. All other events would have 
an index of -1, indicating not to further sort them.

I discussed this with the user and I think this feature will be worth having. I 
think it would also be nice to be able to move events up and down in the Events 
dialog. This isn't necessary for most things, but it's a little extra control 
for people using EOF for their own rhythm game projects.

Original comment by xander4j...@yahoo.com on 4 Apr 2013 at 10:02

GoogleCodeExporter commented 8 years ago
That would be easy to implement.  I've already got almost all of the event 
dialog logic written, would just have to add a couple buttons and the MIDI 
event sorting logic.

Original comment by raynebc on 4 Apr 2013 at 10:37

GoogleCodeExporter commented 8 years ago

Original comment by raynebc on 4 Apr 2013 at 10:38

GoogleCodeExporter commented 8 years ago
The programming is completed and tested for this task.  I'll be committing the 
changes probably later this evening, but I haven't finished another feature 
that I'm working on.

Original comment by raynebc on 5 Apr 2013 at 12:30

GoogleCodeExporter commented 8 years ago
Implemented in r1119.

Original comment by raynebc on 5 Apr 2013 at 5:39