diff options
author | Chris Robinson <chris.kcat@gmail.com> | 2020-03-30 15:37:41 -0700 |
---|---|---|
committer | Chris Robinson <chris.kcat@gmail.com> | 2020-03-30 15:37:41 -0700 |
commit | f2ddf971df5cbbd112e0d677b0ea5bd6368051dc (patch) | |
tree | 8142af1d3cde52f61c30d88951aeff00cb3f2b39 /alc/alc.cpp | |
parent | 167bdce48d1656569cf63448fc2328800288c38f (diff) |
Return the enumerated device names from the backend
Rather than using an out parameter.
Diffstat (limited to 'alc/alc.cpp')
-rw-r--r-- | alc/alc.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index 691b9274..0851305a 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -1217,18 +1217,28 @@ void ProbeAllDevicesList() DO_INITCONFIG(); std::lock_guard<std::recursive_mutex> _{ListLock}; - alcAllDevicesList.clear(); - if(PlaybackFactory) - PlaybackFactory->probe(DevProbe::Playback, &alcAllDevicesList); + if(!PlaybackFactory) + decltype(alcAllDevicesList){}.swap(alcAllDevicesList); + else + { + std::string names{PlaybackFactory->probe(DevProbe::Playback)}; + if(names.empty()) names += '\0'; + names.swap(alcAllDevicesList); + } } void ProbeCaptureDeviceList() { DO_INITCONFIG(); std::lock_guard<std::recursive_mutex> _{ListLock}; - alcCaptureDeviceList.clear(); - if(CaptureFactory) - CaptureFactory->probe(DevProbe::Capture, &alcCaptureDeviceList); + if(!CaptureFactory) + decltype(alcCaptureDeviceList){}.swap(alcCaptureDeviceList); + else + { + std::string names{CaptureFactory->probe(DevProbe::Capture)}; + if(names.empty()) names += '\0'; + names.swap(alcCaptureDeviceList); + } } } // namespace |