SDL icon indicating copy to clipboard operation
SDL copied to clipboard

Android OpenSLES: use common DetectDevices function

Open 1bsyl opened this issue 3 years ago • 4 comments

Android OpenSLES: use common DetectDevices function

and so, this should also immediate for OpenSLES, @v3rm0n ?

1bsyl avatar Dec 18 '22 11:12 1bsyl

Not sure if it would break anything but currently it wouldn't do much because openSLES driver does not have AllowsArbitraryDeviceNames set to true.

v3rm0n avatar Dec 18 '22 11:12 v3rm0n

Just adding it

    impl->OnlyHasDefaultOutputDevice = SDL_FALSE;
    impl->OnlyHasDefaultCaptureDevice = SDL_FALSE;
    impl->AllowsArbitraryDeviceNames = SDL_TRUE;

1bsyl avatar Dec 18 '22 11:12 1bsyl

Looks better, but I haven't found a way to pass the device information to openSLES so it would actually try to use the chosen device...

Also a separate issue maybe: event handlers (adding/removing audio devices) can run before audio system is inited and since the driver is null they will error out.

v3rm0n avatar Dec 18 '22 15:12 v3rm0n

devname is sent to opensles.

for capture, it seems there is openslES_CreatePCMRecorder that should be modified to fill:

255     loc_dev.locatorType = SL_DATALOCATOR_IODEVICE;
256     loc_dev.deviceType = SL_IODEVICE_AUDIOINPUT;
257     loc_dev.deviceID = SL_DEFAULTDEVICEID_AUDIOINPUT;
258     loc_dev.device = NULL;

but for output, not so obvious to select the device

1bsyl avatar Dec 18 '22 16:12 1bsyl

This hasn't been updated in a while and we're cleaning house for SDL 3.0. Please feel free to reopen this if you'd like to clean it up and get it in!

slouken avatar Aug 06 '24 15:08 slouken