Commit graph

9461 commits

Author SHA1 Message Date
Sam Lantinga
4fad2b3b61 Generalized the audio resampling hint for other resampling methods in the future 2017-01-24 19:38:01 -08:00
Ryan C. Gordon
eeec5705e0 audio: libsamplerate can't resample in-place; make space for a copy if needed. 2017-01-24 20:30:48 -05:00
Ryan C. Gordon
088da5be10 configure: report libsamplerate support status. 2017-01-24 16:18:25 -05:00
Ryan C. Gordon
0dc13f56ec 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.

--HG--
extra : amend_source : 804f3d3dc636b5f28f7194b48b492c6c3fe05bf5
2017-01-24 15:52:22 -05:00
Ryan C. Gordon
d756e1486e CMake: fixed logic error in setting -mfpmath=387.
Fixes Bugzilla #3565.

--HG--
extra : histedit_source : 4ca7ab8fd990fa870000c9489b92561703a127e2
2017-01-24 12:20:41 -05:00
Ryan C. Gordon
f521e5b213 configure.in: Check for sse3 too when setting -mfpmath=387. 2017-01-24 12:20:12 -05:00
Ryan C. Gordon
dc15193eb5 audio: Fix static analysis concerns about a dead assignment. 2017-01-24 10:09:29 -05:00
Ryan C. Gordon
e04f23c7ea Added a note about aligning SDL_AudioCVT data. 2017-01-24 00:55:41 -05:00
Ryan C. Gordon
ca2ab5780a audio: Make sure SDL_AudioStream's work buffer is 16-byte aligned, for SIMD.
Note the giantic FIXME, though!
2017-01-24 00:51:33 -05:00
Ryan C. Gordon
30238b8676 audio: Streams now resample in-place. Removed second allocated buffer. 2017-01-24 00:17:40 -05:00
Ryan C. Gordon
2471f581c6 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.
2017-01-24 00:08:24 -05:00
Ryan C. Gordon
6b1e0a7cd2 audio: Fixed off-by-one error in upsampling. 2017-01-24 00:03:36 -05:00
Ryan C. Gordon
8850103510 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!
2017-01-23 16:45:50 -05:00
Ryan C. Gordon
c869f0418a audio: Fixed incorrect pointer in SDL_ResampleCVT_si16_c2().
Forgot to update this when we changed this to process in-place. Whoops!
2017-01-23 16:42:47 -05:00
Ryan C. Gordon
102165d126 audio: Fixed copy/paste bug in float32->sint16/SSE2 scalar leftover code. 2017-01-23 12:14:28 -05:00
Ryan C. Gordon
9e20246b59 audio: Fix same bug as last commit, but for _mm_bslli_si128 vs _mm_slli_si128. 2017-01-23 12:06:10 -05:00
Ryan C. Gordon
0578cb7935 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.
2017-01-23 12:02:02 -05:00
Ryan C. Gordon
6e1edca849 audio: Wired up new SSE code to build system.
--HG--
extra : rebase_source : 3c94cdc92b94864eb43d7429032724227b798cf2
2017-01-23 01:05:44 -05:00
Ryan C. Gordon
c46db55d26 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.

--HG--
extra : rebase_source : 46d6e38d06da451b8c2e836ae36cd1ddba02e510
2017-01-22 20:27:48 -05:00
Ryan C. Gordon
50bb6473ed 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.

--HG--
extra : rebase_source : cab98b19216722eae3749cc1e1429d1c802e9782
2017-01-22 23:48:15 -05:00
Ryan C. Gordon
6ceacbdc4a audio: Added SSE3 implementation of SDL_ConvertStereoToMono().
--HG--
extra : rebase_source : 92882c4fdf5dc4a326057f577ccb4c29c32f938e
2017-01-23 00:57:19 -05:00
Ryan C. Gordon
8af7561815 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.

--HG--
extra : rebase_source : b7b47e961eb974510e133882548ea36b40f6d7e3
2017-01-22 20:18:59 -05:00
Ryan C. Gordon
34fe29bc62 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.

--HG--
extra : rebase_source : c05a536f5a80f065c0872b35d77d4f70a56b4e3e
2017-01-20 16:26:24 -05:00
Philipp Wiesemann
522a5c6f6f Haiku: Fixed memory leak if creating framebuffer failed. 2017-01-22 22:15:36 +01:00
Philipp Wiesemann
91783e4515 WinRT: Fixed typo in README. 2017-01-22 22:15:24 +01:00
Philipp Wiesemann
bd9158e9ed Haiku: Removed unused variable.
Found by Cppcheck.
2017-01-21 22:01:17 +01:00
Philipp Wiesemann
fecb6f7178 Fixed compiler warning about returning a value in a void function. 2017-01-21 22:00:56 +01:00
Philipp Wiesemann
d2bcd9e6eb Fixed copyright symbol in testgles2 program. 2017-01-21 22:00:40 +01:00
Sam Lantinga
b5f23df6a8 Fixed mapping the PG-9021 which, on Linux, emits a button partway through the trigger press along with axis motion all along the pull 2017-01-20 16:40:11 -08:00
Sam Lantinga
88fd1d721d Added support for the 8Bitdo Zero GamePad 2017-01-20 08:13:23 -08:00
Sam Lantinga
e8a0188c9f Fixed mingw64 32-bit build, which does have the correct structure definitions 2017-01-19 20:19:37 -08:00
Sam Lantinga
2b509445d8 Removed unused variable 2017-01-18 12:19:57 -08:00
Sam Lantinga
2129c44985 Fixed bug 3533 - Enumeration joystick devices omitted during directinput enumeration
white.magic

The logic which decides if a device enumerated via the direct input system in the function EnumJoysticksCallback in SDL_dinputjoystick.c is processed is discarding valid joystick devices due to the assumption that devices of the type DI8DEVTYPE_SUPPLEMENTAL are not valid devices.

This change was added with 2.0.4 with this commit http://hg.libsdl.org/SDL/rev/d5adc0c06a03 that is linked to this bug report https://bugzilla.libsdl.org/show_bug.cgi?id=2460 which indicates that in that case devices of the type DI8DEVTYPE_SUPPLEMENTAL were not desirable as they caused a singular device to emit multiple "device added" events.

Since then there appear to have been a few fixes to handle devices that fall into various other classes in the following two commits:
http://hg.libsdl.org/SDL/rev/b9488c689ce3 and http://hg.libsdl.org/SDL/rev/161fee58e36f

Two devices I have reports of failing to be listed when the DI8DEVTYPE_SUPPLEMENTAL type is excluded are ECS Gametric Throttle and Thrustmaster MFD Cougar.

Sam Lantinga

I verified that the OUYA controller shows up as a single device with this change, so I've reverted the change to ignore supplemental devices, leaving framework in place to easily add devices that we want to ignore.
2017-01-18 12:18:50 -08:00
Sam Lantinga
9413c74045 Fixed bug 3561 - Re-acquire device before playing effects if needed.
Mathieu Laurendeau

Check the result of IDirectInputEffect_SetParameters and re-acquire the device to solve concurrency issues.
2017-01-18 11:58:16 -08:00
Sam Lantinga
101fc7428b Fixed building with mingw32 2017-01-18 11:57:27 -08:00
Ryan C. Gordon
adb1d6888f audio: Several fixes to "simple" resampler (thanks, Vitaly!).
Fixes Bugzilla #3551.
2017-01-18 02:11:56 -05:00
Sam Lantinga
61e4e371fa Use icon width * sizeof(Uint32) instead of icon pitch when copying to icon resource data 2017-01-17 21:18:31 -08:00
Ryan C. Gordon
f025391f8c 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).
2017-01-16 00:58:28 -05:00
Ryan C. Gordon
c40d568133 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.

--HG--
extra : rebase_source : c803b416ec487b8c0feba780ac06f8d11e90879b
2017-01-15 05:01:59 -05:00
Philipp Wiesemann
f8d3d73cc9 Fixed comments. 2017-01-14 21:36:06 +01:00
Philipp Wiesemann
fb2c2f5703 Fixed doxygen warning and linking of function names. 2017-01-14 21:35:49 +01:00
Philipp Wiesemann
741322863f Changed Bugzilla link in README.md to HTTPS like in BUGS.txt. 2017-01-14 21:35:18 +01:00
Philipp Wiesemann
f5eb780fe9 Fixed warnings about missing initializers in testoverlay2 program. 2017-01-14 21:34:45 +01:00
Sam Lantinga
db23e877e1 Fixed comment 2017-01-13 11:37:12 -08:00
dmuratshin
65283bda93 fixed SENSOR_LANDSCAPE and SENSOR_PORTRAIT mode false nativeResume bug 2017-01-12 10:58:35 -08:00
Sam Lantinga
c5d89dc186 We don't actually build with the Xt library 2017-01-10 23:23:32 -08:00
Sam Lantinga
d6742bbdf5 Fixed bugs 2570, 3145, improved OpenGL ES context support on Windows and X11
Mark Callow

The attached patch does the following for the X11 and Windows platforms, the only ones where SDL attempts to use context_create_es_profile:

- Adds SDL_HINT_OPENGL_ES_DRIVER by which the application can
  say to use the OpenGL ES driver & EGL rather than the Open GL
  driver. (For bug #2570)
- Adds code to {WIN,X11}_GL_InitExtensions to determine the maximum
  OpenGL ES version supported by the OpenGL driver (for bug #3145)
- Modifies the test that determines whether to use the OpenGL
  driver or the real OpenGL ES driver to take into account the
  hint, the requested and supported ES version and whether ES 1.X
  is being requested. (For bug #2570 & bug #3145)
- Enables the testgles2 test for __WINDOWS__ and __LINUX__ and adds
  the test to the VisualC projects.

With the fix in place I have run testdraw2, testgl and testgles2 without any issues and have run my own apps that use OpenGL, OpenGL ES 3 and OpenGL ES 1.1.
2017-01-10 08:54:33 -08:00
Sam Lantinga
8eb437d4e7 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.
2017-01-09 20:37:52 -08:00
Ryan C. Gordon
27737db314 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.

--HG--
extra : rebase_source : 4c5656de3d1de9f88d6368e5ca363d834fc93af1
2017-01-09 16:31:57 -05:00
Ryan C. Gordon
240e448d41 testresample: write correct length to the .wav header.
--HG--
extra : rebase_source : 2cd3479500c472e06b74b6d640970d991c269696
2017-01-09 15:56:11 -05:00