Skip to content

Commit

Permalink
support exporting the filter effect to midi
Browse files Browse the repository at this point in the history
  • Loading branch information
shockdude committed Jun 29, 2019
1 parent c44deed commit 857f4e2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Sharktooth/Mub/MubExport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,18 @@ private List<MidiEvent> CreateEffectsTrack()
long start = NotePosToTicks(entry.Start);
long end = NotePosToTicks(entry.Start + entry.Length);

if ((entry.Modifier & 0xFF000000) == 0x06000000)
if ((entry.Modifier & 0xFF000000) == 0x06000000 || entry.Modifier == 0x05FFFFFF)
{
// Filter effect doesn't actually need an effect note, but sometimes 0x05FFFFFF is used for Filter.
// For the midi, using pitch 0x7F (127) for Filter is good enough.
int effectMod = entry.Modifier & 0x7F;
if (effects == null)
{
effects = new List<MidiEvent>();
effects.Add(new NAudio.Midi.TextEvent("EFFECTS", MetaEventType.SequenceTrackName, 0));
}
effects.Add(new NoteEvent(start, 1, MidiCommandCode.NoteOn, entry.Modifier & 0xFF, entry.Data + 1));
effects.Add(new NoteEvent(end, 1, MidiCommandCode.NoteOff, entry.Modifier & 0xFF, entry.Data + 1));
effects.Add(new NoteEvent(start, 1, MidiCommandCode.NoteOn, effectMod, entry.Data + 1));
effects.Add(new NoteEvent(end, 1, MidiCommandCode.NoteOff, effectMod, entry.Data + 1));
continue;
}
}
Expand Down

0 comments on commit 857f4e2

Please sign in to comment.