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 $
Version : $Revision: 1.18 $
Version : $Revision: 1.19 $
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,
&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());
Gtk::Menu::MenuList& contextMenuList = contextMenu->items();
// register the signal handlers for the popup menu

View file

@ -22,7 +22,7 @@
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 $
------------------------------------------------------------------------------*/
@ -74,7 +74,7 @@ using namespace LiveSupport::Widgets;
* playlists.
*
* @author $Author: fgerlits $
* @version $Revision: 1.13 $
* @version $Revision: 1.14 $
*/
class LiveModeWindow : public WhiteWindow, public LocalizedObject
{
@ -87,7 +87,7 @@ class LiveModeWindow : public WhiteWindow, public LocalizedObject
* Lists one clip per row.
*
* @author $Author: fgerlits $
* @version $Revision: 1.13 $
* @version $Revision: 1.14 $
*/
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.
* This brings up the right-click context menu.
*
* @param event the button event recieved
*/

View file

@ -22,7 +22,7 @@
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 $
------------------------------------------------------------------------------*/
@ -156,11 +156,11 @@ SimplePlaylistManagementWindow :: SimplePlaylistManagementWindow (
add(*mainBox);
// Register the signal handlers
// Register the signal handlers for the buttons
saveButton->signal_clicked().connect(sigc::mem_fun(*this,
&SimplePlaylistManagementWindow::onSaveButtonClicked));
&SimplePlaylistManagementWindow::onSaveButtonClicked));
closeButton->signal_clicked().connect(sigc::mem_fun(*this,
&SimplePlaylistManagementWindow::onCloseButtonClicked));
&SimplePlaylistManagementWindow::onCloseButtonClicked));
// show
set_name("simplePlaylistManagementWindow");
@ -399,9 +399,12 @@ GLiveSupport :: setFadeIn(Ptr<PlaylistElement>::Ref playlistElement,
} else {
oldFadeOut.reset(new time_duration(0,0,0,0));
}
Ptr<FadeInfo>::Ref newFadeInfo(new FadeInfo(
newFadeIn, oldFadeOut ));
playlistElement->setFadeInfo(newFadeInfo);
if (isLengthOkay(playlistElement, newFadeInfo)) {
playlistElement->setFadeInfo(newFadeInfo);
}
}
@ -422,6 +425,22 @@ GLiveSupport :: setFadeOut(Ptr<PlaylistElement>::Ref playlistElement,
}
Ptr<FadeInfo>::Ref newFadeInfo(new FadeInfo(
oldFadeIn, newFadeOut ));
playlistElement->setFadeInfo(newFadeInfo);
if (isLengthOkay(playlistElement, 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 $
Version : $Revision: 1.9 $
Version : $Revision: 1.10 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.h,v $
------------------------------------------------------------------------------*/
@ -87,7 +87,7 @@ using namespace LiveSupport::Widgets;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.9 $
* @version $Revision: 1.10 $
*/
class SimplePlaylistManagementWindow : public WhiteWindow,
public LocalizedObject
@ -116,7 +116,7 @@ class SimplePlaylistManagementWindow : public WhiteWindow,
* Lists one playlist entry per row.
*
* @author $Author: fgerlits $
* @version $Revision: 1.9 $
* @version $Revision: 1.10 $
*/
class ModelColumns : public ZebraTreeModelColumnRecord
{
@ -287,6 +287,14 @@ class SimplePlaylistManagementWindow : public WhiteWindow,
setFadeOut(Ptr<PlaylistElement>::Ref playlistElement,
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 LiveSupport