diff --git a/livesupport/modules/playlistExecutor/etc/playlist.xml b/livesupport/modules/playlistExecutor/etc/playlist.xml
index 160530ef1..54d6ca9c3 100644
--- a/livesupport/modules/playlistExecutor/etc/playlist.xml
+++ b/livesupport/modules/playlistExecutor/etc/playlist.xml
@@ -31,8 +31,8 @@
playlength="00:00:11"
title = "one"
uri="file:var/test10001.mp3" />
-
+ fadeOut="0" />
+ relativeOffset="00:00:18" >
+ fadeIn="0"
+ fadeOut="00:00:05" />
diff --git a/livesupport/modules/playlistExecutor/src/HelixPlayer.cxx b/livesupport/modules/playlistExecutor/src/HelixPlayer.cxx
index 2b832cfaf..bf721bdb6 100644
--- a/livesupport/modules/playlistExecutor/src/HelixPlayer.cxx
+++ b/livesupport/modules/playlistExecutor/src/HelixPlayer.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.11 $
+ Version : $Revision: 1.12 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/playlistExecutor/src/Attic/HelixPlayer.cxx,v $
------------------------------------------------------------------------------*/
@@ -60,9 +60,9 @@ typedef HX_RESULT (HXEXPORT_PTR FPRMSETDLLACCESSPATH) (const char*);
static DLLAccessPath accessPath;
-/*------------------------------------------------------------------------------
+/**
* The name of the config element for this class
- *----------------------------------------------------------------------------*/
+ */
const std::string HelixPlayer::configElementNameStr = "helixPlayer";
@@ -77,6 +77,18 @@ static const std::string dllPathName = "dllPath";
static const std::string clntcoreName = "/clntcore.so";
+/**
+ * Magic number #1: max time to wait for an audio stream, in milliseconds
+ */
+static const int getAudioStreamTimeOut = 10;
+
+/**
+ * Magic number #2: time to wait after getting crossfade interface,
+ * and before setting crossfade values, in milliseconds
+ */
+static const int crossFadeWaitingTime = 50;
+
+
/* =============================================== local function prototypes */
@@ -422,20 +434,28 @@ HelixPlayer :: openAndStartPlaylist(Ptr::Ref playlist)
Ptr::Ref sleepT(new time_duration(microseconds(10)));
- IHXAudioStream* audioStream[numberOfPlaylistElements];
+ IHXAudioStream* audioStream[numberOfPlaylistElements + 1];
for (int i = 0; i < numberOfPlaylistElements; i++) {
+ int j = 0;
do {
TimeConversion::sleep(sleepT);
audioStream[i] = audioPlayer->GetAudioStream(i);
+ ++j;
+ if (j > getAudioStreamTimeOut * 100) {
+ std::stringstream eMsg;
+ eMsg << "can't get audio stream number " << i;
+ throw std::runtime_error(eMsg.str());
+ }
} while (!audioStream[i]);
}
+ audioStream[numberOfPlaylistElements] = 0; // fade out last clip into 0
it = playlist->begin();
- sleepT.reset(new time_duration(seconds(2)));
+ sleepT.reset(new time_duration(milliseconds(crossFadeWaitingTime)));
TimeConversion::sleep(sleepT);
- for (int i = 1; i < numberOfPlaylistElements; i++) {
+ for (int i = 0; i < numberOfPlaylistElements; i++) {
Ptr::Ref playlistElement = it->second;
if (!playlistElement->getFadeInfo()) {
@@ -455,10 +475,12 @@ HelixPlayer :: openAndStartPlaylist(Ptr::Ref playlist)
->total_milliseconds()
- crossFadeLength;
+ if (crossFadeLength) {
//std::cerr << "fadeOutAt: " << fadeOutAt << "\n"
// << "crossFadeLength: " << crossFadeLength << "\n";
- crossFade->CrossFade(audioStream[i-1], audioStream[i],
+ crossFade->CrossFade(audioStream[i], audioStream[i+1],
fadeOutAt, fadeOutAt, crossFadeLength);
+ }
++it;
}
diff --git a/livesupport/modules/playlistExecutor/src/HelixPlayer.h b/livesupport/modules/playlistExecutor/src/HelixPlayer.h
index 94c4d370d..a51edaac9 100644
--- a/livesupport/modules/playlistExecutor/src/HelixPlayer.h
+++ b/livesupport/modules/playlistExecutor/src/HelixPlayer.h
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.9 $
+ Version : $Revision: 1.10 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/playlistExecutor/src/Attic/HelixPlayer.h,v $
------------------------------------------------------------------------------*/
@@ -91,7 +91,7 @@ using namespace LiveSupport::Core;
*
*
* @author $Author: fgerlits $
- * @version $Revision: 1.9 $
+ * @version $Revision: 1.10 $
*/
class HelixPlayer : virtual public Configurable,
virtual public AudioPlayerInterface,
@@ -330,6 +330,17 @@ class HelixPlayer : virtual public Configurable,
/**
* Play a playlist, with simulated fading.
*
+ * This is a stopgap method, and should be replaced as soon as
+ * the SMIL animation issues are fixed in the Helix client.
+ *
+ * Note: the method only reads the fade out value, and assumes
+ * that the following fade in value is equal to it.
+ *
+ * The playlist is assumed to contain a URI field, which points
+ * to a SMIL file containing the same audio clips, with the same
+ * offsets, as the playlist. This can be ensured, for example, by
+ * calling Storage::WebStorageClient::acquirePlaylist().
+ *
* @param playlist the Playlist object to be played.
* @exception std::invalid_argument playlist is invalid (e.g.,
* does not have a URI field, or there is no valid
diff --git a/livesupport/modules/playlistExecutor/var/playlist.smil b/livesupport/modules/playlistExecutor/var/playlist.smil
index 6f4f48b8a..a44302802 100644
--- a/livesupport/modules/playlistExecutor/var/playlist.smil
+++ b/livesupport/modules/playlistExecutor/var/playlist.smil
@@ -4,7 +4,7 @@
-
+