Changeset 5827


Ignore:
Timestamp:
03/27/14 06:10:49 (6 years ago)
Author:
rohit_tandon
Message:

Elapse Forward implemented.

Location:
trunk/Obi/Obi
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Obi/Obi/KeyboardShortcuts_Settings.cs

    r5771 r5827  
    6666        public KeyboardShortcut ContentView_FastPlayRateNormilize = new KeyboardShortcut(Keys.D, "KeyS_FastPlayRateNormilize"); 
    6767        public KeyboardShortcut ContentView_FastPlayNormalizeWithElapseBack = new KeyboardShortcut(Keys.E, "KeyS_FastPlayNormalizeWithElapseBack"); 
     68        public KeyboardShortcut ContentView_FastPlayWithElapseForward = new KeyboardShortcut(Keys.Y, "KeyS_FastPlayWithElapseForward"); 
    6869        public KeyboardShortcut ContentView_MarkSelectionFromBeginningToTheCursor = new KeyboardShortcut(Keys.Shift | Keys.Home, "KeyS_MarkSelectionFromBeginningToTheCursor"); 
    6970        public KeyboardShortcut ContentView_MarkSelectionFromCursorToTheEnd = new KeyboardShortcut(Keys.Shift | Keys.End, "KeyS_MarkSelectionFromCursorToTheEnd"); 
     
    307308            KeyboardShortcutsDescription.Add(Localizer.Message(ContentView_FastPlayRateNormilize.Description), ContentView_FastPlayRateNormilize); 
    308309            KeyboardShortcutsDescription.Add(Localizer.Message(ContentView_FastPlayNormalizeWithElapseBack.Description), ContentView_FastPlayNormalizeWithElapseBack); 
     310            KeyboardShortcutsDescription.Add(Localizer.Message(ContentView_FastPlayWithElapseForward.Description), ContentView_FastPlayWithElapseForward); 
    309311            KeyboardShortcutsDescription.Add(Localizer.Message(ContentView_MarkSelectionFromBeginningToTheCursor.Description), ContentView_MarkSelectionFromBeginningToTheCursor); 
    310312            KeyboardShortcutsDescription.Add(Localizer.Message(ContentView_MarkSelectionFromCursorToTheEnd.Description), ContentView_MarkSelectionFromCursorToTheEnd); 
  • trunk/Obi/Obi/Playlist.cs

    r5333 r5827  
    12711271            } 
    12721272        } 
     1273        public void FastPlayWithLapseForward(double LapseForwardTime) 
     1274        { 
     1275            double currentTimePosition = CurrentTimeInAsset; 
     1276            //(double)mPlayer.CurrentAudioPCMFormat.ConvertBytesToTime(mPlayer.CurrentBytePosition) / 
     1277            //Time.TIME_UNIT; 
     1278 
     1279            bool wasPaused = State == AudioPlayer.State.Paused; 
     1280            //Console.WriteLine("paused time before " + mPlayer.CurrentTimePosition); 
     1281            if (currentTimePosition > LapseForwardTime) 
     1282            { 
     1283                mPlayer.Pause(); 
     1284                // mPlayer.FastPlayFactor = 1; 
     1285                CurrentTimeInAsset = currentTimePosition + LapseForwardTime; 
     1286 
     1287                // set revert time of preview playlist, to do: this should become part of CurrentTimeOfAsset finally. 
     1288                if (this is PreviewPlaylist) ((PreviewPlaylist)this).RevertTime = currentTimePosition + LapseForwardTime; 
     1289            } 
     1290            else 
     1291            { 
     1292                mPlayer.Pause(); 
     1293                double diff=LapseForwardTime-currentTimePosition; 
     1294                CurrentTimeInAsset += diff; 
     1295                // set revert time of preview playlist, to do: this should become part of CurrentTimeOfAsset finally. 
     1296                if (this is PreviewPlaylist) ((PreviewPlaylist)this).RevertTime = 10; 
     1297              //  mPlayer.FastPlayFactor = 1; 
     1298            } 
     1299            //Console.WriteLine("paused time " + mPlayer.CurrentTimePosition); 
     1300            if (!wasPaused) 
     1301            { 
     1302                mPlaylistState = AudioPlayer.State.Playing; 
     1303                mPlayer.Resume(); 
     1304                if (StateChanged != null) 
     1305                    StateChanged(this, new AudioLib.AudioPlayer.StateChangedEventArgs(AudioPlayer.State.Paused)); 
     1306            } 
     1307        } 
    12731308 
    12741309        public void SanitizePlaylist() 
  • trunk/Obi/Obi/ProjectView/ContentView.cs

    r5794 r5827  
    37393739            mShortcutKeys[keyboardShortcuts.ContentView_FastPlayRateNormilize.Value] = FastPlayRateNormalise; 
    37403740            mShortcutKeys[keyboardShortcuts.ContentView_FastPlayNormalizeWithElapseBack.Value] = FastPlayNormaliseWithLapseBack; 
     3741            mShortcutKeys[keyboardShortcuts.ContentView_FastPlayWithElapseForward.Value] = delegate() { return mProjectView.TransportBar.FastPlayWithLapseForward(); }; 
    37413742            mShortcutKeys[keyboardShortcuts.ContentView_MarkSelectionFromBeginningToTheCursor.Value] = MarkSelectionFromBeginningToTheCursor; 
    37423743            mShortcutKeys[keyboardShortcuts.ContentView_MarkSelectionFromCursorToTheEnd.Value] = MarkSelectionFromCursorToTheEnd; 
  • trunk/Obi/Obi/ProjectView/TransportBar.cs

    r5826 r5827  
    25742574        public bool FastPlayNormaliseWithLapseBack() 
    25752575        { 
    2576              m_ElapseBackInterval = mView.ObiForm.Settings.ElapseBackTimeInMilliseconds; 
     2576            m_ElapseBackInterval = mView.ObiForm.Settings.ElapseBackTimeInMilliseconds; 
    25772577            // work around to handle special nudge condition of preview: this should be implemented universally after 2.0 release 
    25782578            if (mCurrentPlaylist != null && mView.Selection is AudioSelection && mCurrentPlaylist is PreviewPlaylist && CurrentState == State.Paused) Stop(); 
    25792579            if (IsPlayerActive) 
    25802580            { 
    2581                 
     2581 
    25822582                if (IsPaused && mCurrentPlaylist.CurrentTimeInAsset <= 10 && (mView.Selection.Node.PrecedingNode is PhraseNode || mView.Selection.Node.PrecedingNode is EmptyNode) && !mView.IsZoomWaveformActive) 
    25832583                { 
     
    25972597                        { 
    25982598                            if (((AudioSelection)mView.Selection).AudioRange.CursorTime != mCurrentPlaylist.CurrentTimeInAsset) 
    2599                             {                                
     2599                            { 
    26002600                                ((AudioSelection)mView.Selection).AudioRange.CursorTime = mCurrentPlaylist.CurrentTimeInAsset; 
    26012601                            } 
     
    26092609            { 
    26102610                LapseBackCursor(); 
     2611 
     2612                return true; 
     2613            } 
     2614            return false; 
     2615        } 
     2616        public bool FastPlayWithLapseForward() 
     2617        { 
     2618            m_ElapseBackInterval = mView.ObiForm.Settings.ElapseBackTimeInMilliseconds; 
     2619            // work around to handle special nudge condition of preview: this should be implemented universally after 2.0 release 
     2620            if (mCurrentPlaylist != null && mView.Selection is AudioSelection && mCurrentPlaylist is PreviewPlaylist && CurrentState == State.Paused) Stop(); 
     2621            if (IsPlayerActive) 
     2622            { 
     2623 
     2624                if (IsPaused && (mView.Selection.Node.FollowingNode is PhraseNode || mView.Selection.Node.FollowingNode is EmptyNode) && (mView.Selection.Node.Parent == mView.Selection.Node.FollowingNode.Parent) && (mCurrentPlaylist.CurrentTimeInAsset >= (mView.Selection.Node.Duration - m_ElapseBackInterval)) && !mView.IsZoomWaveformActive) 
     2625                { 
     2626                    LapseForwardCursor(); 
     2627                    return true; 
     2628                } 
     2629                else 
     2630                { 
     2631                    DetermineUseOfSoundTouch(1.0f); 
     2632                    mCurrentPlaylist.FastPlayWithLapseForward(m_ElapseBackInterval); 
     2633                    //  mFastPlayRateCombobox.SelectedIndex = 0; 
     2634                    UpdateTimeDisplay(); 
     2635                    if (CurrentPlaylist != null) mView.UpdateCursorPosition(mCurrentPlaylist.CurrentTimeInAsset); 
     2636                    if (mView.Selection is AudioSelection) 
     2637                    { 
     2638                        if (((AudioSelection)mView.Selection).AudioRange.HasCursor) 
     2639                        { 
     2640                            if (((AudioSelection)mView.Selection).AudioRange.CursorTime != mCurrentPlaylist.CurrentTimeInAsset) 
     2641                            { 
     2642                                ((AudioSelection)mView.Selection).AudioRange.CursorTime = mCurrentPlaylist.CurrentTimeInAsset; 
     2643                            } 
     2644 
     2645                        } 
     2646                    } 
     2647                    return true; 
     2648                } 
     2649            } 
     2650            else if (CurrentState == State.Stopped && mView.Selection != null && mView.Selection.Node is PhraseNode) 
     2651            { 
     2652                LapseForwardCursor(); 
    26112653 
    26122654                return true; 
     
    26282670                    AudioRange range = new AudioRange(mView.Selection.Node.Duration); 
    26292671                    mView.Selection = new AudioSelection((PhraseNode)mView.Selection.Node, mView.Selection.Control, range); 
     2672                    if (mView.ObiForm.Settings.AudioClues) 
     2673                    { 
     2674                        System.Media.SystemSounds.Asterisk.Play(); 
     2675                    } 
    26302676                } 
    26312677            } 
     
    26472693                    mView.Selection = new AudioSelection((PhraseNode)mView.Selection.Node, mView.Selection.Control, range); 
    26482694                    time = ((AudioSelection)mView.Selection).AudioRange.CursorTime; 
     2695                    if (mView.ObiForm.Settings.AudioClues) 
     2696                    { 
     2697                        System.Media.SystemSounds.Asterisk.Play(); 
     2698                    } 
    26492699                } 
    26502700 
     
    26582708                mView.Selection = new AudioSelection((PhraseNode)mView.Selection.Node, mView.Selection.Control, 
    26592709                    new AudioRange(((PhraseNode)mView.Selection.EmptyNodeForSelection).Duration - m_ElapseBackInterval)); 
     2710            } 
     2711        } 
     2712        private void LapseForwardCursor() 
     2713        { 
     2714            bool flag = false; 
     2715            if (IsPaused) 
     2716            { 
     2717                double time = mCurrentPlaylist.CurrentTimeInAsset; 
     2718 
     2719                if (mView.Selection.Node.FollowingNode != null && mView.Selection.Node.FollowingNode is PhraseNode) 
     2720                { 
     2721                    Stop(); 
     2722                    // mView.ClearCursor(); 
     2723                    double diff = mView.Selection.Node.Duration - time; 
     2724                    diff = m_ElapseBackInterval - diff; 
     2725                    mView.Selection = new NodeSelection(mView.Selection.Node.FollowingNode, mView.Selection.Control); 
     2726 
     2727                    AudioRange range = new AudioRange(diff); 
     2728                    mView.Selection = new AudioSelection((PhraseNode)mView.Selection.Node, mView.Selection.Control, range); 
     2729                    flag = true; 
     2730                    if (mView.ObiForm.Settings.AudioClues) 
     2731                    { 
     2732                        System.Media.SystemSounds.Asterisk.Play(); 
     2733                    } 
     2734                } 
     2735            } 
     2736            if (mView.Selection is AudioSelection) 
     2737            { 
     2738                double time = ((AudioSelection)mView.Selection).AudioRange.CursorTime; 
     2739 
     2740                if ((time + m_ElapseBackInterval) >= mView.Selection.Node.Duration && !mView.IsZoomWaveformActive && ((mView.Selection.Node.FollowingNode is PhraseNode) || (mView.Selection.Node.FollowingNode is EmptyNode)) && (mView.Selection.Node.Parent==mView.Selection.Node.FollowingNode.Parent)) 
     2741                { 
     2742                    ObiNode followingNode = mView.Selection.Node.FollowingNode; 
     2743                    double diff = mView.Selection.Node.Duration - time; 
     2744                    diff = m_ElapseBackInterval - diff; 
     2745                    mView.Selection = new NodeSelection(followingNode, mView.Selection.Control); 
     2746                    AudioRange range = new AudioRange(diff); 
     2747                    while (mView.Selection.Node is EmptyNode && !(mView.Selection.Node is PhraseNode)) 
     2748                    { 
     2749                        followingNode = mView.Selection.Node.FollowingNode; 
     2750                        mView.Selection = new NodeSelection(followingNode, mView.Selection.Control); 
     2751                        range = new AudioRange(diff); 
     2752                    } 
     2753                    mView.Selection = new AudioSelection((PhraseNode)mView.Selection.Node, mView.Selection.Control, range); 
     2754                    time = ((AudioSelection)mView.Selection).AudioRange.CursorTime; 
     2755                    if (time > mView.Selection.Node.Duration) 
     2756                    { 
     2757                        time = mView.Selection.Node.Duration; 
     2758                    } 
     2759                    //mView.UpdateCursorPosition(time); 
     2760                    if (mView.ObiForm.Settings.AudioClues) 
     2761                    { 
     2762                        System.Media.SystemSounds.Asterisk.Play(); 
     2763                    } 
     2764                } 
     2765                else if (((time + m_ElapseBackInterval) <= mView.Selection.Node.Duration) && !flag) 
     2766                { 
     2767                    time = time + m_ElapseBackInterval; 
     2768                } 
     2769                else if(!flag) 
     2770                { 
     2771                    time = mView.Selection.Node.Duration; 
     2772                } 
     2773 
     2774                mView.Selection = new AudioSelection((PhraseNode)mView.Selection.Node, mView.Selection.Control, 
     2775                    new AudioRange(time)); 
     2776            } 
     2777            else if (!IsPaused) 
     2778            { 
     2779                mView.Selection = new AudioSelection((PhraseNode)mView.Selection.Node, mView.Selection.Control, 
     2780                    new AudioRange(((PhraseNode)mView.Selection.EmptyNodeForSelection).Duration + m_ElapseBackInterval)); 
    26602781            } 
    26612782        } 
  • trunk/Obi/Obi/messages.Designer.cs

    r5814 r5827  
    25152515         
    25162516        /// <summary> 
     2517        ///   Looks up a localized string similar to Elapse Forward. 
     2518        /// </summary> 
     2519        internal static string KeyS_FastPlayWithElapseForward { 
     2520            get { 
     2521                return ResourceManager.GetString("KeyS_FastPlayWithElapseForward", resourceCulture); 
     2522            } 
     2523        } 
     2524         
     2525        /// <summary> 
    25172526        ///   Looks up a localized string similar to Focus on time display. 
    25182527        /// </summary> 
  • trunk/Obi/Obi/messages.resx

    r5814 r5827  
    26242624    <value>Disable deselection on stop</value> 
    26252625  </data> 
     2626  <data name="KeyS_FastPlayWithElapseForward" xml:space="preserve"> 
     2627    <value>Elapse Forward</value> 
     2628  </data> 
    26262629</root> 
Note: See TracChangeset for help on using the changeset viewer.