added check for fade info to make sure fade in + fade out is not

longer than the whole clip
This commit is contained in:
fgerlits 2005-07-15 14:59:08 +00:00
parent 85b8bcbd52
commit 923bfad1a4
4 changed files with 42 additions and 14 deletions

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.18 $ Version : $Revision: 1.19 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/LiveModeWindow.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/LiveModeWindow.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -144,7 +144,7 @@ LiveModeWindow :: LiveModeWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
outputPlayButton->signal_clicked().connect(sigc::mem_fun(*this, outputPlayButton->signal_clicked().connect(sigc::mem_fun(*this,
&LiveModeWindow::onOutputPlay )); &LiveModeWindow::onOutputPlay ));
// create the right-click entry context menu for audio clips // create the right-click entry context menu
contextMenu = Gtk::manage(new Gtk::Menu()); contextMenu = Gtk::manage(new Gtk::Menu());
Gtk::Menu::MenuList& contextMenuList = contextMenu->items(); Gtk::Menu::MenuList& contextMenuList = contextMenu->items();
// register the signal handlers for the popup menu // register the signal handlers for the popup menu

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.13 $ Version : $Revision: 1.14 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/LiveModeWindow.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/LiveModeWindow.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -74,7 +74,7 @@ using namespace LiveSupport::Widgets;
* playlists. * playlists.
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.13 $ * @version $Revision: 1.14 $
*/ */
class LiveModeWindow : public WhiteWindow, public LocalizedObject class LiveModeWindow : public WhiteWindow, public LocalizedObject
{ {
@ -87,7 +87,7 @@ class LiveModeWindow : public WhiteWindow, public LocalizedObject
* Lists one clip per row. * Lists one clip per row.
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.13 $ * @version $Revision: 1.14 $
*/ */
class ModelColumns : public PlayableTreeModelColumnRecord class ModelColumns : public PlayableTreeModelColumnRecord
{ {
@ -159,6 +159,7 @@ class LiveModeWindow : public WhiteWindow, public LocalizedObject
/** /**
* Signal handler for the mouse clicked on one of the entries. * Signal handler for the mouse clicked on one of the entries.
* This brings up the right-click context menu.
* *
* @param event the button event recieved * @param event the button event recieved
*/ */

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.19 $ Version : $Revision: 1.20 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -156,7 +156,7 @@ SimplePlaylistManagementWindow :: SimplePlaylistManagementWindow (
add(*mainBox); add(*mainBox);
// Register the signal handlers // Register the signal handlers for the buttons
saveButton->signal_clicked().connect(sigc::mem_fun(*this, saveButton->signal_clicked().connect(sigc::mem_fun(*this,
&SimplePlaylistManagementWindow::onSaveButtonClicked)); &SimplePlaylistManagementWindow::onSaveButtonClicked));
closeButton->signal_clicked().connect(sigc::mem_fun(*this, closeButton->signal_clicked().connect(sigc::mem_fun(*this,
@ -399,10 +399,13 @@ GLiveSupport :: setFadeIn(Ptr<PlaylistElement>::Ref playlistElement,
} else { } else {
oldFadeOut.reset(new time_duration(0,0,0,0)); oldFadeOut.reset(new time_duration(0,0,0,0));
} }
Ptr<FadeInfo>::Ref newFadeInfo(new FadeInfo( Ptr<FadeInfo>::Ref newFadeInfo(new FadeInfo(
newFadeIn, oldFadeOut )); newFadeIn, oldFadeOut ));
if (isLengthOkay(playlistElement, newFadeInfo)) {
playlistElement->setFadeInfo(newFadeInfo); playlistElement->setFadeInfo(newFadeInfo);
} }
}
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
@ -422,6 +425,22 @@ GLiveSupport :: setFadeOut(Ptr<PlaylistElement>::Ref playlistElement,
} }
Ptr<FadeInfo>::Ref newFadeInfo(new FadeInfo( Ptr<FadeInfo>::Ref newFadeInfo(new FadeInfo(
oldFadeIn, newFadeOut )); oldFadeIn, newFadeOut ));
if (isLengthOkay(playlistElement, newFadeInfo)) {
playlistElement->setFadeInfo(newFadeInfo); playlistElement->setFadeInfo(newFadeInfo);
} }
}
/*------------------------------------------------------------------------------
* Auxilliary function: check that fades are not longer than the whole clip.
*----------------------------------------------------------------------------*/
inline bool
GLiveSupport :: isLengthOkay(Ptr<PlaylistElement>::Ref playlistElement,
Ptr<FadeInfo>::Ref newFadeInfo)
throw()
{
time_duration totalFades = *newFadeInfo->getFadeIn()
+ *newFadeInfo->getFadeOut();
return (totalFades < *playlistElement->getPlayable()->getPlaylength());
}

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.9 $ Version : $Revision: 1.10 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -87,7 +87,7 @@ using namespace LiveSupport::Widgets;
* </code></pre> * </code></pre>
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.9 $ * @version $Revision: 1.10 $
*/ */
class SimplePlaylistManagementWindow : public WhiteWindow, class SimplePlaylistManagementWindow : public WhiteWindow,
public LocalizedObject public LocalizedObject
@ -116,7 +116,7 @@ class SimplePlaylistManagementWindow : public WhiteWindow,
* Lists one playlist entry per row. * Lists one playlist entry per row.
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.9 $ * @version $Revision: 1.10 $
*/ */
class ModelColumns : public ZebraTreeModelColumnRecord class ModelColumns : public ZebraTreeModelColumnRecord
{ {
@ -287,6 +287,14 @@ class SimplePlaylistManagementWindow : public WhiteWindow,
setFadeOut(Ptr<PlaylistElement>::Ref playlistElement, setFadeOut(Ptr<PlaylistElement>::Ref playlistElement,
Ptr<time_duration>::Ref newFadeOut) throw(); Ptr<time_duration>::Ref newFadeOut) throw();
/**
* Auxilliary function: check that fades are not longer than
* the whole clip.
*/
bool
isLengthOkay(Ptr<PlaylistElement>::Ref playlistElement,
Ptr<FadeInfo>::Ref newFadeInfo) throw();
} // namespace GLiveSupport } // namespace GLiveSupport
} // namespace LiveSupport } // namespace LiveSupport