Commit Graph

7990 Commits (ee806597b90376b46c72d0ce004d86d2300cd1b5)

Author SHA1 Message Date
Sam Lantinga ee806597b9 Removed SDL_vulkan_internal.h from SDL_sysvideo.h
Reference: https://github.com/libsdl-org/SDL/issues/8142
2023-08-25 08:18:29 -07:00
Ethan Lee 6f8a6a31ca gdk: GetBasePath should be a UTF8 version of Win32 GetBasePath 2023-08-25 10:47:16 -04:00
Ethan Lee c0cd8c8142 gdk: Add SDL_GDKGetDefaultUser, SDL_GetPrefPath implementation 2023-08-25 10:40:16 -04:00
Brick 106abce69f Refactored GetAudioStreamDataInternal buffer handling
The final conversion step should now always go straight into the output buffer.
2023-08-25 08:43:56 -04:00
Brick e44f54ec54 Avoid using hex-floats 2023-08-25 08:43:56 -04:00
Brick 5b696996cd Added ResampleFrame_SSE 2023-08-25 08:43:56 -04:00
Brick ab83f75bb9 Make sure GetAudioStreamDataInternal is called with a valid length 2023-08-25 08:43:56 -04:00
Brick 6a73f74b6b Rebuild full ResamplerFilter (left wing + right wing) at runtime 2023-08-25 08:43:56 -04:00
Brick 0c15ce0060 Add a missing int cast 2023-08-25 08:43:56 -04:00
Brick b74ee86b1d Optimized ResampleAudio, with special cases for 1 and 2 channels
This would also benefit from some SIMD, since it's just a bunch of multiply-adds
2023-08-25 08:43:56 -04:00
Brick fba6e1e3d3 Removed ResamplerFilterDifference
It takes 1 extra multiply to calculate the correct interpolation,
but I think the improvement in cache locality (and binary size) outweighs that.
2023-08-25 08:43:56 -04:00
Brick 9f7a22fa45 Removed 64-bit handling from AudioConvertByteswap 2023-08-25 08:43:56 -04:00
Brick 1f5327a9fb Removed future_buffer, left_padding, and right_padding from SDL_AudioStream 2023-08-25 08:43:56 -04:00
Brick 71ad52d6db Lowered SDL_GetAudioStreamData to 32 KB
No particular reason for this number, but 1 MB was a bit silly
2023-08-25 08:43:56 -04:00
Sam Lantinga 69aec8c915 Fixed the report format for the Razer Wolverine V2 Pro 2023-08-24 11:37:50 -07:00
Sam Lantinga 8924d0d927 Added missing function prototype for SDL_WriteS64BE() 2023-08-23 21:19:25 -07:00
Sam Lantinga 845f3c7450 Fixed mismatch between stdlib calloc() and SDL free()
Fixes https://github.com/libsdl-org/SDL/issues/8145
2023-08-23 14:49:29 -07:00
Ryan C. Gordon fb79211732
emscriptenaudio: Fire the capture silence_callback at an interval.
Previously it was using setTimeout, not setInterval, so it would only fire
once, which was obviously a mistake.
2023-08-23 16:12:30 -04:00
Ryan C. Gordon 5191b20541
emscriptenaudio: Don't bother undefining things about to be unreachable.
Since the top-level table is getting undefined, all the things in it will
be unreachable and eligible for garbage collection without explicitly
nulling them out.
2023-08-23 16:11:08 -04:00
Ryan C. Gordon fd75a4ca05
emscriptenaudio: Deal with blocked audio devices better.
Now, if the AudioContext starts in a "suspended" state, because the browser
blocked it from playing by default, we we run the audio "thread" in a timer
and throw away the generated audio. Once the AudioContext is allowed to
resume, we clear this timer.

The end result is that the app will continue to drain its audio queue
instead of consuming more memory over time (and, if it relies on an audio
callback to make progress, continue to run!), with the effect that the
page is merely silent but otherwise functioning as intended.

Once the user interacts with the page and the browser permits the the
AudioContext to run for real, audio should still be in sync, instead of
just starting to play audio that might now be at least several seconds behind.
2023-08-23 14:32:23 -04:00
Ryan C. Gordon 981b8a337a
emscriptenaudio: Remove unnecessary functions. 2023-08-23 14:32:23 -04:00
Sam Huang c7588e4261
Transparent window for Win32 + OpenGL (#8143)
* Transparent window for Win32 + OpenGL via DWM
2023-08-23 07:42:59 -07:00
Brick e6c878824c Fixed ResampleAudio interpolation factor calculation 2023-08-22 08:34:22 -04:00
Brick 4983638630 Misc audio tweaks/cleanup 2023-08-21 16:02:54 -04:00
Brick 72d9d53def Invert the inner ResampleAudio loops to avoid doing unnecessary work 2023-08-21 16:02:54 -04:00
Brick 88123a5109 The history buffer should always have the maximum possible padding frames 2023-08-21 16:02:54 -04:00
Brick 96e47f1657 Clamp results of GetResampler(AvailableOutput|NeededInput)Frames 2023-08-21 16:02:54 -04:00
Brick 14e38b17d6 Removed assertions from inner ResampleAudio loop 2023-08-21 16:02:54 -04:00
Brick 9d413dfdc2 The history buffer doesn't need to be so large 2023-08-21 16:02:54 -04:00
Brick 2788e848f8 Allow resampling less than 1 frame of input 2023-08-21 16:02:54 -04:00
Brick 383084e0ad Pre-calculate resampling rate, and use it instead of .freq in most places 2023-08-21 16:02:54 -04:00
Brick 40a6a445ce Update resample_offset inside ResampleAudio 2023-08-21 16:02:54 -04:00
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 33f11e21ee Removed assertions in AudioConvert(To|From)Float 2023-08-14 15:07:18 -04: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