rewrote play-stop-onStop methods in trying to fix #914 -- logic is a bit clearer now, but #914 is still not fixed
This commit is contained in:
parent
7081d4461a
commit
974ecc10a0
3 changed files with 92 additions and 70 deletions
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.2 $
|
||||
Version : $Revision: 1.3 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/CuePlayer.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -121,10 +121,7 @@ CuePlayer :: onPlayItem(void) throw ()
|
|||
|
||||
try {
|
||||
gLiveSupport->playCueAudio(playable);
|
||||
} catch (XmlRpcException &e) {
|
||||
std::cerr << "GLiveSupport::playCueAudio() error:"
|
||||
<< std::endl << e.what() << std::endl;
|
||||
} catch (std::exception &e) {
|
||||
} catch (std::logic_error &e) {
|
||||
std::cerr << "GLiveSupport::playCueAudio() error:"
|
||||
<< std::endl << e.what() << std::endl;
|
||||
}
|
||||
|
@ -197,9 +194,6 @@ CuePlayer :: onStopButtonClicked(void) throw ()
|
|||
if (audioState != waitingState) {
|
||||
try {
|
||||
gLiveSupport->stopCueAudio();
|
||||
} catch (XmlRpcException &e) {
|
||||
std::cerr << "GLiveSupport::stopCueAudio() error:" << std::endl
|
||||
<< e.what() << std::endl;
|
||||
} catch (std::logic_error &e) {
|
||||
std::cerr << "GLiveSupport::stopCueAudio() error:" << std::endl
|
||||
<< e.what() << std::endl;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.42 $
|
||||
Version : $Revision: 1.43 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -598,27 +598,6 @@ GLiveSupport :: addToLiveMode(Ptr<Playable>::Ref playable)
|
|||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Event handler for the "output audio player has stopped" event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
LiveSupport :: GLiveSupport ::
|
||||
GLiveSupport :: onStop(void) throw ()
|
||||
{
|
||||
Ptr<Playable>::Ref playable;
|
||||
setNowPlaying(playable); // reset to empty
|
||||
|
||||
playable = masterPanel->getNextItemToPlay();
|
||||
|
||||
if (playable) {
|
||||
playOutputAudio(playable);
|
||||
setNowPlaying(playable);
|
||||
} else {
|
||||
stopOutputAudio();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Display the playable item on the master panel as "now playing".
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
@ -773,22 +752,18 @@ LiveSupport :: GLiveSupport ::
|
|||
GLiveSupport :: playOutputAudio(Ptr<Playable>::Ref playable)
|
||||
throw (std::logic_error)
|
||||
{
|
||||
try {
|
||||
if (outputItemPlayingNow) {
|
||||
stopOutputAudio(); // stop the audio player and
|
||||
} // release old resources
|
||||
|
||||
try {
|
||||
switch (playable->getType()) {
|
||||
case Playable::AudioClipType:
|
||||
outputItemPlayingNow = storage->acquireAudioClip(sessionId,
|
||||
playable->getId());
|
||||
playable->getId());
|
||||
outputPlayer->open(*outputItemPlayingNow->getUri());
|
||||
outputPlayer->start();
|
||||
break;
|
||||
|
||||
case Playable::PlaylistType:
|
||||
outputItemPlayingNow = storage->acquirePlaylist(sessionId,
|
||||
playable->getId());
|
||||
playable->getId());
|
||||
outputPlayer->openAndStart(outputItemPlayingNow->getPlaylist());
|
||||
break;
|
||||
|
||||
|
@ -843,33 +818,61 @@ LiveSupport :: GLiveSupport ::
|
|||
GLiveSupport :: stopOutputAudio(void)
|
||||
throw (std::logic_error)
|
||||
{
|
||||
try {
|
||||
outputPlayer->close();
|
||||
if (outputItemPlayingNow) {
|
||||
outputPlayer->close(); // triggers a call to onStop()
|
||||
outputPlayerIsPaused = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Event handler for the "output audio player has stopped" event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
LiveSupport :: GLiveSupport ::
|
||||
GLiveSupport :: onStop(void) throw ()
|
||||
{
|
||||
releaseOutputAudio();
|
||||
|
||||
if (outputItemPlayingNow) {
|
||||
Ptr<Playable>::Ref playable = masterPanel->getNextItemToPlay();
|
||||
if (playable) {
|
||||
playOutputAudio(playable);
|
||||
}
|
||||
setNowPlaying(playable);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Release the resources used by the output audio player.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
LiveSupport :: GLiveSupport ::
|
||||
GLiveSupport :: releaseOutputAudio(void)
|
||||
throw (std::logic_error)
|
||||
{
|
||||
if (outputItemPlayingNow) {
|
||||
try {
|
||||
switch (outputItemPlayingNow->getType()) {
|
||||
case Playable::AudioClipType:
|
||||
storage->releaseAudioClip(sessionId,
|
||||
outputItemPlayingNow->getAudioClip());
|
||||
outputItemPlayingNow->getAudioClip());
|
||||
outputItemPlayingNow.reset();
|
||||
break;
|
||||
case Playable::PlaylistType:
|
||||
storage->releasePlaylist(sessionId,
|
||||
outputItemPlayingNow->getPlaylist());
|
||||
outputItemPlayingNow->getPlaylist());
|
||||
outputItemPlayingNow.reset();
|
||||
break;
|
||||
default: // this never happens
|
||||
break;
|
||||
}
|
||||
} catch (XmlRpcException &e) {
|
||||
Ptr<Glib::ustring>::Ref eMsg
|
||||
= getResourceUstring("audioErrorMsg");
|
||||
eMsg->append(e.what());
|
||||
displayMessageWindow(eMsg);
|
||||
}
|
||||
} catch (XmlRpcException &e) {
|
||||
Ptr<Glib::ustring>::Ref eMsg
|
||||
= getResourceUstring("audioErrorMsg");
|
||||
eMsg->append(e.what());
|
||||
displayMessageWindow(eMsg);
|
||||
}
|
||||
|
||||
outputPlayerIsPaused = false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -881,11 +884,11 @@ LiveSupport :: GLiveSupport ::
|
|||
GLiveSupport :: playCueAudio(Ptr<Playable>::Ref playable)
|
||||
throw (std::logic_error)
|
||||
{
|
||||
try {
|
||||
if (cueItemPlayingNow) {
|
||||
stopCueAudio(); // stop the audio player and
|
||||
} // release old resources
|
||||
|
||||
if (cueItemPlayingNow) {
|
||||
stopCueAudio(); // stop the audio player and
|
||||
} // release old resources
|
||||
|
||||
try {
|
||||
switch (playable->getType()) {
|
||||
case Playable::AudioClipType:
|
||||
cueItemPlayingNow = storage->acquireAudioClip(sessionId,
|
||||
|
@ -951,10 +954,23 @@ LiveSupport :: GLiveSupport ::
|
|||
GLiveSupport :: stopCueAudio(void)
|
||||
throw (std::logic_error)
|
||||
{
|
||||
try {
|
||||
if (cueItemPlayingNow) {
|
||||
cuePlayer->close();
|
||||
|
||||
if (cueItemPlayingNow) {
|
||||
releaseCueAudio();
|
||||
cuePlayerIsPaused = false;
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Release the resources used by the cue audio player.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
LiveSupport :: GLiveSupport ::
|
||||
GLiveSupport :: releaseCueAudio(void)
|
||||
throw (std::logic_error)
|
||||
{
|
||||
if (cueItemPlayingNow) {
|
||||
try {
|
||||
switch (cueItemPlayingNow->getType()) {
|
||||
case Playable::AudioClipType:
|
||||
storage->releaseAudioClip(sessionId,
|
||||
|
@ -969,15 +985,13 @@ GLiveSupport :: stopCueAudio(void)
|
|||
default: // this never happens
|
||||
break;
|
||||
}
|
||||
} catch (XmlRpcException &e) {
|
||||
Ptr<Glib::ustring>::Ref eMsg
|
||||
= getResourceUstring("audioErrorMsg");
|
||||
eMsg->append(e.what());
|
||||
displayMessageWindow(eMsg);
|
||||
}
|
||||
} catch (XmlRpcException &e) {
|
||||
Ptr<Glib::ustring>::Ref eMsg
|
||||
= getResourceUstring("audioErrorMsg");
|
||||
eMsg->append(e.what());
|
||||
displayMessageWindow(eMsg);
|
||||
}
|
||||
|
||||
cuePlayerIsPaused = false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.34 $
|
||||
Version : $Revision: 1.35 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -101,7 +101,7 @@ class MasterPanelWindow;
|
|||
* respective documentation.
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.34 $
|
||||
* @version $Revision: 1.35 $
|
||||
* @see LocalizedObject#getBundle(const xmlpp::Element &)
|
||||
* @see AuthenticationClientFactory
|
||||
* @see StorageClientFactory
|
||||
|
@ -235,12 +235,30 @@ class GLiveSupport : public LocalizedConfigurable,
|
|||
void
|
||||
loadScratchpadContents(void) throw ();
|
||||
|
||||
/**
|
||||
* Release the resources used by the output audio player.
|
||||
*
|
||||
* @exception std::logic_error in case of audio player errors.
|
||||
*/
|
||||
virtual void
|
||||
releaseOutputAudio(void) throw (std::logic_error);
|
||||
|
||||
/**
|
||||
* Release the resources used by the cue audio player.
|
||||
*
|
||||
* @exception std::logic_error in case of audio player errors.
|
||||
*/
|
||||
virtual void
|
||||
releaseCueAudio(void) throw (std::logic_error);
|
||||
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
GLiveSupport(void) throw ()
|
||||
: outputPlayerIsPaused(false),
|
||||
cuePlayerIsPaused(false)
|
||||
{
|
||||
scratchpadContents.reset(new PlayableList());
|
||||
}
|
||||
|
@ -581,10 +599,7 @@ class GLiveSupport : public LocalizedConfigurable,
|
|||
* Play a Playable object using the output audio player.
|
||||
*
|
||||
* @param playable the Playable object to play.
|
||||
* @exception XmlRpcException in case of storage server errors.
|
||||
* @exception std::invalid_argument in case of audio player errors.
|
||||
* @exception std::logic_error in case of audio player errors.
|
||||
* @exception std::runtime_error in case of audio player errors.
|
||||
*/
|
||||
virtual void
|
||||
playOutputAudio(Ptr<Playable>::Ref playable)
|
||||
|
@ -593,7 +608,6 @@ class GLiveSupport : public LocalizedConfigurable,
|
|||
/**
|
||||
* Stop the output audio player.
|
||||
*
|
||||
* @exception XmlRpcException in case of storage server errors.
|
||||
* @exception std::logic_error in case of audio player errors.
|
||||
*/
|
||||
virtual void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue