Esempio n. 1
0
 public static PlaybackInfo operator +(PlaybackInfo info1, PlaybackInfo info2)
 {
     PlaybackInfo info = new PlaybackInfo();
     foreach (int k in info1.Messages.Keys)
         info.Add(k, info1.Messages[k]);
     foreach (int k in info2.Messages.Keys)
         info.Add(k, info2.Messages[k]);
     return info;
 }
Esempio n. 2
0
 public PlaybackInfo GeneratePlaybackInfo(int time = 0)
 {
     PlaybackInfo info = new PlaybackInfo();
     info.Add(time, new PlaybackMessage(Instrument, Channel));
     foreach (var s in sequences)
     {
         info += s.GeneratePlaybackInfo(Channel, time);
         time += (int)(1000 * Note.ToRealDuration(s.Duration));
     }
     return info;
 }
Esempio n. 3
0
 public PlaybackInfo GeneratePlaybackInfo(byte channel, int time = 0)
 {
     PlaybackInfo info = new PlaybackInfo();
     foreach (Note n in sequence)
     {
         if (n.Pitch < 0 || n.Velocity == 0)
         {
             time += (int)(1000 * Note.ToRealDuration(n.Duration));
             continue;
         }
         var tag = Tuple.Create(channel,n);
         PlaybackMessage m = new PlaybackMessage(PlaybackMessage.PlaybackMessageType.Start, channel, (byte)n.Velocity, (byte)n.Pitch, n.Duration);
         m.Tag = tag; // Experimenta
         info.Add(time, m);
         time += (int)(1000 * Note.ToRealDuration(n.Duration));
         m = new PlaybackMessage(PlaybackMessage.PlaybackMessageType.Stop, channel, (byte)n.Velocity, (byte)n.Pitch);
         //m.Tag = tag; // Experimental
         info.Add(time, m);
         time += 1;
     }
     return info;
 }