13434 Commits

Author SHA1 Message Date
Ryan C. Gordon
b656720bc6 loopwave: Use SDL_GetAudioStreamQueued() for more accurate results. 2023-09-20 10:15:03 -04:00
Ryan C. Gordon
34b931f7eb audio: Added SDL_GetAudioStreamQueued 2023-09-20 10:15:03 -04:00
Ryan C. Gordon
23206b9e3f audio: Added SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED
This fires if an opened device changes formats (which it can on Windows,
if the user changes this in the system control panel, and WASAPI can
report), or if a default device migrates to new hardware and the format
doesn't match.

This will fire for all logical devices on a physical device (and if it's
a format change and not a default device change, it'll fire for the
physical device too, but that's honestly not that useful and might change).

Fixes #8267.
2023-09-20 10:12:10 -04:00
Ryan C. Gordon
c7e6d7a1f7
audio: Changed debug logging output.
("preconverted bytes" makes it sounds like we already converted them before
the call instead of "bytes that haven't yet hit the stage where we convert
them. Just dump the wording completely.)
2023-09-20 10:04:23 -04:00
Ryan C. Gordon
87ec6acf2d
audio: Added a FIXME 2023-09-20 10:04:19 -04:00
Ryan C. Gordon
ac88ffb7ea
audio: don't allocate buffer in SDL_SetAudioPostmixCallback for NULL callback. 2023-09-20 10:03:02 -04:00
Ryan C. Gordon
2a950f6ae6
audio: Replace some SDL_memcpy calls with SDL_copyp. 2023-09-20 10:01:52 -04:00
Ryan C. Gordon
0dc0434a3e
audio: Fixed race condition in subsystem shutdown.
This makes sure new devices can't be created when we're in the process of
shutting down.
2023-09-20 10:00:44 -04:00
Ryan C. Gordon
23f60203a3
audio: precalculate if we can use simple copies instead of the full mixer.
This just saves a bunch of conditionals (and an atomic get!) per iteration
of the audio thread.
2023-09-20 09:58:27 -04:00
Ryan C. Gordon
36b0f11414
audio: Optimize setting device formats during audio thread iteration.
The API entry point does a ton of unnecessary validation just to eventually
do a memcpy().
2023-09-20 09:09:15 -04:00
Anonymous Maarten
4c3e84897f testspriteminimal: make standalone by embedding icon.bmp 2023-09-19 17:58:25 +02:00
Anonymous Maarten
2a01f9dcb5 tests: plug leaks when running with --trackmem
(using SDL_VIDEO_DRIVER=x11/wayland on Linux)
2023-09-19 17:58:25 +02:00
Anonymous Maarten
f42bbeca24 SDL_test: track stack frames of allocations on Windows 2023-09-19 17:58:25 +02:00
Anonymous Maarten
12c0be028e SDL_test: clear text cache on exit event 2023-09-19 17:58:25 +02:00
Anonymous Maarten
b4bfb18318 SDL_test: free state before logging allocations 2023-09-19 17:58:25 +02:00
Anonymous Maarten
248b1edd3f SDL_test: destroy windows in SDL_CommonQuit
Not destroying the windows, caused a leak in checkkeys when
exiting by clicking somewhere in the window:
Allocation 0: 8 bytes
	0x7f46f56d2fe8: SDL_realloc_REAL+0x3d
	0x7f46f565deb7: GetMouseInputSource+0x88
	0x7f46f565e07b: SDL_PrivateSendMouseButton+0x56
	0x7f46f565e5aa: SDL_SendMouseButton+0x44
	0x7f46f57fb0a4: pointer_handle_button_common+0x1bb
	0x7f46f57fb0f3: pointer_handle_button+0x41
	0x7f46f5123be6: ffi_prep_go_closure+0x2c6
	0x7f46f51204bf: SDL_InitSubSystem+0x19
	0x7f46f512318e: ffi_call+0x12e
2023-09-19 17:58:25 +02:00
Anonymous Maarten
98da2dd303 SDL_test: don't warn about expected allocations when running with --trackmem
Since 9f4baeea53b39ef20869a7ccd7d0b8fddba52726, the TLS storage is cleaned up when running SDL_Quit().
2023-09-19 17:58:25 +02:00
Sam Lantinga
6a381567b0 Support audio rate conversion up to 384KHz 2023-09-18 22:21:54 -07:00
Sam Lantinga
b2b548a1fc Don't hang if IAudioRenderClient_GetBuffer() fails indefinitely 2023-09-18 20:55:28 -07:00
Sam Lantinga
a3a5e17282 Fixed build warning '=': conversion from 'Uint32' to 'Uint16', possible loss of data 2023-09-18 13:56:51 -07:00
Sam Lantinga
6d3e21c27c Fixed android build warnings 2023-09-18 13:22:15 -07:00
Sam Lantinga
fca2f53189 Fixed warning: this function declaration is not a prototype 2023-09-18 13:09:28 -07:00
Sam Lantinga
a72dfa6a5f Fixed sensor timestamp units for third-party PS5 controllers 2023-09-18 12:55:43 -07:00
Sam Lantinga
f6756047a4 Fixed error: array subscript 2 is above array bounds of ‘const Uint8[2]’
Smart compilers don't like dereferencing off the end of arrays
2023-09-18 12:19:18 -07:00
Sam Lantinga
7059a55ccc Fixed sensor timestamp calculation for third-party PS5 controllers 2023-09-18 11:50:56 -07:00
Sam Lantinga
c0443e5d12 Fixed crash in SDL_IMMDevice_FindByDevID()
Either devid or handle->immdevice_id was NULL, crashing SDL_wcscmp()
2023-09-18 09:47:57 -07:00
Sam Lantinga
fde8499f69 Use around 20ms for the audio buffer size
This value is well tested in production software. Larger values introduce audio latency and smaller values cause underflows on many setups.
2023-09-18 09:25:56 -07:00
Frank Praznik
e5739d7d1f video: Remove SDL_GetFocusWindow()
It was rarely used and performed an identical function to SDL_GetKeyboardFocus(), but with worse time complexity.
2023-09-18 11:14:42 -04:00
Mathieu Eyraud
39c2f97373 Fix NULL dereference in SDL_OpenAudio 2023-09-18 09:44:59 -04:00
Sam Lantinga
9a23d0e3f6 Added new audio files to the Xcode project 2023-09-17 13:16:19 -07:00
Brick
a62e62f97a Refactored SDL_audiocvt.c 2023-09-17 13:13:23 -07:00
Ryan C. Gordon
31229fd47f
include: Added a note about SDL's iOS app delegate functions.
Fixes #8250.
2023-09-15 09:50:24 -04:00
Guldoman
65aaf3a9ab x11: Always update clipboard owner
This allows utilities like clipboard managers to keep track of the 
changes.
2023-09-15 05:21:14 -07:00
Sam Lantinga
f622f21e6f Fixed build 2023-09-15 05:17:33 -07:00
Sam Lantinga
5774c9638c Prefer hidraw over libusb when libusb whitelisting is not enabled
Since opening devices via libusb will unbind them from other drivers, we will either whitelist specific devices that we want to support via libusb or we will prefer other drivers over libusb.
2023-09-15 05:14:26 -07:00
Sam Lantinga
9301f7ace2 hidapi/libusb: only enumerate each interface once
If a device has multiple altsettings, like an Xbox Series X controller, make sure we only enumerate each interface once, not once for each altsetting.
2023-09-15 05:07:05 -07:00
Sam Lantinga
859dc14add Replaced SDL_GetGamepadBindForAxis() and SDL_GetGamepadBindForButton() with SDL_GetGamepadBindings() 2023-09-13 23:01:28 -07:00
Sam Lantinga
9e50048ab6 Revert "Removed SDL_GamepadBinding from the API"
This reverts commit eb0955ef89a1917b93da86d9b4b6fdf67cd61a8c.
2023-09-13 22:42:47 -07:00
Sam Lantinga
9f17d1a9d8 Don't reference the same function in "see also" 2023-09-13 11:01:00 -07:00
Ozkan Sezer
86505ea630 fix SDL_AudioStreamCallback documentation 2023-09-13 18:35:30 +03:00
SDL Wiki Bot
d885d5c310 Sync SDL3 wiki -> header 2023-09-13 15:04:13 +00:00
Ryan C. Gordon
2f43f7bc53
audio: Allow querying of device buffer size. 2023-09-13 11:03:17 -04:00
Ryan C. Gordon
cf95721130
audio: Added a hint to let apps force device buffer size.
This is a hint because apps might (probably mistakenly) believe they need this
to migrate from SDL2, but most things don't need to specify this.
2023-09-13 10:42:08 -04:00
Ryan C. Gordon
47d8c77c67
audio: Choose better default sample frame counts.
This might still need tweaking, but this is probably better than it was.
2023-09-13 10:27:11 -04:00
Ryan C. Gordon
8b26e95f91
audio: Change SDL_AudioStreamCallback
Now it offers the total requested bytes in addition to the amount
immediately needed (and immediately needed might be zero if the stream
already has enough queued to satisfy the request.
2023-09-13 10:11:23 -04:00
Ryan C. Gordon
9da34e8fb5
docs: Updated README-emscripten.md.
This is updated from the rewrite in the SDL2 branch.
2023-09-12 21:27:40 -04:00
Max Bachmann
fd1c54a004 detect fanatec steering wheels 2023-09-12 15:35:35 -07:00
Ryan C. Gordon
cb44146089
docs: Whoops, this got added by the wiki bridge by accident! 2023-09-12 17:36:02 -04:00
Sam Lantinga
cd633b9a88 Renamed SDL_IsAudioDevicePaused() to SDL_AudioDevicePaused()
This aligns with the SDL3 convention of removing "Is" from self-explanatory function names

Also improved some documentation in SDL_audio.h
2023-09-12 12:11:09 -07:00
SDL Wiki Bot
c6cad07faa Sync SDL3 wiki -> header 2023-09-12 18:28:12 +00:00