]> ruin.nu Git - moosique.git/blobdiff - MooNote.java
*** empty log message ***
[moosique.git] / MooNote.java
index 6ea6c39b6b6bfb369d6feca755dc194846dc5f06..77ecd53b3db9dbca92db36cae0f5f48853122658 100644 (file)
@@ -29,7 +29,7 @@ public class MooNote extends MidiEvent {
         */
        public MooNote (MidiEvent noteOnEvent, MidiEvent noteOffEvent) {
                super(noteOnEvent.getMessage(), noteOnEvent.getTick());
-               noteOffEvent = new MidiEvent(noteOffEvent.getMessage(), noteOffEvent.getTick());
+               this.noteOffEvent = noteOffEvent;
                noteOnMsg = (ShortMessage)getMessage();
                noteOffMsg = (ShortMessage)noteOffEvent.getMessage();
        }
@@ -62,7 +62,8 @@ public class MooNote extends MidiEvent {
                try {
                        noteOnMsg.setMessage(noteOnMsg.getCommand(), (byte)channel, noteOnMsg.getData1(), noteOnMsg.getData2());
                        noteOffMsg.setMessage(noteOffMsg.getCommand(), (byte)channel, noteOffMsg.getData1(), noteOffMsg.getData2());
-               } catch (InvalidMidiDataException e) {}
+               } catch (Exception e) {}
+               //} catch (InvalidMidiDataException e) {}
        }
 
        /** 
@@ -73,7 +74,8 @@ public class MooNote extends MidiEvent {
                try {
                        noteOnMsg.setMessage(noteOnMsg.getCommand(), noteOnMsg.getChannel(), (byte)pitch, noteOnMsg.getData2());
                        noteOffMsg.setMessage(noteOffMsg.getCommand(), noteOffMsg.getChannel(), (byte)pitch, noteOffMsg.getData2());
-               } catch (InvalidMidiDataException e) {}
+               } catch (Exception e) {}
+               //} catch (InvalidMidiDataException e) {}
        }
 
        /** 
@@ -84,7 +86,8 @@ public class MooNote extends MidiEvent {
                try {
                        noteOnMsg.setMessage(noteOnMsg.getCommand(), noteOnMsg.getChannel(), noteOnMsg.getData1(), (byte)vel);
                        noteOffMsg.setMessage(noteOffMsg.getCommand(), noteOffMsg.getChannel(), noteOffMsg.getData1(), noteOffMsg.getData2());
-               } catch (InvalidMidiDataException e) {}
+               } catch (Exception e) {}
+               //} catch (InvalidMidiDataException e) {}
        }
 
        /** 
@@ -134,7 +137,7 @@ public class MooNote extends MidiEvent {
         */
        public int getDuration() {
                if (!hasNoteOffEvent()) return 0;
-               return (int)(getTick() - noteOffEvent.getTick());
+               return (int)(noteOffEvent.getTick() - getTick());
        }
 
        /** 
@@ -142,6 +145,6 @@ public class MooNote extends MidiEvent {
         * @return      the note off MidiEvent
         */
        public boolean hasNoteOffEvent() {
-               return noteOffEvent == null;
+               return noteOffEvent != null;
        }
-}
\ No newline at end of file
+}