src/audio


Log

Author Commit Date CI Message
Ryan C. Gordon 93583d46 2017-09-09T21:17:46 alsa: removed snd_pcm_wait() call before writing to playback device. This would cause playback problems in certain situations, such as on the Raspberry Pi. The device that the wait was added for seems to not benefit from it in modern times, and standard desktop Linux seems to do the right thing when a USB device is unplugged now, without this patch. Fixes Bugzilla #3599.
Ryan C. Gordon ca15c7d6 2017-09-07T10:56:08 wave: SDL_LoadWAV now supports 24-bit audio.
Ryan C. Gordon 3267398d 2017-09-02T16:41:14 sndio: Patched to compile if SIO_DEVANY isn't defined. (It isn't in whatever Raspbian is currently shipping.)
Sam Lantinga d619d885 2017-08-28T21:42:39 Fixed bug 3662 - Error message when using the audio conversion setup without an initialized audio subsystem is a bit vague Simon Hug This issue actually raises the question if this API change (requirement of initialized audio subsystem) is breaking backwards compatibility. I don't see the documentation saying it is needed in 2.0.5.
Ryan C. Gordon b128e880 2017-08-29T00:41:45 audio: A whole bunch of improvements to audio conversion (thanks, Solra!). "Major changes, roughly in order of appearance: - Use float math everywhere, instead of promoting to double and casting back all the time. - Conserve sound energy when downmixing any channel into two other channels. - Add a QuadToStereo filter. (The previous technique of reusing StereoToMono never worked, since it assumed an incorrect channel layout for 4.0.) - Add a 71to51 filter. This removes just under half of the cases the previous code would silently break in. - Add a QuadTo51 filter. More silent breakage fixed. - Add a 51to71 filter, removing another almost-half of the silently broken cases. - Add 8 to the list of values SDL_SupportedChannelCount will accept. - Change SDL_BuildAudioCVT's channel-related logic to handle every case, and to actually fail if it fails instead of silently corrupting sound data and/or crashing down the road." (Note that SDL doesn't otherwise support 7.1 audio yet, but hopefully it will soon and the 7.1 converters are an important piece of that. --ryan.) Fixes Bugzilla #3727.
Ryan C. Gordon a0cd7d6b 2017-08-29T00:02:04 audio: Converting audio samples from int to float was using wrong equation. Fixes Bugzilla #3775.
Sam Lantinga 6dd3f55d 2017-08-28T01:59:53 Fixed WinRT build after changing the header guard preprocessor symbol
Sam Lantinga 0d011ec6 2017-08-28T00:22:23 Renaming of guard header names to quiet -Wreserved-id-macro
Sam Lantinga 8e7998e1 2017-08-27T19:10:30 Fixed bug 3710 - SDL_OpenAudio(desired, obtained) doesn't update desired's size when obtained is NULL David Ludwig I've created a new set of patches. I am happy to create more, if it would help. One version only copies 'size'. A second version copies both 'size' and 'silence'. When looking over the documentation for SDL_OpenAudio in SDL_audio.h, it mentioned that both 'size' and 'silence' were things that SDL_OpenAudio would calculate. Regarding *both* patches, I did notice that SDL 1.2 appears to have always modified desired's size and silence fields. The SDL wiki, at https://wiki.libsdl.org/SDL_OpenAudio#Remarks , does note:
Sam Lantinga bcf0e071 2017-08-18T17:29:44 Added WASAPI audio target to autoconf build process
Ryan C. Gordon e3e6b4fd 2017-08-18T16:52:19 audio: better docs on conversion APIs, error if not init'd (thanks, Simon!). Fixes Bugzilla #3662.
Sam Lantinga fb835f9e 2017-08-14T20:22:19 Fixed bug 2330 - Debian bug report: SDL2 X11 driver buffer overflow with large X11 file descriptor manuel.montezelo Original bug report (note that it was against 2.0.0, it might have been fixed in between): http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=733015 -------------------------------------------------------- Package: libsdl2-2.0-0 Version: 2.0.0+dfsg1-3 Severity: normal Tags: patch I have occasional crashes here caused by the X11 backend of SDL2. It seems to be caused by the X11_Pending function trying to add a high number (> 1024) file descriptor to a fd_set before doing a select on it to avoid busy waiting on X11 events. This causes a buffer overflow because the file descriptor is larger (or equal) than the limit FD_SETSIZE. Attached is a possible workaround patch. Please also keep in mind that fd_set are also used in following files which may have similar problems. src/audio/bsd/SDL_bsdaudio.c src/audio/paudio/SDL_paudio.c src/audio/qsa/SDL_qsa_audio.c src/audio/sun/SDL_sunaudio.c src/joystick/linux/SDL_sysjoystick.c -------------------------------------------------------- On Tuesday 24 December 2013 00:43:13 Sven Eckelmann wrote: > I have occasional crashes here caused by the X11 backend of SDL2. It seems > to be caused by the X11_Pending function trying to add a high number (> > 1024) file descriptor to a fd_set before doing a select on it to avoid busy > waiting on X11 events. This causes a buffer overflow because the file > descriptor is larger (or equal) than the limit FD_SETSIZE. I personally experienced this problem while hacking on the python bindings package for SDL2 [1] (while doing make runtest). But it easier to reproduce in a smaller, synthetic testcase.
Sam Lantinga 96305832 2017-08-11T10:21:19 Fixed bug 3702 - Clear error messages of SDL_LoadObject for optional libraries Simon Hug Some code in SDL loads libraries with SDL_LoadObject to get more information or use newer APIs. SDL_LoadObject may fail, set an error message and SDL will continue with some fallback code. Since SDL will overwrite the error or exit the function with a return value that indicates success, the error form SDL_LoadObject for the optional stuff might as well be cleared right away.
Ryan C. Gordon 9dde37ea 2017-08-07T00:25:18 sndio: Fix for some platforms (Linux, for example) that don't define INFTIM. Fixes Bugzilla #3712.
Ryan C. Gordon a09efc73 2017-08-04T16:18:34 psp: Force audio channels to stereo if > 2 channels requested (thanks, Solra!). Fixes Bugzilla #3726.
Philipp Wiesemann 68ca9d9e 2017-07-29T23:00:45 qnx: Fixed error message.
Philipp Wiesemann cea33bf5 2017-07-29T23:00:34 aix: Removed unused local variable. Found by Cppcheck.
Sam Lantinga 77ca0f27 2017-07-27T22:55:18 Fixed crash if the WASAPI audio device couldn't be recovered
Sam Lantinga 4a734209 2017-07-27T22:52:19 Fixed infinite recursion if the WASAPI audio device couldn't be recovered
Sam Lantinga f033ce61 2017-07-27T02:41:58 Fixed typo in WASAPI shutdown code
Ryan C. Gordon 03eaddca 2017-07-23T19:25:16 Fixed compiler warnings on QNX.
Ryan C. Gordon 8ac17a2a 2017-07-20T20:40:17 sndio: fixed poll() call (thanks, kdrakehp!). Fixes Bugzilla #3705.
Ryan C. Gordon ee9cc324 2017-07-20T18:16:02 sndio: More improvements to the OpenBSD audio target (thanks, kdrakehp!). Fixes Bugzilla #3705.
Sam Lantinga 2cc68064 2017-07-20T10:39:47 Fixed bug 3705 - Add capture support to the sndio backend kdrakehp The attached patch adds capture support to the sndio backend. The patch also allows the `OpenDevice' function to accept arbitrary device names.
Philipp Wiesemann fb9c2939 2017-07-07T23:00:10 qnx: Fixed setting a field twice.
Ryan C. Gordon 1683a0c1 2017-07-05T12:04:37 audio: trying to pacify static analysis.
Philipp Wiesemann 9f99b3d7 2017-07-02T22:46:49 aix: Fixed audio debug output. DEBUG_AUDIO is checked with #ifdef not #if.
Philipp Wiesemann 4366721b 2017-07-02T22:46:00 qnx: Removed unused bootstrap declaration. QNX_bootstrap is the VideoBootStrap. QSAAUDIO_bootstrap is still there.
Ryan C. Gordon 22241ed0 2017-07-01T17:50:47 Support for QNX 7.0 (thanks, Elad!). Fixes Bugzilla #3686.
Philipp Wiesemann 380e0693 2017-07-01T23:01:49 aix: Fixed compile error.
Philipp Wiesemann 4c190ce5 2017-07-01T23:00:07 netbsd: Fixed comment.
Philipp Wiesemann 4c48260c 2017-06-29T23:00:18 netbsd: Removed unused field.
Philipp Wiesemann 7bb6b402 2017-06-29T23:00:09 netbsd: Fixed compile error.
Ryan C. Gordon a509719f 2017-06-12T21:35:24 audio: Converter now checks a strict list of channels and formats we support.
Sam Lantinga 553b3286 2017-06-12T16:39:15 Fixed bug 3668 - Overflow of SDL_AudioCVT.filters with some downmixes Simon Hug There's a chance that an audio conversion from many channels to a few can use more than 9 audio filters. SDL_AudioCVT has 10 SDL_AudioFilter pointers of which one has to be the terminating NULL pointer. The SDL code has no checks for this limit. If it overflows there can be stack or heap corruption or a call to 0xa. Attached patch adds a function that checks for this limit and throws an error if it is reached. Also adds some documentation. Test parameters that trigger this issue: AUDIO_U16MSB with 224 channels at 46359 Hz V AUDIO_S16MSB with 6 channels at 27463 Hz The fuzzer program I uploaded in bug 3667 has more of them.
Ryan C. Gordon 325330ef 2017-06-09T17:37:43 jack: removed accidental copy/paste.
Ryan C. Gordon 58f08af4 2017-06-09T00:47:47 jack: added capture support.
Ryan C. Gordon c39fd577 2017-06-09T00:14:50 jack: Move jack_client_t into the audio device instead a global variable.
Ryan C. Gordon b65e0777 2017-06-08T22:20:49 jack: Remove BROKEN_MULTI_DEVICE code.
Ryan C. Gordon d9039f23 2017-06-08T13:27:58 jack: Initial shot at a JACK audio target. http://jackaudio.org/ Fixes Bugzilla #2163. (with several more commits following to improve this code.)
Philipp Wiesemann 63b3e06f 2017-06-03T23:00:15 Corrected names of header file guards.
Philipp Wiesemann fc510bd7 2017-05-28T21:50:47 nacl: Fixed crash if allocating memory for audio device failed.
Philipp Wiesemann 7c5078d8 2017-05-28T21:50:37 qnx: Removed unnecessary check for available audio devices.
Philipp Wiesemann 1e60ea76 2017-05-28T21:50:27 qnx: Removed unnecessary call to SDL_zerop() after SDL_calloc().
Ryan C. Gordon e5918acf 2017-05-28T00:41:55 wasapi: properly report init failure if on pre-Vista version of Windows. We really should change the Init interface to return 0 on success and -1 on error, like everything else, to avoid this sort of confusion.
Philipp Wiesemann 3639895e 2017-05-27T23:30:07 Removed unused errno includes.
Philipp Wiesemann 75931972 2017-05-26T22:45:40 emscripten: Fixed compiling on C89 compilers.
Ryan C. Gordon a7fc2822 2017-05-24T19:56:59 audio: rename bsd target to netbsd. Apparently this is no longer a generic BSD audio target, and hasn't been for years, so rename it for NetBSD.
Ryan C. Gordon 6844d92c 2017-05-24T13:28:13 coreaudio: we don't need to track number of allocated audio buffers anymore. CoreAudio takes care of iterating through the buffers and freeing them now, so we don't have to manage this ourselves.
Ryan C. Gordon fc4402e5 2017-05-24T13:25:31 coreaudio: Better handling of audio buffer queue management. We don't fill buffers just to throw them away during shutdown now, we let the AudioQueue free its own buffers during disposal (which fixes possible warnings getting printed to stderr by CoreAudio), and we stop the queue after running any queued audio during shutdown, which prevents dropping the end of the audio playback if you opened the device with an enormous sample buffer. Fixes Bugzilla #3555.
Ryan C. Gordon 3fd35f6b 2017-05-24T01:28:03 coreaudio: looks like we need more like a 10ms buffer minimum, not 50ms.
Ryan C. Gordon 793c788b 2017-05-24T00:12:22 coreaudio: dynamically allocate AudioQueueBuffers. We need more than two buffers to flip between if they are small, or CoreAudio won't make any sound; apparently it needs X milliseconds of audio queued when it needs to play more or it drops any queued buffers. We are currently guessing 50 milliseconds as a minimum, but there's probably a more proper way to get the minimum time period from the system. Fixes Bugzilla #3656.
Ryan C. Gordon 91e6054b 2017-05-19T12:40:55 wasapi: don't mark capture devices as failed for AUDCLNT_S_BUFFER_EMPTY. Fixes Bugzilla #3633.
Ryan C. Gordon 81ab6c98 2017-05-18T16:27:36 Patched to compile on Windows.
Ryan C. Gordon 13b6d995 2017-05-18T15:46:06 wasapi: Replace tabs with strings in source code.
Ryan C. Gordon adabc384 2017-05-18T15:43:51 wasapi: Deal with AUDCLNT_S_BUFFER_EMPTY when flushing audio device.
Ryan C. Gordon 4073a669 2017-05-18T15:33:17 audio: One more callbackspec fix (thanks, Simon!).
Ryan C. Gordon c878b59b 2017-05-10T16:18:43 audio: fixed more "spec" references that should have been "callbackspec". This should catch all the ones for audio targets that have provided their own audio threads.
Alex Szpakowski 75fb07a6 2017-05-03T18:05:29 iOS: Only mark interrupted audio devices as non-interrupted if AudioQueueStart is successful.
Ryan C. Gordon 226541cb 2017-04-26T01:43:40 audio: another wrong struct that causes NULL pointer crash (thanks, Simon!). Fixes Bugzilla #3632.
Juha Kuikka 7382cebb 2017-04-20T21:25:29 audio: Fix audio queue functions to use new spec structure. Using the old spec structure causes the audio queueing functions to fail due to bad callback pointers being checked.
Sam Lantinga d20d426c 2017-04-18T22:17:40 Fix crash in SDL audio thread, by Juha Kuikka Wrong audio spec structure was populated with the internal callback, causing the audio thread to call a NULL pointer.
Ryan C. Gordon 028716e7 2017-03-30T16:33:47 wasapi: deal with default device changes, and more robust failure recovery.
Ryan C. Gordon c85c57a0 2017-03-29T14:23:39 wasapi: Handle lost audio device endpoints. This gracefully recovers when a device format is changed, and will switch to the new default device if the current one is unplugged, etc. This does not handle when a new default device is added; it only notices if the current default goes away. That will be fixed by implementing the stubbed-out MMNotificationClient_OnDefaultDeviceChanged() function.
Philipp Wiesemann 266816b4 2017-03-26T21:00:19 Removed newlines from error messages.
Sam Lantinga 6814f5db 2017-03-14T07:20:14 ALSA driver improvements: * alsa hotplug thread is low priority * give a chance for other threads to catch up when audio playback is not progressing * use nonblocking for alsa audio capture There is a bug with SDL hanging when an audio capture USB device is removed, because poll never returns
Sam Lantinga c4d54504 2017-03-14T07:16:56 differentiate between capture / playback audio thread names
Ryan C. Gordon ca0bf151 2017-03-03T16:38:17 Fix some more compiler warnings on armcc.
Ryan C. Gordon d526b8a1 2017-03-02T13:33:04 Some patches to make SDL compile with armcc (ARM's C compiler).
Ryan C. Gordon a4249b48 2017-02-26T00:56:13 Patched to compile on C89 compilers.
Ryan C. Gordon 3b9e4d0a 2017-02-26T00:39:22 audio: Try to keep callbacks firing at normal pace when device is lost.
Ryan C. Gordon a366c35f 2017-02-26T00:12:33 audio: run the audio callback even if device was lost. We will throw away the data anyhow, but some apps depend on the callback firing to make progress; testmultiaudio.c, if nothing else, is an example of this. Capture also will now fire the callback in these conditions, offering nothing but silence. Apps can check SDL_GetAudioDeviceStatus() or listen for the SDL_AUDIODEVICEREMOVED event if they want to gracefully deal with an opened audio device that has been unexpectedly lost.
Ryan C. Gordon 5728cb20 2017-02-26T00:10:02 audio: Make sure the disk and dummy targets are the last ones we try to init.
Sam Lantinga 71a4e8ed 2017-02-23T12:10:02 Stop CoreAudio from doing expensive audio rate conversion
Philipp Wiesemann cfcec57f 2017-02-19T21:05:09 Fixed comment.
Ryan C. Gordon e8677a1b 2017-02-17T02:25:37 audio: Added basic WAVE_FORMAT_EXTENSIBLE support to .wav loader. This is just enough to get you through a file that just used the extended header for float or int data. It doesn't handle all the other things that you expect from this header, like 24-bit samples inside a 32-bit container or speaker masks.
Ryan C. Gordon 1ed41d6d 2017-02-14T03:12:09 Patched to compile on Windows.
Ryan C. Gordon 6046fd4c 2017-02-14T03:03:27 wasapi: Initial WASAPI support, for Windows Vista and later. This should remain binary compatible with Windows XP, as we dynamically load anything we need and fall back to DirectSound/WinMM/XAudio2 if not available.
Ryan C. Gordon e5fc93ba 2017-02-13T16:59:02 audio: Don't wrap bootstrap declarations in preprocessor macros. They are harmless and ignored if we don't actually link against them. The preprocessor checks elsewhere if they're actually used.
Ryan C. Gordon ad9c702f 2017-02-13T16:56:41 audio: SDL_AudioStream's *_sample_frame_size should be in bytes, not bits. Fixes failures where SDL_AudioStreamGet() incorrectly thinks it got a partial sample frame request.
Ryan C. Gordon 175f1e8f 2017-02-13T16:55:00 audio: Added a ThreadDeinit() method to match ThreadInit. Not used by any targets at the moment, but will be shortly!
Sam Lantinga 886736a2 2017-02-11T16:38:16 Fixed bug 3584 - Small stack size for audio callback thread Walter van Niftrik We have found that since SDL 2.0.5 the audio callback thread is created with a very small stack size. In our application this is leading to stack overflows. We believe there is a bug at http://hg.libsdl.org/SDL/file/391fd532f79e/src/audio/SDL_audio.c#l1132, where the is_internal_thread flag appears to be inverted.
Sam Lantinga 107c19da 2017-02-09T06:01:14 Log the error returned by XAudio2Create()
Sam Lantinga ede5c734 2017-01-24T19:38:01 Generalized the audio resampling hint for other resampling methods in the future
Ryan C. Gordon 47e2f4e9 2017-01-24T20:30:48 audio: libsamplerate can't resample in-place; make space for a copy if needed.
Ryan C. Gordon c7f9dcb6 2017-01-24T15:52:22 audio: Offer a hint for libsamplerate quality/speed tradeoff. This defaults to the internal SDL resampler, since that's the likely default without a system-wide install of libsamplerate, but those that need more can tweak this.
Ryan C. Gordon 1da3a337 2017-01-24T10:09:29 audio: Fix static analysis concerns about a dead assignment.
Ryan C. Gordon 8f627c1c 2017-01-24T00:51:33 audio: Make sure SDL_AudioStream's work buffer is 16-byte aligned, for SIMD. Note the giantic FIXME, though!
Ryan C. Gordon 17dcee20 2017-01-24T00:17:40 audio: Streams now resample in-place. Removed second allocated buffer.
Ryan C. Gordon b5eeab77 2017-01-24T00:08:24 audio: allow stereo Sint16 resampling fast path in SDL_AudioStream. This currently favors libsamplerate over the fast path (quality over speed), but I'm not sure that's the correct approach, as there may be surprising changes in performance metrics depending on what packages are available on a user's system. That being said, currently, the only thing with access to SDL_AudioStream is an SDL audio device's thread, and it might be mostly idle otherwise, so maybe this is generally good.
Ryan C. Gordon a80cb672 2017-01-24T00:03:36 audio: Fixed off-by-one error in upsampling.
Ryan C. Gordon dad07f96 2017-01-23T16:45:50 audio: Resampler now special-cases stereo and mono processing. Turns out that iterating from 0 to channels-1 was a serious performance hit! These cases now tend to match or beat the original audio resampler's speed!
Ryan C. Gordon 8ce6ddf1 2017-01-23T16:42:47 audio: Fixed incorrect pointer in SDL_ResampleCVT_si16_c2(). Forgot to update this when we changed this to process in-place. Whoops!
Ryan C. Gordon ecdc6c12 2017-01-23T12:14:28 audio: Fixed copy/paste bug in float32->sint16/SSE2 scalar leftover code.
Ryan C. Gordon 4b8f3546 2017-01-23T12:06:10 audio: Fix same bug as last commit, but for _mm_bslli_si128 vs _mm_slli_si128.
Ryan C. Gordon fab45018 2017-01-23T12:02:02 audio: use _mm_srli_si128 instead of _mm_bsrli_si128. They're the same thing (one is generally a #define of the other), but some toolchains don't offer the 'b' version.
Ryan C. Gordon 3594bf8e 2017-01-23T01:05:44 audio: Wired up new SSE code to build system.
Ryan C. Gordon 64056e81 2017-01-23T00:57:19 audio: Added SSE3 implementation of SDL_ConvertStereoToMono().
Ryan C. Gordon 8855daac 2017-01-22T23:48:15 audio: Make the simple resampler operate in-place. This allows us to avoid an extra copy, allocate less memory and reduce cache pressure. On the downside: we have to do a lot of tapdancing to resample the buffer in reverse when the output is growing.
Ryan C. Gordon 202ab30c 2017-01-22T20:27:48 audio: Special case for resampling stereo AUDIO_S16SYS audio data. This is a fairly common case, so we avoid the conversion to/from float here.