mirror of https://github.com/mgba-emu/mgba.git
Qt: Support loading fpsTarget and audioBuffers
This commit is contained in:
parent
776c64b0c8
commit
6788008418
|
@ -58,10 +58,14 @@ void AudioProcessor::pause() {
|
|||
}
|
||||
|
||||
void AudioProcessor::setBufferSamples(int samples) {
|
||||
QAudioFormat format = m_audioOutput->format();
|
||||
m_audioOutput->setBufferSize(samples * format.channelCount() * format.sampleSize() / 8);
|
||||
if (m_audioOutput) {
|
||||
QAudioFormat format = m_audioOutput->format();
|
||||
m_audioOutput->setBufferSize(samples * format.channelCount() * format.sampleSize() / 8);
|
||||
}
|
||||
}
|
||||
|
||||
void AudioProcessor::inputParametersChanged() {
|
||||
m_device->setFormat(m_audioOutput->format());
|
||||
if (m_device) {
|
||||
m_device->setFormat(m_audioOutput->format());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -243,17 +243,26 @@ void GameController::keyReleased(int key) {
|
|||
}
|
||||
|
||||
void GameController::setAudioBufferSamples(int samples) {
|
||||
GBAThreadInterrupt(&m_threadContext);
|
||||
m_threadContext.audioBuffers = samples;
|
||||
GBAAudioResizeBuffer(&m_threadContext.gba->audio, samples);
|
||||
GBAThreadContinue(&m_threadContext);
|
||||
if (m_gameOpen) {
|
||||
GBAThreadInterrupt(&m_threadContext);
|
||||
m_threadContext.audioBuffers = samples;
|
||||
GBAAudioResizeBuffer(&m_threadContext.gba->audio, samples);
|
||||
GBAThreadContinue(&m_threadContext);
|
||||
} else {
|
||||
m_threadContext.audioBuffers = samples;
|
||||
|
||||
}
|
||||
QMetaObject::invokeMethod(m_audioProcessor, "setBufferSamples", Q_ARG(int, samples));
|
||||
}
|
||||
|
||||
void GameController::setFPSTarget(float fps) {
|
||||
GBAThreadInterrupt(&m_threadContext);
|
||||
m_threadContext.fpsTarget = fps;
|
||||
GBAThreadContinue(&m_threadContext);
|
||||
if (m_gameOpen) {
|
||||
GBAThreadInterrupt(&m_threadContext);
|
||||
m_threadContext.fpsTarget = fps;
|
||||
GBAThreadContinue(&m_threadContext);
|
||||
} else {
|
||||
m_threadContext.fpsTarget = fps;
|
||||
}
|
||||
QMetaObject::invokeMethod(m_audioProcessor, "inputParametersChanged");
|
||||
}
|
||||
|
||||
|
|
|
@ -118,6 +118,14 @@ void Window::setOptions(GBAOptions* opts) {
|
|||
if (opts->bios) {
|
||||
m_controller->loadBIOS(opts->bios);
|
||||
}
|
||||
|
||||
if (opts->fpsTarget) {
|
||||
emit fpsTargetChanged(opts->fpsTarget);
|
||||
}
|
||||
|
||||
if (opts->audioBuffers) {
|
||||
emit audioBufferSamplesChanged(opts->audioBuffers);
|
||||
}
|
||||
}
|
||||
|
||||
void Window::selectROM() {
|
||||
|
|
Loading…
Reference in New Issue