Commit Graph

13351 Commits (47bcb078f547554735daf2d919127f6cdd0cd656)

Author SHA1 Message Date
Brick 47fea7f06b Used fixed-point arithmetic in ResampleAudio 2023-08-21 16:02:54 -04:00
Brick 7bb4e806ea Clear resample_offset in SDL_ClearAudioStream, not SetAudioStreamFormat
Not entirely sure if ClearAudioStream is the right place, but SetAudioStreamFormat was the wrong place
2023-08-21 16:02:54 -04:00
Brick b9541b9eab Improved ResampleAudio
* filterindex2 was off-by-one
* Generate ResamplerFilter using doubles
* Transpose ResamplerFilter to improve access patterns
2023-08-21 16:02:54 -04:00
Brick cdaa19869d Track offset within the current sample when resampling 2023-08-21 16:02:54 -04:00
Frank Praznik d60ebb06d1 mouse: Ensure that the dummy default cursor is removed from the cursor list
In the case where a dummy cursor is created as the default cursor, make sure it is removed from the cursor list when freeing the default cursor.
2023-08-16 13:46:14 -04:00
Frank Praznik e58c2731fe mouse: Free the default cursor when destroyed
The default cursor was being leaked on destruction as it is not in the cursor list, and subsequently SDL_DestroyCursor() wouldn't call the free function for it.
2023-08-16 12:51:59 -04:00
Ryan C. Gordon 789ce17e11
audio: Don't resample in chunks for now.
This needs a little reworking to not lose sample frames.

Reference Issue #8036.
2023-08-16 10:26:08 -04:00
Ryan C. Gordon cbab33482a
audio: Don't call SDL_AudioStream callbacks for empty data sets.
Fixes #8095.
2023-08-14 18:16:58 -04:00
Sam Lantinga 3e1ae0c867 Clearified the libusb whitelist default logic 2023-08-14 12:19:37 -07:00
Brick f4520821ef Removed some unnecessary integer casts 2023-08-14 15:07:18 -04:00
Brick 0989b7e86d Avoid using designated initializers 2023-08-14 15:07:18 -04:00
Brick c6c1e673c0 Optimized SDL_Convert_*_to_*_Scalar
They are now all branch-less and avoid float multiplication/conversion where possible
2023-08-14 15:07:18 -04:00
Brick f97b920b31 Optimized SDL_Convert_*_to_*_SSE2
Some of the SDL_Convert_F32_to_*_SSE2 do not explicitly clamp the input,
but instead rely on saturating casts.
Inputs very far outside the valid [-1.0, 1.0] range may produce
an incorrect result, but I believe that is an acceptable trade-off.
2023-08-14 15:07:18 -04:00
Brick 300d1ec3ed Added audio_convertAccuracy test 2023-08-14 15:07:18 -04:00
Brick 32cecc2eac Fixed assertion in audio_convertAudio 2023-08-14 15:07:18 -04:00
Brick 33f11e21ee Removed assertions in AudioConvert(To|From)Float 2023-08-14 15:07:18 -04:00
Anonymous Maarten c2f388fd88 cmake: add SDL_HIDAPI_LIBUSB_SHARED option + test on ci 2023-08-14 19:37:58 +02:00
Frank Praznik 371cc2d173 wayland: Remove unnecessary flag and state settings
The video core applies pending minimized/maximized/restored state to windows when they transition from the hidden to shown state, so no need to handle it internally anymore.
2023-08-14 13:20:24 -04:00
Frank Praznik fe85e6e754 cocoa: Send a maximized event instead of restored if a deminiaturized window is zoomed 2023-08-14 13:20:24 -04:00
Frank Praznik ddddcb78cb cocoa: Use the close method to hide a miniaturized window
The 'orderOut' method has no effect on miniaturized windows, so 'close' must be used to remove the window from the desktop, dock, and window list in this case.

SDL holds a strong reference to the window (oneShot/releasedWhenClosed are 'NO'), and calling 'close' doesn't send a 'windowShouldClose' message, so it's safe to use for this purpose as nothing is implicitly released.
2023-08-14 13:20:24 -04:00
Frank Praznik be8c42cfd7 Clarify that a window being 'hidden' means that it is unmapped/ordered out
SDL considers a hidden window to be unmapped and blocks or defers certain operations until the window is shown again, however, the X11 and Cocoa backends would set the hidden flag when the window was minimized, which blocked the functionality of SDL_RestoreWindow().

Specify that a window with the hidden flag set is unmapped and not visible on the desktop or in the dock/taskbar without a call to SDL_ShowWindow(), and don't set the hidden flag in the X11 and Cocoa backends when the window is in the minimized state, but still mapped to the desktop.
2023-08-14 13:20:24 -04:00
Ikko Eltociear Ashimine a44338cbc1 Fix typo in SDL_audiocvt.c
accomodate -> accommodate
2023-08-14 10:13:53 -07:00
Ozkan Sezer f464eb2c54 SDL_hidapi.c: change 'use_libusb_whitelist_default' into a macro.
Avoids 'initializer element is not constant' error from older compilers.
2023-08-14 17:01:24 +03:00
Anonymous Maarten 6607a3cfac Disable cache in python http server
Co-authored-by: Érico Porto <ericoporto2008@gmail.com>
2023-08-14 03:50:06 +02:00
Ethan Lee 181d5d285a hidapi: Enable libusb support by default.
Now that we have a whitelisting system for libusb devices, it should be safe to support it whenever it's available.
2023-08-13 14:16:11 -07:00
Ethan Lee f0f15e365d hidapi: Use a whitelist for libusb when other backends are available 2023-08-13 14:16:11 -07:00
capehill c3f7a7dc46 Convert audio using SDL_AUDIO_F32SYS format instead of SDL_AUDIO_F32
This fixes audio playback noise on big endian systems
as SDL_AUDIO_F32 means SDL_AUDIO_F32LSB.
2023-08-13 14:08:18 -07:00
Vlad-Stefan Harbuz 796713b9d5 xxd.py: always write \n line endings
Previously, `open()` was used with the default option of `newline=None`,
which means that “any '\n' characters written are translated to the
system default line separator”. Now, `xxd.py` always writes `\n` line
endings. This eliminates the need for the .gitattributes file.
2023-08-13 13:51:31 -07:00
David CARLIER 723bcd0a8b SDL_TriggerBreakppoint for riscv arch (both 32/64) version.
`ebreak` acts like int3 for x86, giving control of running process to debuggers.
2023-08-13 11:36:49 -04:00
Anonymous Maarten ec0042081e Add .gitattributes file
On Windows, cmake/xxd.py generates text files with \r\n eol.
Because the in-repo files were stored with \n, and git considered
them as binary files, they were always considered out of date.

An alternative fix could be to let xxd.py generate binary files with \n.
But a .gitattributes file should also avoid people accidentally
converting line endings.
2023-08-12 17:37:52 +02:00
Anonymous Maarten a5d9db0cd0 cmake: build tests for UWP 2023-08-12 17:37:52 +02:00
Anonymous Maarten b7889a7389 winrt: use windowsio in non-libc mode
CMake's SDL_build_config.h force disables HAVE_STDIO_H when buiding
winrt in non-libc mode.

Becase CreateFileEx is not available in UWP mode, use CreateFile2
instead.
2023-08-12 17:37:52 +02:00
Anonymous Maarten ea8757a748 Make testaudiostreamdynamicresample compatible with emscripten 2023-08-12 17:37:20 +02:00
Anonymous Maarten 1a7a74fb2e cmake: build emscripten tests as html page 2023-08-12 17:37:20 +02:00
Anonymous Maarten 64d570f027 Add minimal http server for emscripten test apps 2023-08-12 17:37:20 +02:00
Anonymous Maarten 8e898c4a21 SDL_test does not parse --samples argument 2023-08-12 17:37:20 +02:00
Ryan C. Gordon 91cd5478be
audio: Fix resampler overflowing input buffer.
This usually manifests as a clicking sound, because it often produces
a value outside the range -1.0f to 1.0f based on whatever random data
is past the buffer, which later stages of audio conversion will clamp
to a maximum value for the audio format. Since this tends to be a single
bad sample generated at the end of the resampled buffer, it sounds like
a repeating click in streamed data.

I'd like a more efficient means to clamp this value to not overflow the
buffer, but this puts out the immediate fire.
2023-08-12 00:57:35 -04:00
Ryan C. Gordon f290c85b22
testaudiocapture: Make sure we convert captured audio to output format.
Fixes #8114.
2023-08-11 16:52:23 -04:00
Ryan C. Gordon b75c751dfc
rwlock: Make generic implmentations work on single-threaded platforms.
Fixes #8101.
2023-08-11 15:03:32 -04:00
Sam Lantinga 80850af7ce The controller update complete events are no longer disabled by default 2023-08-10 17:45:00 -07:00
Sam Lantinga 3f486224a9 Fixed refresh rate calculation for KMSDRM 2023-08-10 15:39:38 -07:00
Anonymous Maarten 342ec51131 Fix overflow when doing SDL_sscanf("%hd", ...)
An overflow occured in the stdlib_sscanf test, when using msys2 clang32 toolchain.
2023-08-10 15:06:42 -07:00
Sam Lantinga 9129e1d557 Fixed crash when setting the default cursor twice
This happens in the KMSDRM driver, once after video init, setting a blank default cursor, and once when creating a window when the KMSDRM mouse is initialized.

Also fixed a memory leak freeing the default cursor at shutdown
2023-08-10 12:13:40 -07:00
Sam Lantinga 8e99a4f4f5 Undo variable rename 2023-08-10 11:45:20 -07:00
Sam Lantinga be67f0de10 Fixed crashes related to the default cursor on WinRT and KMSDRM
Fixes https://github.com/libsdl-org/SDL/issues/8104
2023-08-10 11:40:36 -07:00
Mathieu Eyraud 94b3f78c44 Fix out of bound read of 'has_hat' array 2023-08-10 08:25:01 -07:00
Sam Lantinga 94f48f19b0 Use more specific build destinations when creating an xcframework 2023-08-10 01:52:10 -07:00
Sam Lantinga dabd45997e Back out change supporting multiple names for binding elements
testcontroller expects to be able to call SDL_GetGamepadStringForButton() and find that name in the binding string

We can revisit this later if it becomes important to use new names in bindings. @smcv
2023-08-09 11:25:37 -07:00
Simon McVittie efe15588d5 Relabel back paddles as left or right
The sequence order of the four paddles is not obvious, with SDL and Xbox
controllers swapping the order of P2 and P3 relative to each other.
If we group them into left and right, then it becomes more obvious.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-09 11:03:30 -07:00
Anonymous Maarten be884f0c95 ci: disable visionos.yml by renaming the file 2023-08-09 19:17:20 +02:00