/** Test of getNoteOnEvent method, of class MidiNote. */ @Test public void getNoteEvents() throws InvalidMidiDataException { System.out.println("getNoteEvents"); MidiNote instance = new MidiNote(70, 35, 4, 0, 80); MidiEvent noteOnEvent = instance.getNoteOnEvent(); MidiEvent noteOffEvent = instance.getNoteOffEvent(); assertNoteEventEqual(noteOnEvent, 35, (byte) -112, (byte) 70, (byte) 80, true); assertNoteEventEqual(noteOffEvent, 39, (byte) -128, (byte) 70, (byte) 0, true); }
@Test public void noteEventRefreshOnFieldChange() throws InvalidMidiDataException { System.out.println("noteEventRefreshOnFieldChange"); MidiNote instance = new MidiNote(); MidiEvent noteOnEvent = instance.getNoteOnEvent(); MidiEvent noteOffEvent = instance.getNoteOffEvent(); assertNoteEventEqual( noteOnEvent, 0, (byte) -112, (byte) 0, (byte) MidiNote.DEFAULT_VELOCITY, true); assertNoteEventEqual(noteOffEvent, 0, (byte) -128, (byte) 0, (byte) 0, true); instance.setPitch(92); noteOnEvent = instance.getNoteOnEvent(); noteOffEvent = instance.getNoteOffEvent(); assertNoteEventEqual( noteOnEvent, 0, (byte) -112, (byte) 92, (byte) MidiNote.DEFAULT_VELOCITY, true); assertNoteEventEqual(noteOffEvent, 0, (byte) -128, (byte) 92, (byte) 0, true); instance.setStartTime(16L); noteOnEvent = instance.getNoteOnEvent(); noteOffEvent = instance.getNoteOffEvent(); assertNoteEventEqual( noteOnEvent, 16, (byte) -112, (byte) 92, (byte) MidiNote.DEFAULT_VELOCITY, true); assertNoteEventEqual(noteOffEvent, 16, (byte) -128, (byte) 92, (byte) 0, true); instance.setDuration(8L); noteOnEvent = instance.getNoteOnEvent(); noteOffEvent = instance.getNoteOffEvent(); assertNoteEventEqual( noteOnEvent, 16, (byte) -112, (byte) 92, (byte) MidiNote.DEFAULT_VELOCITY, true); assertNoteEventEqual(noteOffEvent, 24, (byte) -128, (byte) 92, (byte) 0, true); instance.setVelocity(120); noteOnEvent = instance.getNoteOnEvent(); noteOffEvent = instance.getNoteOffEvent(); assertNoteEventEqual(noteOnEvent, 16, (byte) -112, (byte) 92, (byte) 120, true); assertNoteEventEqual(noteOffEvent, 24, (byte) -128, (byte) 92, (byte) 0, true); instance.setChannel(2); noteOnEvent = instance.getNoteOnEvent(); noteOffEvent = instance.getNoteOffEvent(); assertNoteEventEqual(noteOnEvent, 16, (byte) -110, (byte) 92, (byte) 120, true); assertNoteEventEqual(noteOffEvent, 24, (byte) -126, (byte) 92, (byte) 0, true); }