src/audio


Log

Author Commit Date CI Message
Ozkan Sezer ac8a3fda 2021-03-03T20:33:20 fix prepare_audiospec() possibly missing a bad SDL_AUDIO_CHANNELS env.
Frank Praznik 4de0c74a 2021-03-02T10:02:59 audio: pipewire: Add the application name to the stream properties
Frank Praznik 9ed01da7 2021-03-02T09: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.
Frank Praznik d7ca855c 2021-03-02T09:33:11 audio: pipewire: Add missing static qualifiers to globals
Oschowa 84c44e01 2021-03-01T12:39:52 audio: pipewire: fix uninitialized variable warnings
Frank Praznik 2f0b99a7 2021-02-13T11:56:05 audio: Add Pipewire playback/capture sink
Frank Praznik 7001b531 2021-02-27T12: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.
Frank Praznik 2fcba50e 2021-02-27T12: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.
Frank Praznik 4eadd147 2021-02-25T14:00:23 audio: pipewire: Fix outdated comment
Frank Praznik cd56f1b3 2021-02-24T14: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.
Frank Praznik adc0a931 2021-02-24T14: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.
Frank Praznik 21adec93 2021-02-24T12: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.
Frank Praznik a07f5434 2021-02-21T13: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.
Frank Praznik 9afd7570 2021-02-20T13: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.
Frank Praznik 106dc009 2021-02-19T17: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>
Frank Praznik f3ebbc06 2021-02-19T16: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.
Oschowa 08547adb 2021-02-20T09:28:03 pulseaudio: Add "zerocopy" playback path
Romain Roffé ef85ed93 2021-02-17T20: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
Alon Zakai 20be1d63 2020-07-15T09: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.
Jay Petacat f443a6fc 2021-02-11T02: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.
Ozkan Sezer b852590b 2021-01-24T17:02:40 minor clean-up in SDL_os2audio.c
Ozkan Sezer 8f102589 2021-01-23T17:28:10 os2audio: changed backend name from MMOS2 to DART (like SDL-1.2)
Sam Lantinga 50ea3b77 2021-01-08T10: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.
Ozkan Sezer 265a1cc9 2021-01-05T15: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*
Ozkan Sezer ed39f2f3 2021-01-04T01:23:50 SDL_wasapi_win32.c (WASAPI_PlatformThreadInit): use L instead of TEXT() because AvSetMmThreadCharacteristicsW specifically accepts WCHAR* input cf. bug #5435.
Ozkan Sezer 01a2f276 2021-01-04T01:23:50 consistently use TEXT() macro with LoadLibrary() and GetModuleHandle() cf. bug #5435.
Sam Lantinga 9130f7c3 2021-01-02T10:25:38 Updated copyright for 2021
Ozkan Sezer 8476df3e 2020-12-30T23:55:10 SDL_mixer.c: remove calls to non-existing m68k asm code.
Sam Lantinga cb361896 2020-12-09T07: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.
Ozkan Sezer 53b16679 2020-11-11T12:33:55 SIZE_MAX need not be defined in limits.h it can be in limits.h (windows) or stdint.h.
Ryan C. Gordon 1b8dee7c 2020-10-31T11:32:40 coreaudio: Remove unnecessary include of CoreServices.h
Ozkan Sezer a4040293 2020-10-25T10:10:02 os2: misc build fixes
Ozkan Sezer bfc80d83 2020-10-25T03:55:02 minor coding style cleanup
Ozkan Sezer a90f0400 2020-10-15T21: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.
Ozkan Sezer d2723875 2020-10-14T23:01:06 os2: integrate the port into main tree.
Ozkan Sezer 1d9cf23e 2020-10-14T23:01:05 os2: updated copyright dates for 2020. header guard fixes.
Ozkan Sezer a3d7913c 2020-10-14T23: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.
Ozkan Sezer e112b776 2020-10-14T23:01:05 SDL_os2audio.c (OS2_OpenDevice): change {0} initializers to SDL_zero()
Ozkan Sezer 72594e25 2020-10-14T23:01:04 SDL_os2audio.c (OS2_OpenDevice): remove assignment to wrong spec member Correct assignment to 'format' member is done below, already.
Ozkan Sezer 222f0268 2020-10-14T23: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
Ozkan Sezer aa790837 2020-10-14T23:01:02 os2: several warning fixes. mostly those "W007: '&array' may not produce intended result" warnings from Watcom, visible only in C++ mode. one or two others here & there.
Ozkan Sezer c2188619 2020-10-14T23:01:01 os2: added a 2-byte padding to os2 SDL_PrivateAudioData
Ozkan Sezer 74cfb81d 2020-10-14T23:01:00 os2: add port files for SDL2-2.0.4 from Andrey Vasilkin only geniconv/iconv.h (was from LGPL libiconv) is replaced with a generic minimal iconv.h based on public knowledge.
Ryan C. Gordon 003a1698 2020-10-06T11:07:50 wav: Make sure the data size is a multiple of blockalign, not an exact match. I _think_ this is a right thing to do; it fixes a .wav file I have here that has blockalign==2 when channels==2 and bitspersample==16, which otherwise would fail.
Manuel V?gele 554037a6 2020-09-26T09:30:08 audio: fix popping sounds caused by signed/unsigned conversion When converting audio from signed to unsigned values of vice-versa the silence value chosen by SDL was the value of the device, not of the stream that the data was being put into. After conversion this would lead to a very high or low value, making the speaker jump to a extreme positon, leading to an audible noise whenever creating, destroying or playing scilence on a device that reqired such conversion.
Ryan C. Gordon 7ef188a1 2020-09-19T14:01:57 jack: Fixed memory leak on device close.
Alistair Leslie-Hughes a69c61fb 2020-08-14T12:08:58 Only assign context and mainloop once we have connected successfully If we fail to connect to the the pa server, we have an assigned context and mainloop that isn't connected. So, when PULSEAUDIO_pa_context_disconnect is called, pa asserts and crashes the application. Assertion 'pa_atomic_load(&(c)->_ref) >= 1' failed at pulse/context.c:1055, function pa_context_disconnect(). Aborting.
Sam Lantinga ff53521b 2020-06-04T12:26:57 Fixed Bluetooth audio output on Apple TV
Ryan C. Gordon 68777406 2020-05-20T16:58:33 windows: Fix calls to CoCreateInstance() so last parameter is a LPVOID *.
Ryan C. Gordon 8601996f 2020-05-03T22:13:48 hints: Allow specifying audio device metadata. This is only supported on PulseAudio. You can set a description when opening your audio device that will show up in pauvcontrol, which lets you set per-stream volume levels. Fixes Bugzilla #4801.
Sam Lantinga a990a34a 2020-04-14T22:26:02 Cleanly switch between audio recording, playback, and both, on iOS
Sam Lantinga 2ae1c0f5 2020-04-14T09:52:27 Allow Bluetooth headphones for iOS playandrecord mode
Ryan C. Gordon fba081e4 2020-04-07T14:51:08 wasapi: Patched to compile on C89 systems, and use SDL_ceilf instead of ceilf.
Ryan C. Gordon 4c2be472 2020-04-07T14:37:24 wasapi: Improve WASAPI audio backend latency (thanks, Anthony!). Anthony Pesch's notes on his patch: "Currently, the WASAPI backend creates a stream in shared mode and sets the device's callback size to be half of the shared stream's total buffer size. This works, but doesn't coordinate will with the actual hardware. The hardware will raise an interrupt after every period which in turn will signal the object being waited on inside of WaitDevice. From my empirical testing, the callback size was often larger than the period size and not a multiple of it, which resulted in poor latency when trying to time an application based on the audio callback. The reason for this looked something like: * The device's callback would be called and and the audio buffer was filled. * WaitDevice would be called. * The hardware would raise an interrupt after one period. * WaitDevice would resume, see that a a full callback had not been played and then wait again. * The hardware would raise an interrupt after another period. * WaitDevice would resume, see that a full callback + some extra amount had been played and then it would again call our callback and this process would repeat. The effect of this is that the pacing between subsequent callbacks is poor - sometimes it's called very quickly, sometimes it's called very late. By matching the callback's size to the stream's period size, the pacing of calls to the user callback is improved substantially. I didn't write an actual test for this, but my use case for this was my Dreamcast emulator (https://redream.io) which uses the audio callback to help drive the emulation speed. Without this change and with the default shared stream buffer (which has a period of ~10ms) I would get frame times that were between ~3-30 milliseconds; after this change I get frame times of ~11-22 milliseconds. Note, this patch also has a change that removes passing a duration to the Initialize call. It seems that the default duration used (when 0 is passed) does typically match up with the duration returned by GetDevicePeriod, however the Initialize docs say: > To set the buffer to the minimum size required by the engine thread, the > client should call Initialize with the hnsBufferDuration parameter set to 0. > Following the Initialize call, the client can get the size of the resulting > buffer by calling IAudioClient::GetBufferSize. This change isn't strictly required, but I made it to hopefully rule out another source of unexpected latency." Fixes Bugzilla #4592.
Sam Lantinga b6afbe63 2020-04-07T09:38:57 Added SDL_log.h to SDL_internal.h so logging is available everywhere
Sam Lantinga 9525f972 2020-04-05T10:44:51 Fixed bug 5076 - SDL_netbsdaudio: Add support for 32-bit LPCM Nia Alarie The kernel supports this, make SDL expose it so it can be used.
Sam Lantinga f3e60967 2020-04-02T12:27:29 Fixed setting the "playandrecord" audio hint on Apple TV The Apple TV doesn't have record capability by default, so activating the audio session with AVAudioSessionCategoryPlayAndRecord fails.
Ryan C. Gordon 55b4f18e 2020-03-29T01:54:00 coreaudio: The default SDL audio device now tracks the system output default. So if you go into System Preferences on a MacBook and toggle between a pair of connected bluetooth headphones and built-in internal speakers, SDL will switch the device it is playing sound through, to match this setting, on the fly. Likewise if the default output device is a USB thing and is unplugged; as the default device changes at the system level, SDL will pick this up and carry on with the new default. This is different from our unplug detection for specific devices, as in those cases we want to send the app a disconnect notification, instead of migrating transparently as we now do for default devices. Note that this should also work for capture devices; if the device changes, SDL will start recording from the new default. Fixes Bugzilla #4851.
Sam Lantinga abdc5cbf 2020-03-26T19:30:17 Allow background music to play in the "play and record" case on iOS
Ethan Lee 27889d02 2020-03-03T12:31:41 winrt: Wait for EnumerationCompleted before leaving WASAPI_EnumerateEndpoints
Sam Lantinga e3b0713e 2020-02-24T12:07:18 Don't call setPreferredOutputNumberOfChannels on iOS, it breaks audio output
Sam Lantinga 2c9871a4 2020-02-24T10:25:57 Fixed surround sound support on Apple TV
Sam Lantinga f4e23553 2020-02-14T15:19:34 Fixed audio not coming out of the phone speakers while recording on iOS
Sam Lantinga 922b3dc3 2020-02-14T14:18:12 Fixed re-setting the audio session category when closing an audio device
Sam Lantinga 14bf532d 2020-02-13T16:10:52 Fixed opening audio on Android from the Steam Link shell activity
Sam Lantinga 4bb95e84 2020-02-11T16:14:02 Implemented OpenSL-ES audio recording on Android
Sam Lantinga b1c6e7c2 2020-01-23T00:32:34 Fixed compile warning
Ryan C. Gordon f30ef6ed 2020-01-21T17:40:16 audio: Fixed a '//' style comment.
Ryan C. Gordon dbe5c14b 2020-01-21T15:49:37 audio: Calculate a legitimate SDL_AudioSpec::silence in SDL_LoadWAV_RW().
Sam Lantinga a8780c6a 2020-01-16T20:49:25 Updated copyright date for 2020
Sam Lantinga 3ce56f62 2020-01-13T08:12:10 Fixed error formatting
Sam Lantinga e3cedf96 2020-01-11T04:38:13 Add the destination format to the error when conversion isn't possible
Ryan C. Gordon 3da6a0b2 2019-12-03T03:53:06 pulseaudio: don't let FlushCapture get stuck in an infinite loop on shutdown. Fixes Bugzilla #4645.
Sylvain Becker 60d3965e 2019-10-30T15:36:17 Readability: remove redundant return, continue, enum declaration
Sylvain Becker b458d7a2 2019-10-30T15:13:55 Readability: remove redundant cast to the same type
Sylvain Becker ed469fa5 2019-10-23T09:36:41 Fixed bug 4842 - Redundant condition in MS_ADPCM_Decode and IMA_ADPCM_Decode (Thanks!)
Ryan C. Gordon aef1ed4a 2019-09-25T15:40:27 audio: Set (something close to) the correct silence value for U16 audio. Partially fixes Bugzilla #4805.
Ryan C. Gordon 693755f0 2019-09-25T15:07:07 coreaudio: Apple doesn't support U16 data, so convert in that case.
Sylvain Becker 70dc8d16 2019-08-30T08:55:20 Android: fix corresponding warnings
Sam Lantinga 455944c8 2019-08-22T16:12:16 Fixed whitespace
Sam Lantinga b521df66 2019-08-22T16:09:42 [SDL][IOS] Audio fix - applies stream to sound data when resampling or reformatting is required.
Sylvain Becker 05f35c24 2019-08-19T21:23:47 Fix audio conversion U16_to_F32_SSE2 (bug 4186)
Sylvain Becker 1d220401 2019-08-19T20:35:02 Fixed bug 4186 - ARM/NEON audio converters cause strange clicking noises reverse the order when storing ouput buffer
Sylvain Becker c0fc94f2 2019-08-19T16:57:15 Fixed bug 4186 - ARM/NEON audio converters cause strange clicking noises reverse the order when storing ouput buffer
Ozkan Sezer 4953e050 2019-07-31T05:11:40 use SDL_zeroa at more places where the argument is an array.
Ozkan Sezer 7a47c292 2019-07-31T01:22:02 Fix bug 4746 - introduce SDL_zeroa macro.
Ozkan Sezer fdc67c3c 2019-07-31T00:10:00 MS_ADPCM_Decode: fix assigning an array to a pointer (lose '&').
Sam Lantinga 680e7937 2019-07-07T09:10:56 Fixed bug 4710 - audio/alsa: avoid configuring hardware parameters with only a single period Anthony Pesch The previous code first configured the period size using snd_pcm_hw_par- ams_set_period_size_near. Then, it further narrowed the configuration space by calling snd_pcm_hw_params_set_buffer_size_near using a buffer size of 2 times the _requested_ period size in order to try and get a configuration with only 2 periods. If the configured period size was larger than the requested size, the second call could inadvertently narrow the configuration space to contain only a single period. Rather than fixing the call to snd_pcm_hw_params_set_buffer_size_near to use a size of 2 times the configured period size, the code has been changed to use snd_pcm_hw_params_set_periods_min in order to more clearly explain the intent.
Sam Lantinga 14e8b93e 2019-06-18T14:24:24 Fixed compiler warning
Ryan C. Gordon 90e2dc98 2019-06-14T18:23:51 A few minor changes to placate static analysis.
Ryan C. Gordon 289d1092 2019-06-14T16:52:42 audio: Attempt to fix build on ARM versions of Visual Studio.
Ryan C. Gordon 33b235f4 2019-06-14T15:52:48 audio: Fix ARM NEON audio converter bugs. (Patch from Sylvain, I'm just applying it.) Fixes Bugzilla #4186.
Ryan C. Gordon 5c56c888 2019-06-14T15:47:32 audio: patched to compile.
Ethan Lee 5bd9b8b1 2019-06-14T09:51:22 Check src alignment for S32_to_F32 conversions
Ryan C. Gordon 2fa33d6f 2019-06-12T15:43:08 wave: Fixed static analysis warning about dead assignment. (technically, this function never returns an error at this point, but since it _does_ have an "uhoh, is this corrupt data?" comment that it ignores, we should probably make sure we handle error cases in the future. :) )
Sylvain Becker cd011bb1 2019-06-12T10:42:02 SDL_Wave: missing field 'length' initializer
Ryan C. Gordon 254eb677 2019-06-11T02:08:31 windows: Don't let Visual Studio insert an implicit dependency on memset(). Fixes Bugzilla #4662.
Sam Lantinga d8da33c0 2019-06-10T08:49:26 Fixed bug 4662 - SDL failed to build due to error LNK2019: unresolved external symbol _memset referenced in function _IMA_ADPCM_Decode with MSVC on Windows LinGao We build SDL with Visual studio 2017 compiler on Windows Server 2016, but it failed to build due to error LNK2019: unresolved external symbol _memset referenced in function _IMA_ADPCM_Decode on latest default branch. And we found that it can be first reproduced on ca7283111ad0 changeset. Could you please help have a look about this issue? Thanks in advance!
Sam Lantinga 762b788f 2019-06-09T12:46:10 Cleanup on bug 3894 - Fuzzing crashes for SDL_LoadWAV Simon Hug Attached is a minor cleanup patch. It changes the option name of one hint to something better, puts one or two more checks in, and adds explicit casting where warnings could appear otherwise. I hope the naming of the hints and their options is acceptable. It would be kind of awkward to change them after they get released with an official SDL version.
Sam Lantinga a21b5b30 2019-06-08T19:09:43 Fixed build