def testShiftTrack(self): time = 1 MyMIDI = MIDIFile(1) MyMIDI.addNote(0, 0, 100, time, 1, 100) self.assertEqual(MyMIDI.tracks[1].eventList[0].type, "note") self.assertEqual(MyMIDI.tracks[1].eventList[0].pitch, 100) self.assertEqual(MyMIDI.tracks[1].eventList[0].time, time) self.assertEqual(MyMIDI.tracks[1].eventList[0].duration, 1) self.assertEqual(MyMIDI.tracks[1].eventList[0].volume, 100) MyMIDI.shiftTracks() self.assertEqual(MyMIDI.tracks[1].eventList[0].time, 0)
def testShiftTrack(self): track = 0 channel = 0 pitch = 100 time = 1 duration = 1 volume = 100 MyMIDI = MIDIFile(1) MyMIDI.addNote(track, channel, pitch, time, duration, volume) self.assertEqual(MyMIDI.tracks[1].eventList[0].evtname, "NoteOn") self.assertEqual(MyMIDI.tracks[1].eventList[0].pitch, pitch) self.assertEqual(MyMIDI.tracks[1].eventList[0].tick, MyMIDI.time_to_ticks(time)) self.assertEqual(MyMIDI.tracks[1].eventList[0].duration, MyMIDI.time_to_ticks(duration)) self.assertEqual(MyMIDI.tracks[1].eventList[0].volume, volume) MyMIDI.shiftTracks() self.assertEqual(MyMIDI.tracks[1].eventList[0].tick, 0)