From 5b0a3620bd8c077ec3c6e90ce0bc13f4ee05442b Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Mon, 1 Nov 2021 11:17:25 +0000 Subject: [PATCH] Use buffered audio for Linux (was just Mac only) --- audiohandler.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/audiohandler.cpp b/audiohandler.cpp index 72e0d2d..d045a6e 100644 --- a/audiohandler.cpp +++ b/audiohandler.cpp @@ -124,14 +124,9 @@ bool audioHandler::init(audioSetup setupIn) if (info.probed) { - // if "preferred" sample rate is 44100, try 48K instead - if (info.preferredSampleRate == (unsigned int)44100) { - qDebug(logAudio()) << "Preferred sample rate 44100, trying 48000"; - this->nativeSampleRate = 48000; - } - else { - this->nativeSampleRate = info.preferredSampleRate; - } + // Always use the "preferred" sample rate + // We can always resample if needed + this->nativeSampleRate = info.preferredSampleRate; // Per channel chunk size. this->chunkSize = (this->nativeSampleRate / 50); @@ -293,7 +288,7 @@ void audioHandler::start() } if (setup.isinput) { -#ifdef Q_OS_MACX +#ifndef Q_OS_WIN this->open(QIODevice::WriteOnly); #else this->open(QIODevice::WriteOnly | QIODevice::Unbuffered); @@ -301,7 +296,7 @@ void audioHandler::start() audioInput->start(this); } else { -#ifdef Q_OS_MACX +#ifndef Q_OS_WIN this->open(QIODevice::ReadOnly); #else this->open(QIODevice::ReadOnly | QIODevice::Unbuffered);