src/audio


Log

Author Commit Date CI Message
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.
Ryan C. Gordon 35166609 2017-01-08T14:28:44 audio: Patched to compile with libsamplerate support (again).
Ryan C. Gordon d005dc21 2017-01-08T14:23:15 audio: Patched to compile with libsamplerate support.
Ryan C. Gordon 19e937fc 2017-01-08T14:18:03 audio: libsamplerate loading now happens once at init time.
Ryan C. Gordon 98cc9d10 2017-01-08T14:17:09 Fixed coding style on a function signature.
Ryan C. Gordon 61a3ba30 2017-01-07T17:09:14 Replaced a few single-line "//" comments.
Sam Lantinga df25258a 2017-01-06T20:43:53 Added configure and cmake support for libsamplerate
Ryan C. Gordon c5825b69 2017-01-06T21:23:51 audio: Don't call a NULL function pointer when clearing audio streams. (Partially?) fixes Bugzilla #3547.
Sam Lantinga cbe44f7f 2017-01-06T02:16:26 Added support for using libsamplerate to do audio resampling
Sam Lantinga 37f404fb 2017-01-06T00:47:42 Fixed confusion between Ryan's new audio stream and the audio buffer we were calling stream in the callback
Ryan C. Gordon 748f4605 2017-01-06T03:38:14 audio: Add an assert to make sure non-streaming audio uses good buffer sizes.
Ryan C. Gordon 345c5989 2017-01-06T03:15:27 haiku: Patched to compile.
Sam Lantinga 3443dc19 2017-01-05T23:53:46 Don't do any audio conversion if none is necessary
Ryan C. Gordon b3e8db80 2017-01-06T01:07:34 audio: rename fake_stream to work_buffer. It's more than an alternative for when the OS can't provide a DMA buffer, now.
Ryan C. Gordon 992124d4 2017-01-06T01:02:58 audio: Fixed SDL_AudioStreamGet() function parameters. There was a draft of this where it did audio conversion into the final buffer, if there was enough room available past what you asked for, but that interface got removed, so the parameters didn't make sense (and we were using the wrong one in any case, too!).
Ryan C. Gordon 99fc1ef9 2017-01-06T00:56:29 naclaudio: Untested attempt to migrate to SDL_AudioStream.
Ryan C. Gordon 115d0ce7 2017-01-06T00:50:01 haikuaudio: Untested attempt to get this working with SDL_AudioStream.
Ryan C. Gordon 1a90c72d 2017-01-06T00:49:35 emscriptenaudio: don't get stuck in infinite loop if SDL_AudioStreamPut fails.
Ryan C. Gordon f07a1a5a 2017-01-05T21:31:02 emscriptenaudio: Reworked to use SDL_AudioStream.
Ryan C. Gordon 3761b5f6 2017-01-05T20:11:19 Fixed a few compiler warnings.
Ryan C. Gordon 4aa9e369 2017-01-05T19:45:57 Patched to compile on some compilers.
Ryan C. Gordon 52130bde 2017-01-05T19:30:45 diskaudio: Use SDL_Log, not fprintf.
Ryan C. Gordon 30178a9b 2017-01-05T19:29:38 audio: Added SDL_AudioStream. Non-power-of-two resampling now works!
Ryan C. Gordon f12ab8f2 2017-01-05T19:12:20 audio: More effort to improve and simplify audio resamplers.
Sam Lantinga 45b774e3 2017-01-01T18:33:28 Updated copyright for 2017
Sam Lantinga 2ba66d05 2016-12-31T16:21:55 Fixed bug 3535 - Misplaced comment #if/#endif closure comment Coriiander This notice is about a misplaced comment. Often times when we use an #if #endif sequence, the #endif is followed by a comment to indicate what #if statement it belonged to. The SDL_xaudio2.c file contains a misplaced comment, as follows (I stripped the other comments): #ifdef __GNUC__ # define SDL_XAUDIO2_HAS_SDK 1 #elif defined(__WINRT__) # define SDL_XAUDIO2_HAS_SDK #include "SDL_xaudio2.h" #else #if 0 #include <dxsdkver.h> #if (!defined(_DXSDK_BUILD_MAJOR) || (_DXSDK_BUILD_MAJOR < 1284)) # pragma message("Your DirectX SDK is too old. Disabling XAudio2 support.") #else # define SDL_XAUDIO2_HAS_SDK 1 #endif #endif #endif /* 0 */ That final /* 0 */ should be moved one line up. Like this (I tabbed it out for you to make it more clear):
Sam Lantinga 9492492d 2016-12-26T01:56:52 Fixed bug 3516 - fix build on illumos Sylvain trivial patch to fix the build on illumos -Werror=declaration-after-statement https://gist.github.com/wiedi/15b71456667f7aa2a7f8815663723bb3
Sam Lantinga b2f6c4c1 2016-12-19T11:15:53 Fixed bus error when converting 16-bit to float for non-integral-multiple sample rates
Ryan C. Gordon 366c77a9 2016-12-18T20:17:33 audio: fixed one more incorrectly-hardcoded value in the resamplers.