diff --git a/rtdata/sounds/Empty.wav b/rtdata/sounds/Empty.wav new file mode 100644 index 000000000..3f102bff1 Binary files /dev/null and b/rtdata/sounds/Empty.wav differ diff --git a/rtgui/main.cc b/rtgui/main.cc index ac7baa5e0..72a1f39ab 100644 --- a/rtgui/main.cc +++ b/rtgui/main.cc @@ -31,6 +31,7 @@ #include #include #include +#include #include "version.h" #ifndef WIN32 @@ -94,6 +95,8 @@ int main(int argc, char **argv) Options::load (); + SoundManager::init(); + if (argc>1){ int ret = processLineParams( argc, argv); if( ret <= 0 ) diff --git a/rtgui/options.cc b/rtgui/options.cc index e2da4f587..e9208543d 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -147,6 +147,7 @@ void Options::setDefaults () { cutOverlayBrush = std::vector (4); cutOverlayBrush[3] = 0.667; // :-p + sndEnable=true; sndLngEditProcDoneSecs=3.0; int babehav[] = { @@ -389,6 +390,7 @@ if (keyFile.has_group ("Batch Processing")) { } if (keyFile.has_group ("Sounds")) { + if (keyFile.has_key ("Sounds", "Enable")) sndEnable = keyFile.get_boolean ("Sounds", "Enable"); if (keyFile.has_key ("Sounds", "BatchQueueDone")) sndBatchQueueDone = keyFile.get_string ("Sounds", "BatchQueueDone"); if (keyFile.has_key ("Sounds", "LngEditProcDone")) sndLngEditProcDone = keyFile.get_string ("Sounds", "LngEditProcDone"); if (keyFile.has_key ("Sounds", "LngEditProcDoneSecs")) sndLngEditProcDoneSecs = keyFile.get_double ("Sounds", "LngEditProcDoneSecs"); @@ -543,6 +545,7 @@ int Options::saveToFile (Glib::ustring fname) { Glib::ArrayHandle bab = baBehav; keyFile.set_integer_list ("Batch Processing", "AdjusterBehavior", bab); + keyFile.set_boolean ("Sounds", "Enable", sndEnable); keyFile.set_string ("Sounds", "BatchQueueDone", sndBatchQueueDone); keyFile.set_string ("Sounds", "LngEditProcDone", sndLngEditProcDone); keyFile.set_double ("Sounds", "LngEditProcDoneSecs", sndLngEditProcDoneSecs); diff --git a/rtgui/options.h b/rtgui/options.h index ca148e761..b4ac2e8ce 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -143,6 +143,8 @@ class Options { Glib::ustring sndBatchQueueDone; Glib::ustring sndLngEditProcDone; double sndLngEditProcDoneSecs; // Minimum processing time seconds till the sound is played + bool sndEnable; + bool tunnelMetaData; // Pass through IPTC and XMP unchanged int histogramPosition; // 0=disabled, 1=left pane, 2=right pane bool showProfileSelector; diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 305fa15c2..6b9455ea6 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -396,6 +396,8 @@ Gtk::Widget* Preferences::getColorManagementPanel () { colt->attach (*cbAutoMonProfile, 1, 2, 3, 4, Gtk::EXPAND | Gtk::FILL | Gtk::SHRINK, Gtk::SHRINK, 2, 2); mvbcm->pack_start (*colt, Gtk::PACK_SHRINK, 4); + autoMonProfileToggled(); + return mvbcm; } @@ -835,6 +837,11 @@ Gtk::Widget* Preferences::getFileBrowserPanel () { Gtk::Widget* Preferences::getSoundPanel () { Gtk::VBox* pSnd = new Gtk::VBox (); + ckbSndEnable = Gtk::manage( new Gtk::CheckButton (M("GENERAL_ENABLE"))); + sndEnableConn = ckbSndEnable->signal_toggled().connect (sigc::mem_fun(*this, &Preferences::sndEnableToggled)); + + pSnd->pack_start (*ckbSndEnable, Gtk::PACK_SHRINK, 8); + Gtk::Label* lSndHelp = Gtk::manage (new Gtk::Label (M("PREFERENCES_SND_HELP"))); pSnd->pack_start (*lSndHelp, Gtk::PACK_SHRINK, 4); @@ -871,6 +878,8 @@ Gtk::Widget* Preferences::getSoundPanel () { pSnd->set_border_width (4); + sndEnableToggled(); + return pSnd; } @@ -1003,6 +1012,7 @@ void Preferences::storePreferences () { moptions.overwriteOutputFile = chOverwriteOutputFile->get_active (); // Sounds + moptions.sndEnable = ckbSndEnable->get_active (); moptions.sndBatchQueueDone = txtSndBatchQueueDone->get_text (); moptions.sndLngEditProcDone = txtSndLngEditProcDone->get_text (); moptions.sndLngEditProcDoneSecs = spbSndLngEditProcDoneSecs->get_value (); @@ -1142,6 +1152,7 @@ void Preferences::fillPreferences () { chOverwriteOutputFile->set_active (moptions.overwriteOutputFile); // Sounds + ckbSndEnable->set_active (moptions.sndEnable); txtSndBatchQueueDone->set_text (moptions.sndBatchQueueDone); txtSndLngEditProcDone->set_text (moptions.sndLngEditProcDone); spbSndLngEditProcDoneSecs->set_value (moptions.sndLngEditProcDoneSecs); @@ -1166,6 +1177,13 @@ void Preferences::autoMonProfileToggled () { monProfile->set_sensitive(!cbAutoMonProfile->get_active()); } +void Preferences::sndEnableToggled () { + txtSndBatchQueueDone->set_sensitive(ckbSndEnable->get_active()); + txtSndLngEditProcDone->set_sensitive(ckbSndEnable->get_active()); + spbSndLngEditProcDoneSecs->set_sensitive(ckbSndEnable->get_active()); +} + + void Preferences::okPressed () { storePreferences (); diff --git a/rtgui/preferences.h b/rtgui/preferences.h index ce62a2504..3d582353b 100644 --- a/rtgui/preferences.h +++ b/rtgui/preferences.h @@ -116,6 +116,7 @@ class Preferences : public Gtk::Dialog { Gtk::ComboBoxText* editorLayout; RTWindow* parent; + Gtk::CheckButton* ckbSndEnable; Gtk::Entry* txtSndBatchQueueDone; Gtk::Entry* txtSndLngEditProcDone; Gtk::SpinButton* spbSndLngEditProcDoneSecs; @@ -131,7 +132,7 @@ class Preferences : public Gtk::Dialog { Options moptions; - sigc::connection tconn, sconn, fconn, usethcon, addc, setc, dfconn, ffconn, autoMonProfileConn; + sigc::connection tconn, sconn, fconn, usethcon, addc, setc, dfconn, ffconn, autoMonProfileConn, sndEnableConn; Glib::ustring initialTheme; Glib::ustring initialFont; @@ -170,6 +171,7 @@ class Preferences : public Gtk::Dialog { void cancelPressed (); void aboutPressed (); void autoMonProfileToggled (); + void sndEnableToggled (); void selectStartupDir (); void addExtPressed (); diff --git a/rtgui/soundman.cc b/rtgui/soundman.cc index ac14e8cd8..5a7bb4d07 100644 --- a/rtgui/soundman.cc +++ b/rtgui/soundman.cc @@ -19,23 +19,33 @@ */ #include +#include #ifdef WIN32 #include #include #endif + +void SoundManager::init() +{ +#ifdef WIN32 // TODO: On Windows Vista/7 RT should register with the OS sound system, so it can enjoy application specific // volume, safed, process independent etc. from the start. // Function call is IAudioClient::Initialize // Unfortunately MinGW does not support this yet. If audioclient.h is available, add an Init // called once on program start. + // + // This mitigation plays an empty file on start, so RT is immidiately avaible in the Windows mixer at least + playSoundAsync(Glib::ustring("sounds\\Empty.wav")); +#endif +} // Plays a sound in async mode to not block the main thread // param is either file name or name of the system event on Windows (e.g. "SystemAsterisk" or "SystemDefault"). void SoundManager::playSoundAsync(const Glib::ustring &sound) { - if (sound.empty()) return; + if (sound.empty() || !options.sndEnable) return; #ifdef WIN32 DWORD sndParam=SND_ASYNC | SND_NODEFAULT; diff --git a/rtgui/soundman.h b/rtgui/soundman.h index 799753814..14a922179 100644 --- a/rtgui/soundman.h +++ b/rtgui/soundman.h @@ -25,6 +25,7 @@ class SoundManager { public: + static void init(); static void playSoundAsync(const Glib::ustring &sound); };