This commit is contained in:
fgerlits 2006-12-01 16:27:30 +00:00
parent 097b46c5ae
commit aafdd144d2
3 changed files with 22 additions and 6 deletions

View File

@ -1622,13 +1622,22 @@ GLiveSupport :: setCueAudioDevice(Ptr<const Glib::ustring>::Ref deviceName)
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
void void
LiveSupport :: GLiveSupport :: LiveSupport :: GLiveSupport ::
GLiveSupport :: playTestSoundOnCue(void) throw () GLiveSupport :: playTestSoundOnCue(Ptr<const Glib::ustring>::Ref oldDevice,
Ptr<const Glib::ustring>::Ref newDevice)
throw ()
{ {
if (cueItemPlayingNow) { if (cueItemPlayingNow) {
stopCueAudio(); // stop the audio player and stopCueAudio(); // stop the audio player and
} // release old resources } // release old resources
try { try {
if (cuePlayer->isOpen()) {
if (cuePlayer->isPlaying()) {
cuePlayer->stop();
}
cuePlayer->close();
}
cuePlayer->setAudioDevice(*newDevice);
cuePlayer->open(*testAudioUrl); cuePlayer->open(*testAudioUrl);
cuePlayer->start(); cuePlayer->start();
Ptr<time_duration>::Ref sleepT(new time_duration(microseconds(10))); Ptr<time_duration>::Ref sleepT(new time_duration(microseconds(10)));
@ -1638,8 +1647,11 @@ GLiveSupport :: playTestSoundOnCue(void) throw ()
} }
} catch (std::runtime_error &e) { } catch (std::runtime_error &e) {
// "invalid device" error from open(); do nothing // "invalid device" error from open(); do nothing
} catch (std::logic_error &e) {
// some other error; do nothing
} }
cuePlayer->close(); cuePlayer->close();
cuePlayer->setAudioDevice(*oldDevice);
} }

View File

@ -988,9 +988,14 @@ class GLiveSupport : public LocalizedConfigurable,
/** /**
* Play a test sound on the cue audio player. * Play a test sound on the cue audio player.
*
* @param oldDevice the name of the current audio device.
* @param oldDevice the name of the audio device to be tested.
*/ */
void void
playTestSoundOnCue(void) throw (); playTestSoundOnCue(Ptr<const Glib::ustring>::Ref oldDevice,
Ptr<const Glib::ustring>::Ref newDevice)
throw ();
/** /**
* Search in the local storage. * Search in the local storage.

View File

@ -349,13 +349,12 @@ OptionsWindow :: onTestButtonClicked(const EntryBin * entry)
Ptr<const Glib::ustring>::Ref Ptr<const Glib::ustring>::Ref
oldDevice = optionsContainer->getOptionItem(OptionsContainer:: oldDevice = optionsContainer->getOptionItem(OptionsContainer::
outputPlayerDeviceName); cuePlayerDeviceName);
Ptr<const Glib::ustring>::Ref Ptr<const Glib::ustring>::Ref
newDevice(new Glib::ustring(entry->get_text())); newDevice(new Glib::ustring(entry->get_text()));
gLiveSupport->setCueAudioDevice(newDevice); // NOTE: we can't use the // NOTE: we can't use the output player b/c that would trigger onStop()
gLiveSupport->playTestSoundOnCue(); // output player b/c that gLiveSupport->playTestSoundOnCue(oldDevice, newDevice);
gLiveSupport->setCueAudioDevice(oldDevice); // would trigger onStop()
} }