aboutsummaryrefslogtreecommitdiffstats
path: root/alc/backends/sdl2.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-03-30 15:37:41 -0700
committerChris Robinson <[email protected]>2020-03-30 15:37:41 -0700
commitf2ddf971df5cbbd112e0d677b0ea5bd6368051dc (patch)
tree8142af1d3cde52f61c30d88951aeff00cb3f2b39 /alc/backends/sdl2.cpp
parent167bdce48d1656569cf63448fc2328800288c38f (diff)
Return the enumerated device names from the backend
Rather than using an out parameter.
Diffstat (limited to 'alc/backends/sdl2.cpp')
-rw-r--r--alc/backends/sdl2.cpp11
1 files changed, 7 insertions, 4 deletions
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)