示例#1
0
 def test_1(self):
     ch_dev = MidiEventStream.ChannelDevice()
     self.assertEquals(0, ch_dev.require_channel(60, 0, 100))
     ch_dev.start_note(0, 60)
     self.assertEquals(1, ch_dev.require_channel(61, 1, 100))
     ch_dev.start_note(1, 61)
     self.assertEquals(2, ch_dev.require_channel(62, 1, 70))
     ch_dev.start_note(2, 62)
     self.assertEquals(0, ch_dev.require_channel(63, 0, 100))
     ch_dev.start_note(0, 63)
     # New channel since we want to play another tone with the
     # same pitch as the one playing in channel 0
     self.assertEquals(3, ch_dev.require_channel(63, 0, 100))
     ch_dev.start_note(3, 63)
     ch_dev.stop_note(0, 60)
     ch_dev.stop_note(1, 61)
     ch_dev.stop_note(2, 62)
     ch_dev.stop_note(0, 63)
     self.assertEquals(0, ch_dev.require_channel(63, 0, 100))
     ch_dev.start_note(0, 63)
示例#2
0
 def setUp(self):
     self.cd = MidiEventStream.ChannelDevice()