Added sound use global focus option to Qt GUI.
This commit is contained in:
parent
f925e82d85
commit
728a7c3580
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include "../../fceu.h"
|
#include "../../fceu.h"
|
||||||
#include "../../driver.h"
|
#include "../../driver.h"
|
||||||
|
#include "Qt/ConsoleWindow.h"
|
||||||
#include "Qt/ConsoleSoundConf.h"
|
#include "Qt/ConsoleSoundConf.h"
|
||||||
#include "Qt/main.h"
|
#include "Qt/main.h"
|
||||||
#include "Qt/dface.h"
|
#include "Qt/dface.h"
|
||||||
|
@ -130,6 +131,15 @@ ConsoleSndConfDialog_t::ConsoleSndConfDialog_t(QWidget *parent)
|
||||||
|
|
||||||
connect(bufSizeSlider, SIGNAL(valueChanged(int)), this, SLOT(bufSizeChanged(int)));
|
connect(bufSizeSlider, SIGNAL(valueChanged(int)), this, SLOT(bufSizeChanged(int)));
|
||||||
|
|
||||||
|
// Use Global Focus
|
||||||
|
useGlobalFocus = new QCheckBox(tr("Use Global Focus"));
|
||||||
|
useGlobalFocus->setToolTip( tr("Mute sound when window is not in focus") );
|
||||||
|
vbox1->addWidget(useGlobalFocus);
|
||||||
|
|
||||||
|
setCheckBoxFromProperty(useGlobalFocus, "SDL.Sound.UseGlobalFocus");
|
||||||
|
|
||||||
|
connect(useGlobalFocus, SIGNAL(stateChanged(int)), this, SLOT(useGlobalFocusChanged(int)));
|
||||||
|
|
||||||
// Swap Duty Cycles
|
// Swap Duty Cycles
|
||||||
swapDutyChkbox = new QCheckBox(tr("Swap Duty Cycles"));
|
swapDutyChkbox = new QCheckBox(tr("Swap Duty Cycles"));
|
||||||
vbox1->addWidget(swapDutyChkbox);
|
vbox1->addWidget(swapDutyChkbox);
|
||||||
|
@ -499,6 +509,20 @@ void ConsoleSndConfDialog_t::enaSoundLowPassChange(int value)
|
||||||
g_config->save();
|
g_config->save();
|
||||||
}
|
}
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
|
void ConsoleSndConfDialog_t::useGlobalFocusChanged(int value)
|
||||||
|
{
|
||||||
|
bool bval = value != Qt::Unchecked;
|
||||||
|
|
||||||
|
//printf("SDL.Sound.UseGlobalFocus = %i\n", bval);
|
||||||
|
g_config->setOption("SDL.Sound.UseGlobalFocus", bval);
|
||||||
|
g_config->save();
|
||||||
|
|
||||||
|
if ( consoleWindow )
|
||||||
|
{
|
||||||
|
consoleWindow->setSoundUseGlobalFocus(bval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//----------------------------------------------------
|
||||||
void ConsoleSndConfDialog_t::swapDutyCallback(int value)
|
void ConsoleSndConfDialog_t::swapDutyCallback(int value)
|
||||||
{
|
{
|
||||||
if (value)
|
if (value)
|
||||||
|
|
|
@ -31,6 +31,7 @@ protected:
|
||||||
QCheckBox *enaChkbox;
|
QCheckBox *enaChkbox;
|
||||||
QCheckBox *enaLowPass;
|
QCheckBox *enaLowPass;
|
||||||
QCheckBox *swapDutyChkbox;
|
QCheckBox *swapDutyChkbox;
|
||||||
|
QCheckBox *useGlobalFocus;
|
||||||
QComboBox *qualitySelect;
|
QComboBox *qualitySelect;
|
||||||
QComboBox *rateSelect;
|
QComboBox *rateSelect;
|
||||||
QSlider *bufSizeSlider;
|
QSlider *bufSizeSlider;
|
||||||
|
@ -62,6 +63,7 @@ private slots:
|
||||||
void enaSoundStateChange(int value);
|
void enaSoundStateChange(int value);
|
||||||
void enaSoundLowPassChange(int value);
|
void enaSoundLowPassChange(int value);
|
||||||
void swapDutyCallback(int value);
|
void swapDutyCallback(int value);
|
||||||
|
void useGlobalFocusChanged(int value);
|
||||||
void soundQualityChanged(int index);
|
void soundQualityChanged(int index);
|
||||||
void soundRateChanged(int index);
|
void soundRateChanged(int index);
|
||||||
};
|
};
|
||||||
|
|
|
@ -124,7 +124,7 @@ consoleWin_t::consoleWin_t(QWidget *parent)
|
||||||
|
|
||||||
g_config->getOption( "SDL.PauseOnMainMenuAccess", &mainMenuPauseWhenActv );
|
g_config->getOption( "SDL.PauseOnMainMenuAccess", &mainMenuPauseWhenActv );
|
||||||
g_config->getOption( "SDL.ContextMenuEnable", &contextMenuEnable );
|
g_config->getOption( "SDL.ContextMenuEnable", &contextMenuEnable );
|
||||||
g_config->getOption( "SDL.Sound.MuteOnDefocus", &muteSoundOnDefocus );
|
g_config->getOption( "SDL.Sound.UseGlobalFocus", &soundUseGlobalFocus );
|
||||||
g_config->getOption ("SDL.VideoDriver", &use_SDL_video);
|
g_config->getOption ("SDL.VideoDriver", &use_SDL_video);
|
||||||
|
|
||||||
if ( use_SDL_video )
|
if ( use_SDL_video )
|
||||||
|
@ -390,13 +390,15 @@ void consoleWin_t::winActiveChanged(void)
|
||||||
|
|
||||||
w = this->window();
|
w = this->window();
|
||||||
|
|
||||||
|
//printf("Active Changed\n");
|
||||||
|
|
||||||
if ( w != NULL)
|
if ( w != NULL)
|
||||||
{
|
{
|
||||||
QWindow *hdl = w->windowHandle();
|
QWindow *hdl = w->windowHandle();
|
||||||
|
|
||||||
if (hdl != NULL)
|
if (hdl != NULL)
|
||||||
{
|
{
|
||||||
if ( muteSoundOnDefocus )
|
if ( !soundUseGlobalFocus )
|
||||||
{
|
{
|
||||||
fceuWrapperLock();
|
fceuWrapperLock();
|
||||||
if ( hdl->isActive() )
|
if ( hdl->isActive() )
|
||||||
|
@ -543,6 +545,13 @@ void consoleWin_t::setContextMenuEnable( bool enable )
|
||||||
contextMenuEnable = enable;
|
contextMenuEnable = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void consoleWin_t::setSoundUseGlobalFocus( bool enable )
|
||||||
|
{
|
||||||
|
soundUseGlobalFocus = enable;
|
||||||
|
|
||||||
|
winActiveChanged();
|
||||||
|
}
|
||||||
|
|
||||||
void consoleWin_t::loadCursor(void)
|
void consoleWin_t::loadCursor(void)
|
||||||
{
|
{
|
||||||
int cursorVis;
|
int cursorVis;
|
||||||
|
|
|
@ -170,6 +170,7 @@ class consoleWin_t : public QMainWindow
|
||||||
|
|
||||||
void setMenuAccessPauseEnable(bool enable);
|
void setMenuAccessPauseEnable(bool enable);
|
||||||
void setContextMenuEnable(bool enable);
|
void setContextMenuEnable(bool enable);
|
||||||
|
void setSoundUseGlobalFocus(bool enable);
|
||||||
protected:
|
protected:
|
||||||
consoleMenuBar *menubar;
|
consoleMenuBar *menubar;
|
||||||
|
|
||||||
|
@ -254,7 +255,7 @@ class consoleWin_t : public QMainWindow
|
||||||
bool mainMenuPauseWhenActv;
|
bool mainMenuPauseWhenActv;
|
||||||
bool scrHandlerConnected;
|
bool scrHandlerConnected;
|
||||||
bool contextMenuEnable;
|
bool contextMenuEnable;
|
||||||
bool muteSoundOnDefocus;
|
bool soundUseGlobalFocus;
|
||||||
|
|
||||||
std::list <std::string*> romList;
|
std::list <std::string*> romList;
|
||||||
std::vector <autoFireMenuAction*> afActList;
|
std::vector <autoFireMenuAction*> afActList;
|
||||||
|
|
|
@ -486,7 +486,7 @@ InitConfig()
|
||||||
config->addOption("soundrecord", "SDL.Sound.RecordFile", "");
|
config->addOption("soundrecord", "SDL.Sound.RecordFile", "");
|
||||||
config->addOption("soundbufsize", "SDL.Sound.BufSize", 128);
|
config->addOption("soundbufsize", "SDL.Sound.BufSize", 128);
|
||||||
config->addOption("lowpass", "SDL.Sound.LowPass", 0);
|
config->addOption("lowpass", "SDL.Sound.LowPass", 0);
|
||||||
config->addOption("SDL.Sound.MuteOnDefocus", 0);
|
config->addOption("SDL.Sound.UseGlobalFocus", 1);
|
||||||
|
|
||||||
config->addOption('g', "gamegenie", "SDL.GameGenie", 0);
|
config->addOption('g', "gamegenie", "SDL.GameGenie", 0);
|
||||||
config->addOption("pal", "SDL.PAL", 0);
|
config->addOption("pal", "SDL.PAL", 0);
|
||||||
|
|
Loading…
Reference in New Issue