Force 48K sample rate when 44100 is detected.

audioplugins
Phil Taylor 2021-06-02 12:08:48 +01:00
rodzic 66c0d18b75
commit f2a36d4cbb
2 zmienionych plików z 12 dodań i 4 usunięć

Wyświetl plik

@ -114,11 +114,18 @@ bool audioHandler::init(const quint8 bits, const quint8 radioChan, const quint16
}
int resample_error = 0;
if (info.preferredSampleRate == 44100) {
qDebug(logAudio()) << "Preferred sample rate 44100, trying 48000";
this->nativeSampleRate = 48000;
}
else {
this->nativeSampleRate = info.preferredSampleRate;
}
if (isInput) {
resampler = wf_resampler_init(devChannels, info.preferredSampleRate, samplerate, resampleQuality, &resample_error);
resampler = wf_resampler_init(devChannels, this->nativeSampleRate, samplerate, resampleQuality, &resample_error);
try {
audio.openStream(NULL, &aParams, RTAUDIO_SINT16, info.preferredSampleRate, &this->chunkSize, &staticWrite, this);
audio.openStream(NULL, &aParams, RTAUDIO_SINT16, this->nativeSampleRate, &this->chunkSize, &staticWrite, this);
audio.startStream();
}
catch (RtAudioError& e) {
@ -128,9 +135,9 @@ bool audioHandler::init(const quint8 bits, const quint8 radioChan, const quint16
}
else
{
resampler = wf_resampler_init(devChannels, samplerate, info.preferredSampleRate, resampleQuality, &resample_error);
resampler = wf_resampler_init(devChannels, samplerate, this->nativeSampleRate, resampleQuality, &resample_error);
try {
audio.openStream(&aParams, NULL, RTAUDIO_SINT16, info.preferredSampleRate, &this->chunkSize, &staticRead, this);
audio.openStream(&aParams, NULL, RTAUDIO_SINT16, this->nativeSampleRate, &this->chunkSize, &staticRead, this);
audio.startStream();
}
catch (RtAudioError& e) {

Wyświetl plik

@ -96,6 +96,7 @@ private:
quint32 lastSeq;
quint16 radioSampleRate;
quint16 nativeSampleRate=0;
quint8 radioSampleBits;
quint8 radioChannels;