From: <ju...@us...> - 2008-05-15 12:02:45
|
Revision: 3064 http://urakawa.svn.sourceforge.net/urakawa/?rev=3064&view=rev Author: julienq Date: 2008-05-15 05:02:41 -0700 (Thu, 15 May 2008) Log Message: ----------- Working on playback/navigation. Fixed crash on cut/delete during playback. Modified Paths: -------------- trunk/urakawa/application/Obi/Obi/ProjectView/ProjectView.cs trunk/urakawa/application/Obi/Obi/ProjectView/TransportBar.cs Modified: trunk/urakawa/application/Obi/Obi/ProjectView/ProjectView.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/ProjectView/ProjectView.cs 2008-05-15 10:56:17 UTC (rev 3063) +++ trunk/urakawa/application/Obi/Obi/ProjectView/ProjectView.cs 2008-05-15 12:02:41 UTC (rev 3064) @@ -277,6 +277,7 @@ /// </summary> public void Cut() { + if (CanDelete && mTransportBar.IsPlayerActive) mTransportBar.Stop(); if (CanRemoveSection || CanRemoveStrip) { bool isSection = mSelection.Control is TOCView; @@ -311,6 +312,7 @@ /// </summary> public void Delete() { + if (CanDelete && mTransportBar.IsPlayerActive) mTransportBar.Stop(); if (CanRemoveSection) { mPresentation.getUndoRedoManager().execute(new Commands.Node.Delete(this, mTOCView.Selection.Section, Modified: trunk/urakawa/application/Obi/Obi/ProjectView/TransportBar.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/ProjectView/TransportBar.cs 2008-05-15 10:56:17 UTC (rev 3063) +++ trunk/urakawa/application/Obi/Obi/ProjectView/TransportBar.cs 2008-05-15 12:02:41 UTC (rev 3064) @@ -520,12 +520,14 @@ /// <summary> /// Play all in the project. (Used when nothing is selected, or from the play all menu item.) + /// Start from the current selection, or from the first phrase. /// </summary> public void PlayAll() { mCurrentPlaylist = mMasterPlaylist; - mCurrentPlaylist.CurrentPhrase = mCurrentPlaylist.FirstPhrase; - mCurrentPlaylist.Play(); + PlayCurrentPlaylistFromSelection(); + // mCurrentPlaylist.CurrentPhrase = mCurrentPlaylist.FirstPhrase; + // mCurrentPlaylist.Play(); } /// <summary> @@ -561,22 +563,41 @@ mLocalPlaylist = new Playlist(mPlayer, mView.Selection); SetPlaylistEvents(mLocalPlaylist); mCurrentPlaylist = mLocalPlaylist; - if (mView.Selection is AudioSelection - && (!((AudioSelection)mView.Selection).AudioRange.HasCursor || mIsSelectionMarked) - && ((AudioSelection)mView.Selection).AudioRange.SelectionEndTime > ((AudioSelection)mView.Selection).AudioRange.SelectionBeginTime) + PlayCurrentPlaylistFromSelection(); + } + } + + // Play the current playlist from the current selection. + private void PlayCurrentPlaylistFromSelection() + { + if (mView.Selection is AudioSelection + && mView.Selection.Node is PhraseNode + && (!((AudioSelection)mView.Selection).AudioRange.HasCursor || mIsSelectionMarked) + && ((AudioSelection)mView.Selection).AudioRange.SelectionEndTime > ((AudioSelection)mView.Selection).AudioRange.SelectionBeginTime) + { + mCurrentPlaylist.CurrentPhrase = (PhraseNode)mView.Selection.Node; + mCurrentPlaylist.Play(((AudioSelection)mView.Selection).AudioRange.SelectionBeginTime, ((AudioSelection)mView.Selection).AudioRange.SelectionEndTime); + } + else if (mView.Selection is AudioSelection + && mView.Selection.Node is PhraseNode + && ((AudioSelection)mView.Selection).AudioRange.HasCursor) + { + mCurrentPlaylist.CurrentPhrase = (PhraseNode)mView.Selection.Node; + mCurrentPlaylist.Play(((AudioSelection)mView.Selection).AudioRange.CursorTime); + } + else if (mView.Selection is StripCursorSelection) + { + StripCursorSelection s = (StripCursorSelection)mView.Selection; + if (s.Index < s.Section.PhraseChildCount) { - mCurrentPlaylist.Play(((AudioSelection)mView.Selection).AudioRange.SelectionBeginTime, ((AudioSelection)mView.Selection).AudioRange.SelectionEndTime); + mCurrentPlaylist.CurrentPhrase = (PhraseNode)s.Section.PhraseChild(s.Index); } - else if (mView.Selection is AudioSelection - && ((AudioSelection)mView.Selection).AudioRange.HasCursor) - { - mCurrentPlaylist.Play(((AudioSelection)mView.Selection).AudioRange.CursorTime); - } - else - { - mCurrentPlaylist.Play(); - } + mCurrentPlaylist.Play(); } + else + { + mCurrentPlaylist.Play(); + } } @@ -639,7 +660,7 @@ // Stopping again deselects everything if (mCurrentPlaylist.State == Obi.Audio.AudioPlayerState.Stopped) { - //mView.Selection = null; + mView.Selection = null; } else { @@ -1186,7 +1207,7 @@ public bool IsActive { get { return Enabled && ( IsPlayerActive || IsRecorderActive ); } } private bool IsPlaying { get { return mPlayer.State == Obi.Audio.AudioPlayerState.Playing; } } - private bool IsPlayerActive { get { return IsPaused || IsPlaying; } } + public bool IsPlayerActive { get { return IsPaused || IsPlaying; } } private bool IsPaused { get { return mPlayer.State == Obi.Audio.AudioPlayerState.Paused; } } public bool IsRecorderActive { get { return IsListening || IsRecording; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |