Beispiel #1
0
 /// <summary>
 /// Saves a drum stroke
 /// </summary>        
 public void RecordSample(Pad pad)
 {
     if (Recording)
         tape.Add(new Sample(GetTimestamp(), pad));
 }
Beispiel #2
0
 /// <summary>
 /// Handles gestures
 /// </summary>
 /// <param name="gesture">Information concerning an individual gesture</param>
 public override void TouchEvent(GestureSample gesture)
 {
     if (gesture.GestureType == GestureType.Hold)
     {
         foreach (Pad pad in pads)
         {
             if (pad.Contains(gesture.Position) && !palette.Visible)
             {
                 activePad = pad;
                 palette.Location = new Point((int)gesture.Position.X, (int)gesture.Position.Y);
                 Point displayCenter = new Point(width / 2, height / 2);
                 int destX = displayCenter.X - (int)(0.5 * (displayCenter.X - pad.Boundaries.Center.X));
                 int destY = displayCenter.Y - (int)(0.3 * (displayCenter.Y - pad.Boundaries.Center.Y));
                 palette.Destination = new Point(destX, destY);
                 // Set the preselected percussion
                 foreach (PercussionItem item in palette.Buttons)
                 {
                     item.On = item.Percussion == pad.Percussion ? true : false;
                 }
                 palette.Show();
                 return;
             }
         }
     }
 }
Beispiel #3
0
 public Sample(long timestamp, Pad pad)
 {
     this.timestamp = timestamp;
     this.pad = pad;
     this.sound = pad.Sound;
 }