Ryan C. Gordon
ccd5fcef12
audio: Fix potential NULL dereference in AudioStream gain adjustment.
...
You can end up with a NULL scratch buffer, which is otherwise not needed on
this path, then ConvertAudio will end up needing that scratch space to move
to float32 to apply gain.
Fixes #12091 .
(I assume.)
2025-01-28 13:14:25 -05:00
Ryan C. Gordon
8f958953f1
audio: Fix audio stream gain going wrong in certain scenarios.
...
Fixes #12091 .
2025-01-27 20:20:17 -05:00
Ryan C. Gordon
3b3af7105b
audio: Fix a minor code style thing.
2025-01-27 20:20:17 -05:00
Ryan C. Gordon
09f900f66e
audio: Remove resampling limits.
...
Audio streams used to accept audio with a src or dest frequency between
4000Hz and 384000Hz. It was arbitrary (or perhaps a relic of older
resampler revisions), and testing shows unnecessary, so remove it.
Fixes #12098 .
2025-01-27 01:13:54 -05:00
hspir404
72a3eae0da
Fix buffer overrun in ConvertAudio with different src/dst channel count
...
- Source or destination format also has to not be F32 to trigger bug
2025-01-23 13:52:31 -05:00
Petar Popovic
983cfe8b1c
Remove even more newlines from log messages
2025-01-23 09:32:50 -08:00
nightmareci
718034f5fa
Remove newlines from log messages
2025-01-22 20:25:04 -08:00
Ryan C. Gordon
071bebf235
coreaudio: Add a note about why this uses 3 buffers instead of 2.
2025-01-20 23:29:53 -05:00
Ryan C. Gordon
b6d0bc0431
coreaudio: Use three buffers for the audioqueue, not two.
...
This doesn't affect latency much, but it makes the system usable if the system
drops you down from the bluetooth a2dp profile (headphones) to the handsfree
(I think...?) profile because the bluetooth audio device is also recording,
which would be extremely common in a VoIP app, but also if you're talking
in a different app while also playing audio.
Fixes #8192 .
2025-01-20 18:35:04 -05:00
Ryan C. Gordon
aa10e51c74
audio: Added some minor missing comments in struct SDL_AudioDevice.
2025-01-20 18:35:04 -05:00
Sam Lantinga
4dd585fb62
coreaudio: convert MPEG channel layout to WAVE channel layout
2025-01-14 22:26:16 -08:00
Ryan C. Gordon
9e60a8994f
audio: Allow streams to change the device-side channels maps.
...
Fixes #11881 .
2025-01-14 16:42:53 -05:00
Sam Lantinga
5ca735b40f
Only use WAVE surround sound channel layouts on macOS 10.15+
2025-01-14 12:03:07 -08:00
Sam Lantinga
cdde6dd7bb
Bumped deployment requirements for Apple platforms
...
We require at least Xcode 12.2 and macOS SDK 11 to build. We support deploying to macOS 10.13, iOS 11.0, and tvOS 11.0.
This cleans up the code significantly
2025-01-14 12:03:07 -08:00
Ryan C. Gordon
3766a39409
emscripten: double the audio buffer size.
...
Some systems seem to not keep up with the smaller buffer.
Reference Issue #11930 .
2025-01-13 16:26:18 -05:00
Ryan C. Gordon
3f7f632e14
audio: Added SDL_AudioDeviceStreamPaused.
...
We had the other two wrapper functions to pause and resume, and forgot query.
2025-01-09 01:36:57 -05:00
Ryan C. Gordon
d16f76e3d4
wasapi: Don't crash/hang if transitioning to/from a Remote Desktop Connection.
...
Fixes #9673 .
2025-01-05 21:53:35 -05:00
Sam Lantinga
f2074d7af3
Updated copyright for 2025
2025-01-01 07:45:52 -08:00
Petar Popovic
5f25691c85
Fix C23 empty initializer warning.
2024-12-29 18:17:24 -08:00
Carl Åstholm
49153ebfc4
audio: Add NULL check to SDL_UnbindAudioStreams
2024-12-28 00:10:58 -05:00
Carl Åstholm
1b99467c71
audio: Make SDL_Bind/UnbindAudioStreams take const arrays
2024-12-28 00:10:58 -05:00
Sam Lantinga
b2178857dc
Corrected CoreAudio surround sound channel layouts
...
Fixes https://github.com/libsdl-org/SDL/issues/11709
2024-12-24 15:03:25 -08:00
L zard
af2dbbcb53
Merge SDL_wasapi_win32 into SDL_wasapi
2024-12-23 16:54:52 -08:00
Ryan C. Gordon
0bb42cb023
alsa: a few more minor formatting tweaks.
2024-12-16 12:19:48 -05:00
Ryan C. Gordon
483ceb5355
alsa: Reenable SDL's internal channel map support when ALSA can't swizzle.
2024-12-16 12:19:48 -05:00
Ryan C. Gordon
35360ec4d7
alsa: Use more hints for opening default devices.
2024-12-16 12:19:48 -05:00
Ryan C. Gordon
576f13ac7c
alsa: Put debug logging back into correct category and logging level.
2024-12-16 12:19:48 -05:00
Ryan C. Gordon
ff96c59df4
alsa: Add back in code to guess the correct ALSA device prefix.
2024-12-16 12:19:48 -05:00
Ryan C. Gordon
b108b54c6a
alsa: Bring up to current SDL coding conventions and standards, other tweaks.
2024-12-16 12:19:48 -05:00
Ryan C. Gordon
639855b7e5
alsa: Remove direct calls to memset
2024-12-16 12:19:48 -05:00
Ryan C. Gordon
a4a1dff219
alsa: remove loop macro
2024-12-16 12:19:48 -05:00
Ryan C. Gordon
b9c062c858
alsa: Pulled in latest changes from @sylware
2024-12-16 12:19:48 -05:00
Sam Lantinga
76e7bc4c04
Added support for ALSA dmix audio output (thanks @sylware!)
...
Fixes https://github.com/libsdl-org/SDL/issues/8577
2024-12-16 12:19:48 -05:00
Ryan C. Gordon
ac2edad809
audio: Simplify and unify audio stream format updating when devices change.
...
This used to do different things for recording streams in different parts of
the codebase, not to mention two separate codepaths through
UpdateAudioStreamFormatsPhysical in any case. My hope is this should kill off
a few corner case bugs...for example, this one:
Fixes #8402 .
2024-12-13 14:59:16 -05:00
Ryan C. Gordon
80b9986418
audio: Fixed potential NULL dereference.
...
This could happen if you call SDL_BindAudioStreams() when the subsystem isn't
initialized, and possibly in other corner cases.
Thanks to Qianxin CodeSafe Team, @QiAnXinCodeSafe, for discovering this issue!
Fixes #11643 .
2024-12-13 10:12:33 -05:00
Sam Lantinga
61511c48a4
SDL_HashTable is now optionally thread-safe
...
Fixes https://github.com/libsdl-org/SDL/issues/11635
2024-12-12 14:39:53 -08:00
Ryan C. Gordon
e0cee83a3a
emscriptenaudio: Removed comment about Firefox not supporting userActivation.
...
It does now, and has since Firefox 120 (around November 2023).
2024-12-12 10:48:23 -05:00
Ryan C. Gordon
9784e10a75
audio: Let emscripten update device->sample_frames at device open time.
...
Fixes #11435 .
2024-12-04 19:16:28 -05:00
Ryan C. Gordon
65c9a58f5e
audio: Make sure a few bitflag checks convert to bools correctly.
...
This might just be defensive coding, but better safe than sorry on this.
2024-12-03 11:04:52 -05:00
Ryan C. Gordon
ce573b01f8
audio: Added SDL_IsAudioDevicePhysical and SDL_IsAudioDevicePlayback.
...
Fixes #11529 .
2024-11-29 17:31:37 -05:00
Ryan C. Gordon
f5ad66ef4b
audio: Allow channel maps to specify -1 to mute a channel.
...
Fixes #11373 .
2024-11-28 00:00:30 -05:00
Sam Lantinga
c508396e33
Avoid usage of CreateEventEx in WASAPI code
...
This also uses FALSE as parameters consistently for CreateEvent()
2024-11-24 17:49:17 -08:00
Sam Lantinga
932bb968d7
Fixed infinite recursion when the microphone is unavailable
2024-11-20 16:07:43 -08:00
Ryan C. Gordon
32cc92dceb
pipewire: i/o callbacks should avoid higher-level iteration during device open.
...
Sometimes these callbacks will fire while we're still waiting on state to
settle down in PIPEWIRE_OpenDevice, which means we're holding the device lock,
but then the i/o callback will fire from a background thread and also try to
grab the device lock, but can't, because PIPEWIRE_OpenDevice is holding it and
waiting for this i/o callback to finish...hence, a deadlock.
So now, if the device is still opening, output callbacks will write silence
and input callbacks will just flush the buffer, without calling the main
iterate function, and thus avoid obtaining the lock.
2024-11-12 15:18:41 -05:00
Sam Lantinga
54ff1f35bd
Fixed audio dropouts when plenty of audio is queued on Android
2024-11-07 19:29:51 -08:00
Sam Lantinga
37b49c98dc
Fixed setting up surround sound on NVIDIA Shield TV
2024-11-07 19:05:29 -08:00
Sam Lantinga
97dac37373
Added SDL_HINT_ANDROID_LOW_LATENCY_AUDIO
2024-11-07 16:34:34 -08:00
Sam Lantinga
6836ef8fd2
Added logging for low latency audio state
2024-11-07 16:31:35 -08:00
Ryan C. Gordon
8d3bec99a7
audio: Make SDL_GetAudioStreamProperties() thread safe.
2024-10-24 14:37:23 -04:00
Ryan C. Gordon
b6a6a4a7f8
audio: fix incorrect dynCall in Emscripten audio.
...
This only seemed to cause problems with `-s ASYNCIFY` on the build command
line, but it was incorrect in general.
Fixes #11258 .
2024-10-18 23:53:40 -04:00