From: <avn...@us...> - 2007-12-12 06:10:04
|
Revision: 2640 http://urakawa.svn.sourceforge.net/urakawa/?rev=2640&view=rev Author: avneeshsingh Date: 2007-12-11 22:09:58 -0800 (Tue, 11 Dec 2007) Log Message: ----------- minor updates to transportBar to avoid AudioSelection crashes Modified Paths: -------------- trunk/urakawa/application/Obi/Obi/ProjectView/TransportBar.cs Modified: trunk/urakawa/application/Obi/Obi/ProjectView/TransportBar.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/ProjectView/TransportBar.cs 2007-12-12 01:30:26 UTC (rev 2639) +++ trunk/urakawa/application/Obi/Obi/ProjectView/TransportBar.cs 2007-12-12 06:09:58 UTC (rev 2640) @@ -744,13 +744,24 @@ // preview playback functions + + private bool IsInPhraseSelectionMarked + { + get + { + if (mView.Selection != null + && mView.Selection is AudioSelection + && ((AudioSelection)mView.Selection).WaveformSelection.HasCursor) + return true; + else + return false; + } + } - public bool MarkSelectionBeginTime () { - if ( ((AudioSelection)mView.Selection) != null - && ((AudioSelection)mView.Selection).WaveformSelection.HasCursor) - { + if ( IsInPhraseSelectionMarked ) + { ((AudioSelection)mView.Selection).WaveformSelection.SelectionBeginTime = ((AudioSelection)mView.Selection).WaveformSelection.CursorTime ; return true; } @@ -759,9 +770,8 @@ public bool MarkSelectionEndTime() { - if (((AudioSelection)mView.Selection) != null - && ((AudioSelection)mView.Selection).WaveformSelection.HasCursor - && mCurrentPlaylist.CurrentTimeInAsset > ((AudioSelection)mView.Selection).WaveformSelection.SelectionBeginTime ) + if ( IsInPhraseSelectionMarked + && mCurrentPlaylist.CurrentTimeInAsset > ((AudioSelection)mView.Selection).WaveformSelection.SelectionBeginTime ) { ((AudioSelection)mView.Selection).WaveformSelection.SelectionEndTime = ((AudioSelection)mView.Selection).WaveformSelection.CursorTime ; return true; @@ -772,9 +782,8 @@ public bool PlayPreviewFromCurrentPosition() { - if ((mView.Selection) != null - && ((AudioSelection)mView.Selection).WaveformSelection.HasCursor) - { + if ( IsInPhraseSelectionMarked ) + { mCurrentPlaylist.PreviewFromCurrentPosition(((AudioSelection)mView.Selection).WaveformSelection.CursorTime, m_PreviewDuration); return true; } @@ -783,8 +792,7 @@ public bool PlayPreviewSelectedFragment() { - // add code for playing between markings - if (( mView.Selection) != null + if ( IsInPhraseSelectionMarked && ((AudioSelection)mView.Selection).WaveformSelection.SelectionBeginTime < ((AudioSelection)mView.Selection).WaveformSelection.SelectionEndTime ) { mCurrentPlaylist.PreviewSelectedFragment(((AudioSelection)mView.Selection).WaveformSelection.SelectionBeginTime, ((AudioSelection)mView.Selection).WaveformSelection.SelectionEndTime ); @@ -795,9 +803,8 @@ public bool PlayPreviewUptoCurrentPosition() { - if ((mView.Selection) != null - && ((AudioSelection)mView.Selection).WaveformSelection.HasCursor) - { + if ( IsInPhraseSelectionMarked ) + { mCurrentPlaylist.PreviewUptoCurrentPosition(((AudioSelection)mView.Selection).WaveformSelection.CursorTime , m_PreviewDuration); return true; } @@ -870,9 +877,8 @@ else if (selected is PhraseNode) { mRecordingSection = selected.ParentAs<SectionNode>(); - if (mCurrentPlaylist.State == Obi.Audio.AudioPlayerState.Paused) - { - if (((AudioSelection)mView.Selection) != null && ((AudioSelection)mView.Selection).WaveformSelection.HasCursor) + + if ( IsInPhraseSelectionMarked ) { if (((AudioSelection)mView.Selection).WaveformSelection.SelectionEndTime != 0 && ((AudioSelection)mView.Selection).WaveformSelection.SelectionBeginTime < ((AudioSelection)mView.Selection).WaveformSelection.SelectionEndTime) @@ -883,12 +889,13 @@ else mView.Presentation.UndoRedoManager.execute(new Commands.Node.SplitAudio(mView )); - + + if ( mCurrentPlaylist.State == Audio.AudioPlayerState.Paused ) mCurrentPlaylist.Stop(); - + } - } + mRecordingInitPhraseIndex = 1 + selected.Index; } Settings settings = mView.ObiForm.Settings; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |