1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-17 10:06:21 +00:00

Attempt to reduce audio latency. Unsuccessfully.

This commit is contained in:
Thomas Harte 2020-06-08 21:30:35 -04:00
parent d027450502
commit bcb23d9a15

View File

@ -166,8 +166,16 @@ void MainWindow::launchMachine() {
idealFormat.setSampleSize(audioIs8bit ? 8 : 16);
audioOutput = std::make_unique<QAudioOutput>(idealFormat, this);
// Start the output.
// Start the output. setBufferSize is supposed to set the audio buffer size, but
// appears not to work properly on macOS; experimenting with this on that platform
// revealed that setting the buffer size to 1024, then reading it back to find out
// what I actually got results in 2048. If I use a QIODevice-based audio output,
// i.e. one that pulls data as required, it then pulls in units of... 16384 bytes.
// That's almost 1/6th of a second — epic latency.
//
// So I have no idea. TODO: find an alternative audio library, I guess.
speaker->set_delegate(this);
audioOutput->setBufferSize(samplesPerBuffer * sizeof(int16_t));
audioIODevice = audioOutput->start();
}
}