public void Visit(TimeSignature timeSignature)
 {
     byte[] timeSignatureBytes = new byte[4];
     this.beatsPerMessage         = timeSignature.beatsPerMeasure;
     timeSignatureBytes[0]        = (byte)timeSignature.beatsPerMeasure;
     timeSignatureBytes[1]        = (byte)timeSignature.lengthOfOneBeat;
     this.timeSignatureLengthNote = timeSignature.lengthOfOneBeat;
     MetaTrack.Insert(PreviousNoteAbsoluteTicks, new MetaMessage(MetaType.TimeSignature, timeSignatureBytes));
 }
        public void Visit(Metronome metronome)
        {
            int speed = (60000000 / metronome.getBeatsPerMinute().Last());

            byte[] tempo = new byte[3];
            tempo[0] = (byte)((speed >> 16) & 0xff);
            tempo[1] = (byte)((speed >> 8) & 0xff);
            tempo[2] = (byte)(speed & 0xff);
            MetaTrack.Insert(PreviousNoteAbsoluteTicks, new MetaMessage(MetaType.Tempo, tempo));
        }
        public StaffContext()
        {
            // Calculate tempo
            speed    = (60000000 / _bpm);
            tempo    = new byte[3];
            tempo[0] = (byte)((speed >> 16) & 0xff);
            tempo[1] = (byte)((speed >> 8) & 0xff);
            tempo[2] = (byte)(speed & 0xff);

            Sequence.Add(MetaTrack);
            MetaTrack.Insert(0 /* Insert at 0 ticks*/, new MetaMessage(MetaType.Tempo, tempo));
            Sequence.Add(NotesTrack);
        }