mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-07-29 20:22:26 -04:00
Try to find the correct available audio sample rates in Qt5
This commit is contained in:
parent
7c738b161c
commit
4dade2a709
@ -60,7 +60,21 @@ QList<int> AudioDeviceInfo::supportedSampleRates() const
|
||||
#else
|
||||
QList<int> AudioDeviceInfo::supportedSampleRates() const
|
||||
{
|
||||
return m_deviceInfo.supportedSampleRates();
|
||||
QList<int> reportedSampleRates = m_deviceInfo.supportedSampleRates();
|
||||
reportedSampleRates.append({96000, 192000, 384000}); // Add some common rates that may not be in the list
|
||||
QList<int> sampleRates;
|
||||
|
||||
for (auto sampleRate : reportedSampleRates) // Retain the sample rates that are supported by the device
|
||||
{
|
||||
QAudioFormat format = m_deviceInfo.preferredFormat();
|
||||
format.setSampleRate(sampleRate);
|
||||
|
||||
if (m_deviceInfo.isFormatSupported(format)) {
|
||||
sampleRates.append(sampleRate);
|
||||
}
|
||||
}
|
||||
|
||||
return sampleRates;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user