diff options
author | Starla Insigna <hatkirby@fourisland.com> | 2009-02-15 13:20:21 -0500 |
---|---|---|
committer | Starla Insigna <hatkirby@fourisland.com> | 2009-02-15 13:20:21 -0500 |
commit | d242cfcf9a62bed5158c33c061e47fa393e2301a (patch) | |
tree | 0ac57c31c2f7924a289df5bf8931f2f362daf747 | |
parent | cb18193a2b599853813dbc5fc128406250741a3c (diff) | |
download | fourpuzzle-d242cfcf9a62bed5158c33c061e47fa393e2301a.tar.gz fourpuzzle-d242cfcf9a62bed5158c33c061e47fa393e2301a.tar.bz2 fourpuzzle-d242cfcf9a62bed5158c33c061e47fa393e2301a.zip |
Engine: Fixed MIDI awkwardness
Previously, MIDIs would retain some behavior from the previously playing MIDI, either because the Sequencer hadn't been reset or because a critical MidiMessage was incorrectly positioned. Both of these possibilities have been fixed.
-rwxr-xr-x | src/com/fourisland/fourpuzzle/Audio.java | 4 | ||||
-rw-r--r-- | src/com/fourisland/fourpuzzle/util/MidiParser.java | 14 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/com/fourisland/fourpuzzle/Audio.java b/src/com/fourisland/fourpuzzle/Audio.java index 9083d27..3283c68 100755 --- a/src/com/fourisland/fourpuzzle/Audio.java +++ b/src/com/fourisland/fourpuzzle/Audio.java | |||
@@ -62,6 +62,10 @@ public class Audio { | |||
62 | if ((seq.getSequence() != null) && (seq.getSequence().equals(s))) | 62 | if ((seq.getSequence() != null) && (seq.getSequence().equals(s))) |
63 | { | 63 | { |
64 | return; | 64 | return; |
65 | } else { | ||
66 | seq.close(); | ||
67 | |||
68 | init(); | ||
65 | } | 69 | } |
66 | 70 | ||
67 | try { | 71 | try { |
diff --git a/src/com/fourisland/fourpuzzle/util/MidiParser.java b/src/com/fourisland/fourpuzzle/util/MidiParser.java index 84dea26..3d6c06b 100644 --- a/src/com/fourisland/fourpuzzle/util/MidiParser.java +++ b/src/com/fourisland/fourpuzzle/util/MidiParser.java | |||
@@ -55,7 +55,12 @@ public class MidiParser { | |||
55 | { | 55 | { |
56 | parseShortMessage((ShortMessage) mm,tick); | 56 | parseShortMessage((ShortMessage) mm,tick); |
57 | } else { | 57 | } else { |
58 | currentTrack.add(new MidiEvent(mm, tick)); | 58 | if (foundFirstReal) |
59 | { | ||
60 | currentTrack.add(new MidiEvent(mm, tick-firstReal)); | ||
61 | } else { | ||
62 | currentTrack.add(new MidiEvent(mm, 0)); | ||
63 | } | ||
59 | } | 64 | } |
60 | } | 65 | } |
61 | 66 | ||
@@ -77,7 +82,12 @@ public class MidiParser { | |||
77 | } | 82 | } |
78 | } | 83 | } |
79 | 84 | ||
80 | currentTrack.add(new MidiEvent(mm, tick-firstReal)); | 85 | if (foundFirstReal) |
86 | { | ||
87 | currentTrack.add(new MidiEvent(mm, tick-firstReal)); | ||
88 | } else { | ||
89 | currentTrack.add(new MidiEvent(mm, 0)); | ||
90 | } | ||
81 | } | 91 | } |
82 | 92 | ||
83 | } | 93 | } |