示例#1
0
        private double to;       // end of the range, or selection point


        /// <summary>
        /// Create a new audio selection for an audio node from a time (in ms) to another time.
        /// </summary>
        public AudioSelection(View.ProjectView view, AudioNode node, double from, double to)
            : base(view)
        {
            this.node    = node;
            this.isRange = true;
            this.from    = from;
            this.to      = to;
            EnsureTimesWithinRange();
        }
示例#2
0
 /// <summary>
 /// Play the selected audio.
 /// </summary>
 public void PlayOrResume()
 {
     if (this.transportBar.Player != null)
     {
         if (this.transportBar.Player.State == Audio.PlayerState.Paused)
         {
             this.transportBar.Player.Resume();
         }
         else if (this.transportBar.Player.State == Audio.PlayerState.Stopped)
         {
             if (this.projectView.Selection is NodeSelection)
             {
                 AudioNode node = ((NodeSelection)this.projectView.Selection).SingleNode as AudioNode;
                 this.projectView.PlaybackNode = node;
                 if (node != null)
                 {
                     this.transportBar.Player.Play(node.Audio);
                 }
             }
             else if (this.projectView.Selection is AudioSelection)
             {
                 AudioSelection selection = this.projectView.Selection as AudioSelection;
                 this.projectView.PlaybackNode = selection.Node;
                 if (selection.IsRange)
                 {
                     double from = selection.From < selection.To ? selection.From : selection.To;
                     double to   = selection.To > selection.From ? selection.To : selection.From;
                     this.transportBar.Player.Play(selection.Node.Audio, from, to);
                 }
                 else
                 {
                     this.transportBar.Player.Play(selection.Node.Audio, selection.At);
                 }
             }
         }
     }
 }
示例#3
0
 public AudioSelection(View.ProjectView view, AudioNode node, double at)
     : base(view)
 {
     this.node = node;
     At        = at;
 }