port audio settings to new config system
This commit is contained in:
parent
d634c450bb
commit
daf981e7c2
|
@ -16,7 +16,6 @@
|
|||
with melonDS. If not, see http://www.gnu.org/licenses/.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <SDL2/SDL.h>
|
||||
#include <QFileDialog>
|
||||
|
||||
|
@ -25,12 +24,10 @@
|
|||
#include "Config.h"
|
||||
#include "NDS.h"
|
||||
#include "DSi.h"
|
||||
#include "DSi_I2C.h"
|
||||
|
||||
#include "AudioSettingsDialog.h"
|
||||
#include "ui_AudioSettingsDialog.h"
|
||||
#include "main.h"
|
||||
#include "EmuInstance.h"
|
||||
|
||||
using namespace melonDS;
|
||||
AudioSettingsDialog* AudioSettingsDialog::currentDlg = nullptr;
|
||||
|
@ -44,41 +41,49 @@ AudioSettingsDialog::AudioSettingsDialog(QWidget* parent) : QDialog(parent), ui(
|
|||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
emuInstance = ((MainWindow*)parent)->getEmuInstance();
|
||||
auto& cfg = emuInstance->getGlobalConfig();
|
||||
auto& instcfg = emuInstance->getLocalConfig();
|
||||
bool emuActive = emuInstance->getEmuThread()->emuIsActive();
|
||||
|
||||
oldInterp = Config::AudioInterp;
|
||||
oldBitDepth = Config::AudioBitDepth;
|
||||
oldVolume = Config::AudioVolume;
|
||||
oldDSiSync = Config::DSiVolumeSync;
|
||||
oldInterp = cfg.GetInt("Audio.Interpolation");
|
||||
oldBitDepth = cfg.GetInt("Audio.BitDepth");
|
||||
oldVolume = instcfg.GetInt("Audio.Volume");
|
||||
oldDSiSync = instcfg.GetBool("Audio.DSiVolumeSync");
|
||||
|
||||
volume = oldVolume;
|
||||
dsiSync = oldDSiSync;
|
||||
|
||||
ui->cbInterpolation->addItem("None");
|
||||
ui->cbInterpolation->addItem("Linear");
|
||||
ui->cbInterpolation->addItem("Cosine");
|
||||
ui->cbInterpolation->addItem("Cubic");
|
||||
ui->cbInterpolation->addItem("Gaussian (SNES)");
|
||||
ui->cbInterpolation->setCurrentIndex(Config::AudioInterp);
|
||||
ui->cbInterpolation->setCurrentIndex(oldInterp);
|
||||
|
||||
ui->cbBitDepth->addItem("Automatic");
|
||||
ui->cbBitDepth->addItem("10-bit");
|
||||
ui->cbBitDepth->addItem("16-bit");
|
||||
ui->cbBitDepth->setCurrentIndex(Config::AudioBitDepth);
|
||||
ui->cbBitDepth->setCurrentIndex(oldBitDepth);
|
||||
|
||||
bool state = ui->slVolume->blockSignals(true);
|
||||
ui->slVolume->setValue(Config::AudioVolume);
|
||||
ui->slVolume->setValue(oldVolume);
|
||||
ui->slVolume->blockSignals(state);
|
||||
|
||||
ui->chkSyncDSiVolume->setChecked(Config::DSiVolumeSync);
|
||||
ui->chkSyncDSiVolume->setChecked(oldDSiSync);
|
||||
|
||||
// Setup volume slider accordingly
|
||||
if (emuActive && emuInstance->getNDS()->ConsoleType == 1)
|
||||
{
|
||||
on_chkSyncDSiVolume_clicked(Config::DSiVolumeSync);
|
||||
on_chkSyncDSiVolume_clicked(oldDSiSync);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->chkSyncDSiVolume->setEnabled(false);
|
||||
}
|
||||
bool isext = (Config::MicInputType == 1);
|
||||
|
||||
int mictype = cfg.GetInt("Mic.InputType");
|
||||
|
||||
bool isext = (mictype == micInputType_External);
|
||||
ui->cbMic->setEnabled(isext);
|
||||
|
||||
const int count = SDL_GetNumAudioDevices(true);
|
||||
|
@ -86,12 +91,14 @@ AudioSettingsDialog::AudioSettingsDialog(QWidget* parent) : QDialog(parent), ui(
|
|||
{
|
||||
ui->cbMic->addItem(SDL_GetAudioDeviceName(i, true));
|
||||
}
|
||||
if (Config::MicDevice == "" && count > 0)
|
||||
|
||||
QString micdev = cfg.GetQString("Mic.Device");
|
||||
if (micdev == "" && count > 0)
|
||||
{
|
||||
Config::MicDevice = SDL_GetAudioDeviceName(0, true);
|
||||
micdev = SDL_GetAudioDeviceName(0, true);
|
||||
}
|
||||
|
||||
ui->cbMic->setCurrentText(QString::fromStdString(Config::MicDevice));
|
||||
ui->cbMic->setCurrentText(micdev);
|
||||
|
||||
grpMicMode = new QButtonGroup(this);
|
||||
grpMicMode->addButton(ui->rbMicNone, micInputType_Silence);
|
||||
|
@ -99,15 +106,15 @@ AudioSettingsDialog::AudioSettingsDialog(QWidget* parent) : QDialog(parent), ui(
|
|||
grpMicMode->addButton(ui->rbMicNoise, micInputType_Noise);
|
||||
grpMicMode->addButton(ui->rbMicWav, micInputType_Wav);
|
||||
connect(grpMicMode, SIGNAL(buttonClicked(int)), this, SLOT(onChangeMicMode(int)));
|
||||
grpMicMode->button(Config::MicInputType)->setChecked(true);
|
||||
grpMicMode->button(mictype)->setChecked(true);
|
||||
|
||||
ui->txtMicWavPath->setText(QString::fromStdString(Config::MicWavPath));
|
||||
ui->txtMicWavPath->setText(cfg.GetQString("Mic.WavPath"));
|
||||
|
||||
bool iswav = (Config::MicInputType == micInputType_Wav);
|
||||
bool iswav = (mictype == micInputType_Wav);
|
||||
ui->txtMicWavPath->setEnabled(iswav);
|
||||
ui->btnMicWavBrowse->setEnabled(iswav);
|
||||
|
||||
int inst = Platform::InstanceID();
|
||||
int inst = emuInstance->getInstanceID();
|
||||
if (inst > 0)
|
||||
{
|
||||
ui->lblInstanceNum->setText(QString("Configuring settings for instance %1").arg(inst+1));
|
||||
|
@ -130,26 +137,30 @@ AudioSettingsDialog::~AudioSettingsDialog()
|
|||
|
||||
void AudioSettingsDialog::onSyncVolumeLevel()
|
||||
{
|
||||
if (Config::DSiVolumeSync && emuInstance->getNDS()->ConsoleType == 1)
|
||||
if (dsiSync && emuInstance->getNDS()->ConsoleType == 1)
|
||||
{
|
||||
auto dsi = static_cast<DSi*>(emuInstance->getNDS());
|
||||
volume = dsi->I2C.GetBPTWL()->GetVolumeLevel();
|
||||
|
||||
bool state = ui->slVolume->blockSignals(true);
|
||||
ui->slVolume->setValue(dsi->I2C.GetBPTWL()->GetVolumeLevel());
|
||||
ui->slVolume->setValue(volume);
|
||||
ui->slVolume->blockSignals(state);
|
||||
}
|
||||
}
|
||||
|
||||
void AudioSettingsDialog::onConsoleReset()
|
||||
{
|
||||
on_chkSyncDSiVolume_clicked(Config::DSiVolumeSync);
|
||||
on_chkSyncDSiVolume_clicked(dsiSync);
|
||||
ui->chkSyncDSiVolume->setEnabled(emuInstance->getNDS()->ConsoleType == 1);
|
||||
}
|
||||
|
||||
void AudioSettingsDialog::on_AudioSettingsDialog_accepted()
|
||||
{
|
||||
Config::MicDevice = ui->cbMic->currentText().toStdString();
|
||||
Config::MicInputType = grpMicMode->checkedId();
|
||||
Config::MicWavPath = ui->txtMicWavPath->text().toStdString();
|
||||
auto& cfg = emuInstance->getGlobalConfig();
|
||||
cfg.SetQString("Mic.Device", ui->cbMic->currentText());
|
||||
cfg.SetInt("Mic.InputType", grpMicMode->checkedId());
|
||||
cfg.SetQString("Mic.WavPath", ui->txtMicWavPath->text());
|
||||
|
||||
Config::Save();
|
||||
|
||||
closeDlg();
|
||||
|
@ -157,10 +168,15 @@ void AudioSettingsDialog::on_AudioSettingsDialog_accepted()
|
|||
|
||||
void AudioSettingsDialog::on_AudioSettingsDialog_rejected()
|
||||
{
|
||||
Config::AudioInterp = oldInterp;
|
||||
Config::AudioBitDepth = oldBitDepth;
|
||||
Config::AudioVolume = oldVolume;
|
||||
Config::DSiVolumeSync = oldDSiSync;
|
||||
auto& cfg = emuInstance->getGlobalConfig();
|
||||
auto& instcfg = emuInstance->getLocalConfig();
|
||||
cfg.SetInt("Audio.Interpolation", oldInterp);
|
||||
cfg.SetInt("Audio.BitDepth", oldBitDepth);
|
||||
instcfg.SetInt("Audio.Volume", oldVolume);
|
||||
instcfg.SetBool("Audio.DSiVolumeSync", oldDSiSync);
|
||||
|
||||
emit updateAudioVolume(oldVolume, oldDSiSync);
|
||||
emit updateAudioSettings();
|
||||
|
||||
closeDlg();
|
||||
}
|
||||
|
@ -170,7 +186,8 @@ void AudioSettingsDialog::on_cbBitDepth_currentIndexChanged(int idx)
|
|||
// prevent a spurious change
|
||||
if (ui->cbBitDepth->count() < 3) return;
|
||||
|
||||
Config::AudioBitDepth = ui->cbBitDepth->currentIndex();
|
||||
auto& cfg = emuInstance->getGlobalConfig();
|
||||
cfg.SetInt("Audio.BitDepth", ui->cbBitDepth->currentIndex());
|
||||
|
||||
emit updateAudioSettings();
|
||||
}
|
||||
|
@ -180,29 +197,37 @@ void AudioSettingsDialog::on_cbInterpolation_currentIndexChanged(int idx)
|
|||
// prevent a spurious change
|
||||
if (ui->cbInterpolation->count() < 5) return;
|
||||
|
||||
Config::AudioInterp = ui->cbInterpolation->currentIndex();
|
||||
auto& cfg = emuInstance->getGlobalConfig();
|
||||
cfg.SetInt("Audio.Interpolation", ui->cbInterpolation->currentIndex());
|
||||
|
||||
emit updateAudioSettings();
|
||||
}
|
||||
|
||||
void AudioSettingsDialog::on_slVolume_valueChanged(int val)
|
||||
{
|
||||
if (Config::DSiVolumeSync && emuInstance->getNDS()->ConsoleType == 1)
|
||||
auto& cfg = emuInstance->getLocalConfig();
|
||||
|
||||
if (dsiSync && emuInstance->getNDS()->ConsoleType == 1)
|
||||
{
|
||||
auto dsi = static_cast<DSi*>(emuInstance->getNDS());
|
||||
dsi->I2C.GetBPTWL()->SetVolumeLevel(val);
|
||||
return;
|
||||
}
|
||||
|
||||
Config::AudioVolume = val;
|
||||
volume = val;
|
||||
cfg.SetInt("Audio.Volume", val);
|
||||
emit updateAudioVolume(val, dsiSync);
|
||||
}
|
||||
|
||||
void AudioSettingsDialog::on_chkSyncDSiVolume_clicked(bool checked)
|
||||
{
|
||||
Config::DSiVolumeSync = checked;
|
||||
dsiSync = checked;
|
||||
|
||||
auto& cfg = emuInstance->getLocalConfig();
|
||||
cfg.SetBool("Audio.DSiVolumeSync", dsiSync);
|
||||
|
||||
bool state = ui->slVolume->blockSignals(true);
|
||||
if (Config::DSiVolumeSync && emuInstance->getNDS()->ConsoleType == 1)
|
||||
if (dsiSync && emuInstance->getNDS()->ConsoleType == 1)
|
||||
{
|
||||
auto dsi = static_cast<DSi*>(emuInstance->getNDS());
|
||||
ui->slVolume->setMaximum(31);
|
||||
|
@ -212,13 +237,16 @@ void AudioSettingsDialog::on_chkSyncDSiVolume_clicked(bool checked)
|
|||
}
|
||||
else
|
||||
{
|
||||
Config::AudioVolume = oldVolume;
|
||||
volume = oldVolume;
|
||||
cfg.SetInt("Audio.Volume", oldVolume);
|
||||
ui->slVolume->setMaximum(256);
|
||||
ui->slVolume->setValue(Config::AudioVolume);
|
||||
ui->slVolume->setValue(oldVolume);
|
||||
ui->slVolume->setPageStep(16);
|
||||
ui->slVolume->setTickPosition(QSlider::NoTicks);
|
||||
}
|
||||
ui->slVolume->blockSignals(state);
|
||||
|
||||
emit updateAudioVolume(volume, dsiSync);
|
||||
}
|
||||
|
||||
void AudioSettingsDialog::onChangeMicMode(int mode)
|
||||
|
|
|
@ -57,6 +57,7 @@ public:
|
|||
void onConsoleReset();
|
||||
|
||||
signals:
|
||||
void updateAudioVolume(int vol, bool dsisync);
|
||||
void updateAudioSettings();
|
||||
|
||||
private slots:
|
||||
|
@ -80,6 +81,9 @@ private:
|
|||
int oldVolume;
|
||||
bool oldDSiSync;
|
||||
QButtonGroup* grpMicMode;
|
||||
|
||||
int volume;
|
||||
bool dsiSync;
|
||||
};
|
||||
|
||||
#endif // AUDIOSETTINGSDIALOG_H
|
||||
|
|
|
@ -244,14 +244,6 @@ extern bool DirectLAN;
|
|||
|
||||
extern bool SavestateRelocSRAM;
|
||||
|
||||
extern int AudioInterp;
|
||||
extern int AudioBitDepth;
|
||||
extern int AudioVolume;
|
||||
extern bool DSiVolumeSync;
|
||||
extern int MicInputType;
|
||||
extern std::string MicDevice;
|
||||
extern std::string MicWavPath;
|
||||
|
||||
extern std::string LastROMFolder;
|
||||
|
||||
extern std::string RecentROMList[10];
|
||||
|
|
|
@ -987,8 +987,8 @@ bool EmuInstance::updateConsole(UpdateConsoleNDSArgs&& _ndsargs, UpdateConsoleGB
|
|||
std::move(arm7bios),
|
||||
std::move(*firmware),
|
||||
jitargs,
|
||||
static_cast<AudioBitDepth>(Config::AudioBitDepth),
|
||||
static_cast<AudioInterpolation>(Config::AudioInterp),
|
||||
static_cast<AudioBitDepth>(globalCfg.GetInt("Audio.BitDepth")),
|
||||
static_cast<AudioInterpolation>(globalCfg.GetInt("Audio.Interpolation")),
|
||||
gdbargs,
|
||||
};
|
||||
|
||||
|
|
|
@ -39,6 +39,9 @@ public:
|
|||
EmuThread* getEmuThread() { return emuThread; }
|
||||
melonDS::NDS* getNDS() { return nds; }
|
||||
|
||||
Config::Table& getGlobalConfig() { return globalCfg; }
|
||||
Config::Table& getLocalConfig() { return localCfg; }
|
||||
|
||||
void createWindow();
|
||||
|
||||
// return: empty string = setup OK, non-empty = error message
|
||||
|
@ -182,6 +185,13 @@ private:
|
|||
melonDS::u32 micBufferLength;
|
||||
melonDS::u32 micBufferReadPos;
|
||||
|
||||
//int audioInterp;
|
||||
int audioVolume;
|
||||
bool audioDSiVolumeSync;
|
||||
int micInputType;
|
||||
std::string micDeviceName;
|
||||
std::string micWavPath;
|
||||
|
||||
friend class EmuThread;
|
||||
friend class MainWindow;
|
||||
};
|
||||
|
|
|
@ -91,7 +91,7 @@ void EmuInstance::audioCallback(void* data, Uint8* stream, int len)
|
|||
num_in = len_in-margin;
|
||||
}
|
||||
|
||||
inst->audioResample(buf_in, num_in, (s16*)stream, len, Config::AudioVolume);
|
||||
inst->audioResample(buf_in, num_in, (s16*)stream, len, inst->audioVolume);
|
||||
}
|
||||
|
||||
void EmuInstance::micCallback(void* data, Uint8* stream, int len)
|
||||
|
@ -139,7 +139,7 @@ void EmuInstance::audioMute()
|
|||
|
||||
void EmuInstance::micOpen()
|
||||
{
|
||||
if (Config::MicInputType != micInputType_External)
|
||||
if (micInputType != micInputType_External)
|
||||
{
|
||||
micDevice = 0;
|
||||
return;
|
||||
|
@ -158,9 +158,9 @@ void EmuInstance::micOpen()
|
|||
whatIwant.callback = micCallback;
|
||||
whatIwant.userdata = this;
|
||||
const char* mic = NULL;
|
||||
if (Config::MicDevice != "")
|
||||
if (micDeviceName != "")
|
||||
{
|
||||
mic = Config::MicDevice.c_str();
|
||||
mic = micDeviceName.c_str();
|
||||
}
|
||||
micDevice = SDL_OpenAudioDevice(mic, 1, &whatIwant, &whatIget, 0);
|
||||
if (!micDevice)
|
||||
|
@ -264,7 +264,7 @@ void EmuInstance::micLoadWav(const std::string& name)
|
|||
|
||||
void EmuInstance::micProcess()
|
||||
{
|
||||
int type = Config::MicInputType;
|
||||
int type = micInputType;
|
||||
bool cmd = Input::HotkeyDown(HK_Mic);
|
||||
|
||||
if (type != micInputType_External && !cmd)
|
||||
|
@ -335,7 +335,11 @@ void EmuInstance::setupMicInputData()
|
|||
micWavLength = 0;
|
||||
}
|
||||
|
||||
switch (Config::MicInputType)
|
||||
micInputType = globalCfg.GetInt("Mic.InputType");
|
||||
micDeviceName = globalCfg.GetString("Mic.Device");
|
||||
micWavPath = globalCfg.GetString("Mic.WavPath");
|
||||
|
||||
switch (micInputType)
|
||||
{
|
||||
case micInputType_Silence:
|
||||
case micInputType_Noise:
|
||||
|
@ -347,7 +351,7 @@ void EmuInstance::setupMicInputData()
|
|||
micBufferLength = sizeof(micExtBuffer)/sizeof(s16);
|
||||
break;
|
||||
case micInputType_Wav:
|
||||
micLoadWav(Config::MicWavPath);
|
||||
micLoadWav(micWavPath);
|
||||
micBuffer = micWavBuffer;
|
||||
micBufferLength = micWavLength;
|
||||
break;
|
||||
|
@ -358,6 +362,9 @@ void EmuInstance::setupMicInputData()
|
|||
|
||||
void EmuInstance::audioInit()
|
||||
{
|
||||
audioVolume = localCfg.GetInt("Audio.Volume");
|
||||
audioDSiVolumeSync = localCfg.GetBool("Audio.DSiVolumeSync");
|
||||
|
||||
audioMuted = false;
|
||||
audioSyncCond = SDL_CreateCond();
|
||||
audioSyncLock = SDL_CreateMutex();
|
||||
|
@ -432,7 +439,8 @@ void EmuInstance::audioUpdateSettings()
|
|||
{
|
||||
micClose();
|
||||
|
||||
nds->SPU.SetInterpolation(static_cast<AudioInterpolation>(Config::AudioInterp));
|
||||
int audiointerp = globalCfg.GetInt("Audio.Interpolation");
|
||||
nds->SPU.SetInterpolation(static_cast<AudioInterpolation>(audiointerp));
|
||||
setupMicInputData();
|
||||
|
||||
micOpen();
|
||||
|
|
|
@ -16,11 +16,8 @@
|
|||
with melonDS. If not, see http://www.gnu.org/licenses/.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QList>
|
||||
#include <QDateEdit>
|
||||
|
||||
#include "types.h"
|
||||
#include "Platform.h"
|
||||
|
@ -28,6 +25,7 @@
|
|||
|
||||
#include "EmuSettingsDialog.h"
|
||||
#include "ui_EmuSettingsDialog.h"
|
||||
#include "main.h"
|
||||
|
||||
using namespace melonDS::Platform;
|
||||
using namespace melonDS;
|
||||
|
@ -59,8 +57,9 @@ EmuSettingsDialog::EmuSettingsDialog(QWidget* parent) : QDialog(parent), ui(new
|
|||
ui->setupUi(this);
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
Config::Table cfg = Config::GetGlobalTable();
|
||||
Config::Table instcfg = Config::GetLocalTable(Platform::InstanceID());
|
||||
emuInstance = ((MainWindow*)parent)->getEmuInstance();
|
||||
auto& cfg = emuInstance->getGlobalConfig();
|
||||
auto& instcfg = emuInstance->getLocalConfig();
|
||||
|
||||
lastBIOSFolder = cfg.GetQString("LastBIOSFolder");
|
||||
|
||||
|
@ -253,8 +252,8 @@ void EmuSettingsDialog::done(int r)
|
|||
QMessageBox::Ok, QMessageBox::Cancel) != QMessageBox::Ok)
|
||||
return;
|
||||
|
||||
Config::Table cfg = Config::GetGlobalTable();
|
||||
Config::Table instcfg = Config::GetLocalTable(Platform::InstanceID());
|
||||
auto& cfg = emuInstance->getGlobalConfig();
|
||||
auto& instcfg = emuInstance->getLocalConfig();
|
||||
|
||||
cfg.SetBool("Emu.ExternalBIOSEnable", ui->chkExternalBIOS->isChecked());
|
||||
cfg.SetQString("DS.BIOS9Path", ui->txtBIOS9Path->text());
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
namespace Ui { class EmuSettingsDialog; }
|
||||
class EmuSettingsDialog;
|
||||
|
||||
class EmuInstance;
|
||||
|
||||
class EmuSettingsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -84,6 +86,7 @@ private:
|
|||
void updateLastBIOSFolder(QString& filename);
|
||||
|
||||
Ui::EmuSettingsDialog* ui;
|
||||
EmuInstance* emuInstance;
|
||||
QString lastBIOSFolder;
|
||||
};
|
||||
|
||||
|
|
|
@ -397,7 +397,7 @@ void EmuThread::run()
|
|||
window->setGLSwapInterval(0);
|
||||
}
|
||||
|
||||
if (Config::DSiVolumeSync && emuInstance->nds->ConsoleType == 1)
|
||||
if (emuInstance->audioDSiVolumeSync && emuInstance->nds->ConsoleType == 1)
|
||||
{
|
||||
DSi* dsi = static_cast<DSi*>(emuInstance->nds);
|
||||
u8 volumeLevel = dsi->I2C.GetBPTWL()->GetVolumeLevel();
|
||||
|
@ -407,7 +407,7 @@ void EmuThread::run()
|
|||
emit syncVolumeLevel();
|
||||
}
|
||||
|
||||
Config::AudioVolume = volumeLevel * (256.0 / 31.0);
|
||||
emuInstance->audioVolume = volumeLevel * (256.0 / 31.0);
|
||||
}
|
||||
|
||||
if (Config::AudioSync && !fastforward)
|
||||
|
|
|
@ -198,10 +198,12 @@ static void signalHandler(int)
|
|||
|
||||
int test = 0;
|
||||
|
||||
MainWindow::MainWindow(EmuInstance* inst, QWidget* parent) : QMainWindow(parent)
|
||||
MainWindow::MainWindow(EmuInstance* inst, QWidget* parent) :
|
||||
QMainWindow(parent),
|
||||
emuInstance(inst),
|
||||
globalCfg(inst->globalCfg),
|
||||
localCfg(inst->localCfg)
|
||||
{
|
||||
emuInstance = inst;
|
||||
|
||||
test_num = test++;
|
||||
#ifndef _WIN32
|
||||
if (!parent)
|
||||
|
@ -1767,6 +1769,7 @@ void MainWindow::onOpenAudioSettings()
|
|||
AudioSettingsDialog* dlg = AudioSettingsDialog::openDlg(this);
|
||||
connect(emuThread, &EmuThread::syncVolumeLevel, dlg, &AudioSettingsDialog::onSyncVolumeLevel);
|
||||
connect(emuThread, &EmuThread::windowEmuStart, dlg, &AudioSettingsDialog::onConsoleReset);
|
||||
connect(dlg, &AudioSettingsDialog::updateAudioVolume, this, &MainWindow::onUpdateAudioVolume);
|
||||
connect(dlg, &AudioSettingsDialog::updateAudioSettings, this, &MainWindow::onUpdateAudioSettings);
|
||||
connect(dlg, &AudioSettingsDialog::finished, this, &MainWindow::onAudioSettingsFinished);
|
||||
}
|
||||
|
@ -1803,15 +1806,24 @@ void MainWindow::onPathSettingsFinished(int res)
|
|||
emuThread->emuUnpause();
|
||||
}
|
||||
|
||||
void MainWindow::onUpdateAudioVolume(int vol, int dsisync)
|
||||
{
|
||||
emuInstance->audioVolume = vol;
|
||||
emuInstance->audioDSiVolumeSync = dsisync;
|
||||
}
|
||||
|
||||
void MainWindow::onUpdateAudioSettings()
|
||||
{
|
||||
assert(emuInstance->nds != nullptr);
|
||||
emuInstance->nds->SPU.SetInterpolation(static_cast<AudioInterpolation>(Config::AudioInterp));
|
||||
|
||||
if (Config::AudioBitDepth == 0)
|
||||
int interp = globalCfg.GetInt("Audio.Interpolation");
|
||||
emuInstance->nds->SPU.SetInterpolation(static_cast<AudioInterpolation>(interp));
|
||||
|
||||
int bitdepth = globalCfg.GetInt("Audio.BitDepth");
|
||||
if (bitdepth == 0)
|
||||
emuInstance->nds->SPU.SetDegrade10Bit(emuInstance->nds->ConsoleType == 0);
|
||||
else
|
||||
emuInstance->nds->SPU.SetDegrade10Bit(Config::AudioBitDepth == 1);
|
||||
emuInstance->nds->SPU.SetDegrade10Bit(bitdepth == 1);
|
||||
}
|
||||
|
||||
void MainWindow::onAudioSettingsFinished(int res)
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <QCloseEvent>
|
||||
|
||||
#include "Screen.h"
|
||||
#include "Config.h"
|
||||
|
||||
|
||||
class EmuInstance;
|
||||
|
@ -177,6 +178,7 @@ private slots:
|
|||
void onOpenCameraSettings();
|
||||
void onCameraSettingsFinished(int res);
|
||||
void onOpenAudioSettings();
|
||||
void onUpdateAudioVolume(int vol, int dsisync);
|
||||
void onUpdateAudioSettings();
|
||||
void onAudioSettingsFinished(int res);
|
||||
void onOpenMPSettings();
|
||||
|
@ -240,9 +242,11 @@ private:
|
|||
int test_num;
|
||||
|
||||
EmuInstance* emuInstance;
|
||||
|
||||
EmuThread* emuThread;
|
||||
|
||||
Config::Table& globalCfg;
|
||||
Config::Table& localCfg;
|
||||
|
||||
public:
|
||||
ScreenPanel* panel;
|
||||
|
||||
|
|
|
@ -347,9 +347,6 @@ int main(int argc, char** argv)
|
|||
#endif
|
||||
SANITIZE(Config::ScreenVSyncInterval, 1, 20);
|
||||
SANITIZE(Config::GL_ScaleFactor, 1, 16);
|
||||
SANITIZE(Config::AudioInterp, 0, 4);
|
||||
SANITIZE(Config::AudioVolume, 0, 256);
|
||||
SANITIZE(Config::MicInputType, 0, (int)micInputType_MAX);
|
||||
SANITIZE(Config::ScreenRotation, 0, (int)Frontend::screenRot_MAX);
|
||||
SANITIZE(Config::ScreenGap, 0, 500);
|
||||
SANITIZE(Config::ScreenLayout, 0, (int)Frontend::screenLayout_MAX);
|
||||
|
|
Loading…
Reference in New Issue