Skip to content

SDL3: Switch audio system to use callbacks - #19432

Open
RobLoach wants to merge 7 commits into
libretro:masterfrom
RobLoach:fix/sdl3-audio-callback-wait
Open

SDL3: Switch audio system to use callbacks#19432
RobLoach wants to merge 7 commits into
libretro:masterfrom
RobLoach:fix/sdl3-audio-callback-wait

Conversation

@RobLoach

Copy link
Copy Markdown
Member

This switches the SDL3 Audio System to use event callbacks rather than constant polling. There are a few benefits out of this over what was there before...

  1. Wait: Before when the buffer was full, it waited in a loop, sleeping 1 millisecond each iteration. Now instead of a 1ms loop, it registers a wait condition, meaning it'll fill the buffer precisely when it's available. Also makes sure it's on the right thread.
  2. Device Removal: Before if a device was lost, like a USB mic was removed, it would keep writing the audio device. Now there's a device removed event that will attempt to re-open the device, or eventually give up if it can't re-find it.

Test

  1. Switch your audio device to sdl3, for both audio and mic
  2. Load a core that plays some sounds, like audio_microphone
  3. Expect to be able to record and hear sounds

Comment thread audio/drivers/sdl3_audio.c Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant