some advance in fading; I (mostly) know what the problem is :)
This commit is contained in:
parent
77d5473a20
commit
0da71b6798
|
@ -31,8 +31,8 @@
|
||||||
playlength="00:00:11"
|
playlength="00:00:11"
|
||||||
title = "one"
|
title = "one"
|
||||||
uri="file:var/test10001.mp3" />
|
uri="file:var/test10001.mp3" />
|
||||||
<fadeInfo id="0000000000009901"
|
<fadeInfo id="0000000000009901"
|
||||||
fadeIn="0"
|
fadeIn="0"
|
||||||
fadeOut="00:00:05" />
|
fadeOut="00:00:05" />
|
||||||
</playlistElement>
|
</playlistElement>
|
||||||
<playlistElement id="0000000000000102"
|
<playlistElement id="0000000000000102"
|
||||||
|
@ -43,16 +43,16 @@
|
||||||
uri="file:var/test10002.mp3" />
|
uri="file:var/test10002.mp3" />
|
||||||
<fadeInfo id="0000000000009902"
|
<fadeInfo id="0000000000009902"
|
||||||
fadeIn="00:00:05"
|
fadeIn="00:00:05"
|
||||||
fadeOut="00:00:05" />
|
fadeOut="0" />
|
||||||
</playlistElement>
|
</playlistElement>
|
||||||
<playlistElement id="0000000000000103"
|
<playlistElement id="0000000000000103"
|
||||||
relativeOffset="00:00:13" >
|
relativeOffset="00:00:18" >
|
||||||
<audioClip id="0000000000010003"
|
<audioClip id="0000000000010003"
|
||||||
playlength="00:00:11.000"
|
playlength="00:00:11.500000"
|
||||||
title = "three"
|
title = "three"
|
||||||
uri="file:var/test10003.mp3" />
|
uri="file:var/test10003.mp3" />
|
||||||
<fadeInfo id="0000000000009903"
|
<fadeInfo id="0000000000009903"
|
||||||
fadeIn="00:00:05"
|
fadeIn="0"
|
||||||
fadeOut="0" />
|
fadeOut="00:00:05" />
|
||||||
</playlistElement>
|
</playlistElement>
|
||||||
</playlist>
|
</playlist>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
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 $
|
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;
|
static DLLAccessPath accessPath;
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/**
|
||||||
* The name of the config element for this class
|
* The name of the config element for this class
|
||||||
*----------------------------------------------------------------------------*/
|
*/
|
||||||
const std::string HelixPlayer::configElementNameStr = "helixPlayer";
|
const std::string HelixPlayer::configElementNameStr = "helixPlayer";
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,6 +77,18 @@ static const std::string dllPathName = "dllPath";
|
||||||
static const std::string clntcoreName = "/clntcore.so";
|
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 */
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
@ -422,20 +434,28 @@ HelixPlayer :: openAndStartPlaylist(Ptr<Playlist>::Ref playlist)
|
||||||
|
|
||||||
Ptr<time_duration>::Ref sleepT(new time_duration(microseconds(10)));
|
Ptr<time_duration>::Ref sleepT(new time_duration(microseconds(10)));
|
||||||
|
|
||||||
IHXAudioStream* audioStream[numberOfPlaylistElements];
|
IHXAudioStream* audioStream[numberOfPlaylistElements + 1];
|
||||||
for (int i = 0; i < numberOfPlaylistElements; i++) {
|
for (int i = 0; i < numberOfPlaylistElements; i++) {
|
||||||
|
int j = 0;
|
||||||
do {
|
do {
|
||||||
TimeConversion::sleep(sleepT);
|
TimeConversion::sleep(sleepT);
|
||||||
audioStream[i] = audioPlayer->GetAudioStream(i);
|
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]);
|
} while (!audioStream[i]);
|
||||||
}
|
}
|
||||||
|
audioStream[numberOfPlaylistElements] = 0; // fade out last clip into 0
|
||||||
|
|
||||||
it = playlist->begin();
|
it = playlist->begin();
|
||||||
|
|
||||||
sleepT.reset(new time_duration(seconds(2)));
|
sleepT.reset(new time_duration(milliseconds(crossFadeWaitingTime)));
|
||||||
TimeConversion::sleep(sleepT);
|
TimeConversion::sleep(sleepT);
|
||||||
|
|
||||||
for (int i = 1; i < numberOfPlaylistElements; i++) {
|
for (int i = 0; i < numberOfPlaylistElements; i++) {
|
||||||
|
|
||||||
Ptr<PlaylistElement>::Ref playlistElement = it->second;
|
Ptr<PlaylistElement>::Ref playlistElement = it->second;
|
||||||
if (!playlistElement->getFadeInfo()) {
|
if (!playlistElement->getFadeInfo()) {
|
||||||
|
@ -455,10 +475,12 @@ HelixPlayer :: openAndStartPlaylist(Ptr<Playlist>::Ref playlist)
|
||||||
->total_milliseconds()
|
->total_milliseconds()
|
||||||
- crossFadeLength;
|
- crossFadeLength;
|
||||||
|
|
||||||
|
if (crossFadeLength) {
|
||||||
//std::cerr << "fadeOutAt: " << fadeOutAt << "\n"
|
//std::cerr << "fadeOutAt: " << fadeOutAt << "\n"
|
||||||
// << "crossFadeLength: " << crossFadeLength << "\n";
|
// << "crossFadeLength: " << crossFadeLength << "\n";
|
||||||
crossFade->CrossFade(audioStream[i-1], audioStream[i],
|
crossFade->CrossFade(audioStream[i], audioStream[i+1],
|
||||||
fadeOutAt, fadeOutAt, crossFadeLength);
|
fadeOutAt, fadeOutAt, crossFadeLength);
|
||||||
|
}
|
||||||
|
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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/modules/playlistExecutor/src/Attic/HelixPlayer.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/playlistExecutor/src/Attic/HelixPlayer.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -91,7 +91,7 @@ using namespace LiveSupport::Core;
|
||||||
* </pre></code>
|
* </pre></code>
|
||||||
*
|
*
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision: 1.9 $
|
* @version $Revision: 1.10 $
|
||||||
*/
|
*/
|
||||||
class HelixPlayer : virtual public Configurable,
|
class HelixPlayer : virtual public Configurable,
|
||||||
virtual public AudioPlayerInterface,
|
virtual public AudioPlayerInterface,
|
||||||
|
@ -330,6 +330,17 @@ class HelixPlayer : virtual public Configurable,
|
||||||
/**
|
/**
|
||||||
* Play a playlist, with simulated fading.
|
* 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.
|
* @param playlist the Playlist object to be played.
|
||||||
* @exception std::invalid_argument playlist is invalid (e.g.,
|
* @exception std::invalid_argument playlist is invalid (e.g.,
|
||||||
* does not have a URI field, or there is no valid
|
* does not have a URI field, or there is no valid
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<par>
|
<par>
|
||||||
<audio src="file:var/test10001.mp3" begin="0s"/>
|
<audio src="file:var/test10001.mp3" begin="0s"/>
|
||||||
<audio src="file:var/test10002.mp3" begin="6s"/>
|
<audio src="file:var/test10002.mp3" begin="6s"/>
|
||||||
<audio src="file:var/test10003.mp3" begin="13s"/>
|
<audio src="file:var/test10003.mp3" begin="18s"/>
|
||||||
</par>
|
</par>
|
||||||
</body>
|
</body>
|
||||||
</smil>
|
</smil>
|
||||||
|
|
Loading…
Reference in New Issue