kc3-lang/SDL/src/audio

Branch :


Log

Author Commit Date CI Message
e830ef34 2017-10-20 16:53:42 Fixed typo converting 4 channel audio to 2 channel
9a291c1e 2017-10-20 14:51:22 Added a note about adjusting channel weights when converting to fewer channels
72932906 2017-10-19 18:05:42 audio: Added SDL_AudioStreamFlush().
e98920f5 2017-10-18 23:49:46 Check correct variable for malloc() results.
afefcbfe 2017-10-18 19:30:47 Fixed bug 3876 - Resampling of certain sounds adds heavy distortion Simon Hug Patch that adds [-1, 1] clamping to the scalar audio type conversions. This may come from the SDL_Convert_F32_to_X_Scalar functions. They don't clamp the float value to [-1, 1] and when they cast it to the target integer it may be too large or too small for the type and get truncated, causing horrible noise. The attached patch throws clamping in, but I don't know if that's the preferred way to fix this. For x86 (without SSE) the compiler (I tested MSVC) seems to throw a horrible amount of x87 code in it. It's a bit better with SSE, but probably still quite the performance hit. And SSE2 uses a branchless approach with maxss and minss.
653ab5d9 2017-10-18 19:26:36 Added a staging buffer to the audio stream so that we can accumulate small amounts of data if needed when resampling
80f8464d 2017-10-18 15:54:05 Added audio stream conversion functions: SDL_NewAudioStream SDL_AudioStreamPut SDL_AudioStreamGet SDL_AudioStreamAvailable SDL_AudioStreamClear SDL_FreeAudioStream
fa156741 2017-10-13 01:15:29 coreaudio: changed device close procedure to prevent long hangs in some cases. The audioqueue thread needs to keep running, and processing the CFRunLoop until the AudioQueue is disposed of, otherwise CoreAudio will hang waiting for final data to feed the device. At least, I think this is how it all works. It definitely fixes the bug here! Since AudioQueueDispose() calls AudioQueueStop() internally, there's no need for our thread to handle this, either, which is good because the AudioQueue would be disposed by this point. So now the AudioQueue is disposed first, and then our thread is joined, and everything works out okay. Just in case, we mark the device "paused" before setting everything in motion, so any further callbacks from CoreAudio will write silence and not fire the app's audio callback again. Fixes Bugzilla #3868.
ba10d2b6 2017-10-12 13:55:35 Fixed compiler warning
5e5f2290 2017-10-11 12:07:43 audio: Turns out the accumulation errors sound better. :/ Moving to double fixed the overflows, but using "time = i * incr" instead of "time += incr" causes clicks in the output.
9bd2c6b4 2017-10-11 11:51:14 audio: Moved the resampler state up to double precision. Fixes more buffer overflows.
b2f5123b 2017-10-11 11:43:35 audio: calculate resampling time directly, don't increment (thanks, Eric!). Fixes buffer overruns as floating point errors accumulate. Partially fixes Bugzilla #3848.
763c3871 2017-10-11 02:33:55 audio: clamp resampler interpolation values to prevent buffer overflow. Partially fixes Bugzilla #3848.
0085f917 2017-10-11 02:31:58 audio: Moved unchanging variable out of loop.
cb8bf6bb 2017-10-11 02:03:05 audio: Make sure audio stream resampling doesn't overflow buffers.
459e2b0b 2017-10-11 01:37:11 audio: Fixed check for minimum audio stream put size.
903ff641 2017-10-10 22:31:02 audio: SDL_ResampleCVT() should use memmove instead of memcpy. This copy can overlap. Fixes Bugzilla #3849.
42fff7ce 2017-10-10 22:18:46 audio: Don't stack-allocate resampler padding. (I thought padding size ranged from 5 frames to ~30 frames (based around RESAMPLER_ZERO_CROSSINGS, which is 5), but it's actually between 512 and several thousands (based on RESAMPLER_SAMPLES_PER_ZERO_CROSSING)). It gets big fast when downsampling.
37d89aa1 2017-10-10 16:12:56 audio: reworked audio streams to have right-hand resampling padding available. Fixes Bugzilla #3851.
099ae43e 2017-09-22 22:28:21 audio: Fixed compiler warning on Visual Studio.
fe6b8f1c 2017-09-22 11:25:52 Fixed Mac OS X build
407e1693 2017-09-22 11:15:14 Fixed audio being silent on older iOS devices Tested on an iPod running iOS 6.1
d74c00e6 2017-09-22 08:51:45 Fixed memory leak when HAVE_ALLOCA isn't defined
6d206a7b 2017-09-22 07:42:24 audio: Stream resampling now saves some samples from previous run for padding. Previously, the padding was silence, which was a problem when streaming since you would sample a little bit of this silence between each buffer. We still need a means to get padding data for the right hand side, but this patch makes the resampler output more correct.
8b660c50 2017-09-21 00:55:29 Added some missing "extern" declarations
1a3b95a1 2017-09-21 02:51:14 audio: Replaced the resampler. Again. This time it's using real math from a real whitepaper instead of my previous amateur, fast-but-low-quality attempt. The new resampler does "bandlimited interpolation," as described here: https://ccrma.stanford.edu/~jos/resample/ The output appears to sound cleaner, especially at high frequencies, and of course works with non-power-of-two rate conversions. There are some obvious optimizations to be done to this still, and there is other fallout: this doesn't resample a buffer in-place, the 2-channels-Sint16 fast path is gone because this resampler does a _lot_ of floating point math. There is a nasty hack to make it work with SDL_AudioCVT. It's possible these issues are solvable, but they aren't solved as of yet. Still, I hope this effort is slouching in the right direction.
f40bd5ee 2017-09-21 02:06:53 audio: removed my perl experiment script.
c08a7a74 2017-09-15 17:27:32 Added a hint SDL_HINT_AUDIO_CATEGORY to control the audio category, determining whether the phone mute switch affects the audio
93583d46 2017-09-09 21: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.
ca15c7d6 2017-09-07 10:56:08 wave: SDL_LoadWAV now supports 24-bit audio.
3267398d 2017-09-02 16:41:14 sndio: Patched to compile if SIO_DEVANY isn't defined. (It isn't in whatever Raspbian is currently shipping.)
d619d885 2017-08-28 21: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.
b128e880 2017-08-29 00: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.
a0cd7d6b 2017-08-29 00:02:04 audio: Converting audio samples from int to float was using wrong equation. Fixes Bugzilla #3775.
6dd3f55d 2017-08-28 01:59:53 Fixed WinRT build after changing the header guard preprocessor symbol
0d011ec6 2017-08-28 00:22:23 Renaming of guard header names to quiet -Wreserved-id-macro
8e7998e1 2017-08-27 19: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:
bcf0e071 2017-08-18 17:29:44 Added WASAPI audio target to autoconf build process
e3e6b4fd 2017-08-18 16:52:19 audio: better docs on conversion APIs, error if not init'd (thanks, Simon!). Fixes Bugzilla #3662.
fb835f9e 2017-08-14 20: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.
96305832 2017-08-11 10: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.
9dde37ea 2017-08-07 00:25:18 sndio: Fix for some platforms (Linux, for example) that don't define INFTIM. Fixes Bugzilla #3712.
a09efc73 2017-08-04 16:18:34 psp: Force audio channels to stereo if > 2 channels requested (thanks, Solra!). Fixes Bugzilla #3726.
68ca9d9e 2017-07-29 23:00:45 qnx: Fixed error message.
cea33bf5 2017-07-29 23:00:34 aix: Removed unused local variable. Found by Cppcheck.
77ca0f27 2017-07-27 22:55:18 Fixed crash if the WASAPI audio device couldn't be recovered
4a734209 2017-07-27 22:52:19 Fixed infinite recursion if the WASAPI audio device couldn't be recovered
f033ce61 2017-07-27 02:41:58 Fixed typo in WASAPI shutdown code
03eaddca 2017-07-23 19:25:16 Fixed compiler warnings on QNX.
8ac17a2a 2017-07-20 20:40:17 sndio: fixed poll() call (thanks, kdrakehp!). Fixes Bugzilla #3705.
ee9cc324 2017-07-20 18:16:02 sndio: More improvements to the OpenBSD audio target (thanks, kdrakehp!). Fixes Bugzilla #3705.
2cc68064 2017-07-20 10: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.
fb9c2939 2017-07-07 23:00:10 qnx: Fixed setting a field twice.
1683a0c1 2017-07-05 12:04:37 audio: trying to pacify static analysis.
9f99b3d7 2017-07-02 22:46:49 aix: Fixed audio debug output. DEBUG_AUDIO is checked with #ifdef not #if.
4366721b 2017-07-02 22:46:00 qnx: Removed unused bootstrap declaration. QNX_bootstrap is the VideoBootStrap. QSAAUDIO_bootstrap is still there.
22241ed0 2017-07-01 17:50:47 Support for QNX 7.0 (thanks, Elad!). Fixes Bugzilla #3686.
380e0693 2017-07-01 23:01:49 aix: Fixed compile error.
4c190ce5 2017-07-01 23:00:07 netbsd: Fixed comment.
4c48260c 2017-06-29 23:00:18 netbsd: Removed unused field.
7bb6b402 2017-06-29 23:00:09 netbsd: Fixed compile error.
a509719f 2017-06-12 21:35:24 audio: Converter now checks a strict list of channels and formats we support.
553b3286 2017-06-12 16: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.
325330ef 2017-06-09 17:37:43 jack: removed accidental copy/paste.
58f08af4 2017-06-09 00:47:47 jack: added capture support.
c39fd577 2017-06-09 00:14:50 jack: Move jack_client_t into the audio device instead a global variable.
b65e0777 2017-06-08 22:20:49 jack: Remove BROKEN_MULTI_DEVICE code.
d9039f23 2017-06-08 13: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.)
63b3e06f 2017-06-03 23:00:15 Corrected names of header file guards.
fc510bd7 2017-05-28 21:50:47 nacl: Fixed crash if allocating memory for audio device failed.
7c5078d8 2017-05-28 21:50:37 qnx: Removed unnecessary check for available audio devices.
1e60ea76 2017-05-28 21:50:27 qnx: Removed unnecessary call to SDL_zerop() after SDL_calloc().
e5918acf 2017-05-28 00: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.
3639895e 2017-05-27 23:30:07 Removed unused errno includes.
75931972 2017-05-26 22:45:40 emscripten: Fixed compiling on C89 compilers.
a7fc2822 2017-05-24 19: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.
6844d92c 2017-05-24 13: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.
fc4402e5 2017-05-24 13: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.
3fd35f6b 2017-05-24 01:28:03 coreaudio: looks like we need more like a 10ms buffer minimum, not 50ms.
793c788b 2017-05-24 00: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.
91e6054b 2017-05-19 12:40:55 wasapi: don't mark capture devices as failed for AUDCLNT_S_BUFFER_EMPTY. Fixes Bugzilla #3633.
81ab6c98 2017-05-18 16:27:36 Patched to compile on Windows.
13b6d995 2017-05-18 15:46:06 wasapi: Replace tabs with strings in source code.
adabc384 2017-05-18 15:43:51 wasapi: Deal with AUDCLNT_S_BUFFER_EMPTY when flushing audio device.
4073a669 2017-05-18 15:33:17 audio: One more callbackspec fix (thanks, Simon!).
c878b59b 2017-05-10 16: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.
75fb07a6 2017-05-03 18:05:29 iOS: Only mark interrupted audio devices as non-interrupted if AudioQueueStart is successful.
226541cb 2017-04-26 01:43:40 audio: another wrong struct that causes NULL pointer crash (thanks, Simon!). Fixes Bugzilla #3632.
7382cebb 2017-04-20 21: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.
d20d426c 2017-04-18 22: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.
028716e7 2017-03-30 16:33:47 wasapi: deal with default device changes, and more robust failure recovery.
c85c57a0 2017-03-29 14: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.
266816b4 2017-03-26 21:00:19 Removed newlines from error messages.
6814f5db 2017-03-14 07: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
c4d54504 2017-03-14 07:16:56 differentiate between capture / playback audio thread names
ca0bf151 2017-03-03 16:38:17 Fix some more compiler warnings on armcc.
d526b8a1 2017-03-02 13:33:04 Some patches to make SDL compile with armcc (ARM's C compiler).
a4249b48 2017-02-26 00:56:13 Patched to compile on C89 compilers.
3b9e4d0a 2017-02-26 00:39:22 audio: Try to keep callbacks firing at normal pace when device is lost.
a366c35f 2017-02-26 00: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.