Update RtAudio backend to overwrite default samplerate to 48 kHz, if available
This commit is contained in:
parent
fbb14f475c
commit
0c0a86dc64
@ -62,12 +62,27 @@ void fillRtAudioDeviceInfo(vector<DeviceInfo> &devinfolist) {
|
||||
d.device_name = devinfo.name;
|
||||
d.api_specific_devindex = devno;
|
||||
|
||||
/// We overwrite the default sample rate with the 48 kHz value, which
|
||||
/// is our preffered rate.
|
||||
bool rate_48k_found = false;
|
||||
|
||||
for (us j = 0; j < devinfo.sampleRates.size(); j++) {
|
||||
us rate = devinfo.sampleRates[j];
|
||||
d.availableSampleRates.push_back((double)rate);
|
||||
if (devinfo.preferredSampleRate == rate) {
|
||||
|
||||
us rate_int = devinfo.sampleRates[j];
|
||||
|
||||
d.availableSampleRates.push_back((double)rate_int);
|
||||
|
||||
if(!rate_48k_found) {
|
||||
|
||||
if (devinfo.preferredSampleRate == rate_int) {
|
||||
d.prefSampleRateIndex = j;
|
||||
}
|
||||
|
||||
if(rate_int == 48000) {
|
||||
d.prefSampleRateIndex = j;
|
||||
rate_48k_found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
d.noutchannels = devinfo.outputChannels;
|
||||
@ -103,7 +118,7 @@ void fillRtAudioDeviceInfo(vector<DeviceInfo> &devinfolist) {
|
||||
d.prefDataTypeIndex = d.availableDataTypes.size() - 1;
|
||||
|
||||
d.availableFramesPerBlock = {512, 1024, 2048, 4096, 8192};
|
||||
d.prefFramesPerBlockIndex = 1;
|
||||
d.prefFramesPerBlockIndex = 2;
|
||||
|
||||
devinfolist.push_back(d);
|
||||
}
|
||||
@ -129,7 +144,7 @@ class RtAudioDaq : public Daq {
|
||||
|
||||
std::atomic<StreamStatus> _streamStatus{};
|
||||
|
||||
public:
|
||||
public:
|
||||
RtAudioDaq(const DeviceInfo &devinfo, const DaqConfiguration &config)
|
||||
: Daq(devinfo, config),
|
||||
rtaudio(static_cast<RtAudio::Api>(devinfo.api.api_specific_subcode)),
|
||||
|
Loading…
Reference in New Issue
Block a user