From fe2e6561d3e8841a13be5bd9a9d88222dedc8afa Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sun, 15 Mar 2020 22:04:32 +1000 Subject: [PATCH] Qt: Add audio dumping options --- src/duckstation-qt/audiosettingswidget.cpp | 1 + src/duckstation-qt/audiosettingswidget.ui | 7 +++++++ src/duckstation-qt/mainwindow.cpp | 8 +++++++- src/duckstation-qt/mainwindow.ui | 12 +++++++++++- src/duckstation-qt/qthostinterface.cpp | 22 ++++++++++++++++++++++ src/duckstation-qt/qthostinterface.h | 2 ++ 6 files changed, 50 insertions(+), 2 deletions(-) diff --git a/src/duckstation-qt/audiosettingswidget.cpp b/src/duckstation-qt/audiosettingswidget.cpp index 6b471c9e7..08c729853 100644 --- a/src/duckstation-qt/audiosettingswidget.cpp +++ b/src/duckstation-qt/audiosettingswidget.cpp @@ -12,6 +12,7 @@ AudioSettingsWidget::AudioSettingsWidget(QtHostInterface* host_interface, QWidge SettingWidgetBinder::BindWidgetToEnumSetting(m_host_interface, m_ui.audioBackend, "Audio/Backend", &Settings::ParseAudioBackend, &Settings::GetAudioBackendName); SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.syncToOutput, "Audio/Sync"); + SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.startDumpingOnBoot, "Audio/DumpOnBoot"); } AudioSettingsWidget::~AudioSettingsWidget() = default; diff --git a/src/duckstation-qt/audiosettingswidget.ui b/src/duckstation-qt/audiosettingswidget.ui index f18ccc79c..f4f536df2 100644 --- a/src/duckstation-qt/audiosettingswidget.ui +++ b/src/duckstation-qt/audiosettingswidget.ui @@ -86,6 +86,13 @@ + + + + Start Dumping On Boot + + + diff --git a/src/duckstation-qt/mainwindow.cpp b/src/duckstation-qt/mainwindow.cpp index 048a67861..d58cb543e 100644 --- a/src/duckstation-qt/mainwindow.cpp +++ b/src/duckstation-qt/mainwindow.cpp @@ -480,11 +480,17 @@ void MainWindow::connectSignals() m_host_interface->populateSaveStateMenus(nullptr, m_ui.menuLoadState, m_ui.menuSaveState); - SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.actionDebugShowVRAM, "Debug/ShowVRAM"); SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.actionDebugDumpCPUtoVRAMCopies, "Debug/DumpCPUToVRAMCopies"); SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.actionDebugDumpVRAMtoCPUCopies, "Debug/DumpVRAMToCPUCopies"); + connect(m_ui.actionDumpAudio, &QAction::toggled, [this](bool checked) { + if (checked) + m_host_interface->startDumpingAudio(); + else + m_host_interface->stopDumpingAudio(); + }); + SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.actionDebugShowVRAM, "Debug/ShowVRAM"); SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.actionDebugShowGPUState, "Debug/ShowGPUState"); SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.actionDebugShowCDROMState, "Debug/ShowCDROMState"); diff --git a/src/duckstation-qt/mainwindow.ui b/src/duckstation-qt/mainwindow.ui index 5c9fcb239..912d65c54 100644 --- a/src/duckstation-qt/mainwindow.ui +++ b/src/duckstation-qt/mainwindow.ui @@ -121,9 +121,11 @@ - + + + @@ -394,6 +396,14 @@ Dump VRAM to CPU Copies + + + true + + + Dump Audio + + true diff --git a/src/duckstation-qt/qthostinterface.cpp b/src/duckstation-qt/qthostinterface.cpp index fdcd785f2..0f0090f1f 100644 --- a/src/duckstation-qt/qthostinterface.cpp +++ b/src/duckstation-qt/qthostinterface.cpp @@ -566,6 +566,28 @@ void QtHostInterface::saveState(bool global, qint32 slot, bool block_until_done SaveState(global, slot); } +void QtHostInterface::startDumpingAudio() +{ + if (!isOnWorkerThread()) + { + QMetaObject::invokeMethod(this, "startDumpingAudio"); + return; + } + + StartDumpingAudio(); +} + +void QtHostInterface::stopDumpingAudio() +{ + if (!isOnWorkerThread()) + { + QMetaObject::invokeMethod(this, "stopDumpingAudio"); + return; + } + + StopDumpingAudio(); +} + void QtHostInterface::enableBackgroundControllerPolling() { if (!isOnWorkerThread()) diff --git a/src/duckstation-qt/qthostinterface.h b/src/duckstation-qt/qthostinterface.h index 17e1ca221..dc33681f4 100644 --- a/src/duckstation-qt/qthostinterface.h +++ b/src/duckstation-qt/qthostinterface.h @@ -95,6 +95,8 @@ public Q_SLOTS: void loadState(const QString& filename); void loadState(bool global, qint32 slot); void saveState(bool global, qint32 slot, bool block_until_done = false); + void startDumpingAudio(); + void stopDumpingAudio(); /// Enables controller polling even without a system active. Must be matched by a call to /// disableBackgroundControllerPolling.