Changeset 1890
- Timestamp:
- Fri Jan 27 14:01:01 2006
- Files:
-
- trunk/livesupport/src/products/gLiveSupport/src/OptionsWindow.cxx (modified) (diff)
- trunk/livesupport/src/products/gLiveSupport/src/GLiveSupport.cxx (modified) (diff)
- trunk/livesupport/src/products/gLiveSupport/src/OptionsWindow.h (modified) (diff)
- trunk/livesupport/src/products/gLiveSupport/src/AudioPlayerTest.cxx (modified) (diff)
- trunk/livesupport/src/products/gLiveSupport/src/GLiveSupport.h (modified) (diff)
- trunk/livesupport/src/products/gLiveSupport/src/AudioPlayerTest.h (modified) (diff)
- trunk/livesupport/src/products/gLiveSupport/var/root.txt (modified) (diff)
- trunk/livesupport/src/products/gLiveSupport/var/testAudio.ogg (added)
- trunk/livesupport/src/products/gLiveSupport/var/testAudio.ogg.license (added)
- trunk/livesupport/src/products/gLiveSupport/etc/Makefile.in (modified) (diff)
- trunk/livesupport/src/products/gLiveSupport/etc/gLiveSupport.xml (modified) (diff)
- trunk/livesupport/src/products/gLiveSupport/etc/gLiveSupport.xml.user-template (modified) (diff)
- trunk/livesupport/src/products/gLiveSupport/etc/gLiveSupport.xml.template (modified) (diff)
- trunk/livesupport/src/modules/widgets/include/LiveSupport/Widgets/EntryBin.h (modified) (diff)
- trunk/livesupport/etc/debian/rules (modified) (diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
trunk/livesupport/src/products/gLiveSupport/src/OptionsWindow.cxx
r1888 r1890 221 221 222 222 /*------------------------------------------------------------------------------ 223 * Event handler for the test button 224 *----------------------------------------------------------------------------*/ 225 void 226 OptionsWindow :: onTestButtonClicked(const EntryBin * entry) 227 throw () 228 { 229 Ptr<OptionsContainer>::Ref optionsContainer 230 = gLiveSupport->getOptionsContainer(); 231 232 Ptr<const Glib::ustring>::Ref 233 oldDevice = optionsContainer->getOptionItem(OptionsContainer:: 234 outputPlayerDeviceName); 235 Ptr<const Glib::ustring>::Ref 236 newDevice(new Glib::ustring(entry->get_text())); 237 238 gLiveSupport->setCueAudioDevice(newDevice); // NOTE: we can't use the 239 gLiveSupport->playTestSoundOnCue(); // output player b/c that 240 gLiveSupport->setCueAudioDevice(oldDevice); // would trigger onStop() 241 } 242 243 244 /*------------------------------------------------------------------------------ 223 245 * Create a new user entry field item. 224 246 *----------------------------------------------------------------------------*/ … … 280 302 audioDeviceTable->attach(*cuePlayerEntry, 1, 2, 0, 1); 281 303 304 Button * cueTestButton; 305 try { 306 cueTestButton = Gtk::manage(wf->createButton( 307 *getResourceUstring("testButtonLabel") )); 308 } catch (std::invalid_argument &e) { 309 // TODO: signal error 310 std::cerr << e.what() << std::endl; 311 std::exit(1); 312 } 313 cueTestButton->signal_clicked().connect(sigc::bind<EntryBin*>( 314 sigc::mem_fun(*this,&OptionsWindow::onTestButtonClicked), 315 cuePlayerEntry)); 316 audioDeviceTable->attach(*cueTestButton, 2, 3, 0, 1); 317 282 318 // display the settings for the output player device 283 319 Glib::ustring outputPlayerLabelContents; 299 335 audioDeviceTable->attach(*outputPlayerEntry, 1, 2, 1, 2); 300 336 337 Button * outputTestButton; 338 try { 339 outputTestButton = Gtk::manage(wf->createButton( 340 *getResourceUstring("testButtonLabel") )); 341 } catch (std::invalid_argument &e) { 342 // TODO: signal error 343 std::cerr << e.what() << std::endl; 344 std::exit(1); 345 } 346 outputTestButton->signal_clicked().connect(sigc::bind<EntryBin*>( 347 sigc::mem_fun(*this, &OptionsWindow::onTestButtonClicked), 348 outputPlayerEntry)); 349 audioDeviceTable->attach(*outputTestButton, 2, 3, 1, 2); 350 301 351 // make a new box and pack the components into it 302 352 Gtk::VBox * section = Gtk::manage(new Gtk::VBox); -
trunk/livesupport/src/products/gLiveSupport/src/GLiveSupport.cxx
r1886 r1890 129 129 130 130 /*------------------------------------------------------------------------------ 131 * The name of the config element for the test audio file location 132 *----------------------------------------------------------------------------*/ 133 static const std::string testAudioUrlConfigElementName = "testAudioUrl"; 134 135 /*------------------------------------------------------------------------------ 131 136 * The name of the user preference for storing Scratchpad contents 132 137 *----------------------------------------------------------------------------*/ … … 334 339 configFileName->append(configFileNameStr); 335 340 optionsContainer.reset(new OptionsContainer(element, configFileName)); 341 342 // read the test audio file location 343 nodes = element.get_children(testAudioUrlConfigElementName); 344 if (nodes.size() < 1) { 345 throw std::invalid_argument("no test audio url element"); 346 } 347 const xmlpp::Element* testAudioUrlElement 348 = dynamic_cast<const xmlpp::Element*>(nodes.front()); 349 testAudioUrl.reset(new Glib::ustring( 350 testAudioUrlElement->get_attribute("path") 351 ->get_value() )); 336 352 } 337 353 1488 1504 } 1489 1505 1506 1507 /*------------------------------------------------------------------------------ 1508 * Set the device for the cue audio player. 1509 *----------------------------------------------------------------------------*/ 1510 void 1511 LiveSupport :: GLiveSupport :: 1512 GLiveSupport :: setCueAudioDevice(Ptr<const Glib::ustring>::Ref deviceName) 1513 throw () 1514 { 1515 cuePlayer->setAudioDevice(*deviceName); 1516 } 1517 1518 1519 /*------------------------------------------------------------------------------ 1520 * Play a test sound on the cue audio player. 1521 *----------------------------------------------------------------------------*/ 1522 void 1523 LiveSupport :: GLiveSupport :: 1524 GLiveSupport :: playTestSoundOnCue(void) throw () 1525 { 1526 if (cueItemPlayingNow) { 1527 stopCueAudio(); // stop the audio player and 1528 } // release old resources 1529 1530 try { 1531 cuePlayer->open(*testAudioUrl); 1532 cuePlayer->start(); 1533 Ptr<time_duration>::Ref sleepT(new time_duration(microseconds(10))); 1534 while (cuePlayer->isPlaying()) { 1535 TimeConversion::sleep(sleepT); 1536 } 1537 } catch (std::runtime_error &e) { 1538 // "invalid device" error from open(); do nothing 1539 } 1540 cuePlayer->close(); 1541 } 1542 -
trunk/livesupport/src/products/gLiveSupport/src/OptionsWindow.h
r1888 r1890 153 153 EntryBin * 154 154 createEntry(OptionsContainer::OptionItemString optionItem) 155 throw (); 155 throw (); 155 155 156 156 /** … … 161 161 */ 162 162 Gtk::VBox* 163 constructSoundSection(void) throw (); 163 constructSoundSection(void) throw (); 163 163 164 164 /** … … 169 169 */ 170 170 Gtk::VBox* 171 constructServersSection(void) throw (); 171 constructServersSection(void) throw (); 171 171 172 172 /** … … 177 177 */ 178 178 Gtk::VBox* 179 constructAboutSection(void) throw (); 179 constructAboutSection(void) throw (); 179 179 180 180 … … 185 185 */ 186 186 virtual void 187 onCancelButtonClicked(void) throw (); 187 onCancelButtonClicked(void) throw (); 187 187 188 188 /** … … 191 191 */ 192 192 virtual void 193 onApplyButtonClicked(void) throw (); 193 onApplyButtonClicked(void) throw (); 193 193 194 194 /** … … 197 197 */ 198 198 virtual void 199 onOkButtonClicked(void) throw (); 199 onOkButtonClicked(void) throw (); 199 199 200 200 /** … … 208 208 */ 209 209 virtual void 210 onCloseButtonClicked(bool needConfirm = true) throw (); 210 onCloseButtonClicked(bool needConfirm = true) throw (); 211 212 /** 213 * Event handler for the test button 214 * 215 * @param entry the text entry field containing the new device name 216 * @see GLiveSupport::setCueAudioDevice() 217 * @see GLiveSupport::playTestSoundOnCue() 218 */ 219 virtual void 220 onTestButtonClicked(const EntryBin * entry) throw (); 221 211 222 212 213 223 public: 214 224 /** … … 220 230 */ 221 231 OptionsWindow(Ptr<GLiveSupport>::Ref gLiveSupport, 222 Ptr<ResourceBundle>::Ref bundle) 223 throw (); 232 Ptr<ResourceBundle>::Ref bundle) throw (); 224 233 225 234 /** 227 236 */ 228 237 virtual 229 ~OptionsWindow(void) throw () 238 ~OptionsWindow(void) throw () 229 238 { 230 239 } -
trunk/livesupport/src/products/gLiveSupport/src/AudioPlayerTest.cxx
r1601 r1890 302 302 } 303 303 304 305 /*------------------------------------------------------------------------------ 306 * Test if we can switch back and forth between devices. 307 *----------------------------------------------------------------------------*/ 308 void 309 AudioPlayerTest :: switchDevicesTest(void) 310 throw (CPPUNIT_NS::Exception) 311 { 312 Ptr<AudioPlayerFactory>::Ref audioPlayerFactory; 313 audioPlayerFactory = AudioPlayerFactory::getInstance(); 314 CPPUNIT_ASSERT(audioPlayerFactory.get()); 315 316 Ptr<AudioPlayerInterface>::Ref audioPlayer; 317 audioPlayer = audioPlayerFactory->getAudioPlayer(); 318 CPPUNIT_ASSERT(audioPlayer.get()); 319 320 audioPlayer->setAudioDevice("/dev/dsp"); 321 CPPUNIT_ASSERT_NO_THROW( 322 audioPlayer->open("file:var/testAudio.ogg") 323 ); 324 audioPlayer->start(); 325 Ptr<time_duration>::Ref sleepT(new time_duration(microseconds(10))); 326 while (audioPlayer->isPlaying()) { 327 TimeConversion::sleep(sleepT); 328 } 329 audioPlayer->close(); 330 331 audioPlayer->setAudioDevice("plughw:0,0"); 332 CPPUNIT_ASSERT_NO_THROW( 333 audioPlayer->open("file:var/testAudio.ogg") 334 ); 335 audioPlayer->start(); 336 while (audioPlayer->isPlaying()) { 337 TimeConversion::sleep(sleepT); 338 } 339 audioPlayer->close(); 340 } 341 -
trunk/livesupport/src/products/gLiveSupport/src/GLiveSupport.h
r1881 r1890 256 256 257 257 /** 258 * The location of the test audio file. 259 */ 260 Ptr<Glib::ustring>::Ref testAudioUrl; 261 262 /** 258 263 * Read a supportedLanguages configuration element, 259 264 * and fill the supportedLanguages map with its contents. 909 914 910 915 /** 916 * Set the device for the cue audio player. 917 * 918 * @param deviceName the name of the new device 919 */ 920 void 921 setCueAudioDevice(Ptr<const Glib::ustring>::Ref deviceName) 922 throw (); 923 924 /** 925 * Play a test sound on the cue audio player. 926 */ 927 void 928 playTestSoundOnCue(void) throw (); 929 930 /** 911 931 * Search in the local storage. 912 932 * -
trunk/livesupport/src/products/gLiveSupport/src/AudioPlayerTest.h
r1601 r1890 74 74 CPPUNIT_TEST(playAudioClipTest); 75 75 CPPUNIT_TEST(playPlaylistTest); 76 CPPUNIT_TEST(switchDevicesTest); 76 77 CPPUNIT_TEST_SUITE_END(); 77 78 109 110 playPlaylistTest(void) throw (CPPUNIT_NS::Exception); 110 111 112 /** 113 * Test if we can switch back and forth between devices. 114 * 115 * @exception CPPUNIT_NS::Exception on test failures. 116 */ 117 void 118 switchDevicesTest(void) throw (CPPUNIT_NS::Exception); 119 111 120 public: 112 121 -
trunk/livesupport/src/products/gLiveSupport/var/root.txt
r1888 r1890 232 232 cueDeviceLabel:string { "Cue audio device:" } 233 233 outputDeviceLabel:string { "Live Mode audio device:" } 234 testButtonLabel:string { "Test" } 234 235 235 236 authenticationLabel:string { "Authentication server" } -
trunk/livesupport/src/products/gLiveSupport/etc/Makefile.in
r1881 r1890 342 342 ${MKDIR} ${USR_VAR_DIR}/LiveSupport 343 343 ${CP} ${TMP_DIR}/*.res ${USR_VAR_DIR}/LiveSupport 344 ${CP} ${VAR_DIR}/livesupport.png ${VAR_DIR}/stationLogo.png \ 345 ${USR_VAR_DIR}/LiveSupport 344 ${CP} ${VAR_DIR}/livesupport.png \ 345 ${VAR_DIR}/stationLogo.png \ 346 ${VAR_DIR}/testAudio.ogg \ 347 ${VAR_DIR}/testAudio.ogg.license ${USR_VAR_DIR}/LiveSupport 346 348 ${CP} ${BIN_DIR}/gLiveSupport.sh ${USR_BIN_DIR} 347 349 ${CP} ${G_LIVESUPPORT_EXE} ${USR_BIN_DIR} -
trunk/livesupport/src/products/gLiveSupport/etc/gLiveSupport.xml
r1776 r1890 90 90 <!ATTLIST stationLogo path CDATA #REQUIRED > 91 91 92 <!ELEMENT testAudioUrl EMPTY > 93 <!ATTLIST testAudioUrl path CDATA #REQUIRED > 94 92 95 <!ELEMENT metadataType EMPTY > 93 96 <!ATTLIST metadataType dcName NMTOKEN #REQUIRED > 156 159 <stationLogo path = "var/stationLogo.png" /> 157 160 161 <testAudioUrl path = "file://var/testAudio.ogg" /> 162 158 163 <metadataTypeContainer> 159 164 <metadataType dcName = "dc:title" -
trunk/livesupport/src/products/gLiveSupport/etc/gLiveSupport.xml.user-template
r1776 r1890 90 90 <!ATTLIST stationLogo path CDATA #REQUIRED > 91 91 92 <!ELEMENT testAudioUrl EMPTY > 93 <!ATTLIST testAudioUrl path CDATA #REQUIRED > 94 92 95 <!ELEMENT metadataType EMPTY > 93 96 <!ATTLIST metadataType dcName NMTOKEN #REQUIRED > 154 157 </cuePlayer> 155 158 156 <stationLogo path="var/stationLogo.png" /> 159 <stationLogo path = "var/stationLogo.png" /> 160 161 <testAudioUrl path = "file:var/testAudio.ogg" /> 157 162 158 163 <metadataTypeContainer> -
trunk/livesupport/src/products/gLiveSupport/etc/gLiveSupport.xml.template
r1776 r1890 90 90 <!ATTLIST stationLogo path CDATA #REQUIRED > 91 91 92 <!ELEMENT testAudioUrl EMPTY > 93 <!ATTLIST testAudioUrl path CDATA #REQUIRED > 94 92 95 <!ELEMENT metadataType EMPTY > 93 96 <!ATTLIST metadataType dcName NMTOKEN #REQUIRED > 154 157 </cuePlayer> 155 158 156 <stationLogo path="ls_var_dir/LiveSupport/stationLogo.png" /> 159 <stationLogo path = "ls_var_dir/LiveSupport/stationLogo.png" /> 160 161 <testAudioUrl path = "file://ls_var_dir/LiveSupport/testAudio.ogg" /> 157 162 158 163 <metadataTypeContainer> -
trunk/livesupport/src/modules/widgets/include/LiveSupport/Widgets/EntryBin.h
r1601 r1890 106 106 107 107 /** 108 * Return the entry held in this container (const version). 109 * 110 * @return the entry held in this container. 111 */ 112 const Gtk::Entry * 113 getEntry(void) const throw () 114 { 115 return entry; 116 } 117 118 /** 108 119 * Return the text of the entry. 109 120 * 111 122 */ 112 123 Glib::ustring 113 get_text(void) 124 get_text(void) const throw () 113 124 { 114 125 return getEntry()->get_text(); -
trunk/livesupport/etc/debian/rules
r1830 r1890 140 140 $(CURDIR)/debian/livesupport/opt/livesupport/var/LiveSupport/livesupport.png \ 141 141 $(CURDIR)/debian/livesupport/opt/livesupport/var/LiveSupport/stationLogo.png \ 142 $(CURDIR)/debian/livesupport/opt/livesupport/var/LiveSupport/testAudio.ogg \ 143 $(CURDIR)/debian/livesupport/opt/livesupport/var/LiveSupport/testAudio.ogg.license \ 142 144 $(CURDIR)/debian/livesupport-studio/opt/livesupport/var/LiveSupport 143 145 mkdir -p $(CURDIR)/debian/livesupport-studio/usr/share/applications