QAudioOutput: control of buffer sizes.
bsomervi last edited by
I am having trouble with synthesised audio output on Windows. I have a synthesiser which is implemented as a QIODevice and run QAudioOutput in pull mode. When the application creates and exec()'s a dialog while audio output is running I get a stutter. I am synthesising in the GUI thread and thought that I might not be producing samples fast enough. The first try to fix this was to increase the buffer size of the QAudioOutput.
Increasing the buffer size helps on Linux but on Windows there is a problem. The first time I start the QAudioOutput instance I get the buffer size I requested, but if I stop and restart the stream I always seem to get a bufferSize of 19200 bytes. I worked around this by setting the buffer size before every start() call.
On Windows it seems to take the length of the data buffer (in time) to complete the stop of the stream even when reset() is called before stop().
Also what open mode should I be using on my QIODevice, I've tried WriteOnly and WriteOnly|Unbuffered but don't see much difference. Also should the device be sequential or not; I cannot implement random access esily (and don't think I should need to for a stream). I ask about QIODevice::isSequential() because I see a warning about not being able to call seek() which was surprising; why would QAudioOutput call seek()?