src/audio


Log

Author Commit Date CI Message
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.
Ryan C. Gordon a7f86f2f 2017-01-22T20:18:59 audio: don't cast to double in SDL_ConvertStereoToMono(). It's expensive and (hopefully) unnecessary. If this becomes an overflow problem, we could multiply both values by 0.5f before adding them, but let's see if we can get by without the extra multiplication first.
Ryan C. Gordon 83454c82 2017-01-20T16:26:24 audio: removed conditional from simple resampler's inner loop. We never seem to overflow the source buffer now; this might have been a leftover from a bug that was covered by Vitaly's fixes? Removing this conditional makes the resampler 10-20% faster. Left an assert in there for debug builds, in case this still happens.
Sam Lantinga 9b99265a 2017-01-19T20:19:37 Fixed mingw64 32-bit build, which does have the correct structure definitions
Sam Lantinga 5cb1ca55 2017-01-18T11:57:27 Fixed building with mingw32
Ryan C. Gordon 3e1679c8 2017-01-18T02:11:56 audio: Several fixes to "simple" resampler (thanks, Vitaly!). Fixes Bugzilla #3551.
Ryan C. Gordon 57182930 2017-01-16T00:58:28 audio: Implemented SIMD support for audio data type converters. This currently adds an SSE2 implementation (but it's #ifdef'd out for now, until it's hooked up to the configure script and such).
Ryan C. Gordon 1e66d457 2017-01-15T05:01:59 audio: Some fixes to the audio data type converter code. Removed some needless things ("len / sizeof (Uint8)"), and made sure the int32 -> float code uses doubles to avoid working with large integer values in a 32-bit float.
Sam Lantinga bf11cd50 2017-01-09T20:37:52 Fixed bug 3552 - Building SDL in release mode fails under VS 2017 RC Lukasz Biel Tried to compile SDL2 using newest version of VS. Got: SDL_audiocvt.obj : error LNK2019: unresolved external symbol memcpy referenced in function SDL_ResampleCVT 1>E:\Users\dotPo\Lib\SDL\VisualC\x64\Release\SDL2.dll : fatal error LNK1120: 1 unresolved externals whole compilation process: http://pastebin.com/eWDAvBce Steps to reproduce: clone http://hg.libsdl.org/SDL using tortoise hg, open SDL\VisualC\SDL.sln, when promted if should retarget solution click ok, select release x64 build type, Build/Build Solution attempt 2, using Visual Studio cmake support: open folder SDL\ select release x64 build type, run CMake\Build CMakeLists.txt build fails When switched to debug build type, buils succeeds in both cases. VS 2017 is still beta.
Ryan C. Gordon 23020f92 2017-01-09T16:31:57 audio: Don't ever use libsamplerate in the SDL_AudioCVT codepath. It causes audio pops if you're converting in chunks (and needs to allocate/initialize/free on each convert). We'll either adjust this interface when we break ABI for 2.1 to make this usable, or publish the SDL_AudioStream API for those that want a streaming solution. In the meantime, the "simple" resampler produces "good enough" audio without pops and doesn't have to be initialized, so that'll do for now on the SDL_AudioCVT interface.
Ryan C. Gordon 063c9d40 2017-01-09T06:00:58 audio: Replaced older resamplers in SDL_AudioCVT with the new ones.
Ryan C. Gordon a41103b1 2017-01-09T05:59:30 audio: Patched to compile if linking directly to libsamplerate.
Ryan C. Gordon 38854e03 2017-01-08T16:18:49 audio: Improvements in channel conversion code.