kopia lustrzana https://gitlab.com/eliggett/wfview
Attempt to fix PortAudio issue
rodzic
f91dea47b5
commit
65ba69822a
|
@ -266,10 +266,16 @@ void paHandler::convertedOutput(audioPacket packet) {
|
||||||
if (packet.data.size() > 0) {
|
if (packet.data.size() > 0) {
|
||||||
|
|
||||||
if (Pa_IsStreamActive(audio) == 1) {
|
if (Pa_IsStreamActive(audio) == 1) {
|
||||||
PaError err = Pa_WriteStream(audio, (char*)packet.data.data(), packet.data.size() / sizeof(float) / outFormat.channelCount());
|
if (currentLatency < (setup.latency)) {
|
||||||
|
PaError err = Pa_WriteStream(audio, (char*)packet.data.data(), packet.data.size() / sizeof(float) / outFormat.channelCount());
|
||||||
|
|
||||||
if (err != paNoError) {
|
if (err != paNoError) {
|
||||||
qDebug(logAudio()) << (setup.isinput ? "Input" : "Output") << "Error writing audio!";
|
qDebug(logAudio()) << (setup.isinput ? "Input" : "Output") << "Error writing audio!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
qDebug(logAudio()) << (setup.isinput ? "Input" : "Output") << "Disgarding audio data as current latency" << currentLatency << "exceeds setup latency" << setup.latency;
|
||||||
|
setup.latency++;
|
||||||
}
|
}
|
||||||
const PaStreamInfo* info = Pa_GetStreamInfo(audio);
|
const PaStreamInfo* info = Pa_GetStreamInfo(audio);
|
||||||
currentLatency = packet.time.msecsTo(QTime::currentTime()) + (info->outputLatency * 1000);
|
currentLatency = packet.time.msecsTo(QTime::currentTime()) + (info->outputLatency * 1000);
|
||||||
|
@ -298,6 +304,8 @@ void paHandler::convertedInput(audioPacket packet)
|
||||||
void paHandler::changeLatency(const quint16 newSize)
|
void paHandler::changeLatency(const quint16 newSize)
|
||||||
{
|
{
|
||||||
qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "Changing latency to: " << newSize << " from " << setup.latency;
|
qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "Changing latency to: " << newSize << " from " << setup.latency;
|
||||||
|
setup.latency = newSize;
|
||||||
|
latencyAllowance = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int paHandler::getLatency()
|
int paHandler::getLatency()
|
||||||
|
|
|
@ -91,6 +91,7 @@ private:
|
||||||
QThread* converterThread = Q_NULLPTR;
|
QThread* converterThread = Q_NULLPTR;
|
||||||
bool isUnderrun = false;
|
bool isUnderrun = false;
|
||||||
bool isOverrun = false;
|
bool isOverrun = false;
|
||||||
|
int latencyAllowance = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PAHANDLER_H
|
#endif // PAHANDLER_H
|
||||||
|
|
Ładowanie…
Reference in New Issue