addAudioClip() and addPlaylist() now update playlength of Playlist object
This commit is contained in:
parent
6fd2b02e01
commit
4453635885
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.26 $
|
Version : $Revision: 1.27 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Playlist.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Playlist.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -93,7 +93,7 @@ using namespace boost::posix_time;
|
||||||
* </code></pre>
|
* </code></pre>
|
||||||
*
|
*
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision: 1.26 $
|
* @version $Revision: 1.27 $
|
||||||
*/
|
*/
|
||||||
class Playlist : public Configurable,
|
class Playlist : public Configurable,
|
||||||
public Playable
|
public Playable
|
||||||
|
@ -476,6 +476,10 @@ class Playlist : public Configurable,
|
||||||
/**
|
/**
|
||||||
* Add a new audio clip to the playlist.
|
* Add a new audio clip to the playlist.
|
||||||
*
|
*
|
||||||
|
* The playlist is not checked for gaps (use valid() for that),
|
||||||
|
* but the playlength is adjusted if the new audio clip is added
|
||||||
|
* at the end of the playlist.
|
||||||
|
*
|
||||||
* @param audioClip the new audio clip to be added
|
* @param audioClip the new audio clip to be added
|
||||||
* @param relativeOffset the start of the audio clip, relative
|
* @param relativeOffset the start of the audio clip, relative
|
||||||
* to the start of the playlist
|
* to the start of the playlist
|
||||||
|
@ -493,6 +497,10 @@ class Playlist : public Configurable,
|
||||||
/**
|
/**
|
||||||
* Add a new sub-playlist to the playlist.
|
* Add a new sub-playlist to the playlist.
|
||||||
*
|
*
|
||||||
|
* The playlist is not checked for gaps (use valid() for that),
|
||||||
|
* but the playlength is adjusted if the new sub-playlist is added
|
||||||
|
* at the end of the playlist.
|
||||||
|
*
|
||||||
* @param playlist the sub-playlist to be added
|
* @param playlist the sub-playlist to be added
|
||||||
* @param relativeOffset the start of the sub-playlist, relative
|
* @param relativeOffset the start of the sub-playlist, relative
|
||||||
* to the start of the containing playlist
|
* to the start of the containing playlist
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.21 $
|
Version : $Revision: 1.22 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -153,9 +153,16 @@ Playlist::addAudioClip(Ptr<AudioClip>::Ref audioClip,
|
||||||
throw std::invalid_argument(eMsg);
|
throw std::invalid_argument(eMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ptr<PlaylistElement>::Ref playlistElement(new PlaylistElement(
|
Ptr<PlaylistElement>::Ref playlistElement(new PlaylistElement(
|
||||||
relativeOffset, audioClip, fadeInfo));
|
relativeOffset, audioClip, fadeInfo));
|
||||||
(*elementList)[*relativeOffset] = playlistElement;
|
(*elementList)[*relativeOffset] = playlistElement;
|
||||||
|
|
||||||
|
Ptr<time_duration>::Ref endOffset(new time_duration(
|
||||||
|
*relativeOffset
|
||||||
|
+ *audioClip->getPlaylength()));
|
||||||
|
if (*endOffset > *playlength) {
|
||||||
|
playlength = endOffset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -176,6 +183,13 @@ Playlist::addPlaylist(Ptr<Playlist>::Ref playlist,
|
||||||
Ptr<PlaylistElement>::Ref playlistElement(new PlaylistElement(
|
Ptr<PlaylistElement>::Ref playlistElement(new PlaylistElement(
|
||||||
relativeOffset, playlist, fadeInfo));
|
relativeOffset, playlist, fadeInfo));
|
||||||
(*elementList)[*relativeOffset] = playlistElement;
|
(*elementList)[*relativeOffset] = playlistElement;
|
||||||
|
|
||||||
|
Ptr<time_duration>::Ref endOffset(new time_duration(
|
||||||
|
*relativeOffset
|
||||||
|
+ *playlist->getPlaylength()));
|
||||||
|
if (*endOffset > *playlength) {
|
||||||
|
playlength = endOffset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.17 $
|
Version : $Revision: 1.18 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistTest.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistTest.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -213,6 +213,9 @@ PlaylistTest :: audioClipTest(void)
|
||||||
CPPUNIT_FAIL(eMsg);
|
CPPUNIT_FAIL(eMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT(playlist->getPlaylength());
|
||||||
|
CPPUNIT_ASSERT(*playlist->getPlaylength() == *relativeOffset + *clipLength);
|
||||||
|
|
||||||
CPPUNIT_ASSERT(!playlist->valid()); // big gap in playlist
|
CPPUNIT_ASSERT(!playlist->valid()); // big gap in playlist
|
||||||
|
|
||||||
Playlist::const_iterator it = playlist->begin();
|
Playlist::const_iterator it = playlist->begin();
|
||||||
|
|
Loading…
Reference in New Issue