This is happening because the processing function keeps reading audio
data from the AudioBuffer even after it has been marked as stopped.
There is also an error in ReadAudioBufferFramesInInternalFormat() where
if it is called on a stopped sound, it'll still return audio frames.
This has also been addressed with this commit.
* Audio: Stop setting capture config options.
Since the device is being configured as a playback device, all capture
config options are unused and therefore need to not be set.
* Audio: Stop pre-silencing the miniaudio output buffer.
raylib already manually silences the output buffer prior to mixing so
there is no reason to have miniaudio also do it. It can therefore be
disabled via the device config to make data processing slightly more
efficient.
* Audio: Stop forcing fixed sized processing callbacks.
There is no requirement for raylib to have guaranteed fixed sized
audio processing. By disabling it, audio processing can be made more
efficient by not having to run the data through an internal intermediary
buffer.
* Audio: Make the period size (latency) configurable.
The default period size is 10ms, but this is inappropriate for certain
platforms so it is useful to be able to allow those platforms to
configure the period size as required.
* Audio: Fix documentation for pan.
The pan if -1..1, not 0..1.
* Audio: Remove use of ma_data_converter_get_required_input_frame_count().
This function is being removed from miniaudio. To make this work with
the current architecture of raylib it requires the use of a cache.
This commit implements a generic solution that works across all
AudioBuffer types (static, streams and callback based), but the static
case could be optimized to avoid the cache by incorporating the
functionality of ReadAudioBufferFramesInInternalFormat() into
ReadAudioBufferFramesInMixingFormat(). It would be unpractical to avoid
the cache with streams and callback-based AudioBuffers however so this
commit sticks with a generic solution.
* Audio: Correct usage of miniaudio's dynamic rate adjustment.
This affects pitch shifting. The output rate is being modified with
ma_data_converter_set_rate(), but then that value is being used in the
computation of the output rate the next time SetAudioBufferPitch() which
results in a cascade. The correct way to do this is to use an anchored
output rate as the basis for the calculation after pitch shifting. In
this case, it's the device's sample rate that acts as the anchor.
* Audio: Optimize memory usage for data conversion.
This reduces the per-AudioBuffer conversion cache from 256 PCM frames
down to 8.
* [rmodels] Added implementation of `UpdateModelAnimationBonesWithBlending()` function
Signed-off-by: Kirandeep-Singh-Khehra <kirandeepsinghkhehra@gmail.com>
* [rmodels] Added example for animation blending and fixed wrap issue for blend factor
Signed-off-by: Kirandeep-Singh-Khehra <kirandeepsinghkhehra@gmail.com>
* [rmodels] Updated build information for animation blending example
Signed-off-by: Kirandeep-Singh-Khehra <kirandeepsinghkhehra@gmail.com>
* [rmodels] Fixed typos in anmation blending example
Signed-off-by: Kirandeep-Singh-Khehra <kirandeepsinghkhehra@gmail.com>
* [rmodels] Updated blend function signature and added function to update verts from bones
Signed-off-by: Kirandeep-Singh-Khehra <kirandeepsinghkhehra@gmail.com>
* [rmodels] Updated documentation
Signed-off-by: Kirandeep-Singh-Khehra <kirandeepsinghkhehra@gmail.com>
* rlparser: update raylib_api.* by CI
* rlparser: update raylib_api.* by CI
---------
Signed-off-by: Kirandeep-Singh-Khehra <kirandeepsinghkhehra@gmail.com>
Co-authored-by: Ray <raysan5@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Fix window scaling on Wayland with GLFW 3.4+ display scaling
GLFW 3.4 defaults GLFW_SCALE_FRAMEBUFFER to TRUE on all platforms,
causing framebuffer/window size mismatch on Wayland with display
scaling (content renders in a subset of the window, mouse coordinates
are wrong).
Three fixes:
- Disable GLFW_SCALE_FRAMEBUFFER on Wayland when FLAG_WINDOW_HIGHDPI
is not set, restoring 1:1 window-to-framebuffer mapping
- With FLAG_WINDOW_HIGHDPI, read actual framebuffer size from GLFW
instead of resizing the window (which double-scales on Wayland
where GLFW_SCALE_TO_MONITOR has no effect)
- Skip mouse coordinate scaling on Wayland since GLFW already reports
coordinates in logical (window) space
Tested on NixOS/Niri with GLFW 3.4 at 1x, 1.5x, and 2x scaling.
Fixes#5504
* Fix fullscreen and borderless windowed scaling on Wayland with HiDPI
ToggleFullscreen and ToggleBorderlessWindowed exit paths manually
scale screen size by DPI before passing to glfwSetWindowMonitor,
which double-scales on Wayland where GLFW_SCALE_FRAMEBUFFER already
handles it. Skip the manual resize on Wayland.
Also fix FramebufferSizeCallback fullscreen branch: on Wayland with
GLFW_SCALE_FRAMEBUFFER the framebuffer is still scaled in fullscreen,
so use the logical window size as screen size and derive screenScale
from the framebuffer/window ratio.
Fixes#5504
* Apply style fixes from code review: remove duplicate screenScale assignment, collapse single-statement ifs to one line, remove trailing periods from comments