From f2ddf971df5cbbd112e0d677b0ea5bd6368051dc Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 30 Mar 2020 15:37:41 -0700 Subject: Return the enumerated device names from the backend Rather than using an out parameter. --- alc/backends/sdl2.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'alc/backends/sdl2.cpp') diff --git a/alc/backends/sdl2.cpp b/alc/backends/sdl2.cpp index af3081f1..e894e6a6 100644 --- a/alc/backends/sdl2.cpp +++ b/alc/backends/sdl2.cpp @@ -193,22 +193,25 @@ bool SDL2BackendFactory::init() bool SDL2BackendFactory::querySupport(BackendType type) { return type == BackendType::Playback; } -void SDL2BackendFactory::probe(DevProbe type, std::string *outnames) +std::string SDL2BackendFactory::probe(DevProbe type) { + std::string outnames; + if(type != DevProbe::Playback) - return; + return outnames; int num_devices{SDL_GetNumAudioDevices(SDL_FALSE)}; /* Includes null char. */ - outnames->append(defaultDeviceName, sizeof(defaultDeviceName)); + outnames.append(defaultDeviceName, sizeof(defaultDeviceName)); for(int i{0};i < num_devices;++i) { std::string name{DEVNAME_PREFIX}; name += SDL_GetAudioDeviceName(i, SDL_FALSE); if(!name.empty()) - outnames->append(name.c_str(), name.length()+1); + outnames.append(name.c_str(), name.length()+1); } + return outnames; } BackendPtr SDL2BackendFactory::createBackend(ALCdevice *device, BackendType type) -- cgit v1.2.3