kc3-lang/SDL/src/audio

Branch :


Log

Author Commit Date CI Message
345c161f 2021-09-22 09:06:45 Fixed some accidental uses of external C runtime functions
ce11caa8 2021-09-21 16:41:29 alsa: Map 7.1 audio channels to match what Windows and macOS expect. This matches what we did a long time ago for 5.1 audio. Fixes #55. (FIFTY FIVE. Bug reported 15 years, 3 months, and 11 days ago! lol)
c45facf2 2021-09-21 11:13:46 alsa: clean up macro salsa a little.
bf97c5a2 2021-09-08 14:47:40 Make sure SDL file descriptors don't leak into child processes
a1ffeda0 2021-08-28 22:52:13 Add SDL_HINT_APP_NAME and DBUS inhibition hint See SDL bug #4703. This implements two new hints: - SDL_APP_NAME - SDL_SCREENSAVER_INHIBIT_ACTIVITY_NAME The former is the successor to SDL_HINT_AUDIO_DEVICE_APP_NAME, and acts as a generic "application name" used both by audio drivers and DBUS screensaver inhibition. If SDL_AUDIO_DEVICE_APP_NAME is set, it will still take priority over SDL_APP_NAME. The second allows the "activity name" used by org.freedesktop.ScreenSavver's Inhibit method, which are often shown in the UI as the reason the screensaver (and/or suspend/other power-managment features) are disabled.
7d90df0e 2021-08-29 15:24:23 Restore previous behavior of empty SDL_AUDIODRIVER trying all drivers. The recent change to make SDL_AUDIODRIVER support comma-separated lists broke the previous behavior where an SDL_AUDIODRIVER that was empty behaved the same as if it was not set at all. This old behavior was necessary to paper over differences in platforms where SDL_setenv may or may not actually delete the env var if an empty string is specified. This patch just adds a simple check to ensure SDL_AUDIODRIVER is not empty before using it, restoring the old interpretation of the empty var.
3261f7f6 2021-08-26 16:15:30 audio: Support "pulse" as an alias for "pulseaudio" Originally, SDL 1.2 used "pulse" as the name for its PulseAudio driver. While it now supports "pulseaudio" as well for compatibility with SDL 2.0 [1], there are still scripts and distro packages which set SDL_AUDIODRIVER=pulse [2]. While it's possible to remove this in most circumstances or replace it with "pulseaudio" or a comma-separated list, this may still conflict if the environment variable is set globally and old binary builds of SDL 1.2 (e.g. packaged with older games) are being used. To fix this on SDL 2.0, add a hardcoded check for "pulse" as an audio driver name, and replace it with "pulseaudio". This mimics what SDL 1.2 does (but in reverse). Note that setting driver_attempt{,_len} is safe here as they're reset correctly based on driver_attempt_end on the next loop. [1] https://github.com/libsdl-org/SDL-1.2/commit/d9514097846381cd30fe08df65dbdd48de92a058 [2] https://bugzilla.opensuse.org/show_bug.cgi?id=1189778
9504bb12 2021-08-23 00:47:25 pulseaudio: Fix some function signatures that expect const pointers. This might have changed at some point in the Pulse API, or this might have always been wrong, but we didn't notice because the dynamic loading code hides it by casting things to void *. The static path, where it assigns the function pointer directly, puts out a clear compiler warning, though.
70c23b25 2021-08-18 13:18:11 audio: pipewire: Reset hotplug atomic variables on deinit.
bfa15931 2021-08-18 12:04:38 audio: pipewire: Set PW_KEY_NODE_RATE to suggest a rate. This can be used by recent pipewire to avoid resampling.
07a2d71e 2021-03-30 11:56:38 emscripten: Feed silence to device when paused
1e921352 2021-08-13 07:58:48 Improve portability of SDL_Convert51ToStereo_AVX Don't rely on checking __clang_major__ since it is not comparable between different vendors. Don't use "#pragma clang attribute" since it is only available in relatively recent versions, there's no obvious way to check if it's supported, and just using __attribute__ directly (for gcc as well) results in simpler code anyway.
ed6eb07e 2021-08-12 01:40:50 SDL_wasapi.c: fixed build against older SDKs.
44a76710 2021-08-11 12:55:50 Don't disable clang avx instrinsics on win32 if __AVX__ is defined. C.f.: https://github.com/libsdl-org/SDL/issues/4533
ac32c522 2021-08-10 18:11:09 Try using the built-in WASAPI audio rate conversion Fixes https://github.com/libsdl-org/SDL/issues/4608
a0af7ce7 2021-08-10 15:05:49 OSS is no longer the preferred audio backend on modern UNIX systems Fixes https://github.com/libsdl-org/SDL/issues/4207
25f9ed87 2021-08-10 13:10:36 audio: Fix false positives in driver name comparison Without this change, driver names don't get matched correctly; for example "a" can get matched with "alsa" since it only checks whether the string matches up to the length of the requested driver name.
bec78357 2021-08-06 14:20:55 Better fix for compiling using clang on Windows This fixes https://github.com/libsdl-org/SDL/issues/4533
cae7bd9b 2021-08-06 12:01:24 Don't use AVX with clang if the compiler isn't building with AVX instructions Fixes https://github.com/libsdl-org/SDL/issues/4533
659e1f0a 2021-07-29 17:49:52 audiocvt: The to-5.1 converters now soften FL and FR channels more. This is experimental and might be tweaked further. Reference #4104. Also reference: https://github.com/Keriew/augustus/issues/194#issuecomment-847655049
8f38ba4d 2021-07-29 18:02:47 Fix casts that should be using uintptr_t This is needed to support CHERI, and thus Arm's experimental Morello prototype, where pointers are implemented using unforgeable capabilities that include bounds and permissions metadata to provide fine-grained spatial and referential memory safety, as well as revocation by sweeping memory to provide heap temporal memory safety. On most systems (anything with a flat memory hierarchy rather than using segment-based addressing), size_t and uintptr_t are the same type. However, on CHERI, size_t is just an integer offset, whereas uintptr_t is still a capability as described above. Casting a pointer to size_t will strip the metadata and validity tag, and casting from size_t to a pointer will result in a null-derived capability whose validity tag is not set, and thus cannot be dereferenced without faulting. The audio and cursor casts were harmless as they intend to stuff an integer into a pointer, but using uintptr_t is the idiomatic way to do that and silences our compiler warnings (which our build tool makes fatal by default as they often indicate real problems). The iconv and egl casts were true positives as SDL_iconv_t and iconv_t are pointer types, as is NativeDisplayType on most OSes, so this would have trapped at run time when using the round-tripped pointers. The gles2 casts were also harmless; the OpenGL API defines this argument to be a pointer type (and uses the argument name "pointer"), but it in fact represents an integer offset, so like audio and cursor the additional idiomatic cast is needed to silence the warning.
53987e9b 2021-07-28 21:03:42 Optimized SDL_Convert51ToStereo_AVX
cf85710c 2021-07-28 22:55:10 SDL_audiocvt.c: disable AVX for clang < 5 and gcc < 4.9 See: https://github.com/libsdl-org/SDL/issues/4533
c72aef26 2021-05-01 23:56:23 Fixed microphone randomly stop working WASAPI_WaitDevice is used for audio playback and capture, but needs to behave slighty different. For playback `GetCurrentPadding` returns the padding which is already queued, so WaitDevice should return when buffer length falls below the buffer threshold (`maxpadding`). For capture `GetCurrentPadding` returns the available data which can be read, so WaitDevice can return as soon as any data is available. In the old implementation WaitDevice could suddenly hang. This is because on many capture devices the buffer (`padding`) wasn't filled fast enough to surpass `maxpadding`. But if at one point (due to unlucky timing) more than maxpadding frames were available, WaitDevice would not return anymore. Issue #3234 is probably related to this.
4ef8674d 2021-07-27 14:18:44 Revert "wasapi: Open capture devices the way we used to." This reverts commit 0d0fee7569803ddc41985bfc249418b02dd8cd97.
0d0fee75 2021-07-27 14:12:18 wasapi: Open capture devices the way we used to. This should work around the regression in #3234, since it basically reverts the problem change, but only for capture devices. Fixes #3234.
736a424f 2021-07-27 13:12:57 pulseaudio: Optionally add "monitor" sources to device list. There's a new hint to enable this. Fixes #2917.
8d790b10 2021-07-27 12:23:46 audiocvt: stereo-to-mono SSE3 now uses unaligned accesses. On modern CPUs, there's no penalty for using the unaligned instruction on aligned memory, but now it can vectorize unaligned data too, which even if it's not optimal, is still going to be faster than the scalar fallback. Fixes #4532.
45de0a1d 2021-04-02 06:28:10 Support comma-separated lists in SDL_AUDIODRIVER
b2c8d3e9 2021-06-11 22:14:54 audiocvt: 5.1 to Stereo conversion utilizing AVX
638befc1 2021-06-10 17:22:39 audiocvt: 5.1 to Stereo conversion utilizing SSE
db56526f 2021-06-10 13:07:27 audiocvt: Replace divisions Division is expensive and the compiler can not replace it themselves. Though we now we will be ok in terms of floating point edge behaviour.
86ee383f 2021-05-25 09:59:45 Removed duplicate SDL_AtomicGet()
db146e66 2021-05-25 10:34:04 Fixed warnings building with Visual Studio
58884e4c 2021-05-04 00:23:40 SDL_audiocvt.c: fixed MSVC double->float conversion warnings.
8ac0fb52 2021-04-29 09:29:02 OpenSLES: CloseDevice() is called at higher level, if OpenDevice() fails - explicit initialization of static variables
fcbf19b7 2021-04-28 21:04:47 AAudio: make sure stream is not null to prevent crash in RequestStop (see #3710)
f8695185 2021-04-27 11:07:51 Audio: normalize conversion Stereo to 5.1, Quad to 7.1, 5.1 to 7.1 (bug #4104)
21349901 2021-04-27 10:57:48 Audio: convert 5.1 to 7.1, use right-surround for r-front and r-back (see #4104)
058bbe02 2021-04-24 10:17:03 Set volume on device open
f1fab24e 2021-04-15 21:00:00 AAudio: add bootstrap in SDL_audio.c
04b2f5f6 2021-04-15 20:54:58 Android: add AAudio back-end, with playback and capture (see #3710) https://developer.android.com/ndk/guides/audio/aaudio/aaudio
4118fe62 2021-04-15 20:52:43 Android: OpenSLES, explicitly initialise the global variable 'bqPlayerPlay', it may be read even if OpenSLES back-end hasn't been intialized
0f4aba7b 2021-04-06 18:34:53 audio: Fixed assertion failure if trying to use dummy backend.
64853b73 2021-04-06 18:34:17 audio: Changed a disk and dummy backends to use _this instead of this.
9d294f1f 2021-03-27 00:53:10 audio: Allow AudioStreamGet to return 0 in RunAudio. While we should normally expect _something_ from the stream based on the AudioStreamAvailable check, it's possible for a device change to flush the stream at an inconvenient time, causing this function to return 0. Thing is, this is harmless. Either data will be NULL and the result won't matter anyway, or the data buffer will be zeroed out and the output will just be silence for the brief moment that the device change is occurring. Both scenarios work themselves out, and testing on Windows shows that this behavior is safe.
9b7babf9 2021-03-27 00:47:54 wasapi: Remove assert added by 67e8522d
5f9effaa 2021-03-28 17:45:41 audio: pipewire: Block while waiting on stream state info Initializing streams, particularly capture streams, can take many milliseconds, which is a bit much for a busy wait. Use a blocking wait instead.
8deb4063 2021-03-28 17:22:59 audio: pipewire: Avoid redundant locking The pw_thread_loop already locks and unlocks the thread mutex at the start and end of each loop iteration, so these locks are unnecessary.
5bb2bbd4 2021-03-28 17:17:00 audio: pipewire: Don't use uninitialized variables in callbacks Some of the SDL_AudioDevice struct members aren't initialized until after returning from the OpenDevice function. Since Pipewire uses it's own processing threads, the callbacks can be entered before all members of SDL_AudioDevice are initialized, such as work_buffer, callbackspec and the processing stream, which creates a race condition. Don't use these members when in the paused state to avoid potentially using uninitialized values and memory.
e7e519a4 2021-03-17 13:04:05 dsp: Refuse to initialize if there aren't any Open Sound System devices. This prevents the dsp target from stealing the audio subsystem but not being able to produce sound, so other audio targets further down the list can make an attempt instead. Thanks to Frank Praznik who did a lot of the research on this problem!
b98b5adc 2021-03-15 10:21:36 wasapi: Don't use the system's resampler.
a5f3ea14 2021-03-10 09:36:46 netbsdaudio: Handle ioctls failing A user reported that the mpv video player hangs after attempting to set an unsupported number of channels with the SDL audio output, because it thinks it's successfully opened the device. This makes the failure graceful.
4fbd60b8 2021-03-09 12:22:48 audio: pipewire: Remove the nickname portion of sink/source names Removes the node nickname from sink/source nodes as it doesn't provide any useful information and names now match those used in Pulseaudio, so any stored configuration data will be compatible between the two audio backends.
a4ddb175 2021-03-08 19:28:58 Formatting
7d89f09f 2020-12-18 14:28:09 ISO C90 fixes
e7edb06e 2020-12-04 00:06:15 Audio fix
2d64e37e 2020-11-02 18:09:43 Initial rebase of xerpi's port
391bb80b 2021-03-05 16:53:06 Replace duplicate functions and lstrlen/lstrcat with SDL string functions
67e8522d 2021-02-27 17:37:25 Add SDL_GetAudioDeviceSpec. This API is supported by pipewire, pulseaudio, coreaudio, wasapi, and disk.
ac8a3fda 2021-03-03 20:33:20 fix prepare_audiospec() possibly missing a bad SDL_AUDIO_CHANNELS env.
4de0c74a 2021-03-02 10:02:59 audio: pipewire: Add the application name to the stream properties
9ed01da7 2021-03-02 09:47:47 audio: pipewire: Constify and clarify period size calculations Constify the min/max period variables, use a #define for the base clock rate used in the calculations and note that changing the upper limit can have dire side effects as it's a hard limit in Pipewire.
d7ca855c 2021-03-02 09:33:11 audio: pipewire: Add missing static qualifiers to globals
84c44e01 2021-03-01 12:39:52 audio: pipewire: fix uninitialized variable warnings
7001b531 2021-02-27 12:53:08 audio: pipewire: Add vim format lines to files and fix indentation Increase indentation spacing from 2 to 4 to comply with style standards.
2fcba50e 2021-02-27 12:08:15 audio: pipewire: Code and comment cleanups Replace "magic numbers" with #defines, explain the requirements when using the userdata pointer in the node_object struct and a few other minor code and comment cleanups.
4eadd147 2021-02-25 14:00:23 audio: pipewire: Fix outdated comment
cd56f1b3 2021-02-24 14:36:58 audio: pipewire: Use "rear" designation for rear channels Use the 'R' (rear) prefixed designations for the rear audio channels instead of 'S' (surround). Surround designated channels are only used in the 8 channel configuration.
adc0a931 2021-02-24 14:08:08 audio: Move Pipewire bootstrap after Jack Move the Pipewire audio driver below others in the list so it won't be mistakenly initialized when it's not the system mixer.
21adec93 2021-02-24 12:02:54 audio: pipewire: Make enumeration structure and function names more descriptive Rename the add/remove/clear list functions and rename connected_device to io_node, as a sink/source node isn't necessarily a device.
a07f5434 2021-02-21 13:24:20 audio: pipewire: Report default devices first Further refactor the device enumeration code to retrieve the default sink/source node IDs from the metadata node. Use the retrieved IDs to sort the device list so that the default devices are at the beginning and thus are the first reported to SDL.
9afd7570 2021-02-20 13:33:12 audio: pipewire: Always buffer source audio The latency of source nodes can change depending on the overall latency of the processing graph. Incoming audio must therefore always be buffered to ensure uninterrupted delivery. The SDL_AudioStream path was removed in the input callback as the only thing it was used for was buffering audio outside of Pipewire's min/max period sizes, and that case is now handled by the omnipresent buffer.
106dc009 2021-02-19 17:18:36 audio: pipewire: Pass proper parameter to user audio callback The audio callbacks should pass the callbackspec.userdata parameter to the callback, not spec.userdata Co-authored-by: Oschowa <Oschowa@web.de>
f3ebbc06 2021-02-19 16:02:20 audio: pipewire: Retrieve the channel count and default sample rate for sinks/sources Extend device enumeration to retrieve the channel count and default sample rate for sink and source nodes. This required a fairly significant rework of the enumeration procedure as multiple callbacks are involved now. Sink/source nodes are tracked in a separate list during the enumeration process so they can be cleaned up if a device is removed before completion. These changes also simplify any future efforts that may be needed to retrieve additional configuration information from the nodes.
2f0b99a7 2021-02-13 11:56:05 audio: Add Pipewire playback/capture sink
08547adb 2021-02-20 09:28:03 pulseaudio: Add "zerocopy" playback path
ef85ed93 2021-02-17 20:53:35 pulseaudio: Initialize fragsize to fix mic recording fragsize wasn't initialized, and it is used for recording. If the value was 0 or -1, pulseaudio configures it itself. But sometimes we can get a random (and large) value that makes pulseaudio give us large sample at a very low frequency. https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/blob/master/src/pulse/def.h#L453 https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/blob/v13.0/src/pulsecore/protocol-native.c#L409
20be1d63 2020-07-15 09:13:03 emscripten: Automatically resume audio contexts This uses the mechanism added in emscripten-core/emscripten#10843 which was applied to SDL1 and OpenAL. This adds the same for SDL2. This also reverts commit 865eaddffed50dbd13e6564c3f73902472cf74e8 which did something similar, but the new mechanism is more effective.
f443a6fc 2021-02-11 02:05:02 Fix format string warnings for width-based integers The DJGPP compiler emits many warnings for conflicts between print format specifiers and argument types. To fix the warnings, I added `SDL_PRIx32` macros for use with `Sint32` and `Uint32` types. The macros alias those found in <inttypes.h> or fallback to a reasonable default. As an alternative, print arguments could be cast to plain old integers. I opted slightly for the current solution as it felt more technically correct, despite making the format strings more verbose.
b852590b 2021-01-24 17:02:40 minor clean-up in SDL_os2audio.c
8f102589 2021-01-23 17:28:10 os2audio: changed backend name from MMOS2 to DART (like SDL-1.2)
50ea3b77 2021-01-08 10:09:37 Fixed bug 5080 - SDL_netbsdaudio: Always use the device's preferred frequency Nia Alarie The NetBSD kernel's audio resampling code is much simpler and lower quality than libsamplerate. Presumably, if SDL always performs I/O on the audio device in its native frequency, we can avoid resampling audio in the kernel and let SDL do it with libsamplerate instead.
265a1cc9 2021-01-05 15:50:02 use WIN_StringToUTF8W instead of WIN_StringToUTF8 where needed (#2) cf. bug #5435. - SDL_wasapi_win32.c (GetWasapiDeviceName): pwszVal is WCHAR* - windows/SDL_sysfilesystem.c (SDL_GetBasePath, SDL_GetPrefPath) - windows/SDL_sysurl.c (SDL_SYS_OpenURL): wurl is WCHAR* - SDL_windowssensor.c (ConnectSensor): bstr_name is WCHAR* - windows/SDL_systhread.c (SDL_SYS_SetupThread): strw is WCHAR*
ed39f2f3 2021-01-04 01:23:50 SDL_wasapi_win32.c (WASAPI_PlatformThreadInit): use L instead of TEXT() because AvSetMmThreadCharacteristicsW specifically accepts WCHAR* input cf. bug #5435.
01a2f276 2021-01-04 01:23:50 consistently use TEXT() macro with LoadLibrary() and GetModuleHandle() cf. bug #5435.
9130f7c3 2021-01-02 10:25:38 Updated copyright for 2021
8476df3e 2020-12-30 23:55:10 SDL_mixer.c: remove calls to non-existing m68k asm code.
cb361896 2020-12-09 07:16:22 Fixed bug 5235 - All internal sources should include SDL_assert.h Ryan C. Gordon We should really stick this in SDL_internal.h or something so it's always available.
53b16679 2020-11-11 12:33:55 SIZE_MAX need not be defined in limits.h it can be in limits.h (windows) or stdint.h.
1b8dee7c 2020-10-31 11:32:40 coreaudio: Remove unnecessary include of CoreServices.h
a4040293 2020-10-25 10:10:02 os2: misc build fixes
bfc80d83 2020-10-25 03:55:02 minor coding style cleanup
a90f0400 2020-10-15 21:37:30 os2: a _lot_ of coding style cleanup, sot that they match the SDL style. also renamed the 'debug' macro to debug_os2: the former was dangerously a common name. the binary (dll) output is precisely the same as before.
d2723875 2020-10-14 23:01:06 os2: integrate the port into main tree.
1d9cf23e 2020-10-14 23:01:05 os2: updated copyright dates for 2020. header guard fixes.
a3d7913c 2020-10-14 23:01:05 SDL_os2audio.c (OS2_OpenDevice): change spec->samples assignment: Original code assigned MCIMixSetup.ulSamplesPerSec value to it, but it is just the freq... We now change spec->samples only either if it is 0 or we changed the frequency, by picking a default of ~46 ms at desired frequency (code taken from SDL_audio.c:prepare_audiospec()). With this, the crashes I have been experiencing are gone.
e112b776 2020-10-14 23:01:05 SDL_os2audio.c (OS2_OpenDevice): change {0} initializers to SDL_zero()
72594e25 2020-10-14 23:01:04 SDL_os2audio.c (OS2_OpenDevice): remove assignment to wrong spec member Correct assignment to 'format' member is done below, already.
222f0268 2020-10-14 23:01:03 os/2: port from SDL2-2.0.4 to SDL2-2.0.5: changes to SDL_os2audio.c, SDL_os2video.c, os2/SDL_systhread.c in order to accomodate SDL2-2.0.5 changes. - audio: WaitDone() is gone, CloseDevice() interface changes. - events / video: DropFile() changes: SDL_DROPBEGIN and SDL_DROPCOMPLETE events, window IDs for drops. - thread: struct SDL_Thread->stacksize