Added backend logic to mute sound when GUI focus is lost. Still TODO add window controls.
This commit is contained in:
parent
455df4caae
commit
f925e82d85
|
@ -124,6 +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.VideoDriver", &use_SDL_video);
|
g_config->getOption ("SDL.VideoDriver", &use_SDL_video);
|
||||||
|
|
||||||
if ( use_SDL_video )
|
if ( use_SDL_video )
|
||||||
|
@ -359,6 +360,8 @@ void consoleWin_t::initScreenHandler(void)
|
||||||
scrHandlerConnected = true;
|
scrHandlerConnected = true;
|
||||||
|
|
||||||
winScreenChanged( hdl->screen() );
|
winScreenChanged( hdl->screen() );
|
||||||
|
|
||||||
|
connect( hdl, SIGNAL(activeChanged(void)), this, SLOT(winActiveChanged(void)) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -381,6 +384,37 @@ void consoleWin_t::winScreenChanged(QScreen *scr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void consoleWin_t::winActiveChanged(void)
|
||||||
|
{
|
||||||
|
QWidget *w;
|
||||||
|
|
||||||
|
w = this->window();
|
||||||
|
|
||||||
|
if ( w != NULL)
|
||||||
|
{
|
||||||
|
QWindow *hdl = w->windowHandle();
|
||||||
|
|
||||||
|
if (hdl != NULL)
|
||||||
|
{
|
||||||
|
if ( muteSoundOnDefocus )
|
||||||
|
{
|
||||||
|
fceuWrapperLock();
|
||||||
|
if ( hdl->isActive() )
|
||||||
|
{
|
||||||
|
int vol;
|
||||||
|
g_config->getOption("SDL.Sound.Volume", &vol);
|
||||||
|
FCEUI_SetSoundVolume(vol);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FCEUI_SetSoundVolume(0);
|
||||||
|
}
|
||||||
|
fceuWrapperUnLock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QSize consoleWin_t::calcRequiredSize(void)
|
QSize consoleWin_t::calcRequiredSize(void)
|
||||||
{
|
{
|
||||||
QSize out( GL_NES_WIDTH, GL_NES_HEIGHT );
|
QSize out( GL_NES_WIDTH, GL_NES_HEIGHT );
|
||||||
|
|
|
@ -254,6 +254,7 @@ class consoleWin_t : public QMainWindow
|
||||||
bool mainMenuPauseWhenActv;
|
bool mainMenuPauseWhenActv;
|
||||||
bool scrHandlerConnected;
|
bool scrHandlerConnected;
|
||||||
bool contextMenuEnable;
|
bool contextMenuEnable;
|
||||||
|
bool muteSoundOnDefocus;
|
||||||
|
|
||||||
std::list <std::string*> romList;
|
std::list <std::string*> romList;
|
||||||
std::vector <autoFireMenuAction*> afActList;
|
std::vector <autoFireMenuAction*> afActList;
|
||||||
|
@ -417,6 +418,7 @@ class consoleWin_t : public QMainWindow
|
||||||
void wavRecordAsStart(void);
|
void wavRecordAsStart(void);
|
||||||
void wavRecordStop(void);
|
void wavRecordStop(void);
|
||||||
void winScreenChanged( QScreen *scr );
|
void winScreenChanged( QScreen *scr );
|
||||||
|
void winActiveChanged(void);
|
||||||
void emuFrameFinish(void);
|
void emuFrameFinish(void);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -486,6 +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('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