1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-18 17:10:05 +02:00

Bug 1949: WASAPI playback stops before the end of the selection

Problem: When using WASAPI on Windows, the last "latency buffer length" of a selection is not played. This is a fairly nasty bug for those relying on playback when making fine adjustments to the position of the cursor, or the start or end of selection.

During playback the "latency buffer length" has no effect on the actual latency of the playback, but the playback cursor is positioned as if the "latency buffer length" did have an effect, that is, it is positioned by this amount after the audio being played.

So an obvious workaround is for the user to set the latency buffer length to zero when using WASAPI. However they then have to remember to change it if they use another audio host.

Fix: The real problem is presumably a portaudio bug, but this fix just hard codes the workaround given above. For playback, when using WASAPI, set the suggested latency to 0, regardless of user setting.
This commit is contained in:
David Bailes 2018-08-29 10:38:35 +01:00 committed by James Crook
parent 85c1eb4720
commit a5e9fb9e34

View File

@ -1569,8 +1569,16 @@ bool AudioIO::StartPortAudioStream(double sampleRate,
if (mSoftwarePlaythrough)
playbackParameters.suggestedLatency =
playbackDeviceInfo->defaultLowOutputLatency;
else
playbackParameters.suggestedLatency = latencyDuration/1000.0;
else {
// When using WASAPI, the suggested latency does not affect
// the latency of the playback, but the position of playback is given as if
// there was the suggested latency. This results in the last "suggested latency"
// of a selection not being played. So for WASAPI use 0.0 for the suggested
// latency regardless of user setting. See bug 1949.
const PaHostApiInfo* hostInfo = Pa_GetHostApiInfo(playbackDeviceInfo->hostApi);
bool isWASAPI = (hostInfo && hostInfo->type == paWASAPI);
playbackParameters.suggestedLatency = isWASAPI ? 0.0 : latencyDuration/1000.0;
}
mOutputMeter = mOwningProject->GetPlaybackMeter();
}