Пример #1
0
 public void Add(int time, PlaybackMessage message)
 {
     if (!Messages.ContainsKey(time))
         Messages[time] = new List<PlaybackMessage>() { message };
     else
         Messages[time].Add(message);
 }
Пример #2
0
 void player_OnMessageSent(object sender, int key, PlaybackMessage msg)
 {
     if (OnMessageSent != null)
         OnMessageSent(this, key, msg);
 }
Пример #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;
 }