Midi input causes audio glitches.
This commit is contained in:
+20
-7
@@ -1422,17 +1422,31 @@ namespace pipedal
|
||||
}
|
||||
|
||||
// snd_pcm_wait(captureHandle, 1);
|
||||
|
||||
ssize_t framesRead;
|
||||
if ((framesRead = ReadBuffer(captureHandle, this->rawCaptureBuffer, bufferSize)) < 0)
|
||||
ssize_t framesToRead = bufferSize;
|
||||
ssize_t framesRead = 0;
|
||||
bool xrun = false;
|
||||
while (framesToRead != 0)
|
||||
{
|
||||
ssize_t thisTime = framesToRead;
|
||||
ssize_t nFrames;
|
||||
if ((nFrames = ReadBuffer(
|
||||
captureHandle,
|
||||
this->rawCaptureBuffer + this->captureFrameSize*framesRead,
|
||||
bufferSize)) < 0)
|
||||
{
|
||||
this->driverHost->OnUnderrun();
|
||||
auto state = snd_pcm_state(playbackHandle);
|
||||
XrunRecoverInputUnderrun(captureHandle, framesRead);
|
||||
XrunRecoverInputUnderrun(captureHandle, nFrames);
|
||||
xrun = true;
|
||||
break;
|
||||
}
|
||||
framesRead += nFrames;
|
||||
framesToRead -= nFrames;
|
||||
}
|
||||
if (xrun)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
cpuUse.AddSample(ProfileCategory::Read);
|
||||
if (framesRead == 0)
|
||||
continue;
|
||||
@@ -1462,7 +1476,6 @@ namespace pipedal
|
||||
cpuUse.AddSample(ProfileCategory::Write);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
Lv2Log::error(e.what());
|
||||
|
||||
Reference in New Issue
Block a user