Ryan C. Gordon
e7ab581d79
coreaudio: Dispose of AudioQueue before waiting on the thread.
...
Otherwise the thread might block for a long time (more than 10 seconds!).
It's not clear to me why this happens, or why its safe to do this with a
resource that's still in use, but we have, until recently, always
disposed of the AudioQueue first, so changing back is probably okay.
Also changed the disposal to allow in-flight buffers to reach hardware;
otherwise you lose the last little bit of audio that's already been queued
but not played, which you can hear clearly in the loopwave test program.
Fixes #6377 .
2022-10-19 09:14:16 -04:00
Brad Smith
f4e3af15a1
Simplify OSS test by removing OpenBSD specific location of the soundcard.h header
...
OpenBSD has long since stopped using OSS. Remove checking for OpenBSD specific header.
2022-10-17 07:18:47 -07:00
Daniel Bomar
22461383c6
SDL_audiocvt: Respct the SDL_HINT_AUDIO_RESAMPLING_MODE hint
...
This implements using libsamplerate for the SDL_AudioCVT API.
This library was already being used for audio streams when this hint is
set.
2022-10-15 14:31:00 -07:00
Pierre Wendling
655275378d
N3DS port (squashed)
...
A dedicated renderer using Citro3D would likely allow for better
much better graphical performances.
2022-10-10 08:50:59 -07:00
Nicolas Cian
484d5fd6cf
audio open: ensure 2 devices don't get the same id
2022-10-07 06:45:01 -07:00
daniel
e41942e814
fix compilation error SDL_coreaudio mixing declarations and code
2022-10-04 21:04:45 -07:00
Ryan C. Gordon
e6640ef2d4
coreaudio: Possibly fixed another shutdown race condition.
...
Reference Issue #6159 .
2022-09-30 14:53:49 -04:00
Jarod Hillman
40893821f2
coreaudio: Add support for SDL_GetDefaultAudioInfo ( #6277 )
...
Co-authored-by: Ethan Lee <flibitijibibo@gmail.com>
Co-authored-by: Ozkan Sezer <sezeroz@gmail.com>
2022-09-29 10:33:07 -04:00
Ryan C. Gordon
f6565c329b
coreaudio: Remove redundant variable.
2022-09-28 09:27:45 -04:00
Ryan C. Gordon
411582c710
coreaudio: Don't crash on shutdown in a race condition.
...
Fixed #6159 .
2022-09-28 09:22:17 -04:00
Francisco Javier Trujillo Mata
b9e3cae572
Add more valid configurations to PS2 audio driver
2022-08-27 18:34:33 -07:00
Francisco Javier Trujillo Mata
5b4b4fa1ff
Decrease audio thread priority when created
2022-08-14 08:13:17 -04:00
Mathieu Eyraud
f1390780ca
Fix use after free when removing Windows audio device
2022-08-02 10:24:11 -04:00
Ryan C. Gordon
8ff738f234
audio: Report SDL_AUDIODEVICEREMOVED for unopened devices.
...
Unopened devices, if removed, now send SDL_AUDIODEVICEREMOVED events with
a `which` field set to zero. Apps can use this to decide if they need to
refresh a list of devices being shown in an options menu, etc.
It's safe to call SDL_CloseAudioDevice(0), so even if they try to clean
up this bogus id, it should be safe.
Fixes #5199 .
2022-07-26 12:40:47 -04:00
Ozkan Sezer
8c51cae784
audio/aaudio, audio/openslES: fix -Wdeclaration-after-statement errors
...
Fixes https://github.com/libsdl-org/SDL/issues/5950
2022-07-23 14:56:04 +03:00
Ethan Lee
f3008e4aab
audio: 3- and 5-channel formats are now supported
2022-07-20 19:08:31 -04:00
Ryan C. Gordon
45c3b59d4b
audio: Turn off DEBUG_CONFIG logging again.
2022-07-20 18:41:53 -04:00
Ryan C. Gordon
bec721f08a
audio: Fixed dst pointer on channel conversions that grow in-place.
2022-07-20 18:41:53 -04:00
Ryan C. Gordon
9f56c7cf02
audio: Remove 5.1->X SIMD converters, add SSE mono->stereo.
...
The 5.1 versions didn't use the new algorithm, and making that new
algorithm work took so many permutes that it was significantly slower
than just using the scalar versions.
However, mono-to-stereo is an extremely common conversion, and it's
trivial to accelerate it with plain SSE, so that was added!
2022-07-20 18:41:53 -04:00
Ryan C. Gordon
b83ae9f24c
audio: Replaced some debug-printfs with debug-SDL_Logs. :)
2022-07-20 18:41:53 -04:00
Ryan C. Gordon
49ec8db5f8
audio: Generate the channel converter code from a program.
2022-07-20 18:41:53 -04:00
Ryan C. Gordon
f06cc3e945
audio: "SL" means "surround left" not "side left", etc.
2022-07-20 18:41:53 -04:00
Ryan C. Gordon
5a0c819863
audio: Add channel convert filter _after_ choosing an SIMD version.
2022-07-20 18:41:53 -04:00
Ryan C. Gordon
fe16084075
audio: LOG_DEBUG_CONVERT should use SDL_Log, not fprintf(stderr).
2022-07-20 18:41:53 -04:00
Ryan C. Gordon
257277903e
audio: first attempt at rewriting the channel converters.
...
This is not ready for production use!
2022-07-20 18:41:53 -04:00
Ozkan Sezer
b700a32630
audio, pipewire: fix signatures of pw_get_library_version and pw_init.
...
Reference issue: https://github.com/libsdl-org/SDL/issues/5938
2022-07-20 07:01:10 +03:00
Ozkan Sezer
6e210d3797
audio, pipewire: pipewire_version_xx globals out of dynamic loading
...
Fixes build with --disable-pipewire-shared
Reference issue: https://github.com/libsdl-org/SDL/issues/5938
2022-07-20 07:01:10 +03:00
Sam Lantinga
b299cb3d3c
Added a utility function to calculate the next power of 2 for a value
2022-07-17 08:31:16 -07:00
Ethan Lee
90b86b132a
audio: Handle non-power-of-two spec.samples when unsupported
...
Fixes #3685
2022-07-17 10:36:15 -04:00
Ethan Lee
a09d62e4d8
directsound: Remove redundant SubFormat copy
2022-07-15 23:45:56 -04:00
Ethan Lee
c5e408ae98
directsound: For channel counts > 2, generate a dwChannelMask for CreateSoundBuffer
2022-07-15 13:59:46 -04:00
Ethan Lee
fff34f6304
windows: SDL_IMMDevice needed more deinit code from the Win32 path.
...
Fixes #5919
2022-07-15 09:49:29 -04:00
Frank Praznik
37aecda2c1
pipewire: Use PW_KEY_TARGET_OBJECT to specify stream connection nodes
...
Pipewire 0.3.44 introduced PW_KEY_TARGET_OBJECT, which is to be used to specify target connection nodes for streams. This parameter takes either a node path (PW_KEY_NODE_NAME) or serial number (PW_KEY_OBJECT_SERIAL) to specify a target node. The former is used in this case since the path is already being retrieved and stored for other purposes.
The target_id parameter in pw_stream_connect() is now deprecated and should always be PW_ID_ANY when PW_KEY_TARGET_OBJECT is used.
2022-07-14 12:23:50 -04:00
Frank Praznik
36d8460c9e
pipewire: Dynamically allocate the buffer for node strings
...
Calculate and allocate the buffer for the IO node name and path strings dynamically instead of using arbitrary sized static buffers.
2022-07-11 18:03:56 -04:00
Frank Praznik
996cea31ee
pipewire: Update default audio devices during runtime
...
Make the default device metadata node persist for the lifetime of the hotplug loop so the default source/sink devices will be updated if they change during runtime.
2022-07-11 18:03:56 -04:00
Frank Praznik
60da11f0e2
pipewire: Remove deprecated configuration key
...
With Pipewire now requiring a minimum version 0.3.24, the PW_KEY_CONTEXT_PROFILE_MODULES value is no longer required for legacy compatability and can be safely removed.
2022-07-11 18:03:56 -04:00
Ethan Lee
ecfbdce64b
pipewire: Require version 0.3.24 or newer at runtime
2022-07-11 13:34:35 -04:00
Ethan Lee
2f0816adb7
Add SDL_GetDefaultAudioInfo.
...
This API is supported on pipewire, pulseaudio, wasapi, and directsound.
Co-authored-by: Frank Praznik <frank.praznik@gmail.com>
2022-07-11 13:34:35 -04:00
Ethan Lee
ae105ae1c7
windows: Move IMMDevice work to common file, implement DirectSound enumeration support
2022-07-11 12:54:34 -04:00
285424336
4aad594a8b
Update SDL_qsa_audio.c
...
Fix qnx platform compile error, change SDL_Bool to SDL_bool.
2022-07-08 12:15:00 +03:00
Pierre Wendling
6c536afdb7
Fix C89 declaration for macOS modules.
...
Since Clang 14, `-Wdeclaration-after-statement` is enforced on every
standard.
2022-06-27 15:19:40 -07:00
Francisco Javier Trujillo Mata
e4a8087551
Initial Audio driver
2022-06-27 15:18:48 -07:00
chalonverse
3b191580c3
Windows GDK Support ( #5830 )
...
* Added GDK
* Simplfied checks in SDL_config_wingdk.h
* Added testgdk sample
* Added GDK readme
* Fixed error in merge of SDL_windows.h
* Additional GDK fixes
* OpenWatcom should not export _SDL_GDKGetTaskQueue
* Formatting fixes
* Moved initialization code into SDL_GDKRunApp
2022-06-27 10:19:39 -07:00
Sam Lantinga
abe38bca3e
Support SDL_AUDIODRIVER set to "dsound", which was used by SDL 1.2
...
Fixes https://github.com/libsdl-org/SDL/issues/5818
2022-06-18 13:08:58 -07:00
Sam Lantinga
adc6875870
Added SDL_copyp to avoid size mismatch when copying values (thanks @1bsyl!)
...
Closes https://github.com/libsdl-org/SDL/pull/5811
2022-06-17 10:22:28 -07:00
Ryan C. Gordon
dc62fec5e9
audio: Fix locking in backends that manage their own callback threads.
...
Otherwise you might get a race where an app pauses the device, but
the audio callback still manages to run after the pause is in place.
2022-05-20 21:08:29 -04:00
Pierre Wendling
501a499180
Add clang-format on/off comments where necessary.
...
Comments were added in places where INDENT-ON/OFF comments are. Places
like stdlib's asm don't need it as clang-format doesn't try to indent it.
2022-05-19 01:31:29 -07:00
Cameron Cawley
0cca71a846
Use SDLCALL for callbacks in public APIs
2022-05-18 15:01:27 -07:00
Ryan C. Gordon
29694869b1
audio: Revert one of the resampler optimizations.
...
This is the one that splits the "left wing" into two for loops to
bubble out the conditional that decides if it should read from the
left padding or the input buffer.
I still believe the optimization is good, but the basic logic of it
was incorrect, and needs to be reexamined and fixed before going
back into revision control.
2022-04-28 15:58:39 -04:00
Ryan C. Gordon
5066910bf5
audio: Make pregenerated resampler kaiser filter more precise.
2022-04-26 13:32:42 -04:00