Ejemplo n.º 1
0
 // mergePlayEmptyTest(): m1 and/or m2 empty
 @Test
 public void mergePlayEmptyTest() {
   Merge a = new Merge(new Rest(0), new Rest(0));
   try {
     SequencePlayer player = new SequencePlayer(140, 12);
     a.play(player, 0);
     assertEquals("Meta event: END_OF_TRACK Tick: 0\n", player.toString());
   } catch (MidiUnavailableException mue) {
     mue.printStackTrace();
   } catch (InvalidMidiDataException imde) {
     imde.printStackTrace();
   }
 }
Ejemplo n.º 2
0
 // mergePlayEqualsTest(): m1 = m2
 @Test
 public void mergePlayEqualsTest() {
   Merge a = new Merge(new Note(1.0, new Pitch('C')), new Note(1.0, new Pitch('C')));
   try {
     SequencePlayer player = new SequencePlayer(140, 12);
     a.play(player, 0);
     assertEquals(
         "Event: NOTE_ON  Pitch: 60  Tick: 0\n"
             + "Event: NOTE_OFF Pitch: 60  Tick: 12\n"
             + "Event: NOTE_ON  Pitch: 60  Tick: 12\n"
             + "Event: NOTE_OFF Pitch: 60  Tick: 24\n"
             + "Meta event: END_OF_TRACK Tick: 24\n",
         player.toString());
   } catch (MidiUnavailableException mue) {
     mue.printStackTrace();
   } catch (InvalidMidiDataException imde) {
     imde.printStackTrace();
   }
 }