This commit is contained in:
fgerlits 2006-10-23 14:19:12 +00:00
parent 39ee84d0f3
commit 617cad8421
7 changed files with 39 additions and 25 deletions

View File

@ -168,7 +168,7 @@ class AudioPlayerInterface
* @see #open
*/
virtual void
close(void) throw () = 0;
close(void) throw (std::logic_error) = 0;
/**
* Get the length of the currently opened audio clip.

View File

@ -452,7 +452,7 @@ GstreamerPlayer :: stop(void) throw (std::logic_error)
* Close the currently opened audio file.
*----------------------------------------------------------------------------*/
void
GstreamerPlayer :: close(void) throw ()
GstreamerPlayer :: close(void) throw (std::logic_error)
{
if (isPlaying()) {
stop();

View File

@ -335,7 +335,7 @@ class GstreamerPlayer : virtual public Configurable,
* @see #open
*/
virtual void
close(void) throw ();
close(void) throw (std::logic_error);
/**
* Start playing.

View File

@ -128,15 +128,15 @@ CuePlayer :: onPlayItem(void) throw ()
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
try {
gLiveSupport->playCueAudio(playable);
} catch (std::logic_error &e) {
audioState = playingState;
remove(*playButton);
pack_end(*pauseButton, Gtk::PACK_SHRINK, 3);
pauseButton->show();
gLiveSupport->runMainLoop();
} catch (std::runtime_error &e) {
std::cerr << "GLiveSupport::playCueAudio() error:"
<< std::endl << e.what() << std::endl;
}
audioState = playingState;
remove(*playButton);
pack_end(*pauseButton, Gtk::PACK_SHRINK, 3);
pauseButton->show();
gLiveSupport->runMainLoop();
}
}

View File

@ -497,7 +497,7 @@ LiveSupport :: GLiveSupport ::
GLiveSupport :: displayMessageWindow(Ptr<Glib::ustring>::Ref message)
throw ()
{
std::cerr << "gLiveSupport: " << *message;
std::cerr << "gLiveSupport: " << *message << std::endl;
Ptr<DialogWindow>::Ref window(widgetFactory->createDialogWindow(
message,
@ -1161,7 +1161,8 @@ GLiveSupport :: removeFromSchedule(Ptr<const UniqueId>::Ref scheduleEntryId)
void
LiveSupport :: GLiveSupport ::
GLiveSupport :: playOutputAudio(Ptr<Playable>::Ref playable)
throw (std::logic_error)
throw (std::logic_error,
std::runtime_error)
{
try {
switch (playable->getType()) {
@ -1186,18 +1187,21 @@ GLiveSupport :: playOutputAudio(Ptr<Playable>::Ref playable)
eMsg->append("\n");
eMsg->append(e.what());
displayMessageWindow(eMsg);
throw std::runtime_error(e.what());
} catch (std::invalid_argument &e) {
Ptr<Glib::ustring>::Ref eMsg
= getResourceUstring("audioErrorMsg");
eMsg->append("\n");
eMsg->append(e.what());
displayMessageWindow(eMsg);
throw std::runtime_error(e.what());
} catch (std::runtime_error &e) {
Ptr<Glib::ustring>::Ref eMsg
= getResourceUstring("audioErrorMsg");
eMsg->append("\n");
eMsg->append(e.what());
displayMessageWindow(eMsg);
throw std::runtime_error(e.what());
}
outputPlayerIsPaused = false;
@ -1251,12 +1255,17 @@ LiveSupport :: GLiveSupport ::
GLiveSupport :: onStop(void) throw ()
{
outputItemPlayingNow.reset();
outputPlayer->close();
try {
outputPlayer->close();
Ptr<Playable>::Ref playable = masterPanel->getNextItemToPlay();
setNowPlaying(playable);
if (playable) {
playOutputAudio(playable);
Ptr<Playable>::Ref playable = masterPanel->getNextItemToPlay();
setNowPlaying(playable);
if (playable) {
playOutputAudio(playable);
}
} catch (std::logic_error) {
std::cerr << "logic_error caught in GLiveSupport::onStop()\n";
std::exit(1);
}
}
@ -1267,7 +1276,8 @@ GLiveSupport :: onStop(void) throw ()
void
LiveSupport :: GLiveSupport ::
GLiveSupport :: playCueAudio(Ptr<Playable>::Ref playable)
throw (std::logic_error)
throw (std::logic_error,
std::runtime_error)
{
if (cueItemPlayingNow) {
stopCueAudio(); // stop the audio player and
@ -1296,18 +1306,21 @@ GLiveSupport :: playCueAudio(Ptr<Playable>::Ref playable)
eMsg->append("\n");
eMsg->append(e.what());
displayMessageWindow(eMsg);
throw std::runtime_error(e.what());
} catch (std::invalid_argument &e) {
Ptr<Glib::ustring>::Ref eMsg
= getResourceUstring("audioErrorMsg");
eMsg->append("\n");
eMsg->append(e.what());
displayMessageWindow(eMsg);
throw std::runtime_error(e.what());
} catch (std::runtime_error &e) {
Ptr<Glib::ustring>::Ref eMsg
= getResourceUstring("audioErrorMsg");
eMsg->append("\n");
eMsg->append(e.what());
displayMessageWindow(eMsg);
throw std::runtime_error(e.what());
}
cuePlayerIsPaused = false;

View File

@ -853,10 +853,12 @@ class GLiveSupport : public LocalizedConfigurable,
*
* @param playable the Playable object to play.
* @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)
throw (std::logic_error);
throw (std::logic_error,
std::runtime_error);
/**
* Stop the output audio player.
@ -895,14 +897,13 @@ class GLiveSupport : public LocalizedConfigurable,
* Play a Playable object using the cue 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
playCueAudio(Ptr<Playable>::Ref playable)
throw (std::logic_error);
throw (std::logic_error,
std::runtime_error);
/**
* Stop the cue audio player.

View File

@ -291,15 +291,15 @@ LiveModeWindow :: onOutputPlay(void) throw ()
if (iter) {
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
gLiveSupport->setNowPlaying(playable);
treeView->removeItem(iter);
try {
gLiveSupport->playOutputAudio(playable);
} catch (std::logic_error &e) {
gLiveSupport->setNowPlaying(playable);
treeView->removeItem(iter);
gLiveSupport->runMainLoop();
} catch (std::runtime_error &e) {
std::cerr << "cannot play on live mode output device: "
<< e.what() << std::endl;
}
gLiveSupport->runMainLoop();
}
}