Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 20 additions & 14 deletions Streaming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,22 +227,28 @@ int SoapyAudio::activateStream(
resetBuffer = true;
bufferedElems = 0;

try {
#ifndef _MSC_VER
opts.priority = sched_get_priority_max(SCHED_FIFO);
#endif
// opts.flags = RTAUDIO_MINIMIZE_LATENCY;
opts.flags = RTAUDIO_SCHEDULE_REALTIME;
#ifndef _MSC_VER
opts.priority = sched_get_priority_max(SCHED_FIFO);
#endif
// opts.flags = RTAUDIO_MINIMIZE_LATENCY;
opts.flags = RTAUDIO_SCHEDULE_REALTIME;

sampleRateChanged.store(false);
dac.openStream(NULL, &inputParameters, RTAUDIO_FLOAT32, sampleRate, &bufferLength, &_rx_callback, (void *) this, &opts);
dac.startStream();

streamActive = true;
} catch (RtAudioError& e) {
throw std::runtime_error("RtAudio init error '" + e.getMessage());
}
sampleRateChanged.store(false);

RtAudioErrorType error = dac.openStream(NULL, &inputParameters, RTAUDIO_FLOAT32, sampleRate, &bufferLength, &_rx_callback, (void *) this, &opts);

if (error) {
throw std::runtime_error("RtAudio init error" + dac.getErrorText());
}

dac.startStream();

if (error) {
throw std::runtime_error("RtAudio init error" + dac.getErrorText());
}

streamActive = true;

return 0;
}

Expand Down