/// <summary> /// Initializes the sequencer. /// </summary> private void InitializeSequencer() { seq = new Sequence(); sequenceVersion = seq.Version; player = new SequencePlayer(outDevice, tickGen, seq); player.EndOfSequenceReached += new EventHandler(EndOfSequenceReachedHandler); clock = new SlaveClock(inDevice, outDevice, tickGen); clock.Starting += new EventHandler(StartingHandler); clock.Continuing += new EventHandler(ContinuingHandler); clock.Stopping += new EventHandler(StoppingHandler); clock.PositionChanged += new PositionChangedEventHandler(PositionChangedHandler); tickGen.TempoChanged += new EventHandler(OnTempoChanged); if(InputDevice.DeviceCount > 0) InputDeviceID = 0; if(OutputDevice.DeviceCount > 0) OutputDeviceID = 0; }
/// <summary> /// Reads the division value. /// </summary> private void ReadDivision() { byte[] d = binReader.ReadBytes(DivisionByteCount); // Convert array to the same byte order as this platform. ConvertByteArray(d); // Create sequence to hold tracks from the Midi file. sequence = new Sequence(BitConverter.ToInt16(d, 0)); }