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 * @see #open
*/ */
virtual void virtual void
close(void) throw () = 0; close(void) throw (std::logic_error) = 0;
/** /**
* Get the length of the currently opened audio clip. * 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. * Close the currently opened audio file.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
void void
GstreamerPlayer :: close(void) throw () GstreamerPlayer :: close(void) throw (std::logic_error)
{ {
if (isPlaying()) { if (isPlaying()) {
stop(); stop();

View File

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

View File

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

View File

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

View File

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