예제 #1
0
 private void parseEvents(IEnumerable <TimedEvent> events, TempoMap tempoMap)
 {
     foreach (var ev in events)
     {
         String str = ev.Event.ToString();
         if (str.Contains("Sequence/Track Name"))
         {
             this.trackName = parseTrackName(str);
         }
         else if (str.Contains("Program Change"))
         {
             this.instrument = parseInstrument(str);
         }
         else if (str.Contains("Pitch Bend"))
         {
             parsePitchBendEvents(str, ev.Time, tempoMap);
         }
         else if (str.Contains("Time Signature"))
         {
             parseTimeSignatureEvents(str, ev.Time, tempoMap);
         }
         else if (str.Contains("Key Signature"))
         {
             //
         }
     }
 }
예제 #2
0
 public MidiTrack(TrackChunk track, TempoMap tempoMap)
 {
     this.trackName      = "";
     this.pitchBends     = new List <MidiPitchBend>();
     this.notes          = new List <MidiNote>();
     this.timeSignatures = new List <MidiTimeSignature>();
     this.instrument     = new MidiInstrument(0, 0);
     parseEvents(track.GetTimedEvents(), tempoMap);
     parseNotes(track.GetNotes(), tempoMap);
     if (timeSignatures.Count == 0) // default value if timesignature doesnt exist in midi
     {
         timeSignatures.Add(new MidiTimeSignature(0, "4/4", " 24 clocks/click", " 8 /32nd/beat", tempoMap));
     }
 }