Changeset 5813


Ignore:
Timestamp:
03/19/14 15:14:01 (6 years ago)
Author:
rohit_tandon
Message:

Cursor laps back is done for containing empty phrases and when the player is paused.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Obi/Obi/ProjectView/TransportBar.cs

    r5812 r5813  
    5858        private string mStopButtonAccessibleName;    // Normal accessible name for the stop button ??? 
    5959        private KeyboardShortcuts_Settings keyboardShortcuts=null; 
     60        private double m_ElapseBackInterval; 
    6061 
    6162        //private ContextMenuStrip m_RecordingOptionsContextMenuStrip; 
     
    25692570        public bool FastPlayNormaliseWithLapseBack() 
    25702571        { 
    2571             double elapseBackInterval = mView.ObiForm.Settings.ElapseBackTimeInMilliseconds; 
     2572             m_ElapseBackInterval = mView.ObiForm.Settings.ElapseBackTimeInMilliseconds; 
    25722573            // work around to handle special nudge condition of preview: this should be implemented universally after 2.0 release 
    25732574            if (mCurrentPlaylist != null && mView.Selection is AudioSelection && mCurrentPlaylist is PreviewPlaylist && CurrentState == State.Paused) Stop(); 
    25742575            if (IsPlayerActive) 
    25752576            { 
    2576                 DetermineUseOfSoundTouch(1.0f); 
    2577                 mCurrentPlaylist.FastPlayNormaliseWithLapseBack(elapseBackInterval); 
    2578                 mFastPlayRateCombobox.SelectedIndex = 0; 
    2579                 UpdateTimeDisplay(); 
    2580                 if (CurrentPlaylist != null) mView.UpdateCursorPosition(mCurrentPlaylist.CurrentTimeInAsset); 
     2577                if (IsPaused) 
     2578                {                    
     2579                    Stop(); 
     2580                    LapseBackCursor(); 
     2581                    return true; 
     2582                } 
     2583                else 
     2584                { 
     2585                    DetermineUseOfSoundTouch(1.0f); 
     2586                    mCurrentPlaylist.FastPlayNormaliseWithLapseBack(m_ElapseBackInterval); 
     2587                    mFastPlayRateCombobox.SelectedIndex = 0; 
     2588                    UpdateTimeDisplay(); 
     2589                    if (CurrentPlaylist != null) mView.UpdateCursorPosition(mCurrentPlaylist.CurrentTimeInAsset); 
     2590                    return true; 
     2591                } 
     2592            } 
     2593            else if (CurrentState == State.Stopped &&  mView.Selection != null && mView.Selection.Node is PhraseNode) 
     2594            { 
     2595                LapseBackCursor(); 
     2596 
    25812597                return true; 
    25822598            } 
    2583             else if (CurrentState == State.Stopped &&  mView.Selection != null && mView.Selection.Node is PhraseNode) 
    2584             { 
    2585                 if (mView.Selection is AudioSelection) 
    2586                 { 
    2587                     double time = ((AudioSelection)mView.Selection).AudioRange.CursorTime; 
    2588                     if (time < 1 && mView.Selection.Node.PrecedingNode is PhraseNode) 
    2589                     { 
    2590                         ObiNode preceedingNode = mView.Selection.Node.PrecedingNode; 
     2599            return false; 
     2600        } 
     2601        private void LapseBackCursor() 
     2602        { 
     2603            if (mView.Selection is AudioSelection) 
     2604            { 
     2605                double time = ((AudioSelection)mView.Selection).AudioRange.CursorTime; 
     2606                if (time < 1 && ((mView.Selection.Node.PrecedingNode is PhraseNode) || (mView.Selection.Node.PrecedingNode is EmptyNode))) 
     2607                { 
     2608                    ObiNode preceedingNode = mView.Selection.Node.PrecedingNode; 
     2609                    mView.Selection = new NodeSelection(preceedingNode, mView.Selection.Control); 
     2610                    AudioRange range = new AudioRange(mView.Selection.Node.Duration); 
     2611                    while (mView.Selection.Node is EmptyNode && !(mView.Selection.Node is PhraseNode)) 
     2612                    { 
     2613                        preceedingNode = mView.Selection.Node.PrecedingNode; 
    25912614                        mView.Selection = new NodeSelection(preceedingNode, mView.Selection.Control); 
    2592                         AudioRange range = new AudioRange(mView.Selection.Node.Duration); 
    2593                         mView.Selection = new AudioSelection((PhraseNode)mView.Selection.Node, mView.Selection.Control, range); 
    2594                         time = ((AudioSelection)mView.Selection).AudioRange.CursorTime;                         
    2595                     } 
    2596                     //else 
    2597                      
    2598                         time = time - elapseBackInterval >= 0 ? time - elapseBackInterval : 0; 
    2599                      
    2600                     mView.Selection = new AudioSelection((PhraseNode)mView.Selection.Node, mView.Selection.Control, 
    2601                         new AudioRange(time)); 
    2602                 } 
    2603                 else 
    2604                 { 
    2605                     mView.Selection = new AudioSelection((PhraseNode)mView.Selection.Node, mView.Selection.Control, 
    2606                         new AudioRange(((PhraseNode)mView.Selection.EmptyNodeForSelection).Duration - elapseBackInterval)); 
    2607                 } 
    2608                 return true; 
    2609             } 
    2610             return false; 
    2611         } 
    2612  
     2615                        range = new AudioRange(mView.Selection.Node.Duration); 
     2616                    } 
     2617                    mView.Selection = new AudioSelection((PhraseNode)mView.Selection.Node, mView.Selection.Control, range); 
     2618                    time = ((AudioSelection)mView.Selection).AudioRange.CursorTime; 
     2619                } 
     2620 
     2621                time = time - m_ElapseBackInterval >= 0 ? time - m_ElapseBackInterval : 0; 
     2622 
     2623                mView.Selection = new AudioSelection((PhraseNode)mView.Selection.Node, mView.Selection.Control, 
     2624                    new AudioRange(time)); 
     2625            } 
     2626            else 
     2627            { 
     2628                mView.Selection = new AudioSelection((PhraseNode)mView.Selection.Node, mView.Selection.Control, 
     2629                    new AudioRange(((PhraseNode)mView.Selection.EmptyNodeForSelection).Duration - m_ElapseBackInterval)); 
     2630            } 
     2631        } 
    26132632        /// <summary> 
    26142633        /// sound touch is enabled if fast play is to be activated else it is restored to original DX 
Note: See TracChangeset for help on using the changeset viewer.