Tell rtaudio not to hog device

merge-requests/5/head
Phil Taylor 2021-06-02 12:48:35 +01:00
rodzic 69a34f1c00
commit 462551838d
2 zmienionych plików z 5 dodań i 2 usunięć

Wyświetl plik

@ -123,10 +123,12 @@ bool audioHandler::init(const quint8 bits, const quint8 radioChan, const quint16
int resample_error = 0;
options.flags = !RTAUDIO_HOG_DEVICE | RTAUDIO_MINIMIZE_LATENCY;
if (isInput) {
resampler = wf_resampler_init(devChannels, this->nativeSampleRate, samplerate, resampleQuality, &resample_error);
try {
audio.openStream(NULL, &aParams, RTAUDIO_SINT16, this->nativeSampleRate, &this->chunkSize, &staticWrite, this);
audio.openStream(NULL, &aParams, RTAUDIO_SINT16, this->nativeSampleRate, &this->chunkSize, &staticWrite, this, &options);
audio.startStream();
}
catch (RtAudioError& e) {
@ -138,7 +140,7 @@ bool audioHandler::init(const quint8 bits, const quint8 radioChan, const quint16
{
resampler = wf_resampler_init(devChannels, samplerate, this->nativeSampleRate, resampleQuality, &resample_error);
try {
audio.openStream(&aParams, NULL, RTAUDIO_SINT16, this->nativeSampleRate, &this->chunkSize, &staticRead, this);
audio.openStream(&aParams, NULL, RTAUDIO_SINT16, this->nativeSampleRate, &this->chunkSize, &staticRead, this, &options);
audio.startStream();
}
catch (RtAudioError& e) {

Wyświetl plik

@ -82,6 +82,7 @@ private:
RtAudio audio;
int audioDevice = 0;
RtAudio::StreamParameters aParams;
RtAudio::StreamOptions options;
RtAudio::DeviceInfo info;
SpeexResamplerState* resampler = Q_NULLPTR;