Exemplo n.º 1
0
        private void SetClef(string text)
        {
            Clef tempClef = new Clef
            {
                key = cleffs[text]
            };

            noteBuilder.SetClef(tempClef);
        }
Exemplo n.º 2
0
        public void processFile(Sequence midiSequence)
        {
            division = midiSequence.Division;
            List <MidiEvent> allEvents = new List <MidiEvent>();;

            //add all events to list
            foreach (var track in midiSequence)
            {
                foreach (var midiEvent in track.Iterator())
                {
                    IMidiMessage midiMessage = midiEvent.MidiMessage;
                    if (midiMessage.GetType() == typeof(MetaMessage))
                    {
                        addMetaMessage(midiEvent, allEvents);
                    }
                    if (midiMessage.GetType() == typeof(ChannelMessage))
                    {
                        addChannelMessage(midiEvent, allEvents);
                    }
                }
            }

            //sort allNodes
            MidiEvent[] allEventsArray = allEvents.ToArray();
            sortAllEvents(allEventsArray);

            noteBuilder.SetClef(new Clef(Clef.Key.G));
            lastAbsoluteTicks = 0;
            foreach (var midiEvent in allEventsArray)
            {
                IMidiMessage midiMessage = midiEvent.MidiMessage;
                if (midiMessage.GetType() == typeof(MetaMessage))
                {
                    handleMetaMessage(midiMessage);
                }
                if (midiMessage.GetType() == typeof(ChannelMessage))
                {
                    handleChannelMessage(midiEvent);
                }
            }
        }