Sound reset and signal handlers.

This commit is contained in:
BearOso 2023-06-28 15:40:21 -05:00
parent 4aaf009dbb
commit f8c71178d9
2 changed files with 18 additions and 2 deletions

View File

@ -30,8 +30,11 @@ SoundPanel::SoundPanel(EmuApplication *app_)
});
connect(spinBox_buffer_size, &QSpinBox::valueChanged, [&](int value) {
app->config->audio_buffer_size_ms = value;
app->restartAudio();
if (app->config->audio_buffer_size_ms != value)
{
app->config->audio_buffer_size_ms = value;
app->restartAudio();
}
});
connect(checkBox_adjust_input_rate, &QCheckBox::clicked, [&](bool checked) {

View File

@ -1,5 +1,9 @@
#include "EmuApplication.hpp"
#ifndef _WIN32
#include <csignal>
#endif
int main(int argc, char *argv[])
{
EmuApplication emu;
@ -7,6 +11,12 @@ int main(int argc, char *argv[])
QGuiApplication::setDesktopFileName("snes9x-gtk");
#ifndef _WIN32
auto quit_handler = [](int) { QApplication::quit(); };
for (auto s : { SIGQUIT, SIGINT, SIGTERM, SIGHUP })
signal(s, quit_handler);
#endif
emu.config = std::make_unique<EmuConfig>();
emu.config->setDefaults();
emu.config->loadFile(EmuConfig::findConfigFile());
@ -17,6 +27,9 @@ int main(int argc, char *argv[])
emu.updateBindings();
emu.startIdleLoop();
emu.qtapp->exec();
emu.config->saveFile(EmuConfig::findConfigFile());