Mute button + RT shows up immediately now in Windows Mixer

see issue 803
This commit is contained in:
Oliver Duis 2011-06-28 19:44:22 +02:00
parent 47cd6fc04e
commit 58efd5c861
8 changed files with 41 additions and 2 deletions

BIN
rtdata/sounds/Empty.wav Normal file

Binary file not shown.

View File

@ -31,6 +31,7 @@
#include <string.h>
#include <stdlib.h>
#include <options.h>
#include <soundman.h>
#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 )

View File

@ -147,6 +147,7 @@ void Options::setDefaults () {
cutOverlayBrush = std::vector<double> (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<int> 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);

View File

@ -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;

View File

@ -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 ();

View File

@ -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 ();

View File

@ -19,23 +19,33 @@
*/
#include <soundman.h>
#include <options.h>
#ifdef WIN32
#include <windows.h>
#include <mmsystem.h>
#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;

View File

@ -25,6 +25,7 @@
class SoundManager {
public:
static void init();
static void playSoundAsync(const Glib::ustring &sound);
};