diff --git a/.github/workflows/webassembly.yml b/.github/workflows/webassembly.yml
index 198e88802..b50cd8c46 100644
--- a/.github/workflows/webassembly.yml
+++ b/.github/workflows/webassembly.yml
@@ -29,7 +29,7 @@ jobs:
- name: Setup emsdk
uses: mymindstorm/setup-emsdk@v11
with:
- version: 3.0.0
+ version: 3.1.30
actions-cache-folder: 'emsdk-cache'
- name: Setup Release Version
diff --git a/BINDINGS.md b/BINDINGS.md
index e232b1b6c..0b2acc36d 100644
--- a/BINDINGS.md
+++ b/BINDINGS.md
@@ -27,7 +27,7 @@ Some people ported raylib to other languages in form of bindings or wrappers to
| raylib-go | **4.2** | [Go](https://golang.org/) | Zlib | https://github.com/gen2brain/raylib-go |
| raylib-guile | auto | [Guile](https://www.gnu.org/software/guile/) | Zlib | https://github.com/petelliott/raylib-guile |
| gforth-raylib | 3.5 | [Gforth](https://gforth.org/) | MIT | https://github.com/ArnautDaniel/gforth-raylib |
-| h-raylib | 4.5-dev | [Haskell](https://haskell.org/) | Apache-2.0 | https://github.com/Anut-py/h-raylib |
+| h-raylib | **4.5** | [Haskell](https://haskell.org/) | Apache-2.0 | https://github.com/Anut-py/h-raylib |
| raylib-hx | **4.2** | [Haxe](https://haxe.org/) | Zlib | https://github.com/foreignsasquatch/raylib-hx |
| hb-raylib | 3.5 | [Harbour](https://harbour.github.io) | MIT | https://github.com/MarcosLeonardoMendezGerencir/hb-raylib |
| jaylib | **4.2** | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | GPLv3+CE | https://github.com/electronstudio/jaylib/ |
@@ -68,9 +68,10 @@ Some people ported raylib to other languages in form of bindings or wrappers to
| raylib-vapi | **4.2** | [Vala](https://vala.dev/) | Zlib | https://github.com/lxmcf/raylib-vapi |
| raylib-wren | **4.0** | [Wren](http://wren.io/) | ISC | https://github.com/TSnake41/raylib-wren |
| raylib-zig | **4.2** | [Zig](https://ziglang.org/) | MIT | https://github.com/Not-Nik/raylib-zig |
-| raylib.zig | **4.2** | [Zig](https://ziglang.org/) | MIT | https://github.com/ryupold/raylib.zig |
+| raylib.zig | **4.5** | [Zig](https://ziglang.org/) | MIT | https://github.com/ryupold/raylib.zig |
| hare-raylib | auto | [Hare](https://harelang.org/) | Zlib | https://git.sr.ht/~evantj/hare-raylib |
-
+| raylib-sunder | auto | [Sunder](https://github.com/ashn-dot-dev/sunder) | 0BSD | https://github.com/ashn-dot-dev/raylib-sunder |
+| rayed-bqn | auto | [BQN](https://mlochbaum.github.io/BQN/) | MIT | https://github.com/Brian-ED/rayed-bqn |
### Utility Wrapers
diff --git a/CHANGELOG b/CHANGELOG
index 8cbbaa2b1..43ab3ab44 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,25 +1,26 @@
changelog
---------
-Current Release: raylib 4.2.0 (11 August 2022)
+Current Release: raylib 4.5.0 (18 March 2023)
-------------------------------------------------------------------------
-Release: raylib 4.5 (xx February 2023) -WIP-
+Release: raylib 4.5 (18 March 2023)
-------------------------------------------------------------------------
KEY CHANGES:
- - ADDED: M3D model format support with animations
- - ADDED: GLTF animation support
- - ADDED: QOA audio format support (import/export) -WIP-
- - rlgl redesign to avoid render batch triangles limits pre-check: rlCheckRenderBatchLimit()
- - rshapes simplification to minimize the requirement of rlgl functionality, now it only depends on 6 functions
- - rl_gputex.h: Compressed textures loading, required by rtextures module, has been moved to a separate self-contained library
- - raygui 3.5: New version of the immediate-mode gui system for tools development with raylib
+ - ADDED: Improved ANGLE support on Desktop platforms
+ - ADDED: rcamera module, simpler and more extendable
+ - ADDED: Support for M3D models and M3D/GLTF animations
+ - ADDED: Support QOA audio format (import/export)
+ - ADDED: rl_gputex module for compressed textures loading
+ - REDESIGNED: rlgl module for automatic render-batch limits checking
+ - REDESIGNED: rshapes module to minimize the rlgl dependency
Detailed changes:
[core] ADDED: RAYLIB_VERSION_* values to raylib.h (#2856) by @RobLoach
[core] ADDED: Basic gamepad support for Android (#2709) by @deniska
[core] ADDED: Support CAPS/NUM lock keys registering if locked
[core] ADDED: _GNU_SOURCE define on Linux (#2729)
+[core] ADDED: SetWindowIcons() to set multiple icon image sizes
[core] `WARNING`: RENAMED: Exported raylib version symbol to raylib_version #2671
[core] REMOVED: Touch points on touch up events on Android (#2711) by @deniska
[core] REVIEWED: Window position setup on InitWindow() (#2732) by @RandomErrorMessage
@@ -37,19 +38,30 @@ Detailed changes:
[core] REVIEWED: GetKeyPressed(), out of range issue (#2814) by @daipom
[core] REVIEWED: GetTime(), renamed variable 'time' to 'nanoSeconds' (#2816) by @jtainer
[core] REVIEWED: LoadShaderFromMemory(), issue with shader linkage
-[core] REVIEWED: Avoid possible gamepad index as -1 (#2839)
+[core] REVIEWED: Avoid possible gamepad index as -1 (#2839)
[core] REVIEWED: SetShaderValue*(), avoid setup uniforms for invalid locations
[core] REVIEWED: GetClipboardText() on PLATFORM_WEB, permissions issues
[core] REVIEWED: Initial window position for display-sized fullscreen (#2742) by @daipom
[core] REVIEWED: Sticky touches input (#2857) by @ImazighenGhost
[core] REVIEWED: Enable GetWindowHandle() on macOS (#2915) by @Not-Nik
+[core] REVIEWED: Window position always inits centered in current monitor
+[core] REVIEWED: IsWindowFocused() to consider Android App state (#2935)
+[core] REVIEWED: GetMonitorWidth() and GetMonitorHeight() (#2934)
+[core] REVIEWED: GetWindowHandle() to return Linux window (#2938)
+[core] REVIEWED: WindowDropCallback(), additional security check (#2943)
+[core] REVIEWED: Security checks for emscripten_run_script() (#2954)
+[utils] REVIEWED: TraceLog() message size limit overflow
+[rcamera] REDESIGNED: New implementation from scratch (#2563) by @Crydsch
+[rcamera] REVIEWED: Make orbital camera work as expected (#2926) by @JeffM2501
+[rcamera] REVIEWED: Multiple reviews on the new implementation
+[rcamera] ADDED: UpdateCameraPro(), supporting custom user inputs
[rlgl] ADDED: OpenGL ES 2.0 support on PLATFORM_DESKTOP (#2840) by @wtnbgo
[rlgl] ADDED: Separate blending modes for color and alpha, BLEND_CUSTOM_SEPARATE (#2741)
[rlgl] ADDED: rlSetBlendFactorsSeparate and custom blend mode modification checks (#2741) by @pure01fx
[rlgl] ADDED: RL_TEXTURE_MIPMAP_BIAS_RATIO support to `rlTextureParameters()` for OpenGL 3.3 #2674
[rlgl] ADDED: rlCubemapParameters() (#2862) by @GithubPrankster
[rlgl] ADDED: rlSetCullFace() (#2797) by @jtainer
-[rlgl] REMOVED: Mipmaps software generation for OpenGL 1.1
+[rlgl] REMOVED: Mipmaps software generation for OpenGL 1.1
[rlgl] REVIEWED: Check for extensions before enabling them (#2706) by @Not-Nik
[rlgl] REVIEWED: SSBO usage to avoid long long data types
[rlgl] REVIEWED: Enable DXT compression on __APPLE__ targets (#2694) by @Not-Nik
@@ -58,6 +70,7 @@ Detailed changes:
[rlgl] REVIEWED: rlMultMatrixf(), use const pointer (#2807) by @planetis-m
[rlgl] REVIEWED: Expose OpenGL blending mode factors and functions/equations
[rlgl] REVIEWED: rLoadTextureDepth(), issue with depth textures on WebGL (#2824)
+[rlgl] REVIEWED: rlUnloadFramebuffer() (#2937)
[raymath] ADDED: Vector2LineAngle() (#2887)
[raymath] REVIEWED: Vector2Angle() (#2829, #2832) by @AlxHnr, @planetis-m
[shapes] ADDED: CheckCollisionPointPoly() (#2685) by @acejacek
@@ -73,7 +86,7 @@ Detailed changes:
[textures] ADDED: ImageBlurGaussian() (#2770) by @nobytesgiven
[textures] REVIEWED: Image fileformat support: PIC, PNM
[textures] REVIEWED: ImageTextEx() and ImageDrawTextEx() scaling (#2756) by @hatkidchan
-[textures] `WARNING`: REMOVED: DrawTextureQuad()
+[textures] `WARNING`: REMOVED: DrawTextureQuad()
[textures] `WARNING`: REMOVED: DrawTexturePoly(), function moved to example: `textures_polygon`
[textures] `WARNING`: REMOVED: DrawTextureTiled(),function implementation moved to the textures_tiled.c
[text] ADDED: GetCodepointPrevious()
@@ -81,7 +94,6 @@ Detailed changes:
[text] `WARNING`: RENAMED: TextCodepointsToUTF8() to LoadUTF8()
[text] `WARNING`: RENAMED: GetCodepoint() -> GetCodepointNext()
[text] REDESIGNED: GetCodepointNext()
-[text] REVIEWED text_codepoints_loading.c
[text] REVIEWED: MeasureTextEx(), avoid crash on bad data
[text] REVIEWED: UnloadFontData(), avoid crash on invalid font data
[models] ADDED: Support M3D model file format (meshes and materials) (#2648) by @bztsrc
@@ -89,41 +101,53 @@ Detailed changes:
[models] ADDED: GLTF animation support (#2844) by @charles-l
[models] ADDED: DrawCapsule() and DrawCapsuleWires() (#2761) by @IanBand
[models] ADDED: LoadMaterials(), MTL files loading, same code as OBJ loader (#2872) by @JeffM2501
+[models] `WARNING`: REMOVED: UnloadModelKeepMeshes()
+[models] `WARNING`: REMOVED: DrawCubeTexture(), DrawCubeTextureRec(), functions moved to new example: `models_draw_cube_texture`
[models] REVIEWED: DrawMesh(), using SHADER_LOC_COLOR_SPECULAR as a material map (#2908) by @haved
[models] REVIEWED: LoadM3D() vertex color support (#2878) by @GithubPrankster, @bztsrc
[models] REVIEWED: GenMeshHeightmap() (#2716)
[models] REVIEWED: LoadIQM() (#2676)
[models] REVIEWED: Simplify .vox signature check (#2752) by @CrezyDud
[models] REVIEWED: LoadIQM(), support bone names loading if available (#2882) by @PencilAmazing
-[models] `WARNING`: REMOVED: DrawCubeTexture(), DrawCubeTextureRec(), functions moved to new example: `models_draw_cube_texture`
+[models] REVIEWED: GenMeshTangents(), avoid crash on missing texcoords data (#2927)
+[audio] ADDED: Full support for QOA audio file format
+[audio] ADDED: Mixed audio processor (#2929) by @hatkidchan
[audio] ADDED: IsWaveReady()`, IsSoundReady(), IsMusicReady() (#2892) by @RobLoach
+[audio] `WARNING`: REMOVED: Multichannel audio API: PlaySoundMulti(), StopSoundMulti()
[audio] REVIEWED: Clear PCM buffer state when closing audio device (#2736) by @veins1
[audio] REVIEWED: Android backend selected (#2118, #2875) by @planetis-m
+[audio] REVIEWED: Change default threading model for COM objects in miniaudio
[multi] ADDED: IsShaderReady(), IsImageReady(), IsFontReady() (#2892) by @RobLoach
[multi] ADDED: IsModelReady(), IsMaterialReady(), IsTextureReady(), IsRenderTextureReady() (#2895) by @RobLoach
[multi] REVIEWED: Multiple code/comment typos by @sDos280
[multi] REVIEWED: Grammar mistakes and typos (#2914) by @stickM4N
[multi] REVIEWED: Use TRACELOG() macro instead of TraceLog() in internal modules (#2881) by @RobLoach
[examples] ADDED: textures_textured_curve (#2821) by @JeffM2501
+[examples] ADDED: models_draw_cube_texture
+[examples] ADDED: models_loading_m3d (#2648) by @bztsrc
[examples] ADDED: shaders_write_depth (#2836) by @BugraAlptekinSari
[examples] ADDED: shaders_hybrid_render (#2919) by @BugraAlptekinSari
+[examples] REMOVED: audio_multichannel_sound
[examples] RENAMED: Several shaders for naming consistency (#2707)
[examples] RENAMED: lighting_instanced.fs to lighting_instancing.fs (glsl100) (#2805) by @gtrxAC
[examples] REVIEWED: core_custom_logging.c (#2692) by @hartmannathan
[examples] REVIEWED: core_camera_2d_platformer (#2687) by @skylar779
[examples] REVIEWED: core_input_gamepad.c (#2903) by @planetis-m
[examples] REVIEWED: core_custom_frame_control
+[examples] REVIEWED: core_drop_files (#2943)
[examples] REVIEWED: text_rectangle_bounds (#2746) by @SzieberthAdam
[examples] REVIEWED: textures_image_processing, added gaussian blurring (#2775) by @nobytesgiven
[examples] REVIEWED: models_billboard, highlighting rotation and draw order (#2779) by @nobytesgiven
[examples] REVIEWED: core_loading_thread, join thread on completion (#2845) by @planetis-m
[examples] REVIEWED: models_loading_gltf
[examples] REVIEWED: Shader lighting.fs for GLSL120 (#2651)
+[examples] REVIEWED: text_codepoints_loading.c
[parser] REVIEWED: raylib-parser Makefile (#2765) by @Peter0x44
[build] ADDED: Packaging for distros with deb-based and rpm-based packages (#2877) by @KOLANICH
[build] ADDED: Linkage library -latomic on Linux (only required for ARM32)
[build] ADDED: Required frameworks on macOS (#2793) by @SpexGuy
[build] ADDED: WASM support for Zig build (#2901) by @Not-Nik
+[build] ADDED: New raylib examples as VS2022 project (to raylib solution)
[build] REVIEWED: config.h format and inconsistencies
[build] REVIEWED: Zig build to latest master, avoid deprecated functions (#2910) by @star-tek-mb
[build] REVIEWED: CMake project template to easily target raylib version (#2700) by @RobLoach
@@ -137,6 +161,7 @@ Detailed changes:
[build] REVIEWED: Several compilation warnings (for strict rules)
[build] REVIEWED: All github workflows using deprecated actions
[build] REVIEWED: CMake when compiling for web (#2820) by @object71
+[build] REVIEWED: DLL build on Windows (#2951) by @Skaytacium
[build] REVIEWED: Avoid MSVC warnings in raylib project (#2871) by @JeffM2501
[build] REVIEWED: Paths in .bat files to build examples (#2870) by @masoudd
[build] REVIEWED: CMake, use GLVND for old cmake versions (#2826) by @simendsjo
@@ -153,6 +178,9 @@ Detailed changes:
[bindings] ADDED: TurboRaylib (Object Pascal) by @turborium
[bindings] ADDED: Kaylib (Kotlin/Native) by @Its-Kenta
[bindings] ADDED: Raylib-Nelua (Nelua) by @Its-Kenta
+[bindings] ADDED: Cyber (Cyber) by @fubark
+[bindings] ADDED: raylib-sunder (Sunder) by @ashn-dot-dev
+[bindings] ADDED: raylib BQN (#2962) by @Brian-ED
[misc] REVIEWED: Update external libraries to latest versions
-------------------------------------------------------------------------
diff --git a/HISTORY.md b/HISTORY.md
index cebac5362..5ae12c05c 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -395,3 +395,40 @@ Highlights for `raylib 4.2`:
As always, there are more improvements than the key features listed, make sure to check raylib [CHANGELOG](CHANGELOG) for the detailed list of changes; for this release a `WARNING` flag has been added to all the changes that could affect bindings or productivity code. **raylib keeps improving one more version** and a special focus on maintainability has been put on the library for the future. Specific/advance functionality will be provided through **raylib-extras** repos and raylib main repo devlelopment will be focused on what made raylib popular: being a simple and easy-to-use library to **enjoy videogames programming**.
**Enjoy gamedev/tools/graphics programming!** :)
+
+notes on raylib 4.5
+-------------------
+
+It's been **7 months** since latest raylib release. As usual, **many parts of the library have been reviewed and improved** along those months. Many issues have been closed, staying under 10 open issues at the moment of this writting and also many PRs from contributors have been received, reviewed and merged into raylib library. Some new functions have been added and some others have been removed to improve library coherence and avoid moving too high level, giving the users the tools to implement advance functionality themselfs over raylib. Again, this is a big release with a considerable amount of changes and improvements. Here it is a small summary highlighting this new **rayib 4.5**.
+
+Some numbers for this release:
+
+ - **+100** closed issues (for a TOTAL of **+1340**!)
+ - **+350** commits since previous RELEASE (for a TOTAL of **+6350**!)
+ - **+25** functions ADDED to raylib API (for a TOTAL of **516**!)
+ - **+40** functions REVIEWED/REDESIGNED
+ - **+40** new contributors (for a TOTAL of **405**!)
+
+Highlights for `raylib 4.5`:
+
+ - **`NEW` Improved ANGLE support on Desktop platforms**: Support for OpenGL ES 2.0 on Desktop platforms (Windows, Linux, macOS) has been reviewed by @wtnbgo GitHub user. Now raylib can be compiled on desktop for OpenGL ES 2.0 and linked against [`ANGLE`](https://github.com/google/angle). This _small_ addition open the door to building raylib for all **ANGLE supported backends: Direct3D 11, Vulkan and Metal**. Please note that this new feature is still experimental and requires further testing!
+
+ - **`NEW` Camera module**: A brand new implementation from scratch for `rcamera` module, contributed by @Crydsch GitHub user! **New camera system is simpler, more flexible, more granular and more extendable**. Specific camera math transformations (movement/rotation) have been moved to individual functions, exposing them to users if required. Global state has been removed from the module and standalone usage has been greatly improved; now `rcamera.h` single-file header-only library can be used externally, independently of raylib. A new `UpdateCameraPro()` function has been added to address input-dependency of `UpdateCamera()`, now advance users have **full control over camera inputs and movement/rotation speeds**!
+
+ - **`NEW` Support for M3D models and M3D/GLTF animations**: 3d models animations support has been a limited aspect of raylib for long time, some versions ago IQM animations were supported but raylib 4.5 also adds support for the brand new [M3D file format](https://bztsrc.gitlab.io/model3d/), including animations and the long expected support for **GLTF animations**! The new M3D file format is **simple, portable, feature complete, extensible and open source**. It also provides a complete set of tools to export/visualize M3D models from/to Blender! Now raylib supports up to **3 model file-formats with animations**: `IQM`, `GLTF` and `M3D`.
+
+ - **`NEW` Support QOA audio format (import/export)**: Just a couple of months ago the new [QOA file format](https://qoaformat.org/) was published, a very simple, portable and open source quite-ok-audio file format. raylib already supports it, added to `raudio` module and including audio loading from file, loading from memory, streaming from file, streaming from memory and **exporting to QOA** audio format. **Because simplicity really matters to raylib!**
+
+ - **`NEW` Module for compressed textures loading**: [`rl_gputex`](https://github.com/raysan5/raylib/blob/master/src/external/rl_gputex.h), a portable single-file header-only small library to load compressed texture file-formats (DDS, PKM, KTX, PVR, ASTC). Provided functionality is not new to raylib but it was part of the raylib `rtextures` module, now it has been moved into a separate self-contained library, **improving portability**. Note that this module is only intended to **load compressed data from files, ready to be uploaded to GPU**, no compression/decompression functionality is provided. This change is a first step towards a better modularization of raylib library.
+
+ - **Reviewed `rlgl` module for automatic limits checking**: Again, [`rlgl`](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) has been reviewed to simplify usage. Now users do not need to worry about reaching the internal render-batch limits when they send their triangles to draw 2d/3d, `rlgl` manages it automatically! This change allows a **great simplification for other modules** like `rshapes`, `rtextures` and `rmodels` that do not need to worry about bufffer overflows and can just define as many vertex as desired!
+
+ - **Reviewed `rshapes` module to minimize the rlgl dependency**: Now `rshapes` 2d shapes drawing functions **only depend on 6 low-level functions**: `rlBegin()`, `rlEnd()`, `rlVertex3f()`, `rlTexCoord2f()`, `rlNormal3f()`, `rlSetTexture()`. With only those pseudo-OpenGl 1.1 minimal functionality, everything can be drawn! This improvement converts `rshapes` module in a **self-contained, portable shapes-drawing library that can be used independently of raylib**, as far as entry points for those 6 functions are provided by the user. It even allows to be used for software rendering, with the proper backend!
+
+ - **Added data structures validation functions**: Multiple functions have been added by @RobLoach GitHub user to ease the validation of raylib data structures: `IsImageReady()`, `IsTextureReady()`, `IsSoundReady()`... Now users have a simple mechanism to **make sure data has been correctly loaded**, instead of checking internal structure values by themselfs.
+
+As usual, those are only some highlights but there is much more! New image generators, new color transformation functionality, improved blending support for color/alpha, etc... Make sure to check raylib [CHANGELOG]([CHANGELOG](https://github.com/raysan5/raylib/blob/master/CHANGELOG)) for a detailed list of changes! Please, note that all breaking changes have been flagged with a `WARNING` in the CHANGELOG, specially useful for binding creators!
+
+**raylib keeps improving one more version** with a special focus on maintainability and sustainability. Always working towards making the library more **simple and easy-to-use**.
+
+Let's keep **enjoying games/tools/graphics programming!** :)
diff --git a/README.md b/README.md
index c66eed75e..05ba5ccf0 100644
--- a/README.md
+++ b/README.md
@@ -38,10 +38,10 @@ features
--------
- **NO external dependencies**, all required libraries are [bundled into raylib](https://github.com/raysan5/raylib/tree/master/src/external)
- Multiple platforms supported: **Windows, Linux, MacOS, RPI, Android, HTML5... and more!**
- - Written in plain C code (C99) in PascalCase/camelCase notation
+ - Written in plain C code (C99) using PascalCase/camelCase notation
- Hardware accelerated with OpenGL (**1.1, 2.1, 3.3, 4.3 or ES 2.0**)
- **Unique OpenGL abstraction layer** (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h)
- - Multiple **Fonts** formats supported (TTF, XNA fonts, AngelCode fonts)
+ - Multiple **Fonts** formats supported (TTF, Image fonts, AngelCode fonts)
- Multiple texture formats supported, including **compressed formats** (DXT, ETC, ASTC)
- **Full 3D support**, including 3D Shapes, Models, Billboards, Heightmaps and more!
- Flexible Materials system, supporting classic maps and **PBR maps**
@@ -51,7 +51,7 @@ features
- Audio loading and playing with streaming support (WAV, OGG, MP3, FLAC, XM, MOD)
- **VR stereo rendering** support with configurable HMD device parameters
- Huge examples collection with [+120 code examples](https://github.com/raysan5/raylib/tree/master/examples)!
- - Bindings to [+50 programming languages](https://github.com/raysan5/raylib/blob/master/BINDINGS.md)!
+ - Bindings to [+60 programming languages](https://github.com/raysan5/raylib/blob/master/BINDINGS.md)!
- **Free and open source**.
basic example
diff --git a/ROADMAP.md b/ROADMAP.md
index f25f83459..61c6b56e3 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -3,16 +3,21 @@
Here it is a wishlist with features and ideas to improve the library. Note that features listed here are usually long term improvements or just describe a route to follow for the library. There are also some additional places to look for raylib improvements and ideas:
- [GitHub Issues](https://github.com/raysan5/raylib/issues) has several open issues for possible improvements or bugs to fix.
- - [raylib source code](https://github.com/raysan5/raylib/tree/master/src) has multiple *TODO* comments around code with pending things to review or improve.
- - raylib wishlists discussions (https://github.com/raysan5/raylib/discussions/1502, https://github.com/raysan5/raylib/discussions/2272) are open to everyone to ask for improvements, feel free to check and comment.
+ - [raylib source code](https://github.com/raysan5/raylib/tree/master/src) has multiple *TODO* comments around code with pending things to review or improve.
+ - raylib wishlists discussions are open to everyone to ask for improvements, feel free to check and comment:
+ - [raylib wishlist 2021](https://github.com/raysan5/raylib/discussions/1502)
+ - [raylib wishlist 2022](https://github.com/raysan5/raylib/discussions/2272)
+ - [raylib 5.0 wishlist](https://github.com/raysan5/raylib/discussions/2952)
_Current version of raylib is complete and functional but there is always room for improvements._
**raylib 4.x**
- - [ ] Redesign camera module (more flexible) ([#1143](https://github.com/raysan5/raylib/issues/1143), https://github.com/raysan5/raylib/discussions/2507)
+ - [ ] Split core module into separate platforms?
+ - [ ] Basic 2d software renderer, using `Image` provided API
- [ ] Redesign gestures system, improve touch inputs management
- - [ ] Redesign raudio module, implement miniaudio high-level provided features
- - [x] Better documentation and improved examples
+ - [ ] Redesign audio module, implement miniaudio high-level provided features
+ - [x] Redesign camera module (more flexible) ([#1143](https://github.com/raysan5/raylib/issues/1143), https://github.com/raysan5/raylib/discussions/2507)
+ - [x] Better documentation and improved examples, reviewed webpage with examples complexity level
- [x] Focus on HTML5 ([raylib 5k gamejam](https://itch.io/jam/raylib-5k-gamejam)) and embedded platforms (RPI and similar SOCs)
- [x] Additional support libraries: [raygui](https://github.com/raysan5/raygui), [rres](https://github.com/raysan5/rres)
@@ -23,23 +28,23 @@ _Current version of raylib is complete and functional but there is always room f
- Basic CPU/GPU stats system (memory, draws, time...) ([#1295](https://github.com/raysan5/raylib/issues/1295)) - _DISCARDED_
- Software rendering backend (avoiding OpenGL) ([#1370](https://github.com/raysan5/raylib/issues/1370)) - _DISCARDED_
- Network module (UDP): `rnet` ([#753](https://github.com/raysan5/raylib/issues/753)) - _DISCARDED_ - Use [nbnet](https://github.com/nathhB/nbnet).
-
+
**raylib 3.0**
- [x] Custom memory allocators support
- [x] Global variables moved to global context
- [x] Optimize data structures for pass-by-value
- [x] Trace log messages redesign ([#1065](https://github.com/raysan5/raylib/issues/1065))
- [x] Continuous Integration using GitHub Actions
-
+
**raylib 2.5**
- [x] Support Animated models
- [x] Support glTF models file format
- [x] Unicode support on text drawing
-
+
**raylib 2.0**
- [x] Removed external dependencies (GLFW3 and OpenAL)
- [x] Support TCC compiler (32bit and 64bit)
-
+
**raylib 1.8**
- [x] Improved Materials system with PBR support
- [x] Procedural image generation functions (spot, gradient, noise...)
@@ -50,7 +55,7 @@ _Current version of raylib is complete and functional but there is always room f
- [x] Support configuration flags
- [x] Improved build system for Android
- [x] Gamepad support on HTML5
-
+
**raylib 1.6**
- [x] Lua scripting support (raylib Lua wrapper)
- [x] Redesigned audio module
diff --git a/examples/Makefile b/examples/Makefile
index 0b524015f..cc9ef2395 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -30,7 +30,7 @@ PLATFORM ?= PLATFORM_DESKTOP
# Define required raylib variables
PROJECT_NAME ?= raylib_examples
-RAYLIB_VERSION ?= 4.2.0
+RAYLIB_VERSION ?= 4.5.0
RAYLIB_PATH ?= ..
# Locations of raylib.h and libraylib.a/libraylib.so
@@ -129,7 +129,7 @@ endif
RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/src
ifeq ($(PLATFORM),PLATFORM_WEB)
- ifeq ($(PLATFORM_OS),WINDOWS)
+ ifeq ($(PLATFORM_OS),WINDOWS)
# Emscripten required variables
EMSDK_PATH ?= C:/emsdk
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten
@@ -137,7 +137,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
PYTHON_PATH = $(EMSDK_PATH)/python/3.9.2-1_64bit
NODE_PATH = $(EMSDK_PATH)/node/14.15.5_64bit/bin
export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH):$$(PATH)
- endif
+ endif
endif
# Define default C compiler: CC
@@ -210,7 +210,7 @@ else
CFLAGS += -Os
endif
else
- CFLAGS += -s -O2
+ CFLAGS += -O2
endif
endif
@@ -489,6 +489,7 @@ MODELS = \
models/models_billboard \
models/models_box_collisions \
models/models_cubicmap \
+ models/models_draw_cube_texture \
models/models_first_person_maze \
models/models_geometric_shapes \
models/models_mesh_generation \
@@ -531,8 +532,8 @@ AUDIO = \
audio/audio_music_stream \
audio/audio_raw_stream \
audio/audio_sound_loading \
- audio/audio_multichannel_sound \
- audio/audio_stream_effects
+ audio/audio_stream_effects \
+ audio/audio_mixed_processor
CURRENT_MAKEFILE = $(lastword $(MAKEFILE_LIST))
diff --git a/examples/Makefile.Web b/examples/Makefile.Web
index a55a76b8c..499eb3eaa 100644
--- a/examples/Makefile.Web
+++ b/examples/Makefile.Web
@@ -30,7 +30,7 @@ PLATFORM ?= PLATFORM_WEB
# Define required raylib variables
PROJECT_NAME ?= raylib_examples
-RAYLIB_VERSION ?= 4.2.0
+RAYLIB_VERSION ?= 4.5.0
RAYLIB_PATH ?= ..
# Locations of raylib.h and libraylib.a/libraylib.so
@@ -60,8 +60,8 @@ ifeq ($(PLATFORM),PLATFORM_RPI)
endif
endif
-# Determine PLATFORM_OS in case PLATFORM_DESKTOP selected
-ifeq ($(PLATFORM),PLATFORM_DESKTOP)
+# Determine PLATFORM_OS in case PLATFORM_DESKTOP or PLATFORM_WEB selected
+ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_WEB))
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
# ifeq ($(UNAME),Msys) -> Windows
ifeq ($(OS),Windows_NT)
@@ -119,16 +119,18 @@ ifeq ($(PLATFORM),PLATFORM_DRM)
endif
# Define raylib release directory for compiled library
-RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/src
+RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/src
ifeq ($(PLATFORM),PLATFORM_WEB)
- # Emscripten required variables
- EMSDK_PATH ?= C:/emsdk
- EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten
- CLANG_PATH = $(EMSDK_PATH)/upstream/bin
- PYTHON_PATH = $(EMSDK_PATH)/python/3.9.2-1_64bit
- NODE_PATH = $(EMSDK_PATH)/node/14.15.5_64bit/bin
- export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH):$$(PATH)
+ ifeq ($(PLATFORM_OS),WINDOWS)
+ # Emscripten required variables
+ EMSDK_PATH ?= C:/emsdk
+ EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten
+ CLANG_PATH = $(EMSDK_PATH)/upstream/bin
+ PYTHON_PATH = $(EMSDK_PATH)/python/3.9.2-1_64bit
+ NODE_PATH = $(EMSDK_PATH)/node/14.15.5_64bit/bin
+ export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH):$$(PATH)
+ endif
endif
# Define default C compiler: CC
@@ -195,9 +197,13 @@ ifeq ($(BUILD_MODE),DEBUG)
endif
else
ifeq ($(PLATFORM),PLATFORM_WEB)
- CFLAGS += -Os
+ ifeq ($(BUILD_WEB_ASYNCIFY),TRUE)
+ CFLAGS += -O3
+ else
+ CFLAGS += -Os
+ endif
else
- CFLAGS += -s -O1
+ CFLAGS += -s -O2
endif
endif
@@ -329,7 +335,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(RAYLIB_LIBTYPE),SHARED)
LDLIBS += -lc
endif
-
+
# NOTE: On ARM 32bit arch, miniaudio requires atomics library
LDLIBS += -latomic
endif
@@ -394,13 +400,13 @@ CORE = \
core/core_scissor_test \
core/core_storage_values \
core/core_vr_simulator \
- core/core_loading_thread \
core/core_window_flags \
core/core_window_letterbox \
core/core_window_should_close \
core/core_split_screen \
core/core_smooth_pixelperfect \
- core/core_custom_frame_control
+ core/core_custom_frame_control \
+ core/core_loading_thread
SHAPES = \
shapes/shapes_basic_shapes \
@@ -437,6 +443,7 @@ TEXTURES = \
textures/textures_sprite_anim \
textures/textures_sprite_button \
textures/textures_sprite_explosion \
+ textures/textures_textured_curve \
textures/textures_bunnymark \
textures/textures_blend_modes \
textures/textures_draw_tiled \
@@ -463,6 +470,7 @@ MODELS = \
models/models_billboard \
models/models_box_collisions \
models/models_cubicmap \
+ models/models_draw_cube_texture \
models/models_first_person_maze \
models/models_geometric_shapes \
models/models_mesh_generation \
@@ -496,15 +504,17 @@ SHADERS = \
shaders/shaders_spotlight \
shaders/shaders_hot_reloading \
shaders/shaders_mesh_instancing \
- shaders/shaders_multi_sample2d
+ shaders/shaders_multi_sample2d \
+ shaders/shaders_write_depth \
+ shaders/shaders_hybrid_render
AUDIO = \
audio/audio_module_playing \
audio/audio_music_stream \
audio/audio_raw_stream \
audio/audio_sound_loading \
- audio/audio_multichannel_sound \
- audio/audio_stream_effects
+ audio/audio_stream_effects \
+ audio/audio_mixed_processor
CURRENT_MAKEFILE = $(lastword $(MAKEFILE_LIST))
@@ -594,13 +604,6 @@ core/core_vr_simulator: core/core_vr_simulator.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file core/resources/distortion100.fs@resources/distortion100.fs
-# NOTE: To use multi-threading raylib must be compiled with multi-theading support (-s USE_PTHREADS=1)
-# WARNING: For security reasons multi-threading is not supported on browsers, it requires cross-origin isolation (Oct.2021)
-# WARNING: It requires raylib to be compiled using -pthread, so atomic operations and thread-local data (if any)
-# in its source were transformed to non-atomic operations and non-thread-local data
-core/core_loading_thread: core/core_loading_thread.c
- $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s USE_PTHREADS=1
-
core/core_window_flags: core/core_window_flags.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
@@ -615,6 +618,14 @@ core/core_custom_frame_control: core/core_custom_frame_control.c
core/core_window_should_close: core/core_window_should_close.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
+
+# NOTE: To use multi-threading raylib must be compiled with multi-theading support (-s USE_PTHREADS=1)
+# WARNING: For security reasons multi-threading is not supported on browsers, it requires cross-origin isolation (Oct.2021)
+# WARNING: It requires raylib to be compiled using -pthread, so atomic operations and thread-local data (if any)
+# in its source were transformed to non-atomic operations and non-thread-local data
+core/core_loading_thread: core/core_loading_thread.c
+ $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s USE_PTHREADS=1
+
# Compile SHAPES examples
shapes/shapes_basic_shapes: shapes/shapes_basic_shapes.c
@@ -734,6 +745,10 @@ textures/textures_sprite_explosion: textures/textures_sprite_explosion.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file textures/resources/explosion.png@resources/explosion.png \
--preload-file textures/resources/boom.wav@resources/boom.wav
+
+textures/textures_textured_curve: textures/textures_textured_curve.c
+ $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
+ --preload-file textures/resources/road.png@resources/road.png
textures/textures_bunnymark: textures/textures_bunnymark.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
@@ -840,6 +855,10 @@ models/models_cubicmap: models/models_cubicmap.c
--preload-file models/resources/cubicmap.png@resources/cubicmap.png \
--preload-file models/resources/cubicmap_atlas.png@resources/cubicmap_atlas.png
+models/models_draw_cube_texture: models/models_draw_cube_texture.c
+ $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
+ --preload-file models/resources/cubicmap_atlas.png@resources/cubicmap_atlas.png
+
models/models_first_person_maze: models/models_first_person_maze.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file models/resources/cubicmap.png@resources/cubicmap.png \
@@ -870,6 +889,10 @@ models/models_loading_vox: models/models_loading_vox.c
models/models_loading_gltf: models/models_loading_gltf.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s TOTAL_MEMORY=67108864 \
--preload-file models/resources/models/gltf/robot.glb@resources/models/gltf/robot.glb
+
+models/models_loading_m3d: models/models_loading_m3d.c
+ $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s TOTAL_MEMORY=67108864 \
+ --preload-file models/resources/models/m3d/cesium_man.m3d@resources/models/m3d/cesium_man.m3d
models/models_orthographic_projection: models/models_orthographic_projection.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
@@ -951,13 +974,13 @@ shaders/shaders_basic_lighting: shaders/shaders_basic_lighting.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file shaders/resources/texel_checker.png@resources/texel_checker.png \
--preload-file shaders/resources/shaders/glsl100/lighting.fs@resources/shaders/glsl100/lighting.fs \
- --preload-file shaders/resources/shaders/glsl100/base_lighting.vs@resources/shaders/glsl100/base_lighting.vs
+ --preload-file shaders/resources/shaders/glsl100/lighting.vs@resources/shaders/glsl100/lighting.vs
shaders/shaders_fog: shaders/shaders_fog.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file shaders/resources/texel_checker.png@resources/texel_checker.png \
--preload-file shaders/resources/shaders/glsl100/fog.fs@resources/shaders/glsl100/fog.fs \
- --preload-file shaders/resources/shaders/glsl100/base_lighting.vs@resources/shaders/glsl100/base_lighting.vs
+ --preload-file shaders/resources/shaders/glsl100/lighting.vs@resources/shaders/glsl100/lighting.vs
shaders/shaders_simple_mask: shaders/shaders_simple_mask.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
@@ -976,10 +999,9 @@ shaders/shaders_hot_reloading: shaders/shaders_hot_reloading.c
shaders/shaders_mesh_instancing: shaders/shaders_mesh_instancing.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
- --preload-file shaders/resources/shaders/glsl100/base_lighting_instanced.vs@resources/shaders/glsl100/base_lighting_instanced.vs \
+ --preload-file shaders/resources/shaders/glsl100/lighting_instancing.vs@resources/shaders/glsl100/lighting_instancing.vs \
--preload-file shaders/resources/shaders/glsl100/lighting.fs@resources/shaders/glsl100/lighting.fs
-
shaders/shaders_multi_sample2d: shaders/shaders_multi_sample2d.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file shaders/resources/shaders/glsl100/color_mix.fs@resources/shaders/glsl100/color_mix.fs
@@ -988,7 +1010,16 @@ shaders/shaders_texture_outline: shaders/shaders_texture_outline.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file shaders/resources/shaders/glsl100/outline.fs@resources/shaders/glsl100/outline.fs \
--preload-file shaders/resources/fudesumi.png@resources/fudesumi.png
-
+
+shaders/shaders_write_depth: shaders/shaders_write_depth.c
+ $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
+ --preload-file shaders/resources/shaders/glsl100/write_depth.fs@resources/shaders/glsl100/write_depth.fs
+
+shaders/shaders_hybrid_render: shaders/shaders_hybrid_render.c
+ $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
+ --preload-file shaders/resources/shaders/glsl100/hybrid_raymarch.fs@resources/shaders/glsl100/hybrid_raymarch.fs \
+ --preload-file shaders/resources/shaders/glsl100/hybrid_raster.fs@resources/shaders/glsl100/hybrid_raster.fs
+
# Compile AUDIO examples
audio/audio_module_playing: audio/audio_module_playing.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
@@ -1006,14 +1037,14 @@ audio/audio_sound_loading: audio/audio_sound_loading.c
--preload-file audio/resources/sound.wav@resources/sound.wav \
--preload-file audio/resources/target.ogg@resources/target.ogg
-audio/audio_multichannel_sound: audio/audio_multichannel_sound.c
- $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
- --preload-file audio/resources/sound.wav@resources/sound.wav \
- --preload-file audio/resources/target.ogg@resources/target.ogg
-
audio/audio_stream_effects: audio/audio_stream_effects.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s TOTAL_MEMORY=67108864 \
--preload-file audio/resources/country.mp3@resources/country.mp3
+
+audio/audio_mixed_processor: audio/audio_mixed_processor.c
+ $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s TOTAL_MEMORY=67108864 \
+ --preload-file audio/resources/country.mp3@resources/country.mp3 \
+ --preload-file audio/resources/coin.wav@resources/coin.wav
# Clean everything
clean:
diff --git a/examples/README.md b/examples/README.md
index 7a3e72f87..8399d677d 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -186,7 +186,6 @@ Examples using raylib audio functionality, including sound/music loading and pla
| 118 | [audio_music_stream](audio/audio_music_stream.c) |
| ⭐️☆☆☆ | 1.3 | **4.2** | [Ray](https://github.com/raysan5) |
| 119 | [audio_raw_stream](audio/audio_raw_stream.c) |
| ⭐️⭐️⭐️☆ | 1.6 | **4.2** | [Ray](https://github.com/raysan5) |
| 120 | [audio_sound_loading](audio/audio_sound_loading.c) |
| ⭐️☆☆☆ | 1.1 | 3.5 | [Ray](https://github.com/raysan5) |
-| 121 | [audio_multichannel_sound](audio/audio_multichannel_sound.c) |
| ⭐️☆☆☆ | 3.0 | 3.5 | [Chris Camacho](https://github.com/codifies) |
### category: others
diff --git a/examples/audio/audio_multichannel_sound.c b/examples/audio/audio_multichannel_sound.c
deleted file mode 100644
index 1d549a055..000000000
--- a/examples/audio/audio_multichannel_sound.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************************
-*
-* raylib [audio] example - Multichannel sound playing
-*
-* Example originally created with raylib 3.0, last time updated with raylib 3.5
-*
-* Example contributed by Chris Camacho (@chriscamacho) and reviewed by Ramon Santamaria (@raysan5)
-*
-* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
-* BSD-like license that allows static linking with closed source software
-*
-* Copyright (c) 2019-2023 Chris Camacho (@chriscamacho) and Ramon Santamaria (@raysan5)
-*
-********************************************************************************************/
-
-#include "raylib.h"
-
-//------------------------------------------------------------------------------------
-// Program main entry point
-//------------------------------------------------------------------------------------
-int main(void)
-{
- // Initialization
- //--------------------------------------------------------------------------------------
- const int screenWidth = 800;
- const int screenHeight = 450;
-
- InitWindow(screenWidth, screenHeight, "raylib [audio] example - Multichannel sound playing");
-
- InitAudioDevice(); // Initialize audio device
-
- Sound fxWav = LoadSound("resources/sound.wav"); // Load WAV audio file
- Sound fxOgg = LoadSound("resources/target.ogg"); // Load OGG audio file
-
- SetSoundVolume(fxWav, 0.2f);
-
- SetTargetFPS(60); // Set our game to run at 60 frames-per-second
- //--------------------------------------------------------------------------------------
-
- // Main game loop
- while (!WindowShouldClose()) // Detect window close button or ESC key
- {
- // Update
- //----------------------------------------------------------------------------------
- if (IsKeyPressed(KEY_ENTER)) PlaySoundMulti(fxWav); // Play a new wav sound instance
- if (IsKeyPressed(KEY_SPACE)) PlaySoundMulti(fxOgg); // Play a new ogg sound instance
- //----------------------------------------------------------------------------------
-
- // Draw
- //----------------------------------------------------------------------------------
- BeginDrawing();
-
- ClearBackground(RAYWHITE);
-
- DrawText("MULTICHANNEL SOUND PLAYING", 20, 20, 20, GRAY);
- DrawText("Press SPACE to play new ogg instance!", 200, 120, 20, LIGHTGRAY);
- DrawText("Press ENTER to play new wav instance!", 200, 180, 20, LIGHTGRAY);
-
- DrawText(TextFormat("CONCURRENT SOUNDS PLAYING: %02i", GetSoundsPlaying()), 220, 280, 20, RED);
-
- EndDrawing();
- //----------------------------------------------------------------------------------
- }
-
- // De-Initialization
- //--------------------------------------------------------------------------------------
- StopSoundMulti(); // We must stop the buffer pool before unloading
-
- UnloadSound(fxWav); // Unload sound data
- UnloadSound(fxOgg); // Unload sound data
-
- CloseAudioDevice(); // Close audio device
-
- CloseWindow(); // Close window and OpenGL context
- //--------------------------------------------------------------------------------------
-
- return 0;
-}
diff --git a/examples/audio/audio_multichannel_sound.png b/examples/audio/audio_multichannel_sound.png
deleted file mode 100644
index 4b98b26e0..000000000
Binary files a/examples/audio/audio_multichannel_sound.png and /dev/null differ
diff --git a/examples/core/core_3d_camera_first_person.c b/examples/core/core_3d_camera_first_person.c
index 0fc784fa6..6a2a115a7 100644
--- a/examples/core/core_3d_camera_first_person.c
+++ b/examples/core/core_3d_camera_first_person.c
@@ -113,7 +113,30 @@ int main(void)
}
}
+ // Update camera computes movement internally depending on the camera mode
+ // Some default standard keyboard/mouse inputs are hardcoded to simplify use
+ // For advance camera controls, it's reecommended to compute camera movement manually
UpdateCamera(&camera, cameraMode); // Update camera
+
+/*
+ // Camera PRO usage example (EXPERIMENTAL)
+ // This new camera function allows custom movement/rotation values to be directly provided
+ // as input parameters, with this approach, rcamera module is internally independent of raylib inputs
+ UpdateCameraPro(&camera,
+ (Vector3){
+ (IsKeyDown(KEY_W) || IsKeyDown(KEY_UP))*0.1f - // Move forward-backward
+ (IsKeyDown(KEY_S) || IsKeyDown(KEY_DOWN))*0.1f,
+ (IsKeyDown(KEY_D) || IsKeyDown(KEY_RIGHT))*0.1f - // Move right-left
+ (IsKeyDown(KEY_A) || IsKeyDown(KEY_LEFT))*0.1f,
+ 0.0f // Move up-down
+ },
+ (Vector3){
+ GetMouseDelta().x*0.05f, // Rotation: yaw
+ GetMouseDelta().y*0.05f, // Rotation: pitch
+ 0.0f // Rotation: roll
+ },
+ GetMouseWheelMove()*2.0f); // Move to target (zoom)
+*/
//----------------------------------------------------------------------------------
// Draw
diff --git a/examples/core/core_loading_thread.c b/examples/core/core_loading_thread.c
index 5a988bb27..0538dcee3 100644
--- a/examples/core/core_loading_thread.c
+++ b/examples/core/core_loading_thread.c
@@ -15,6 +15,7 @@
#include "raylib.h"
+// WARNING: This example does not build on Windows with MSVC compiler
#include "pthread.h" // POSIX style threads management
#include // C11 atomic data types
diff --git a/examples/models/models_loading_m3d.c b/examples/models/models_loading_m3d.c
index 42d3416de..b9674b6f6 100644
--- a/examples/models/models_loading_m3d.c
+++ b/examples/models/models_loading_m3d.c
@@ -2,7 +2,7 @@
*
* raylib [models] example - Load models M3D
*
-* Example originally created with raylib 4.5-dev, last time updated with raylib 4.5-dev
+* Example originally created with raylib 4.5, last time updated with raylib 4.5
*
* Example contributed by bzt (@bztsrc) and reviewed by Ramon Santamaria (@raysan5)
*
@@ -41,7 +41,7 @@ int main(void)
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
- char modelFileName[128] = "resources/models/m3d/CesiumMan.m3d";
+ char modelFileName[128] = "resources/models/m3d/cesium_man.m3d";
bool drawMesh = 1;
bool drawSkeleton = 1;
bool animPlaying = false; // Store anim state, what to draw
diff --git a/examples/models/resources/models/m3d/CesiumMan.m3d b/examples/models/resources/models/m3d/cesium_man.m3d
similarity index 100%
rename from examples/models/resources/models/m3d/CesiumMan.m3d
rename to examples/models/resources/models/m3d/cesium_man.m3d
diff --git a/examples/shaders/resources/shaders/glsl330/write_depth.fs b/examples/shaders/resources/shaders/glsl330/write_depth.fs
index 88a4113ff..f0e07beec 100644
--- a/examples/shaders/resources/shaders/glsl330/write_depth.fs
+++ b/examples/shaders/resources/shaders/glsl330/write_depth.fs
@@ -1,15 +1,20 @@
#version 330
+// Input vertex attributes (from vertex shader)
in vec2 fragTexCoord;
in vec4 fragColor;
+// Input uniform values
uniform sampler2D texture0;
uniform vec4 colDiffuse;
+// Output fragment color
+out vec4 finalColor;
+
void main()
{
- vec4 texelColor = texture2D(texture0, fragTexCoord);
+ vec4 texelColor = texture(texture0, fragTexCoord);
- gl_FragColor = texelColor*colDiffuse*fragColor;
- gl_FragDepth = 1.0 - gl_FragCoord.z;
+ finalColor = texelColor*colDiffuse*fragColor;
+ gl_FragDepth = 1.0 - finalColor.z;
}
diff --git a/examples/textures/textures_textured_curve.c b/examples/textures/textures_textured_curve.c
index 7945d8e32..3c2f0606a 100644
--- a/examples/textures/textures_textured_curve.c
+++ b/examples/textures/textures_textured_curve.c
@@ -2,7 +2,7 @@
*
* raylib [textures] example - Draw a texture along a segmented curve
*
-* Example originally created with raylib 4.5-dev
+* Example originally created with raylib 4.5, last time updated with raylib 4.5
*
* Example contributed by Jeffery Myers and reviewed by Ramon Santamaria (@raysan5)
*
diff --git a/parser/output/raylib_api.json b/parser/output/raylib_api.json
index d9a548128..62d9f4401 100644
--- a/parser/output/raylib_api.json
+++ b/parser/output/raylib_api.json
@@ -6,10 +6,28 @@
"value": "",
"description": ""
},
+ {
+ "name": "RAYLIB_VERSION_MAJOR",
+ "type": "INT",
+ "value": 4,
+ "description": ""
+ },
+ {
+ "name": "RAYLIB_VERSION_MINOR",
+ "type": "INT",
+ "value": 5,
+ "description": ""
+ },
+ {
+ "name": "RAYLIB_VERSION_PATCH",
+ "type": "INT",
+ "value": 0,
+ "description": ""
+ },
{
"name": "RAYLIB_VERSION",
"type": "STRING",
- "value": "4.5-dev",
+ "value": "4.5",
"description": ""
},
{
@@ -385,7 +403,7 @@
},
{
"name": "Matrix",
- "description": "Matrix, 4x4 components, column major, OpenGL style, right handed",
+ "description": "Matrix, 4x4 components, column major, OpenGL style, right-handed",
"fields": [
{
"type": "float",
@@ -1045,12 +1063,12 @@
{
"type": "float",
"name": "distance",
- "description": "Distance to nearest hit"
+ "description": "Distance to the nearest hit"
},
{
"type": "Vector3",
"name": "point",
- "description": "Point of nearest hit"
+ "description": "Point of the nearest hit"
},
{
"type": "Vector3",
@@ -2112,7 +2130,7 @@
{
"name": "MOUSE_CURSOR_RESIZE_ALL",
"value": 9,
- "description": "The omni-directional resize/move cursor shape"
+ "description": "The omnidirectional resize/move cursor shape"
},
{
"name": "MOUSE_CURSOR_NOT_ALLOWED",
@@ -2717,7 +2735,7 @@
{
"name": "CUBEMAP_LAYOUT_LINE_HORIZONTAL",
"value": 2,
- "description": "Layout is defined by an horizontal line with faces"
+ "description": "Layout is defined by a horizontal line with faces"
},
{
"name": "CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR",
@@ -2732,7 +2750,7 @@
{
"name": "CUBEMAP_LAYOUT_PANORAMA",
"value": 5,
- "description": "Layout is defined by a panorama image (equirectangular map)"
+ "description": "Layout is defined by a panorama image (equirrectangular map)"
}
]
},
@@ -2794,12 +2812,12 @@
{
"name": "BLEND_CUSTOM",
"value": 6,
- "description": "Blend textures using custom src/dst factors (use rlSetBlendMode())"
+ "description": "Blend textures using custom src/dst factors (use rlSetBlendFactors())"
},
{
"name": "BLEND_CUSTOM_SEPARATE",
"value": 7,
- "description": "Blend textures using custom rgb/alpha separate src/dst factors (use rlSetBlendModeSeparate())"
+ "description": "Blend textures using custom rgb/alpha separate src/dst factors (use rlSetBlendFactorsSeparate())"
}
]
},
@@ -3149,7 +3167,7 @@
},
{
"name": "SetWindowIcon",
- "description": "Set icon for window (only PLATFORM_DESKTOP)",
+ "description": "Set icon for window (single image, RGBA 32bit, only PLATFORM_DESKTOP)",
"returnType": "void",
"params": [
{
@@ -3158,6 +3176,21 @@
}
]
},
+ {
+ "name": "SetWindowIcons",
+ "description": "Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP)",
+ "returnType": "void",
+ "params": [
+ {
+ "type": "Image *",
+ "name": "images"
+ },
+ {
+ "type": "int",
+ "name": "count"
+ }
+ ]
+ },
{
"name": "SetWindowTitle",
"description": "Set title for window (only PLATFORM_DESKTOP)",
@@ -3632,6 +3665,17 @@
}
]
},
+ {
+ "name": "IsShaderReady",
+ "description": "Check if a shader is ready",
+ "returnType": "bool",
+ "params": [
+ {
+ "type": "Shader",
+ "name": "shader"
+ }
+ ]
+ },
{
"name": "GetShaderLocation",
"description": "Get shader uniform location",
@@ -4124,7 +4168,7 @@
"returnType": "bool",
"params": [
{
- "type": "const char *",
+ "type": "const unsigned char *",
"name": "data"
},
{
@@ -4863,12 +4907,12 @@
"returnType": "float"
},
{
- "name": "SetCameraMode",
- "description": "Set camera mode (multiple camera modes available)",
+ "name": "UpdateCamera",
+ "description": "Update camera position for selected mode",
"returnType": "void",
"params": [
{
- "type": "Camera",
+ "type": "Camera *",
"name": "camera"
},
{
@@ -4878,77 +4922,25 @@
]
},
{
- "name": "UpdateCamera",
- "description": "Update camera position for selected mode",
+ "name": "UpdateCameraPro",
+ "description": "Update camera movement/rotation",
"returnType": "void",
"params": [
{
"type": "Camera *",
"name": "camera"
- }
- ]
- },
- {
- "name": "SetCameraPanControl",
- "description": "Set camera pan key to combine with mouse movement (free camera)",
- "returnType": "void",
- "params": [
- {
- "type": "int",
- "name": "keyPan"
- }
- ]
- },
- {
- "name": "SetCameraAltControl",
- "description": "Set camera alt key to combine with mouse movement (free camera)",
- "returnType": "void",
- "params": [
- {
- "type": "int",
- "name": "keyAlt"
- }
- ]
- },
- {
- "name": "SetCameraSmoothZoomControl",
- "description": "Set camera smooth zoom key to combine with mouse (free camera)",
- "returnType": "void",
- "params": [
- {
- "type": "int",
- "name": "keySmoothZoom"
- }
- ]
- },
- {
- "name": "SetCameraMoveControls",
- "description": "Set camera move controls (1st person and 3rd person cameras)",
- "returnType": "void",
- "params": [
- {
- "type": "int",
- "name": "keyFront"
},
{
- "type": "int",
- "name": "keyBack"
+ "type": "Vector3",
+ "name": "movement"
},
{
- "type": "int",
- "name": "keyRight"
+ "type": "Vector3",
+ "name": "rotation"
},
{
- "type": "int",
- "name": "keyLeft"
- },
- {
- "type": "int",
- "name": "keyUp"
- },
- {
- "type": "int",
- "name": "keyDown"
+ "type": "float",
+ "name": "zoom"
}
]
},
@@ -6172,6 +6164,17 @@
"description": "Load image from screen buffer and (screenshot)",
"returnType": "Image"
},
+ {
+ "name": "IsImageReady",
+ "description": "Check if an image is ready",
+ "returnType": "bool",
+ "params": [
+ {
+ "type": "Image",
+ "name": "image"
+ }
+ ]
+ },
{
"name": "UnloadImage",
"description": "Unload image from CPU memory (RAM)",
@@ -6401,6 +6404,25 @@
}
]
},
+ {
+ "name": "GenImageText",
+ "description": "Generate image: grayscale image from text data",
+ "returnType": "Image",
+ "params": [
+ {
+ "type": "int",
+ "name": "width"
+ },
+ {
+ "type": "int",
+ "name": "height"
+ },
+ {
+ "type": "const char *",
+ "name": "text"
+ }
+ ]
+ },
{
"name": "ImageCopy",
"description": "Create an image duplicate (useful for transformations)",
@@ -6578,6 +6600,21 @@
}
]
},
+ {
+ "name": "ImageBlurGaussian",
+ "description": "Apply Gaussian blur using a box blur approximation",
+ "returnType": "void",
+ "params": [
+ {
+ "type": "Image *",
+ "name": "image"
+ },
+ {
+ "type": "int",
+ "name": "blurSize"
+ }
+ ]
+ },
{
"name": "ImageResize",
"description": "Resize image (Bicubic scaling algorithm)",
@@ -7353,6 +7390,17 @@
}
]
},
+ {
+ "name": "IsTextureReady",
+ "description": "Check if a texture is ready",
+ "returnType": "bool",
+ "params": [
+ {
+ "type": "Texture2D",
+ "name": "texture"
+ }
+ ]
+ },
{
"name": "UnloadTexture",
"description": "Unload texture from GPU memory (VRAM)",
@@ -7364,6 +7412,17 @@
}
]
},
+ {
+ "name": "IsRenderTextureReady",
+ "description": "Check if a render texture is ready",
+ "returnType": "bool",
+ "params": [
+ {
+ "type": "RenderTexture2D",
+ "name": "target"
+ }
+ ]
+ },
{
"name": "UnloadRenderTexture",
"description": "Unload render texture from GPU memory (VRAM)",
@@ -7542,68 +7601,6 @@
}
]
},
- {
- "name": "DrawTextureQuad",
- "description": "Draw texture quad with tiling and offset parameters",
- "returnType": "void",
- "params": [
- {
- "type": "Texture2D",
- "name": "texture"
- },
- {
- "type": "Vector2",
- "name": "tiling"
- },
- {
- "type": "Vector2",
- "name": "offset"
- },
- {
- "type": "Rectangle",
- "name": "quad"
- },
- {
- "type": "Color",
- "name": "tint"
- }
- ]
- },
- {
- "name": "DrawTextureTiled",
- "description": "Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest.",
- "returnType": "void",
- "params": [
- {
- "type": "Texture2D",
- "name": "texture"
- },
- {
- "type": "Rectangle",
- "name": "source"
- },
- {
- "type": "Rectangle",
- "name": "dest"
- },
- {
- "type": "Vector2",
- "name": "origin"
- },
- {
- "type": "float",
- "name": "rotation"
- },
- {
- "type": "float",
- "name": "scale"
- },
- {
- "type": "Color",
- "name": "tint"
- }
- ]
- },
{
"name": "DrawTexturePro",
"description": "Draw a part of a texture defined by a rectangle with 'pro' parameters",
@@ -7666,37 +7663,6 @@
}
]
},
- {
- "name": "DrawTexturePoly",
- "description": "Draw a textured polygon",
- "returnType": "void",
- "params": [
- {
- "type": "Texture2D",
- "name": "texture"
- },
- {
- "type": "Vector2",
- "name": "center"
- },
- {
- "type": "Vector2 *",
- "name": "points"
- },
- {
- "type": "Vector2 *",
- "name": "texcoords"
- },
- {
- "type": "int",
- "name": "pointCount"
- },
- {
- "type": "Color",
- "name": "tint"
- }
- ]
- },
{
"name": "Fade",
"description": "Get color with alpha applied, alpha goes from 0.0f to 1.0f",
@@ -7775,6 +7741,51 @@
}
]
},
+ {
+ "name": "ColorTint",
+ "description": "Get color multiplied with another color",
+ "returnType": "Color",
+ "params": [
+ {
+ "type": "Color",
+ "name": "color"
+ },
+ {
+ "type": "Color",
+ "name": "tint"
+ }
+ ]
+ },
+ {
+ "name": "ColorBrightness",
+ "description": "Get color with brightness correction, brightness factor goes from -1.0f to 1.0f",
+ "returnType": "Color",
+ "params": [
+ {
+ "type": "Color",
+ "name": "color"
+ },
+ {
+ "type": "float",
+ "name": "factor"
+ }
+ ]
+ },
+ {
+ "name": "ColorContrast",
+ "description": "Get color with contrast correction, contrast values between -1.0f and 1.0f",
+ "returnType": "Color",
+ "params": [
+ {
+ "type": "Color",
+ "name": "color"
+ },
+ {
+ "type": "float",
+ "name": "contrast"
+ }
+ ]
+ },
{
"name": "ColorAlpha",
"description": "Get color with alpha applied, alpha goes from 0.0f to 1.0f",
@@ -7962,6 +7973,17 @@
}
]
},
+ {
+ "name": "IsFontReady",
+ "description": "Check if a font is ready",
+ "returnType": "bool",
+ "params": [
+ {
+ "type": "Font",
+ "name": "font"
+ }
+ ]
+ },
{
"name": "LoadFontData",
"description": "Load font data for further use",
@@ -8869,72 +8891,6 @@
}
]
},
- {
- "name": "DrawCubeTexture",
- "description": "Draw cube textured",
- "returnType": "void",
- "params": [
- {
- "type": "Texture2D",
- "name": "texture"
- },
- {
- "type": "Vector3",
- "name": "position"
- },
- {
- "type": "float",
- "name": "width"
- },
- {
- "type": "float",
- "name": "height"
- },
- {
- "type": "float",
- "name": "length"
- },
- {
- "type": "Color",
- "name": "color"
- }
- ]
- },
- {
- "name": "DrawCubeTextureRec",
- "description": "Draw cube with a region of a texture",
- "returnType": "void",
- "params": [
- {
- "type": "Texture2D",
- "name": "texture"
- },
- {
- "type": "Rectangle",
- "name": "source"
- },
- {
- "type": "Vector3",
- "name": "position"
- },
- {
- "type": "float",
- "name": "width"
- },
- {
- "type": "float",
- "name": "height"
- },
- {
- "type": "float",
- "name": "length"
- },
- {
- "type": "Color",
- "name": "color"
- }
- ]
- },
{
"name": "DrawSphere",
"description": "Draw sphere",
@@ -9132,6 +9088,68 @@
}
]
},
+ {
+ "name": "DrawCapsule",
+ "description": "Draw a capsule with the center of its sphere caps at startPos and endPos",
+ "returnType": "void",
+ "params": [
+ {
+ "type": "Vector3",
+ "name": "startPos"
+ },
+ {
+ "type": "Vector3",
+ "name": "endPos"
+ },
+ {
+ "type": "float",
+ "name": "radius"
+ },
+ {
+ "type": "int",
+ "name": "slices"
+ },
+ {
+ "type": "int",
+ "name": "rings"
+ },
+ {
+ "type": "Color",
+ "name": "color"
+ }
+ ]
+ },
+ {
+ "name": "DrawCapsuleWires",
+ "description": "Draw capsule wireframe with the center of its sphere caps at startPos and endPos",
+ "returnType": "void",
+ "params": [
+ {
+ "type": "Vector3",
+ "name": "startPos"
+ },
+ {
+ "type": "Vector3",
+ "name": "endPos"
+ },
+ {
+ "type": "float",
+ "name": "radius"
+ },
+ {
+ "type": "int",
+ "name": "slices"
+ },
+ {
+ "type": "int",
+ "name": "rings"
+ },
+ {
+ "type": "Color",
+ "name": "color"
+ }
+ ]
+ },
{
"name": "DrawPlane",
"description": "Draw a plane XZ",
@@ -9204,9 +9222,9 @@
]
},
{
- "name": "UnloadModel",
- "description": "Unload model (including meshes) from memory (RAM and/or VRAM)",
- "returnType": "void",
+ "name": "IsModelReady",
+ "description": "Check if a model is ready",
+ "returnType": "bool",
"params": [
{
"type": "Model",
@@ -9215,8 +9233,8 @@
]
},
{
- "name": "UnloadModelKeepMeshes",
- "description": "Unload model (but not meshes) from memory (RAM and/or VRAM)",
+ "name": "UnloadModel",
+ "description": "Unload model (including meshes) from memory (RAM and/or VRAM)",
"returnType": "void",
"params": [
{
@@ -9821,6 +9839,17 @@
"description": "Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps)",
"returnType": "Material"
},
+ {
+ "name": "IsMaterialReady",
+ "description": "Check if a material is ready",
+ "returnType": "bool",
+ "params": [
+ {
+ "type": "Material",
+ "name": "material"
+ }
+ ]
+ },
{
"name": "UnloadMaterial",
"description": "Unload material from GPU memory (VRAM)",
@@ -10161,6 +10190,17 @@
}
]
},
+ {
+ "name": "IsWaveReady",
+ "description": "Checks if wave data is ready",
+ "returnType": "bool",
+ "params": [
+ {
+ "type": "Wave",
+ "name": "wave"
+ }
+ ]
+ },
{
"name": "LoadSound",
"description": "Load sound from file",
@@ -10183,6 +10223,17 @@
}
]
},
+ {
+ "name": "IsSoundReady",
+ "description": "Checks if a sound is ready",
+ "returnType": "bool",
+ "params": [
+ {
+ "type": "Sound",
+ "name": "sound"
+ }
+ ]
+ },
{
"name": "UpdateSound",
"description": "Update sound buffer with new data",
@@ -10298,27 +10349,6 @@
}
]
},
- {
- "name": "PlaySoundMulti",
- "description": "Play a sound (using multichannel buffer pool)",
- "returnType": "void",
- "params": [
- {
- "type": "Sound",
- "name": "sound"
- }
- ]
- },
- {
- "name": "StopSoundMulti",
- "description": "Stop any sound playing (using multichannel buffer pool)",
- "returnType": "void"
- },
- {
- "name": "GetSoundsPlaying",
- "description": "Get number of sounds playing in the multichannel",
- "returnType": "int"
- },
{
"name": "IsSoundPlaying",
"description": "Check if a sound is currently playing",
@@ -10480,6 +10510,17 @@
}
]
},
+ {
+ "name": "IsMusicReady",
+ "description": "Checks if a music stream is ready",
+ "returnType": "bool",
+ "params": [
+ {
+ "type": "Music",
+ "name": "music"
+ }
+ ]
+ },
{
"name": "UnloadMusicStream",
"description": "Unload music stream",
@@ -10658,6 +10699,17 @@
}
]
},
+ {
+ "name": "IsAudioStreamReady",
+ "description": "Checks if an audio stream is ready",
+ "returnType": "bool",
+ "params": [
+ {
+ "type": "AudioStream",
+ "name": "stream"
+ }
+ ]
+ },
{
"name": "UnloadAudioStream",
"description": "Unload audio stream and free memory",
@@ -10854,6 +10906,28 @@
"name": "processor"
}
]
+ },
+ {
+ "name": "AttachAudioMixedProcessor",
+ "description": "Attach audio stream processor to the entire audio pipeline",
+ "returnType": "void",
+ "params": [
+ {
+ "type": "AudioCallback",
+ "name": "processor"
+ }
+ ]
+ },
+ {
+ "name": "DetachAudioMixedProcessor",
+ "description": "Detach audio stream processor from the entire audio pipeline",
+ "returnType": "void",
+ "params": [
+ {
+ "type": "AudioCallback",
+ "name": "processor"
+ }
+ ]
}
]
}
diff --git a/parser/output/raylib_api.lua b/parser/output/raylib_api.lua
index a7b68f1c3..0a1b95856 100644
--- a/parser/output/raylib_api.lua
+++ b/parser/output/raylib_api.lua
@@ -6,10 +6,28 @@ return {
value = "",
description = ""
},
+ {
+ name = "RAYLIB_VERSION_MAJOR",
+ type = "INT",
+ value = 4,
+ description = ""
+ },
+ {
+ name = "RAYLIB_VERSION_MINOR",
+ type = "INT",
+ value = 5,
+ description = ""
+ },
+ {
+ name = "RAYLIB_VERSION_PATCH",
+ type = "INT",
+ value = 0,
+ description = ""
+ },
{
name = "RAYLIB_VERSION",
type = "STRING",
- value = "4.5-dev",
+ value = "4.5",
description = ""
},
{
@@ -385,7 +403,7 @@ return {
},
{
name = "Matrix",
- description = "Matrix, 4x4 components, column major, OpenGL style, right handed",
+ description = "Matrix, 4x4 components, column major, OpenGL style, right-handed",
fields = {
{
type = "float",
@@ -1045,12 +1063,12 @@ return {
{
type = "float",
name = "distance",
- description = "Distance to nearest hit"
+ description = "Distance to the nearest hit"
},
{
type = "Vector3",
name = "point",
- description = "Point of nearest hit"
+ description = "Point of the nearest hit"
},
{
type = "Vector3",
@@ -2112,7 +2130,7 @@ return {
{
name = "MOUSE_CURSOR_RESIZE_ALL",
value = 9,
- description = "The omni-directional resize/move cursor shape"
+ description = "The omnidirectional resize/move cursor shape"
},
{
name = "MOUSE_CURSOR_NOT_ALLOWED",
@@ -2717,7 +2735,7 @@ return {
{
name = "CUBEMAP_LAYOUT_LINE_HORIZONTAL",
value = 2,
- description = "Layout is defined by an horizontal line with faces"
+ description = "Layout is defined by a horizontal line with faces"
},
{
name = "CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR",
@@ -2732,7 +2750,7 @@ return {
{
name = "CUBEMAP_LAYOUT_PANORAMA",
value = 5,
- description = "Layout is defined by a panorama image (equirectangular map)"
+ description = "Layout is defined by a panorama image (equirrectangular map)"
}
}
},
@@ -2794,12 +2812,12 @@ return {
{
name = "BLEND_CUSTOM",
value = 6,
- description = "Blend textures using custom src/dst factors (use rlSetBlendMode())"
+ description = "Blend textures using custom src/dst factors (use rlSetBlendFactors())"
},
{
name = "BLEND_CUSTOM_SEPARATE",
value = 7,
- description = "Blend textures using custom rgb/alpha separate src/dst factors (use rlSetBlendModeSeparate())"
+ description = "Blend textures using custom rgb/alpha separate src/dst factors (use rlSetBlendFactorsSeparate())"
}
}
},
@@ -3092,12 +3110,21 @@ return {
},
{
name = "SetWindowIcon",
- description = "Set icon for window (only PLATFORM_DESKTOP)",
+ description = "Set icon for window (single image, RGBA 32bit, only PLATFORM_DESKTOP)",
returnType = "void",
params = {
{type = "Image", name = "image"}
}
},
+ {
+ name = "SetWindowIcons",
+ description = "Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP)",
+ returnType = "void",
+ params = {
+ {type = "Image *", name = "images"},
+ {type = "int", name = "count"}
+ }
+ },
{
name = "SetWindowTitle",
description = "Set title for window (only PLATFORM_DESKTOP)",
@@ -3467,6 +3494,14 @@ return {
{type = "const char *", name = "fsCode"}
}
},
+ {
+ name = "IsShaderReady",
+ description = "Check if a shader is ready",
+ returnType = "bool",
+ params = {
+ {type = "Shader", name = "shader"}
+ }
+ },
{
name = "GetShaderLocation",
description = "Get shader uniform location",
@@ -3778,7 +3813,7 @@ return {
description = "Export data to code (.h), returns true on success",
returnType = "bool",
params = {
- {type = "const char *", name = "data"},
+ {type = "const unsigned char *", name = "data"},
{type = "unsigned int", name = "size"},
{type = "const char *", name = "fileName"}
}
@@ -4304,58 +4339,24 @@ return {
description = "Get gesture pinch angle",
returnType = "float"
},
- {
- name = "SetCameraMode",
- description = "Set camera mode (multiple camera modes available)",
- returnType = "void",
- params = {
- {type = "Camera", name = "camera"},
- {type = "int", name = "mode"}
- }
- },
{
name = "UpdateCamera",
description = "Update camera position for selected mode",
returnType = "void",
params = {
- {type = "Camera *", name = "camera"}
+ {type = "Camera *", name = "camera"},
+ {type = "int", name = "mode"}
}
},
{
- name = "SetCameraPanControl",
- description = "Set camera pan key to combine with mouse movement (free camera)",
+ name = "UpdateCameraPro",
+ description = "Update camera movement/rotation",
returnType = "void",
params = {
- {type = "int", name = "keyPan"}
- }
- },
- {
- name = "SetCameraAltControl",
- description = "Set camera alt key to combine with mouse movement (free camera)",
- returnType = "void",
- params = {
- {type = "int", name = "keyAlt"}
- }
- },
- {
- name = "SetCameraSmoothZoomControl",
- description = "Set camera smooth zoom key to combine with mouse (free camera)",
- returnType = "void",
- params = {
- {type = "int", name = "keySmoothZoom"}
- }
- },
- {
- name = "SetCameraMoveControls",
- description = "Set camera move controls (1st person and 3rd person cameras)",
- returnType = "void",
- params = {
- {type = "int", name = "keyFront"},
- {type = "int", name = "keyBack"},
- {type = "int", name = "keyRight"},
- {type = "int", name = "keyLeft"},
- {type = "int", name = "keyUp"},
- {type = "int", name = "keyDown"}
+ {type = "Camera *", name = "camera"},
+ {type = "Vector3", name = "movement"},
+ {type = "Vector3", name = "rotation"},
+ {type = "float", name = "zoom"}
}
},
{
@@ -4945,6 +4946,14 @@ return {
description = "Load image from screen buffer and (screenshot)",
returnType = "Image"
},
+ {
+ name = "IsImageReady",
+ description = "Check if an image is ready",
+ returnType = "bool",
+ params = {
+ {type = "Image", name = "image"}
+ }
+ },
{
name = "UnloadImage",
description = "Unload image from CPU memory (RAM)",
@@ -5060,6 +5069,16 @@ return {
{type = "int", name = "tileSize"}
}
},
+ {
+ name = "GenImageText",
+ description = "Generate image: grayscale image from text data",
+ returnType = "Image",
+ params = {
+ {type = "int", name = "width"},
+ {type = "int", name = "height"},
+ {type = "const char *", name = "text"}
+ }
+ },
{
name = "ImageCopy",
description = "Create an image duplicate (useful for transformations)",
@@ -5162,6 +5181,15 @@ return {
{type = "Image *", name = "image"}
}
},
+ {
+ name = "ImageBlurGaussian",
+ description = "Apply Gaussian blur using a box blur approximation",
+ returnType = "void",
+ params = {
+ {type = "Image *", name = "image"},
+ {type = "int", name = "blurSize"}
+ }
+ },
{
name = "ImageResize",
description = "Resize image (Bicubic scaling algorithm)",
@@ -5571,6 +5599,14 @@ return {
{type = "int", name = "height"}
}
},
+ {
+ name = "IsTextureReady",
+ description = "Check if a texture is ready",
+ returnType = "bool",
+ params = {
+ {type = "Texture2D", name = "texture"}
+ }
+ },
{
name = "UnloadTexture",
description = "Unload texture from GPU memory (VRAM)",
@@ -5579,6 +5615,14 @@ return {
{type = "Texture2D", name = "texture"}
}
},
+ {
+ name = "IsRenderTextureReady",
+ description = "Check if a render texture is ready",
+ returnType = "bool",
+ params = {
+ {type = "RenderTexture2D", name = "target"}
+ }
+ },
{
name = "UnloadRenderTexture",
description = "Unload render texture from GPU memory (VRAM)",
@@ -5676,32 +5720,6 @@ return {
{type = "Color", name = "tint"}
}
},
- {
- name = "DrawTextureQuad",
- description = "Draw texture quad with tiling and offset parameters",
- returnType = "void",
- params = {
- {type = "Texture2D", name = "texture"},
- {type = "Vector2", name = "tiling"},
- {type = "Vector2", name = "offset"},
- {type = "Rectangle", name = "quad"},
- {type = "Color", name = "tint"}
- }
- },
- {
- name = "DrawTextureTiled",
- description = "Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest.",
- returnType = "void",
- params = {
- {type = "Texture2D", name = "texture"},
- {type = "Rectangle", name = "source"},
- {type = "Rectangle", name = "dest"},
- {type = "Vector2", name = "origin"},
- {type = "float", name = "rotation"},
- {type = "float", name = "scale"},
- {type = "Color", name = "tint"}
- }
- },
{
name = "DrawTexturePro",
description = "Draw a part of a texture defined by a rectangle with 'pro' parameters",
@@ -5728,19 +5746,6 @@ return {
{type = "Color", name = "tint"}
}
},
- {
- name = "DrawTexturePoly",
- description = "Draw a textured polygon",
- returnType = "void",
- params = {
- {type = "Texture2D", name = "texture"},
- {type = "Vector2", name = "center"},
- {type = "Vector2 *", name = "points"},
- {type = "Vector2 *", name = "texcoords"},
- {type = "int", name = "pointCount"},
- {type = "Color", name = "tint"}
- }
- },
{
name = "Fade",
description = "Get color with alpha applied, alpha goes from 0.0f to 1.0f",
@@ -5792,6 +5797,33 @@ return {
{type = "float", name = "value"}
}
},
+ {
+ name = "ColorTint",
+ description = "Get color multiplied with another color",
+ returnType = "Color",
+ params = {
+ {type = "Color", name = "color"},
+ {type = "Color", name = "tint"}
+ }
+ },
+ {
+ name = "ColorBrightness",
+ description = "Get color with brightness correction, brightness factor goes from -1.0f to 1.0f",
+ returnType = "Color",
+ params = {
+ {type = "Color", name = "color"},
+ {type = "float", name = "factor"}
+ }
+ },
+ {
+ name = "ColorContrast",
+ description = "Get color with contrast correction, contrast values between -1.0f and 1.0f",
+ returnType = "Color",
+ params = {
+ {type = "Color", name = "color"},
+ {type = "float", name = "contrast"}
+ }
+ },
{
name = "ColorAlpha",
description = "Get color with alpha applied, alpha goes from 0.0f to 1.0f",
@@ -5895,6 +5927,14 @@ return {
{type = "int", name = "glyphCount"}
}
},
+ {
+ name = "IsFontReady",
+ description = "Check if a font is ready",
+ returnType = "bool",
+ params = {
+ {type = "Font", name = "font"}
+ }
+ },
{
name = "LoadFontData",
description = "Load font data for further use",
@@ -6379,33 +6419,6 @@ return {
{type = "Color", name = "color"}
}
},
- {
- name = "DrawCubeTexture",
- description = "Draw cube textured",
- returnType = "void",
- params = {
- {type = "Texture2D", name = "texture"},
- {type = "Vector3", name = "position"},
- {type = "float", name = "width"},
- {type = "float", name = "height"},
- {type = "float", name = "length"},
- {type = "Color", name = "color"}
- }
- },
- {
- name = "DrawCubeTextureRec",
- description = "Draw cube with a region of a texture",
- returnType = "void",
- params = {
- {type = "Texture2D", name = "texture"},
- {type = "Rectangle", name = "source"},
- {type = "Vector3", name = "position"},
- {type = "float", name = "width"},
- {type = "float", name = "height"},
- {type = "float", name = "length"},
- {type = "Color", name = "color"}
- }
- },
{
name = "DrawSphere",
description = "Draw sphere",
@@ -6492,6 +6505,32 @@ return {
{type = "Color", name = "color"}
}
},
+ {
+ name = "DrawCapsule",
+ description = "Draw a capsule with the center of its sphere caps at startPos and endPos",
+ returnType = "void",
+ params = {
+ {type = "Vector3", name = "startPos"},
+ {type = "Vector3", name = "endPos"},
+ {type = "float", name = "radius"},
+ {type = "int", name = "slices"},
+ {type = "int", name = "rings"},
+ {type = "Color", name = "color"}
+ }
+ },
+ {
+ name = "DrawCapsuleWires",
+ description = "Draw capsule wireframe with the center of its sphere caps at startPos and endPos",
+ returnType = "void",
+ params = {
+ {type = "Vector3", name = "startPos"},
+ {type = "Vector3", name = "endPos"},
+ {type = "float", name = "radius"},
+ {type = "int", name = "slices"},
+ {type = "int", name = "rings"},
+ {type = "Color", name = "color"}
+ }
+ },
{
name = "DrawPlane",
description = "Draw a plane XZ",
@@ -6537,16 +6576,16 @@ return {
}
},
{
- name = "UnloadModel",
- description = "Unload model (including meshes) from memory (RAM and/or VRAM)",
- returnType = "void",
+ name = "IsModelReady",
+ description = "Check if a model is ready",
+ returnType = "bool",
params = {
{type = "Model", name = "model"}
}
},
{
- name = "UnloadModelKeepMeshes",
- description = "Unload model (but not meshes) from memory (RAM and/or VRAM)",
+ name = "UnloadModel",
+ description = "Unload model (including meshes) from memory (RAM and/or VRAM)",
returnType = "void",
params = {
{type = "Model", name = "model"}
@@ -6857,6 +6896,14 @@ return {
description = "Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps)",
returnType = "Material"
},
+ {
+ name = "IsMaterialReady",
+ description = "Check if a material is ready",
+ returnType = "bool",
+ params = {
+ {type = "Material", name = "material"}
+ }
+ },
{
name = "UnloadMaterial",
description = "Unload material from GPU memory (VRAM)",
@@ -7053,6 +7100,14 @@ return {
{type = "int", name = "dataSize"}
}
},
+ {
+ name = "IsWaveReady",
+ description = "Checks if wave data is ready",
+ returnType = "bool",
+ params = {
+ {type = "Wave", name = "wave"}
+ }
+ },
{
name = "LoadSound",
description = "Load sound from file",
@@ -7069,6 +7124,14 @@ return {
{type = "Wave", name = "wave"}
}
},
+ {
+ name = "IsSoundReady",
+ description = "Checks if a sound is ready",
+ returnType = "bool",
+ params = {
+ {type = "Sound", name = "sound"}
+ }
+ },
{
name = "UpdateSound",
description = "Update sound buffer with new data",
@@ -7145,24 +7208,6 @@ return {
{type = "Sound", name = "sound"}
}
},
- {
- name = "PlaySoundMulti",
- description = "Play a sound (using multichannel buffer pool)",
- returnType = "void",
- params = {
- {type = "Sound", name = "sound"}
- }
- },
- {
- name = "StopSoundMulti",
- description = "Stop any sound playing (using multichannel buffer pool)",
- returnType = "void"
- },
- {
- name = "GetSoundsPlaying",
- description = "Get number of sounds playing in the multichannel",
- returnType = "int"
- },
{
name = "IsSoundPlaying",
description = "Check if a sound is currently playing",
@@ -7261,6 +7306,14 @@ return {
{type = "int", name = "dataSize"}
}
},
+ {
+ name = "IsMusicReady",
+ description = "Checks if a music stream is ready",
+ returnType = "bool",
+ params = {
+ {type = "Music", name = "music"}
+ }
+ },
{
name = "UnloadMusicStream",
description = "Unload music stream",
@@ -7379,6 +7432,14 @@ return {
{type = "unsigned int", name = "channels"}
}
},
+ {
+ name = "IsAudioStreamReady",
+ description = "Checks if an audio stream is ready",
+ returnType = "bool",
+ params = {
+ {type = "AudioStream", name = "stream"}
+ }
+ },
{
name = "UnloadAudioStream",
description = "Unload audio stream and free memory",
@@ -7506,6 +7567,22 @@ return {
{type = "AudioStream", name = "stream"},
{type = "AudioCallback", name = "processor"}
}
+ },
+ {
+ name = "AttachAudioMixedProcessor",
+ description = "Attach audio stream processor to the entire audio pipeline",
+ returnType = "void",
+ params = {
+ {type = "AudioCallback", name = "processor"}
+ }
+ },
+ {
+ name = "DetachAudioMixedProcessor",
+ description = "Detach audio stream processor from the entire audio pipeline",
+ returnType = "void",
+ params = {
+ {type = "AudioCallback", name = "processor"}
+ }
}
}
}
diff --git a/parser/output/raylib_api.txt b/parser/output/raylib_api.txt
index c53e292d0..4b13bc3b4 100644
--- a/parser/output/raylib_api.txt
+++ b/parser/output/raylib_api.txt
@@ -1,267 +1,282 @@
-Defines found: 53
+Defines found: 56
Define 001: RAYLIB_H
Name: RAYLIB_H
Type: GUARD
Value:
Description:
-Define 002: RAYLIB_VERSION
+Define 002: RAYLIB_VERSION_MAJOR
+ Name: RAYLIB_VERSION_MAJOR
+ Type: INT
+ Value: 4
+ Description:
+Define 003: RAYLIB_VERSION_MINOR
+ Name: RAYLIB_VERSION_MINOR
+ Type: INT
+ Value: 5
+ Description:
+Define 004: RAYLIB_VERSION_PATCH
+ Name: RAYLIB_VERSION_PATCH
+ Type: INT
+ Value: 0
+ Description:
+Define 005: RAYLIB_VERSION
Name: RAYLIB_VERSION
Type: STRING
- Value: "4.5-dev"
+ Value: "4.5"
Description:
-Define 003: __declspec(x)
+Define 006: __declspec(x)
Name: __declspec(x)
Type: MACRO
Value: __attribute__((x))
Description:
-Define 004: RLAPI
+Define 007: RLAPI
Name: RLAPI
Type: UNKNOWN
Value: __declspec(dllexport)
Description: We are building the library as a Win32 shared library (.dll)
-Define 005: PI
+Define 008: PI
Name: PI
Type: FLOAT
Value: 3.14159265358979323846
Description:
-Define 006: DEG2RAD
+Define 009: DEG2RAD
Name: DEG2RAD
Type: FLOAT_MATH
Value: (PI/180.0f)
Description:
-Define 007: RAD2DEG
+Define 010: RAD2DEG
Name: RAD2DEG
Type: FLOAT_MATH
Value: (180.0f/PI)
Description:
-Define 008: RL_MALLOC(sz)
+Define 011: RL_MALLOC(sz)
Name: RL_MALLOC(sz)
Type: MACRO
Value: malloc(sz)
Description:
-Define 009: RL_CALLOC(n,sz)
+Define 012: RL_CALLOC(n,sz)
Name: RL_CALLOC(n,sz)
Type: MACRO
Value: calloc(n,sz)
Description:
-Define 010: RL_REALLOC(ptr,sz)
+Define 013: RL_REALLOC(ptr,sz)
Name: RL_REALLOC(ptr,sz)
Type: MACRO
Value: realloc(ptr,sz)
Description:
-Define 011: RL_FREE(ptr)
+Define 014: RL_FREE(ptr)
Name: RL_FREE(ptr)
Type: MACRO
Value: free(ptr)
Description:
-Define 012: CLITERAL(type)
+Define 015: CLITERAL(type)
Name: CLITERAL(type)
Type: MACRO
Value: type
Description:
-Define 013: RL_COLOR_TYPE
+Define 016: RL_COLOR_TYPE
Name: RL_COLOR_TYPE
Type: GUARD
Value:
Description:
-Define 014: RL_RECTANGLE_TYPE
+Define 017: RL_RECTANGLE_TYPE
Name: RL_RECTANGLE_TYPE
Type: GUARD
Value:
Description:
-Define 015: RL_VECTOR2_TYPE
+Define 018: RL_VECTOR2_TYPE
Name: RL_VECTOR2_TYPE
Type: GUARD
Value:
Description:
-Define 016: RL_VECTOR3_TYPE
+Define 019: RL_VECTOR3_TYPE
Name: RL_VECTOR3_TYPE
Type: GUARD
Value:
Description:
-Define 017: RL_VECTOR4_TYPE
+Define 020: RL_VECTOR4_TYPE
Name: RL_VECTOR4_TYPE
Type: GUARD
Value:
Description:
-Define 018: RL_QUATERNION_TYPE
+Define 021: RL_QUATERNION_TYPE
Name: RL_QUATERNION_TYPE
Type: GUARD
Value:
Description:
-Define 019: RL_MATRIX_TYPE
+Define 022: RL_MATRIX_TYPE
Name: RL_MATRIX_TYPE
Type: GUARD
Value:
Description:
-Define 020: LIGHTGRAY
+Define 023: LIGHTGRAY
Name: LIGHTGRAY
Type: COLOR
Value: CLITERAL(Color){ 200, 200, 200, 255 }
Description: Light Gray
-Define 021: GRAY
+Define 024: GRAY
Name: GRAY
Type: COLOR
Value: CLITERAL(Color){ 130, 130, 130, 255 }
Description: Gray
-Define 022: DARKGRAY
+Define 025: DARKGRAY
Name: DARKGRAY
Type: COLOR
Value: CLITERAL(Color){ 80, 80, 80, 255 }
Description: Dark Gray
-Define 023: YELLOW
+Define 026: YELLOW
Name: YELLOW
Type: COLOR
Value: CLITERAL(Color){ 253, 249, 0, 255 }
Description: Yellow
-Define 024: GOLD
+Define 027: GOLD
Name: GOLD
Type: COLOR
Value: CLITERAL(Color){ 255, 203, 0, 255 }
Description: Gold
-Define 025: ORANGE
+Define 028: ORANGE
Name: ORANGE
Type: COLOR
Value: CLITERAL(Color){ 255, 161, 0, 255 }
Description: Orange
-Define 026: PINK
+Define 029: PINK
Name: PINK
Type: COLOR
Value: CLITERAL(Color){ 255, 109, 194, 255 }
Description: Pink
-Define 027: RED
+Define 030: RED
Name: RED
Type: COLOR
Value: CLITERAL(Color){ 230, 41, 55, 255 }
Description: Red
-Define 028: MAROON
+Define 031: MAROON
Name: MAROON
Type: COLOR
Value: CLITERAL(Color){ 190, 33, 55, 255 }
Description: Maroon
-Define 029: GREEN
+Define 032: GREEN
Name: GREEN
Type: COLOR
Value: CLITERAL(Color){ 0, 228, 48, 255 }
Description: Green
-Define 030: LIME
+Define 033: LIME
Name: LIME
Type: COLOR
Value: CLITERAL(Color){ 0, 158, 47, 255 }
Description: Lime
-Define 031: DARKGREEN
+Define 034: DARKGREEN
Name: DARKGREEN
Type: COLOR
Value: CLITERAL(Color){ 0, 117, 44, 255 }
Description: Dark Green
-Define 032: SKYBLUE
+Define 035: SKYBLUE
Name: SKYBLUE
Type: COLOR
Value: CLITERAL(Color){ 102, 191, 255, 255 }
Description: Sky Blue
-Define 033: BLUE
+Define 036: BLUE
Name: BLUE
Type: COLOR
Value: CLITERAL(Color){ 0, 121, 241, 255 }
Description: Blue
-Define 034: DARKBLUE
+Define 037: DARKBLUE
Name: DARKBLUE
Type: COLOR
Value: CLITERAL(Color){ 0, 82, 172, 255 }
Description: Dark Blue
-Define 035: PURPLE
+Define 038: PURPLE
Name: PURPLE
Type: COLOR
Value: CLITERAL(Color){ 200, 122, 255, 255 }
Description: Purple
-Define 036: VIOLET
+Define 039: VIOLET
Name: VIOLET
Type: COLOR
Value: CLITERAL(Color){ 135, 60, 190, 255 }
Description: Violet
-Define 037: DARKPURPLE
+Define 040: DARKPURPLE
Name: DARKPURPLE
Type: COLOR
Value: CLITERAL(Color){ 112, 31, 126, 255 }
Description: Dark Purple
-Define 038: BEIGE
+Define 041: BEIGE
Name: BEIGE
Type: COLOR
Value: CLITERAL(Color){ 211, 176, 131, 255 }
Description: Beige
-Define 039: BROWN
+Define 042: BROWN
Name: BROWN
Type: COLOR
Value: CLITERAL(Color){ 127, 106, 79, 255 }
Description: Brown
-Define 040: DARKBROWN
+Define 043: DARKBROWN
Name: DARKBROWN
Type: COLOR
Value: CLITERAL(Color){ 76, 63, 47, 255 }
Description: Dark Brown
-Define 041: WHITE
+Define 044: WHITE
Name: WHITE
Type: COLOR
Value: CLITERAL(Color){ 255, 255, 255, 255 }
Description: White
-Define 042: BLACK
+Define 045: BLACK
Name: BLACK
Type: COLOR
Value: CLITERAL(Color){ 0, 0, 0, 255 }
Description: Black
-Define 043: BLANK
+Define 046: BLANK
Name: BLANK
Type: COLOR
Value: CLITERAL(Color){ 0, 0, 0, 0 }
Description: Blank (Transparent)
-Define 044: MAGENTA
+Define 047: MAGENTA
Name: MAGENTA
Type: COLOR
Value: CLITERAL(Color){ 255, 0, 255, 255 }
Description: Magenta
-Define 045: RAYWHITE
+Define 048: RAYWHITE
Name: RAYWHITE
Type: COLOR
Value: CLITERAL(Color){ 245, 245, 245, 255 }
Description: My own White (raylib logo)
-Define 046: RL_BOOL_TYPE
+Define 049: RL_BOOL_TYPE
Name: RL_BOOL_TYPE
Type: GUARD
Value:
Description:
-Define 047: MOUSE_LEFT_BUTTON
+Define 050: MOUSE_LEFT_BUTTON
Name: MOUSE_LEFT_BUTTON
Type: UNKNOWN
Value: MOUSE_BUTTON_LEFT
Description:
-Define 048: MOUSE_RIGHT_BUTTON
+Define 051: MOUSE_RIGHT_BUTTON
Name: MOUSE_RIGHT_BUTTON
Type: UNKNOWN
Value: MOUSE_BUTTON_RIGHT
Description:
-Define 049: MOUSE_MIDDLE_BUTTON
+Define 052: MOUSE_MIDDLE_BUTTON
Name: MOUSE_MIDDLE_BUTTON
Type: UNKNOWN
Value: MOUSE_BUTTON_MIDDLE
Description:
-Define 050: MATERIAL_MAP_DIFFUSE
+Define 053: MATERIAL_MAP_DIFFUSE
Name: MATERIAL_MAP_DIFFUSE
Type: UNKNOWN
Value: MATERIAL_MAP_ALBEDO
Description:
-Define 051: MATERIAL_MAP_SPECULAR
+Define 054: MATERIAL_MAP_SPECULAR
Name: MATERIAL_MAP_SPECULAR
Type: UNKNOWN
Value: MATERIAL_MAP_METALNESS
Description:
-Define 052: SHADER_LOC_MAP_DIFFUSE
+Define 055: SHADER_LOC_MAP_DIFFUSE
Name: SHADER_LOC_MAP_DIFFUSE
Type: UNKNOWN
Value: SHADER_LOC_MAP_ALBEDO
Description:
-Define 053: SHADER_LOC_MAP_SPECULAR
+Define 056: SHADER_LOC_MAP_SPECULAR
Name: SHADER_LOC_MAP_SPECULAR
Type: UNKNOWN
Value: SHADER_LOC_MAP_METALNESS
@@ -289,7 +304,7 @@ Struct 03: Vector4 (4 fields)
Field[4]: float w // Vector w component
Struct 04: Matrix (16 fields)
Name: Matrix
- Description: Matrix, 4x4 components, column major, OpenGL style, right handed
+ Description: Matrix, 4x4 components, column major, OpenGL style, right-handed
Field[1]: float m0 // Matrix first row (4 components)
Field[2]: float m4 // Matrix first row (4 components)
Field[3]: float m8 // Matrix first row (4 components)
@@ -457,8 +472,8 @@ Struct 24: RayCollision (4 fields)
Name: RayCollision
Description: RayCollision, ray hit information
Field[1]: bool hit // Did the ray hit something?
- Field[2]: float distance // Distance to nearest hit
- Field[3]: Vector3 point // Point of nearest hit
+ Field[2]: float distance // Distance to the nearest hit
+ Field[3]: Vector3 point // Point of the nearest hit
Field[4]: Vector3 normal // Surface normal of hit
Struct 25: BoundingBox (2 fields)
Name: BoundingBox
@@ -948,7 +963,7 @@ Callback 006: AudioCallback() (2 input parameters)
Param[1]: bufferData (type: void *)
Param[2]: frames (type: unsigned int)
-Functions found: 509
+Functions found: 517
Function 001: InitWindow() (3 input parameters)
Name: InitWindow
@@ -1040,252 +1055,258 @@ Function 017: RestoreWindow() (0 input parameters)
Function 018: SetWindowIcon() (1 input parameters)
Name: SetWindowIcon
Return type: void
- Description: Set icon for window (only PLATFORM_DESKTOP)
+ Description: Set icon for window (single image, RGBA 32bit, only PLATFORM_DESKTOP)
Param[1]: image (type: Image)
-Function 019: SetWindowTitle() (1 input parameters)
+Function 019: SetWindowIcons() (2 input parameters)
+ Name: SetWindowIcons
+ Return type: void
+ Description: Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP)
+ Param[1]: images (type: Image *)
+ Param[2]: count (type: int)
+Function 020: SetWindowTitle() (1 input parameters)
Name: SetWindowTitle
Return type: void
Description: Set title for window (only PLATFORM_DESKTOP)
Param[1]: title (type: const char *)
-Function 020: SetWindowPosition() (2 input parameters)
+Function 021: SetWindowPosition() (2 input parameters)
Name: SetWindowPosition
Return type: void
Description: Set window position on screen (only PLATFORM_DESKTOP)
Param[1]: x (type: int)
Param[2]: y (type: int)
-Function 021: SetWindowMonitor() (1 input parameters)
+Function 022: SetWindowMonitor() (1 input parameters)
Name: SetWindowMonitor
Return type: void
Description: Set monitor for the current window (fullscreen mode)
Param[1]: monitor (type: int)
-Function 022: SetWindowMinSize() (2 input parameters)
+Function 023: SetWindowMinSize() (2 input parameters)
Name: SetWindowMinSize
Return type: void
Description: Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE)
Param[1]: width (type: int)
Param[2]: height (type: int)
-Function 023: SetWindowSize() (2 input parameters)
+Function 024: SetWindowSize() (2 input parameters)
Name: SetWindowSize
Return type: void
Description: Set window dimensions
Param[1]: width (type: int)
Param[2]: height (type: int)
-Function 024: SetWindowOpacity() (1 input parameters)
+Function 025: SetWindowOpacity() (1 input parameters)
Name: SetWindowOpacity
Return type: void
Description: Set window opacity [0.0f..1.0f] (only PLATFORM_DESKTOP)
Param[1]: opacity (type: float)
-Function 025: GetWindowHandle() (0 input parameters)
+Function 026: GetWindowHandle() (0 input parameters)
Name: GetWindowHandle
Return type: void *
Description: Get native window handle
No input parameters
-Function 026: GetScreenWidth() (0 input parameters)
+Function 027: GetScreenWidth() (0 input parameters)
Name: GetScreenWidth
Return type: int
Description: Get current screen width
No input parameters
-Function 027: GetScreenHeight() (0 input parameters)
+Function 028: GetScreenHeight() (0 input parameters)
Name: GetScreenHeight
Return type: int
Description: Get current screen height
No input parameters
-Function 028: GetRenderWidth() (0 input parameters)
+Function 029: GetRenderWidth() (0 input parameters)
Name: GetRenderWidth
Return type: int
Description: Get current render width (it considers HiDPI)
No input parameters
-Function 029: GetRenderHeight() (0 input parameters)
+Function 030: GetRenderHeight() (0 input parameters)
Name: GetRenderHeight
Return type: int
Description: Get current render height (it considers HiDPI)
No input parameters
-Function 030: GetMonitorCount() (0 input parameters)
+Function 031: GetMonitorCount() (0 input parameters)
Name: GetMonitorCount
Return type: int
Description: Get number of connected monitors
No input parameters
-Function 031: GetCurrentMonitor() (0 input parameters)
+Function 032: GetCurrentMonitor() (0 input parameters)
Name: GetCurrentMonitor
Return type: int
Description: Get current connected monitor
No input parameters
-Function 032: GetMonitorPosition() (1 input parameters)
+Function 033: GetMonitorPosition() (1 input parameters)
Name: GetMonitorPosition
Return type: Vector2
Description: Get specified monitor position
Param[1]: monitor (type: int)
-Function 033: GetMonitorWidth() (1 input parameters)
+Function 034: GetMonitorWidth() (1 input parameters)
Name: GetMonitorWidth
Return type: int
Description: Get specified monitor width (current video mode used by monitor)
Param[1]: monitor (type: int)
-Function 034: GetMonitorHeight() (1 input parameters)
+Function 035: GetMonitorHeight() (1 input parameters)
Name: GetMonitorHeight
Return type: int
Description: Get specified monitor height (current video mode used by monitor)
Param[1]: monitor (type: int)
-Function 035: GetMonitorPhysicalWidth() (1 input parameters)
+Function 036: GetMonitorPhysicalWidth() (1 input parameters)
Name: GetMonitorPhysicalWidth
Return type: int
Description: Get specified monitor physical width in millimetres
Param[1]: monitor (type: int)
-Function 036: GetMonitorPhysicalHeight() (1 input parameters)
+Function 037: GetMonitorPhysicalHeight() (1 input parameters)
Name: GetMonitorPhysicalHeight
Return type: int
Description: Get specified monitor physical height in millimetres
Param[1]: monitor (type: int)
-Function 037: GetMonitorRefreshRate() (1 input parameters)
+Function 038: GetMonitorRefreshRate() (1 input parameters)
Name: GetMonitorRefreshRate
Return type: int
Description: Get specified monitor refresh rate
Param[1]: monitor (type: int)
-Function 038: GetWindowPosition() (0 input parameters)
+Function 039: GetWindowPosition() (0 input parameters)
Name: GetWindowPosition
Return type: Vector2
Description: Get window position XY on monitor
No input parameters
-Function 039: GetWindowScaleDPI() (0 input parameters)
+Function 040: GetWindowScaleDPI() (0 input parameters)
Name: GetWindowScaleDPI
Return type: Vector2
Description: Get window scale DPI factor
No input parameters
-Function 040: GetMonitorName() (1 input parameters)
+Function 041: GetMonitorName() (1 input parameters)
Name: GetMonitorName
Return type: const char *
Description: Get the human-readable, UTF-8 encoded name of the primary monitor
Param[1]: monitor (type: int)
-Function 041: SetClipboardText() (1 input parameters)
+Function 042: SetClipboardText() (1 input parameters)
Name: SetClipboardText
Return type: void
Description: Set clipboard text content
Param[1]: text (type: const char *)
-Function 042: GetClipboardText() (0 input parameters)
+Function 043: GetClipboardText() (0 input parameters)
Name: GetClipboardText
Return type: const char *
Description: Get clipboard text content
No input parameters
-Function 043: EnableEventWaiting() (0 input parameters)
+Function 044: EnableEventWaiting() (0 input parameters)
Name: EnableEventWaiting
Return type: void
Description: Enable waiting for events on EndDrawing(), no automatic event polling
No input parameters
-Function 044: DisableEventWaiting() (0 input parameters)
+Function 045: DisableEventWaiting() (0 input parameters)
Name: DisableEventWaiting
Return type: void
Description: Disable waiting for events on EndDrawing(), automatic events polling
No input parameters
-Function 045: SwapScreenBuffer() (0 input parameters)
+Function 046: SwapScreenBuffer() (0 input parameters)
Name: SwapScreenBuffer
Return type: void
Description: Swap back buffer with front buffer (screen drawing)
No input parameters
-Function 046: PollInputEvents() (0 input parameters)
+Function 047: PollInputEvents() (0 input parameters)
Name: PollInputEvents
Return type: void
Description: Register all input events
No input parameters
-Function 047: WaitTime() (1 input parameters)
+Function 048: WaitTime() (1 input parameters)
Name: WaitTime
Return type: void
Description: Wait for some time (halt program execution)
Param[1]: seconds (type: double)
-Function 048: ShowCursor() (0 input parameters)
+Function 049: ShowCursor() (0 input parameters)
Name: ShowCursor
Return type: void
Description: Shows cursor
No input parameters
-Function 049: HideCursor() (0 input parameters)
+Function 050: HideCursor() (0 input parameters)
Name: HideCursor
Return type: void
Description: Hides cursor
No input parameters
-Function 050: IsCursorHidden() (0 input parameters)
+Function 051: IsCursorHidden() (0 input parameters)
Name: IsCursorHidden
Return type: bool
Description: Check if cursor is not visible
No input parameters
-Function 051: EnableCursor() (0 input parameters)
+Function 052: EnableCursor() (0 input parameters)
Name: EnableCursor
Return type: void
Description: Enables cursor (unlock cursor)
No input parameters
-Function 052: DisableCursor() (0 input parameters)
+Function 053: DisableCursor() (0 input parameters)
Name: DisableCursor
Return type: void
Description: Disables cursor (lock cursor)
No input parameters
-Function 053: IsCursorOnScreen() (0 input parameters)
+Function 054: IsCursorOnScreen() (0 input parameters)
Name: IsCursorOnScreen
Return type: bool
Description: Check if cursor is on the screen
No input parameters
-Function 054: ClearBackground() (1 input parameters)
+Function 055: ClearBackground() (1 input parameters)
Name: ClearBackground
Return type: void
Description: Set background color (framebuffer clear color)
Param[1]: color (type: Color)
-Function 055: BeginDrawing() (0 input parameters)
+Function 056: BeginDrawing() (0 input parameters)
Name: BeginDrawing
Return type: void
Description: Setup canvas (framebuffer) to start drawing
No input parameters
-Function 056: EndDrawing() (0 input parameters)
+Function 057: EndDrawing() (0 input parameters)
Name: EndDrawing
Return type: void
Description: End canvas drawing and swap buffers (double buffering)
No input parameters
-Function 057: BeginMode2D() (1 input parameters)
+Function 058: BeginMode2D() (1 input parameters)
Name: BeginMode2D
Return type: void
Description: Begin 2D mode with custom camera (2D)
Param[1]: camera (type: Camera2D)
-Function 058: EndMode2D() (0 input parameters)
+Function 059: EndMode2D() (0 input parameters)
Name: EndMode2D
Return type: void
Description: Ends 2D mode with custom camera
No input parameters
-Function 059: BeginMode3D() (1 input parameters)
+Function 060: BeginMode3D() (1 input parameters)
Name: BeginMode3D
Return type: void
Description: Begin 3D mode with custom camera (3D)
Param[1]: camera (type: Camera3D)
-Function 060: EndMode3D() (0 input parameters)
+Function 061: EndMode3D() (0 input parameters)
Name: EndMode3D
Return type: void
Description: Ends 3D mode and returns to default 2D orthographic mode
No input parameters
-Function 061: BeginTextureMode() (1 input parameters)
+Function 062: BeginTextureMode() (1 input parameters)
Name: BeginTextureMode
Return type: void
Description: Begin drawing to render texture
Param[1]: target (type: RenderTexture2D)
-Function 062: EndTextureMode() (0 input parameters)
+Function 063: EndTextureMode() (0 input parameters)
Name: EndTextureMode
Return type: void
Description: Ends drawing to render texture
No input parameters
-Function 063: BeginShaderMode() (1 input parameters)
+Function 064: BeginShaderMode() (1 input parameters)
Name: BeginShaderMode
Return type: void
Description: Begin custom shader drawing
Param[1]: shader (type: Shader)
-Function 064: EndShaderMode() (0 input parameters)
+Function 065: EndShaderMode() (0 input parameters)
Name: EndShaderMode
Return type: void
Description: End custom shader drawing (use default shader)
No input parameters
-Function 065: BeginBlendMode() (1 input parameters)
+Function 066: BeginBlendMode() (1 input parameters)
Name: BeginBlendMode
Return type: void
Description: Begin blending mode (alpha, additive, multiplied, subtract, custom)
Param[1]: mode (type: int)
-Function 066: EndBlendMode() (0 input parameters)
+Function 067: EndBlendMode() (0 input parameters)
Name: EndBlendMode
Return type: void
Description: End blending mode (reset to default: alpha blending)
No input parameters
-Function 067: BeginScissorMode() (4 input parameters)
+Function 068: BeginScissorMode() (4 input parameters)
Name: BeginScissorMode
Return type: void
Description: Begin scissor mode (define screen area for following drawing)
@@ -1293,56 +1314,61 @@ Function 067: BeginScissorMode() (4 input parameters)
Param[2]: y (type: int)
Param[3]: width (type: int)
Param[4]: height (type: int)
-Function 068: EndScissorMode() (0 input parameters)
+Function 069: EndScissorMode() (0 input parameters)
Name: EndScissorMode
Return type: void
Description: End scissor mode
No input parameters
-Function 069: BeginVrStereoMode() (1 input parameters)
+Function 070: BeginVrStereoMode() (1 input parameters)
Name: BeginVrStereoMode
Return type: void
Description: Begin stereo rendering (requires VR simulator)
Param[1]: config (type: VrStereoConfig)
-Function 070: EndVrStereoMode() (0 input parameters)
+Function 071: EndVrStereoMode() (0 input parameters)
Name: EndVrStereoMode
Return type: void
Description: End stereo rendering (requires VR simulator)
No input parameters
-Function 071: LoadVrStereoConfig() (1 input parameters)
+Function 072: LoadVrStereoConfig() (1 input parameters)
Name: LoadVrStereoConfig
Return type: VrStereoConfig
Description: Load VR stereo config for VR simulator device parameters
Param[1]: device (type: VrDeviceInfo)
-Function 072: UnloadVrStereoConfig() (1 input parameters)
+Function 073: UnloadVrStereoConfig() (1 input parameters)
Name: UnloadVrStereoConfig
Return type: void
Description: Unload VR stereo config
Param[1]: config (type: VrStereoConfig)
-Function 073: LoadShader() (2 input parameters)
+Function 074: LoadShader() (2 input parameters)
Name: LoadShader
Return type: Shader
Description: Load shader from files and bind default locations
Param[1]: vsFileName (type: const char *)
Param[2]: fsFileName (type: const char *)
-Function 074: LoadShaderFromMemory() (2 input parameters)
+Function 075: LoadShaderFromMemory() (2 input parameters)
Name: LoadShaderFromMemory
Return type: Shader
Description: Load shader from code strings and bind default locations
Param[1]: vsCode (type: const char *)
Param[2]: fsCode (type: const char *)
-Function 075: GetShaderLocation() (2 input parameters)
+Function 076: IsShaderReady() (1 input parameters)
+ Name: IsShaderReady
+ Return type: bool
+ Description: Check if a shader is ready
+ Param[1]: shader (type: Shader)
+Function 077: GetShaderLocation() (2 input parameters)
Name: GetShaderLocation
Return type: int
Description: Get shader uniform location
Param[1]: shader (type: Shader)
Param[2]: uniformName (type: const char *)
-Function 076: GetShaderLocationAttrib() (2 input parameters)
+Function 078: GetShaderLocationAttrib() (2 input parameters)
Name: GetShaderLocationAttrib
Return type: int
Description: Get shader attribute location
Param[1]: shader (type: Shader)
Param[2]: attribName (type: const char *)
-Function 077: SetShaderValue() (4 input parameters)
+Function 079: SetShaderValue() (4 input parameters)
Name: SetShaderValue
Return type: void
Description: Set shader uniform value
@@ -1350,7 +1376,7 @@ Function 077: SetShaderValue() (4 input parameters)
Param[2]: locIndex (type: int)
Param[3]: value (type: const void *)
Param[4]: uniformType (type: int)
-Function 078: SetShaderValueV() (5 input parameters)
+Function 080: SetShaderValueV() (5 input parameters)
Name: SetShaderValueV
Return type: void
Description: Set shader uniform value vector
@@ -1359,54 +1385,54 @@ Function 078: SetShaderValueV() (5 input parameters)
Param[3]: value (type: const void *)
Param[4]: uniformType (type: int)
Param[5]: count (type: int)
-Function 079: SetShaderValueMatrix() (3 input parameters)
+Function 081: SetShaderValueMatrix() (3 input parameters)
Name: SetShaderValueMatrix
Return type: void
Description: Set shader uniform value (matrix 4x4)
Param[1]: shader (type: Shader)
Param[2]: locIndex (type: int)
Param[3]: mat (type: Matrix)
-Function 080: SetShaderValueTexture() (3 input parameters)
+Function 082: SetShaderValueTexture() (3 input parameters)
Name: SetShaderValueTexture
Return type: void
Description: Set shader uniform value for texture (sampler2d)
Param[1]: shader (type: Shader)
Param[2]: locIndex (type: int)
Param[3]: texture (type: Texture2D)
-Function 081: UnloadShader() (1 input parameters)
+Function 083: UnloadShader() (1 input parameters)
Name: UnloadShader
Return type: void
Description: Unload shader from GPU memory (VRAM)
Param[1]: shader (type: Shader)
-Function 082: GetMouseRay() (2 input parameters)
+Function 084: GetMouseRay() (2 input parameters)
Name: GetMouseRay
Return type: Ray
Description: Get a ray trace from mouse position
Param[1]: mousePosition (type: Vector2)
Param[2]: camera (type: Camera)
-Function 083: GetCameraMatrix() (1 input parameters)
+Function 085: GetCameraMatrix() (1 input parameters)
Name: GetCameraMatrix
Return type: Matrix
Description: Get camera transform matrix (view matrix)
Param[1]: camera (type: Camera)
-Function 084: GetCameraMatrix2D() (1 input parameters)
+Function 086: GetCameraMatrix2D() (1 input parameters)
Name: GetCameraMatrix2D
Return type: Matrix
Description: Get camera 2d transform matrix
Param[1]: camera (type: Camera2D)
-Function 085: GetWorldToScreen() (2 input parameters)
+Function 087: GetWorldToScreen() (2 input parameters)
Name: GetWorldToScreen
Return type: Vector2
Description: Get the screen space position for a 3d world space position
Param[1]: position (type: Vector3)
Param[2]: camera (type: Camera)
-Function 086: GetScreenToWorld2D() (2 input parameters)
+Function 088: GetScreenToWorld2D() (2 input parameters)
Name: GetScreenToWorld2D
Return type: Vector2
Description: Get the world space position for a 2d camera screen space position
Param[1]: position (type: Vector2)
Param[2]: camera (type: Camera2D)
-Function 087: GetWorldToScreenEx() (4 input parameters)
+Function 089: GetWorldToScreenEx() (4 input parameters)
Name: GetWorldToScreenEx
Return type: Vector2
Description: Get size position for a 3d world space position
@@ -1414,566 +1440,544 @@ Function 087: GetWorldToScreenEx() (4 input parameters)
Param[2]: camera (type: Camera)
Param[3]: width (type: int)
Param[4]: height (type: int)
-Function 088: GetWorldToScreen2D() (2 input parameters)
+Function 090: GetWorldToScreen2D() (2 input parameters)
Name: GetWorldToScreen2D
Return type: Vector2
Description: Get the screen space position for a 2d camera world space position
Param[1]: position (type: Vector2)
Param[2]: camera (type: Camera2D)
-Function 089: SetTargetFPS() (1 input parameters)
+Function 091: SetTargetFPS() (1 input parameters)
Name: SetTargetFPS
Return type: void
Description: Set target FPS (maximum)
Param[1]: fps (type: int)
-Function 090: GetFPS() (0 input parameters)
+Function 092: GetFPS() (0 input parameters)
Name: GetFPS
Return type: int
Description: Get current FPS
No input parameters
-Function 091: GetFrameTime() (0 input parameters)
+Function 093: GetFrameTime() (0 input parameters)
Name: GetFrameTime
Return type: float
Description: Get time in seconds for last frame drawn (delta time)
No input parameters
-Function 092: GetTime() (0 input parameters)
+Function 094: GetTime() (0 input parameters)
Name: GetTime
Return type: double
Description: Get elapsed time in seconds since InitWindow()
No input parameters
-Function 093: GetRandomValue() (2 input parameters)
+Function 095: GetRandomValue() (2 input parameters)
Name: GetRandomValue
Return type: int
Description: Get a random value between min and max (both included)
Param[1]: min (type: int)
Param[2]: max (type: int)
-Function 094: SetRandomSeed() (1 input parameters)
+Function 096: SetRandomSeed() (1 input parameters)
Name: SetRandomSeed
Return type: void
Description: Set the seed for the random number generator
Param[1]: seed (type: unsigned int)
-Function 095: TakeScreenshot() (1 input parameters)
+Function 097: TakeScreenshot() (1 input parameters)
Name: TakeScreenshot
Return type: void
Description: Takes a screenshot of current screen (filename extension defines format)
Param[1]: fileName (type: const char *)
-Function 096: SetConfigFlags() (1 input parameters)
+Function 098: SetConfigFlags() (1 input parameters)
Name: SetConfigFlags
Return type: void
Description: Setup init configuration flags (view FLAGS)
Param[1]: flags (type: unsigned int)
-Function 097: TraceLog() (3 input parameters)
+Function 099: TraceLog() (3 input parameters)
Name: TraceLog
Return type: void
Description: Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...)
Param[1]: logLevel (type: int)
Param[2]: text (type: const char *)
Param[3]: args (type: ...)
-Function 098: SetTraceLogLevel() (1 input parameters)
+Function 100: SetTraceLogLevel() (1 input parameters)
Name: SetTraceLogLevel
Return type: void
Description: Set the current threshold (minimum) log level
Param[1]: logLevel (type: int)
-Function 099: MemAlloc() (1 input parameters)
+Function 101: MemAlloc() (1 input parameters)
Name: MemAlloc
Return type: void *
Description: Internal memory allocator
Param[1]: size (type: unsigned int)
-Function 100: MemRealloc() (2 input parameters)
+Function 102: MemRealloc() (2 input parameters)
Name: MemRealloc
Return type: void *
Description: Internal memory reallocator
Param[1]: ptr (type: void *)
Param[2]: size (type: unsigned int)
-Function 101: MemFree() (1 input parameters)
+Function 103: MemFree() (1 input parameters)
Name: MemFree
Return type: void
Description: Internal memory free
Param[1]: ptr (type: void *)
-Function 102: OpenURL() (1 input parameters)
+Function 104: OpenURL() (1 input parameters)
Name: OpenURL
Return type: void
Description: Open URL with default system browser (if available)
Param[1]: url (type: const char *)
-Function 103: SetTraceLogCallback() (1 input parameters)
+Function 105: SetTraceLogCallback() (1 input parameters)
Name: SetTraceLogCallback
Return type: void
Description: Set custom trace log
Param[1]: callback (type: TraceLogCallback)
-Function 104: SetLoadFileDataCallback() (1 input parameters)
+Function 106: SetLoadFileDataCallback() (1 input parameters)
Name: SetLoadFileDataCallback
Return type: void
Description: Set custom file binary data loader
Param[1]: callback (type: LoadFileDataCallback)
-Function 105: SetSaveFileDataCallback() (1 input parameters)
+Function 107: SetSaveFileDataCallback() (1 input parameters)
Name: SetSaveFileDataCallback
Return type: void
Description: Set custom file binary data saver
Param[1]: callback (type: SaveFileDataCallback)
-Function 106: SetLoadFileTextCallback() (1 input parameters)
+Function 108: SetLoadFileTextCallback() (1 input parameters)
Name: SetLoadFileTextCallback
Return type: void
Description: Set custom file text data loader
Param[1]: callback (type: LoadFileTextCallback)
-Function 107: SetSaveFileTextCallback() (1 input parameters)
+Function 109: SetSaveFileTextCallback() (1 input parameters)
Name: SetSaveFileTextCallback
Return type: void
Description: Set custom file text data saver
Param[1]: callback (type: SaveFileTextCallback)
-Function 108: LoadFileData() (2 input parameters)
+Function 110: LoadFileData() (2 input parameters)
Name: LoadFileData
Return type: unsigned char *
Description: Load file data as byte array (read)
Param[1]: fileName (type: const char *)
Param[2]: bytesRead (type: unsigned int *)
-Function 109: UnloadFileData() (1 input parameters)
+Function 111: UnloadFileData() (1 input parameters)
Name: UnloadFileData
Return type: void
Description: Unload file data allocated by LoadFileData()
Param[1]: data (type: unsigned char *)
-Function 110: SaveFileData() (3 input parameters)
+Function 112: SaveFileData() (3 input parameters)
Name: SaveFileData
Return type: bool
Description: Save data to file from byte array (write), returns true on success
Param[1]: fileName (type: const char *)
Param[2]: data (type: void *)
Param[3]: bytesToWrite (type: unsigned int)
-Function 111: ExportDataAsCode() (3 input parameters)
+Function 113: ExportDataAsCode() (3 input parameters)
Name: ExportDataAsCode
Return type: bool
Description: Export data to code (.h), returns true on success
- Param[1]: data (type: const char *)
+ Param[1]: data (type: const unsigned char *)
Param[2]: size (type: unsigned int)
Param[3]: fileName (type: const char *)
-Function 112: LoadFileText() (1 input parameters)
+Function 114: LoadFileText() (1 input parameters)
Name: LoadFileText
Return type: char *
Description: Load text data from file (read), returns a '\0' terminated string
Param[1]: fileName (type: const char *)
-Function 113: UnloadFileText() (1 input parameters)
+Function 115: UnloadFileText() (1 input parameters)
Name: UnloadFileText
Return type: void
Description: Unload file text data allocated by LoadFileText()
Param[1]: text (type: char *)
-Function 114: SaveFileText() (2 input parameters)
+Function 116: SaveFileText() (2 input parameters)
Name: SaveFileText
Return type: bool
Description: Save text data to file (write), string must be '\0' terminated, returns true on success
Param[1]: fileName (type: const char *)
Param[2]: text (type: char *)
-Function 115: FileExists() (1 input parameters)
+Function 117: FileExists() (1 input parameters)
Name: FileExists
Return type: bool
Description: Check if file exists
Param[1]: fileName (type: const char *)
-Function 116: DirectoryExists() (1 input parameters)
+Function 118: DirectoryExists() (1 input parameters)
Name: DirectoryExists
Return type: bool
Description: Check if a directory path exists
Param[1]: dirPath (type: const char *)
-Function 117: IsFileExtension() (2 input parameters)
+Function 119: IsFileExtension() (2 input parameters)
Name: IsFileExtension
Return type: bool
Description: Check file extension (including point: .png, .wav)
Param[1]: fileName (type: const char *)
Param[2]: ext (type: const char *)
-Function 118: GetFileLength() (1 input parameters)
+Function 120: GetFileLength() (1 input parameters)
Name: GetFileLength
Return type: int
Description: Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h)
Param[1]: fileName (type: const char *)
-Function 119: GetFileExtension() (1 input parameters)
+Function 121: GetFileExtension() (1 input parameters)
Name: GetFileExtension
Return type: const char *
Description: Get pointer to extension for a filename string (includes dot: '.png')
Param[1]: fileName (type: const char *)
-Function 120: GetFileName() (1 input parameters)
+Function 122: GetFileName() (1 input parameters)
Name: GetFileName
Return type: const char *
Description: Get pointer to filename for a path string
Param[1]: filePath (type: const char *)
-Function 121: GetFileNameWithoutExt() (1 input parameters)
+Function 123: GetFileNameWithoutExt() (1 input parameters)
Name: GetFileNameWithoutExt
Return type: const char *
Description: Get filename string without extension (uses static string)
Param[1]: filePath (type: const char *)
-Function 122: GetDirectoryPath() (1 input parameters)
+Function 124: GetDirectoryPath() (1 input parameters)
Name: GetDirectoryPath
Return type: const char *
Description: Get full path for a given fileName with path (uses static string)
Param[1]: filePath (type: const char *)
-Function 123: GetPrevDirectoryPath() (1 input parameters)
+Function 125: GetPrevDirectoryPath() (1 input parameters)
Name: GetPrevDirectoryPath
Return type: const char *
Description: Get previous directory path for a given path (uses static string)
Param[1]: dirPath (type: const char *)
-Function 124: GetWorkingDirectory() (0 input parameters)
+Function 126: GetWorkingDirectory() (0 input parameters)
Name: GetWorkingDirectory
Return type: const char *
Description: Get current working directory (uses static string)
No input parameters
-Function 125: GetApplicationDirectory() (0 input parameters)
+Function 127: GetApplicationDirectory() (0 input parameters)
Name: GetApplicationDirectory
Return type: const char *
Description: Get the directory if the running application (uses static string)
No input parameters
-Function 126: ChangeDirectory() (1 input parameters)
+Function 128: ChangeDirectory() (1 input parameters)
Name: ChangeDirectory
Return type: bool
Description: Change working directory, return true on success
Param[1]: dir (type: const char *)
-Function 127: IsPathFile() (1 input parameters)
+Function 129: IsPathFile() (1 input parameters)
Name: IsPathFile
Return type: bool
Description: Check if a given path is a file or a directory
Param[1]: path (type: const char *)
-Function 128: LoadDirectoryFiles() (1 input parameters)
+Function 130: LoadDirectoryFiles() (1 input parameters)
Name: LoadDirectoryFiles
Return type: FilePathList
Description: Load directory filepaths
Param[1]: dirPath (type: const char *)
-Function 129: LoadDirectoryFilesEx() (3 input parameters)
+Function 131: LoadDirectoryFilesEx() (3 input parameters)
Name: LoadDirectoryFilesEx
Return type: FilePathList
Description: Load directory filepaths with extension filtering and recursive directory scan
Param[1]: basePath (type: const char *)
Param[2]: filter (type: const char *)
Param[3]: scanSubdirs (type: bool)
-Function 130: UnloadDirectoryFiles() (1 input parameters)
+Function 132: UnloadDirectoryFiles() (1 input parameters)
Name: UnloadDirectoryFiles
Return type: void
Description: Unload filepaths
Param[1]: files (type: FilePathList)
-Function 131: IsFileDropped() (0 input parameters)
+Function 133: IsFileDropped() (0 input parameters)
Name: IsFileDropped
Return type: bool
Description: Check if a file has been dropped into window
No input parameters
-Function 132: LoadDroppedFiles() (0 input parameters)
+Function 134: LoadDroppedFiles() (0 input parameters)
Name: LoadDroppedFiles
Return type: FilePathList
Description: Load dropped filepaths
No input parameters
-Function 133: UnloadDroppedFiles() (1 input parameters)
+Function 135: UnloadDroppedFiles() (1 input parameters)
Name: UnloadDroppedFiles
Return type: void
Description: Unload dropped filepaths
Param[1]: files (type: FilePathList)
-Function 134: GetFileModTime() (1 input parameters)
+Function 136: GetFileModTime() (1 input parameters)
Name: GetFileModTime
Return type: long
Description: Get file modification time (last write time)
Param[1]: fileName (type: const char *)
-Function 135: CompressData() (3 input parameters)
+Function 137: CompressData() (3 input parameters)
Name: CompressData
Return type: unsigned char *
Description: Compress data (DEFLATE algorithm), memory must be MemFree()
Param[1]: data (type: const unsigned char *)
Param[2]: dataSize (type: int)
Param[3]: compDataSize (type: int *)
-Function 136: DecompressData() (3 input parameters)
+Function 138: DecompressData() (3 input parameters)
Name: DecompressData
Return type: unsigned char *
Description: Decompress data (DEFLATE algorithm), memory must be MemFree()
Param[1]: compData (type: const unsigned char *)
Param[2]: compDataSize (type: int)
Param[3]: dataSize (type: int *)
-Function 137: EncodeDataBase64() (3 input parameters)
+Function 139: EncodeDataBase64() (3 input parameters)
Name: EncodeDataBase64
Return type: char *
Description: Encode data to Base64 string, memory must be MemFree()
Param[1]: data (type: const unsigned char *)
Param[2]: dataSize (type: int)
Param[3]: outputSize (type: int *)
-Function 138: DecodeDataBase64() (2 input parameters)
+Function 140: DecodeDataBase64() (2 input parameters)
Name: DecodeDataBase64
Return type: unsigned char *
Description: Decode Base64 string data, memory must be MemFree()
Param[1]: data (type: const unsigned char *)
Param[2]: outputSize (type: int *)
-Function 139: IsKeyPressed() (1 input parameters)
+Function 141: IsKeyPressed() (1 input parameters)
Name: IsKeyPressed
Return type: bool
Description: Check if a key has been pressed once
Param[1]: key (type: int)
-Function 140: IsKeyDown() (1 input parameters)
+Function 142: IsKeyDown() (1 input parameters)
Name: IsKeyDown
Return type: bool
Description: Check if a key is being pressed
Param[1]: key (type: int)
-Function 141: IsKeyReleased() (1 input parameters)
+Function 143: IsKeyReleased() (1 input parameters)
Name: IsKeyReleased
Return type: bool
Description: Check if a key has been released once
Param[1]: key (type: int)
-Function 142: IsKeyUp() (1 input parameters)
+Function 144: IsKeyUp() (1 input parameters)
Name: IsKeyUp
Return type: bool
Description: Check if a key is NOT being pressed
Param[1]: key (type: int)
-Function 143: SetExitKey() (1 input parameters)
+Function 145: SetExitKey() (1 input parameters)
Name: SetExitKey
Return type: void
Description: Set a custom key to exit program (default is ESC)
Param[1]: key (type: int)
-Function 144: GetKeyPressed() (0 input parameters)
+Function 146: GetKeyPressed() (0 input parameters)
Name: GetKeyPressed
Return type: int
Description: Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty
No input parameters
-Function 145: GetCharPressed() (0 input parameters)
+Function 147: GetCharPressed() (0 input parameters)
Name: GetCharPressed
Return type: int
Description: Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty
No input parameters
-Function 146: IsGamepadAvailable() (1 input parameters)
+Function 148: IsGamepadAvailable() (1 input parameters)
Name: IsGamepadAvailable
Return type: bool
Description: Check if a gamepad is available
Param[1]: gamepad (type: int)
-Function 147: GetGamepadName() (1 input parameters)
+Function 149: GetGamepadName() (1 input parameters)
Name: GetGamepadName
Return type: const char *
Description: Get gamepad internal name id
Param[1]: gamepad (type: int)
-Function 148: IsGamepadButtonPressed() (2 input parameters)
+Function 150: IsGamepadButtonPressed() (2 input parameters)
Name: IsGamepadButtonPressed
Return type: bool
Description: Check if a gamepad button has been pressed once
Param[1]: gamepad (type: int)
Param[2]: button (type: int)
-Function 149: IsGamepadButtonDown() (2 input parameters)
+Function 151: IsGamepadButtonDown() (2 input parameters)
Name: IsGamepadButtonDown
Return type: bool
Description: Check if a gamepad button is being pressed
Param[1]: gamepad (type: int)
Param[2]: button (type: int)
-Function 150: IsGamepadButtonReleased() (2 input parameters)
+Function 152: IsGamepadButtonReleased() (2 input parameters)
Name: IsGamepadButtonReleased
Return type: bool
Description: Check if a gamepad button has been released once
Param[1]: gamepad (type: int)
Param[2]: button (type: int)
-Function 151: IsGamepadButtonUp() (2 input parameters)
+Function 153: IsGamepadButtonUp() (2 input parameters)
Name: IsGamepadButtonUp
Return type: bool
Description: Check if a gamepad button is NOT being pressed
Param[1]: gamepad (type: int)
Param[2]: button (type: int)
-Function 152: GetGamepadButtonPressed() (0 input parameters)
+Function 154: GetGamepadButtonPressed() (0 input parameters)
Name: GetGamepadButtonPressed
Return type: int
Description: Get the last gamepad button pressed
No input parameters
-Function 153: GetGamepadAxisCount() (1 input parameters)
+Function 155: GetGamepadAxisCount() (1 input parameters)
Name: GetGamepadAxisCount
Return type: int
Description: Get gamepad axis count for a gamepad
Param[1]: gamepad (type: int)
-Function 154: GetGamepadAxisMovement() (2 input parameters)
+Function 156: GetGamepadAxisMovement() (2 input parameters)
Name: GetGamepadAxisMovement
Return type: float
Description: Get axis movement value for a gamepad axis
Param[1]: gamepad (type: int)
Param[2]: axis (type: int)
-Function 155: SetGamepadMappings() (1 input parameters)
+Function 157: SetGamepadMappings() (1 input parameters)
Name: SetGamepadMappings
Return type: int
Description: Set internal gamepad mappings (SDL_GameControllerDB)
Param[1]: mappings (type: const char *)
-Function 156: IsMouseButtonPressed() (1 input parameters)
+Function 158: IsMouseButtonPressed() (1 input parameters)
Name: IsMouseButtonPressed
Return type: bool
Description: Check if a mouse button has been pressed once
Param[1]: button (type: int)
-Function 157: IsMouseButtonDown() (1 input parameters)
+Function 159: IsMouseButtonDown() (1 input parameters)
Name: IsMouseButtonDown
Return type: bool
Description: Check if a mouse button is being pressed
Param[1]: button (type: int)
-Function 158: IsMouseButtonReleased() (1 input parameters)
+Function 160: IsMouseButtonReleased() (1 input parameters)
Name: IsMouseButtonReleased
Return type: bool
Description: Check if a mouse button has been released once
Param[1]: button (type: int)
-Function 159: IsMouseButtonUp() (1 input parameters)
+Function 161: IsMouseButtonUp() (1 input parameters)
Name: IsMouseButtonUp
Return type: bool
Description: Check if a mouse button is NOT being pressed
Param[1]: button (type: int)
-Function 160: GetMouseX() (0 input parameters)
+Function 162: GetMouseX() (0 input parameters)
Name: GetMouseX
Return type: int
Description: Get mouse position X
No input parameters
-Function 161: GetMouseY() (0 input parameters)
+Function 163: GetMouseY() (0 input parameters)
Name: GetMouseY
Return type: int
Description: Get mouse position Y
No input parameters
-Function 162: GetMousePosition() (0 input parameters)
+Function 164: GetMousePosition() (0 input parameters)
Name: GetMousePosition
Return type: Vector2
Description: Get mouse position XY
No input parameters
-Function 163: GetMouseDelta() (0 input parameters)
+Function 165: GetMouseDelta() (0 input parameters)
Name: GetMouseDelta
Return type: Vector2
Description: Get mouse delta between frames
No input parameters
-Function 164: SetMousePosition() (2 input parameters)
+Function 166: SetMousePosition() (2 input parameters)
Name: SetMousePosition
Return type: void
Description: Set mouse position XY
Param[1]: x (type: int)
Param[2]: y (type: int)
-Function 165: SetMouseOffset() (2 input parameters)
+Function 167: SetMouseOffset() (2 input parameters)
Name: SetMouseOffset
Return type: void
Description: Set mouse offset
Param[1]: offsetX (type: int)
Param[2]: offsetY (type: int)
-Function 166: SetMouseScale() (2 input parameters)
+Function 168: SetMouseScale() (2 input parameters)
Name: SetMouseScale
Return type: void
Description: Set mouse scaling
Param[1]: scaleX (type: float)
Param[2]: scaleY (type: float)
-Function 167: GetMouseWheelMove() (0 input parameters)
+Function 169: GetMouseWheelMove() (0 input parameters)
Name: GetMouseWheelMove
Return type: float
Description: Get mouse wheel movement for X or Y, whichever is larger
No input parameters
-Function 168: GetMouseWheelMoveV() (0 input parameters)
+Function 170: GetMouseWheelMoveV() (0 input parameters)
Name: GetMouseWheelMoveV
Return type: Vector2
Description: Get mouse wheel movement for both X and Y
No input parameters
-Function 169: SetMouseCursor() (1 input parameters)
+Function 171: SetMouseCursor() (1 input parameters)
Name: SetMouseCursor
Return type: void
Description: Set mouse cursor
Param[1]: cursor (type: int)
-Function 170: GetTouchX() (0 input parameters)
+Function 172: GetTouchX() (0 input parameters)
Name: GetTouchX
Return type: int
Description: Get touch position X for touch point 0 (relative to screen size)
No input parameters
-Function 171: GetTouchY() (0 input parameters)
+Function 173: GetTouchY() (0 input parameters)
Name: GetTouchY
Return type: int
Description: Get touch position Y for touch point 0 (relative to screen size)
No input parameters
-Function 172: GetTouchPosition() (1 input parameters)
+Function 174: GetTouchPosition() (1 input parameters)
Name: GetTouchPosition
Return type: Vector2
Description: Get touch position XY for a touch point index (relative to screen size)
Param[1]: index (type: int)
-Function 173: GetTouchPointId() (1 input parameters)
+Function 175: GetTouchPointId() (1 input parameters)
Name: GetTouchPointId
Return type: int
Description: Get touch point identifier for given index
Param[1]: index (type: int)
-Function 174: GetTouchPointCount() (0 input parameters)
+Function 176: GetTouchPointCount() (0 input parameters)
Name: GetTouchPointCount
Return type: int
Description: Get number of touch points
No input parameters
-Function 175: SetGesturesEnabled() (1 input parameters)
+Function 177: SetGesturesEnabled() (1 input parameters)
Name: SetGesturesEnabled
Return type: void
Description: Enable a set of gestures using flags
Param[1]: flags (type: unsigned int)
-Function 176: IsGestureDetected() (1 input parameters)
+Function 178: IsGestureDetected() (1 input parameters)
Name: IsGestureDetected
Return type: bool
Description: Check if a gesture have been detected
Param[1]: gesture (type: int)
-Function 177: GetGestureDetected() (0 input parameters)
+Function 179: GetGestureDetected() (0 input parameters)
Name: GetGestureDetected
Return type: int
Description: Get latest detected gesture
No input parameters
-Function 178: GetGestureHoldDuration() (0 input parameters)
+Function 180: GetGestureHoldDuration() (0 input parameters)
Name: GetGestureHoldDuration
Return type: float
Description: Get gesture hold time in milliseconds
No input parameters
-Function 179: GetGestureDragVector() (0 input parameters)
+Function 181: GetGestureDragVector() (0 input parameters)
Name: GetGestureDragVector
Return type: Vector2
Description: Get gesture drag vector
No input parameters
-Function 180: GetGestureDragAngle() (0 input parameters)
+Function 182: GetGestureDragAngle() (0 input parameters)
Name: GetGestureDragAngle
Return type: float
Description: Get gesture drag angle
No input parameters
-Function 181: GetGesturePinchVector() (0 input parameters)
+Function 183: GetGesturePinchVector() (0 input parameters)
Name: GetGesturePinchVector
Return type: Vector2
Description: Get gesture pinch delta
No input parameters
-Function 182: GetGesturePinchAngle() (0 input parameters)
+Function 184: GetGesturePinchAngle() (0 input parameters)
Name: GetGesturePinchAngle
Return type: float
Description: Get gesture pinch angle
No input parameters
-Function 183: SetCameraMode() (2 input parameters)
- Name: SetCameraMode
- Return type: void
- Description: Set camera mode (multiple camera modes available)
- Param[1]: camera (type: Camera)
- Param[2]: mode (type: int)
-Function 184: UpdateCamera() (1 input parameters)
+Function 185: UpdateCamera() (2 input parameters)
Name: UpdateCamera
Return type: void
Description: Update camera position for selected mode
Param[1]: camera (type: Camera *)
-Function 185: SetCameraPanControl() (1 input parameters)
- Name: SetCameraPanControl
+ Param[2]: mode (type: int)
+Function 186: UpdateCameraPro() (4 input parameters)
+ Name: UpdateCameraPro
Return type: void
- Description: Set camera pan key to combine with mouse movement (free camera)
- Param[1]: keyPan (type: int)
-Function 186: SetCameraAltControl() (1 input parameters)
- Name: SetCameraAltControl
- Return type: void
- Description: Set camera alt key to combine with mouse movement (free camera)
- Param[1]: keyAlt (type: int)
-Function 187: SetCameraSmoothZoomControl() (1 input parameters)
- Name: SetCameraSmoothZoomControl
- Return type: void
- Description: Set camera smooth zoom key to combine with mouse (free camera)
- Param[1]: keySmoothZoom (type: int)
-Function 188: SetCameraMoveControls() (6 input parameters)
- Name: SetCameraMoveControls
- Return type: void
- Description: Set camera move controls (1st person and 3rd person cameras)
- Param[1]: keyFront (type: int)
- Param[2]: keyBack (type: int)
- Param[3]: keyRight (type: int)
- Param[4]: keyLeft (type: int)
- Param[5]: keyUp (type: int)
- Param[6]: keyDown (type: int)
-Function 189: SetShapesTexture() (2 input parameters)
+ Description: Update camera movement/rotation
+ Param[1]: camera (type: Camera *)
+ Param[2]: movement (type: Vector3)
+ Param[3]: rotation (type: Vector3)
+ Param[4]: zoom (type: float)
+Function 187: SetShapesTexture() (2 input parameters)
Name: SetShapesTexture
Return type: void
Description: Set texture and rectangle to be used on shapes drawing
Param[1]: texture (type: Texture2D)
Param[2]: source (type: Rectangle)
-Function 190: DrawPixel() (3 input parameters)
+Function 188: DrawPixel() (3 input parameters)
Name: DrawPixel
Return type: void
Description: Draw a pixel
Param[1]: posX (type: int)
Param[2]: posY (type: int)
Param[3]: color (type: Color)
-Function 191: DrawPixelV() (2 input parameters)
+Function 189: DrawPixelV() (2 input parameters)
Name: DrawPixelV
Return type: void
Description: Draw a pixel (Vector version)
Param[1]: position (type: Vector2)
Param[2]: color (type: Color)
-Function 192: DrawLine() (5 input parameters)
+Function 190: DrawLine() (5 input parameters)
Name: DrawLine
Return type: void
Description: Draw a line
@@ -1982,14 +1986,14 @@ Function 192: DrawLine() (5 input parameters)
Param[3]: endPosX (type: int)
Param[4]: endPosY (type: int)
Param[5]: color (type: Color)
-Function 193: DrawLineV() (3 input parameters)
+Function 191: DrawLineV() (3 input parameters)
Name: DrawLineV
Return type: void
Description: Draw a line (Vector version)
Param[1]: startPos (type: Vector2)
Param[2]: endPos (type: Vector2)
Param[3]: color (type: Color)
-Function 194: DrawLineEx() (4 input parameters)
+Function 192: DrawLineEx() (4 input parameters)
Name: DrawLineEx
Return type: void
Description: Draw a line defining thickness
@@ -1997,7 +2001,7 @@ Function 194: DrawLineEx() (4 input parameters)
Param[2]: endPos (type: Vector2)
Param[3]: thick (type: float)
Param[4]: color (type: Color)
-Function 195: DrawLineBezier() (4 input parameters)
+Function 193: DrawLineBezier() (4 input parameters)
Name: DrawLineBezier
Return type: void
Description: Draw a line using cubic-bezier curves in-out
@@ -2005,7 +2009,7 @@ Function 195: DrawLineBezier() (4 input parameters)
Param[2]: endPos (type: Vector2)
Param[3]: thick (type: float)
Param[4]: color (type: Color)
-Function 196: DrawLineBezierQuad() (5 input parameters)
+Function 194: DrawLineBezierQuad() (5 input parameters)
Name: DrawLineBezierQuad
Return type: void
Description: Draw line using quadratic bezier curves with a control point
@@ -2014,7 +2018,7 @@ Function 196: DrawLineBezierQuad() (5 input parameters)
Param[3]: controlPos (type: Vector2)
Param[4]: thick (type: float)
Param[5]: color (type: Color)
-Function 197: DrawLineBezierCubic() (6 input parameters)
+Function 195: DrawLineBezierCubic() (6 input parameters)
Name: DrawLineBezierCubic
Return type: void
Description: Draw line using cubic bezier curves with 2 control points
@@ -2024,14 +2028,14 @@ Function 197: DrawLineBezierCubic() (6 input parameters)
Param[4]: endControlPos (type: Vector2)
Param[5]: thick (type: float)
Param[6]: color (type: Color)
-Function 198: DrawLineStrip() (3 input parameters)
+Function 196: DrawLineStrip() (3 input parameters)
Name: DrawLineStrip
Return type: void
Description: Draw lines sequence
Param[1]: points (type: Vector2 *)
Param[2]: pointCount (type: int)
Param[3]: color (type: Color)
-Function 199: DrawCircle() (4 input parameters)
+Function 197: DrawCircle() (4 input parameters)
Name: DrawCircle
Return type: void
Description: Draw a color-filled circle
@@ -2039,7 +2043,7 @@ Function 199: DrawCircle() (4 input parameters)
Param[2]: centerY (type: int)
Param[3]: radius (type: float)
Param[4]: color (type: Color)
-Function 200: DrawCircleSector() (6 input parameters)
+Function 198: DrawCircleSector() (6 input parameters)
Name: DrawCircleSector
Return type: void
Description: Draw a piece of a circle
@@ -2049,7 +2053,7 @@ Function 200: DrawCircleSector() (6 input parameters)
Param[4]: endAngle (type: float)
Param[5]: segments (type: int)
Param[6]: color (type: Color)
-Function 201: DrawCircleSectorLines() (6 input parameters)
+Function 199: DrawCircleSectorLines() (6 input parameters)
Name: DrawCircleSectorLines
Return type: void
Description: Draw circle sector outline
@@ -2059,7 +2063,7 @@ Function 201: DrawCircleSectorLines() (6 input parameters)
Param[4]: endAngle (type: float)
Param[5]: segments (type: int)
Param[6]: color (type: Color)
-Function 202: DrawCircleGradient() (5 input parameters)
+Function 200: DrawCircleGradient() (5 input parameters)
Name: DrawCircleGradient
Return type: void
Description: Draw a gradient-filled circle
@@ -2068,14 +2072,14 @@ Function 202: DrawCircleGradient() (5 input parameters)
Param[3]: radius (type: float)
Param[4]: color1 (type: Color)
Param[5]: color2 (type: Color)
-Function 203: DrawCircleV() (3 input parameters)
+Function 201: DrawCircleV() (3 input parameters)
Name: DrawCircleV
Return type: void
Description: Draw a color-filled circle (Vector version)
Param[1]: center (type: Vector2)
Param[2]: radius (type: float)
Param[3]: color (type: Color)
-Function 204: DrawCircleLines() (4 input parameters)
+Function 202: DrawCircleLines() (4 input parameters)
Name: DrawCircleLines
Return type: void
Description: Draw circle outline
@@ -2083,7 +2087,7 @@ Function 204: DrawCircleLines() (4 input parameters)
Param[2]: centerY (type: int)
Param[3]: radius (type: float)
Param[4]: color (type: Color)
-Function 205: DrawEllipse() (5 input parameters)
+Function 203: DrawEllipse() (5 input parameters)
Name: DrawEllipse
Return type: void
Description: Draw ellipse
@@ -2092,7 +2096,7 @@ Function 205: DrawEllipse() (5 input parameters)
Param[3]: radiusH (type: float)
Param[4]: radiusV (type: float)
Param[5]: color (type: Color)
-Function 206: DrawEllipseLines() (5 input parameters)
+Function 204: DrawEllipseLines() (5 input parameters)
Name: DrawEllipseLines
Return type: void
Description: Draw ellipse outline
@@ -2101,7 +2105,7 @@ Function 206: DrawEllipseLines() (5 input parameters)
Param[3]: radiusH (type: float)
Param[4]: radiusV (type: float)
Param[5]: color (type: Color)
-Function 207: DrawRing() (7 input parameters)
+Function 205: DrawRing() (7 input parameters)
Name: DrawRing
Return type: void
Description: Draw ring
@@ -2112,7 +2116,7 @@ Function 207: DrawRing() (7 input parameters)
Param[5]: endAngle (type: float)
Param[6]: segments (type: int)
Param[7]: color (type: Color)
-Function 208: DrawRingLines() (7 input parameters)
+Function 206: DrawRingLines() (7 input parameters)
Name: DrawRingLines
Return type: void
Description: Draw ring outline
@@ -2123,7 +2127,7 @@ Function 208: DrawRingLines() (7 input parameters)
Param[5]: endAngle (type: float)
Param[6]: segments (type: int)
Param[7]: color (type: Color)
-Function 209: DrawRectangle() (5 input parameters)
+Function 207: DrawRectangle() (5 input parameters)
Name: DrawRectangle
Return type: void
Description: Draw a color-filled rectangle
@@ -2132,20 +2136,20 @@ Function 209: DrawRectangle() (5 input parameters)
Param[3]: width (type: int)
Param[4]: height (type: int)
Param[5]: color (type: Color)
-Function 210: DrawRectangleV() (3 input parameters)
+Function 208: DrawRectangleV() (3 input parameters)
Name: DrawRectangleV
Return type: void
Description: Draw a color-filled rectangle (Vector version)
Param[1]: position (type: Vector2)
Param[2]: size (type: Vector2)
Param[3]: color (type: Color)
-Function 211: DrawRectangleRec() (2 input parameters)
+Function 209: DrawRectangleRec() (2 input parameters)
Name: DrawRectangleRec
Return type: void
Description: Draw a color-filled rectangle
Param[1]: rec (type: Rectangle)
Param[2]: color (type: Color)
-Function 212: DrawRectanglePro() (4 input parameters)
+Function 210: DrawRectanglePro() (4 input parameters)
Name: DrawRectanglePro
Return type: void
Description: Draw a color-filled rectangle with pro parameters
@@ -2153,7 +2157,7 @@ Function 212: DrawRectanglePro() (4 input parameters)
Param[2]: origin (type: Vector2)
Param[3]: rotation (type: float)
Param[4]: color (type: Color)
-Function 213: DrawRectangleGradientV() (6 input parameters)
+Function 211: DrawRectangleGradientV() (6 input parameters)
Name: DrawRectangleGradientV
Return type: void
Description: Draw a vertical-gradient-filled rectangle
@@ -2163,7 +2167,7 @@ Function 213: DrawRectangleGradientV() (6 input parameters)
Param[4]: height (type: int)
Param[5]: color1 (type: Color)
Param[6]: color2 (type: Color)
-Function 214: DrawRectangleGradientH() (6 input parameters)
+Function 212: DrawRectangleGradientH() (6 input parameters)
Name: DrawRectangleGradientH
Return type: void
Description: Draw a horizontal-gradient-filled rectangle
@@ -2173,7 +2177,7 @@ Function 214: DrawRectangleGradientH() (6 input parameters)
Param[4]: height (type: int)
Param[5]: color1 (type: Color)
Param[6]: color2 (type: Color)
-Function 215: DrawRectangleGradientEx() (5 input parameters)
+Function 213: DrawRectangleGradientEx() (5 input parameters)
Name: DrawRectangleGradientEx
Return type: void
Description: Draw a gradient-filled rectangle with custom vertex colors
@@ -2182,7 +2186,7 @@ Function 215: DrawRectangleGradientEx() (5 input parameters)
Param[3]: col2 (type: Color)
Param[4]: col3 (type: Color)
Param[5]: col4 (type: Color)
-Function 216: DrawRectangleLines() (5 input parameters)
+Function 214: DrawRectangleLines() (5 input parameters)
Name: DrawRectangleLines
Return type: void
Description: Draw rectangle outline
@@ -2191,14 +2195,14 @@ Function 216: DrawRectangleLines() (5 input parameters)
Param[3]: width (type: int)
Param[4]: height (type: int)
Param[5]: color (type: Color)
-Function 217: DrawRectangleLinesEx() (3 input parameters)
+Function 215: DrawRectangleLinesEx() (3 input parameters)
Name: DrawRectangleLinesEx
Return type: void
Description: Draw rectangle outline with extended parameters
Param[1]: rec (type: Rectangle)
Param[2]: lineThick (type: float)
Param[3]: color (type: Color)
-Function 218: DrawRectangleRounded() (4 input parameters)
+Function 216: DrawRectangleRounded() (4 input parameters)
Name: DrawRectangleRounded
Return type: void
Description: Draw rectangle with rounded edges
@@ -2206,7 +2210,7 @@ Function 218: DrawRectangleRounded() (4 input parameters)
Param[2]: roundness (type: float)
Param[3]: segments (type: int)
Param[4]: color (type: Color)
-Function 219: DrawRectangleRoundedLines() (5 input parameters)
+Function 217: DrawRectangleRoundedLines() (5 input parameters)
Name: DrawRectangleRoundedLines
Return type: void
Description: Draw rectangle with rounded edges outline
@@ -2215,7 +2219,7 @@ Function 219: DrawRectangleRoundedLines() (5 input parameters)
Param[3]: segments (type: int)
Param[4]: lineThick (type: float)
Param[5]: color (type: Color)
-Function 220: DrawTriangle() (4 input parameters)
+Function 218: DrawTriangle() (4 input parameters)
Name: DrawTriangle
Return type: void
Description: Draw a color-filled triangle (vertex in counter-clockwise order!)
@@ -2223,7 +2227,7 @@ Function 220: DrawTriangle() (4 input parameters)
Param[2]: v2 (type: Vector2)
Param[3]: v3 (type: Vector2)
Param[4]: color (type: Color)
-Function 221: DrawTriangleLines() (4 input parameters)
+Function 219: DrawTriangleLines() (4 input parameters)
Name: DrawTriangleLines
Return type: void
Description: Draw triangle outline (vertex in counter-clockwise order!)
@@ -2231,21 +2235,21 @@ Function 221: DrawTriangleLines() (4 input parameters)
Param[2]: v2 (type: Vector2)
Param[3]: v3 (type: Vector2)
Param[4]: color (type: Color)
-Function 222: DrawTriangleFan() (3 input parameters)
+Function 220: DrawTriangleFan() (3 input parameters)
Name: DrawTriangleFan
Return type: void
Description: Draw a triangle fan defined by points (first vertex is the center)
Param[1]: points (type: Vector2 *)
Param[2]: pointCount (type: int)
Param[3]: color (type: Color)
-Function 223: DrawTriangleStrip() (3 input parameters)
+Function 221: DrawTriangleStrip() (3 input parameters)
Name: DrawTriangleStrip
Return type: void
Description: Draw a triangle strip defined by points
Param[1]: points (type: Vector2 *)
Param[2]: pointCount (type: int)
Param[3]: color (type: Color)
-Function 224: DrawPoly() (5 input parameters)
+Function 222: DrawPoly() (5 input parameters)
Name: DrawPoly
Return type: void
Description: Draw a regular polygon (Vector version)
@@ -2254,7 +2258,7 @@ Function 224: DrawPoly() (5 input parameters)
Param[3]: radius (type: float)
Param[4]: rotation (type: float)
Param[5]: color (type: Color)
-Function 225: DrawPolyLines() (5 input parameters)
+Function 223: DrawPolyLines() (5 input parameters)
Name: DrawPolyLines
Return type: void
Description: Draw a polygon outline of n sides
@@ -2263,7 +2267,7 @@ Function 225: DrawPolyLines() (5 input parameters)
Param[3]: radius (type: float)
Param[4]: rotation (type: float)
Param[5]: color (type: Color)
-Function 226: DrawPolyLinesEx() (6 input parameters)
+Function 224: DrawPolyLinesEx() (6 input parameters)
Name: DrawPolyLinesEx
Return type: void
Description: Draw a polygon outline of n sides with extended parameters
@@ -2273,13 +2277,13 @@ Function 226: DrawPolyLinesEx() (6 input parameters)
Param[4]: rotation (type: float)
Param[5]: lineThick (type: float)
Param[6]: color (type: Color)
-Function 227: CheckCollisionRecs() (2 input parameters)
+Function 225: CheckCollisionRecs() (2 input parameters)
Name: CheckCollisionRecs
Return type: bool
Description: Check collision between two rectangles
Param[1]: rec1 (type: Rectangle)
Param[2]: rec2 (type: Rectangle)
-Function 228: CheckCollisionCircles() (4 input parameters)
+Function 226: CheckCollisionCircles() (4 input parameters)
Name: CheckCollisionCircles
Return type: bool
Description: Check collision between two circles
@@ -2287,27 +2291,27 @@ Function 228: CheckCollisionCircles() (4 input parameters)
Param[2]: radius1 (type: float)
Param[3]: center2 (type: Vector2)
Param[4]: radius2 (type: float)
-Function 229: CheckCollisionCircleRec() (3 input parameters)
+Function 227: CheckCollisionCircleRec() (3 input parameters)
Name: CheckCollisionCircleRec
Return type: bool
Description: Check collision between circle and rectangle
Param[1]: center (type: Vector2)
Param[2]: radius (type: float)
Param[3]: rec (type: Rectangle)
-Function 230: CheckCollisionPointRec() (2 input parameters)
+Function 228: CheckCollisionPointRec() (2 input parameters)
Name: CheckCollisionPointRec
Return type: bool
Description: Check if point is inside rectangle
Param[1]: point (type: Vector2)
Param[2]: rec (type: Rectangle)
-Function 231: CheckCollisionPointCircle() (3 input parameters)
+Function 229: CheckCollisionPointCircle() (3 input parameters)
Name: CheckCollisionPointCircle
Return type: bool
Description: Check if point is inside circle
Param[1]: point (type: Vector2)
Param[2]: center (type: Vector2)
Param[3]: radius (type: float)
-Function 232: CheckCollisionPointTriangle() (4 input parameters)
+Function 230: CheckCollisionPointTriangle() (4 input parameters)
Name: CheckCollisionPointTriangle
Return type: bool
Description: Check if point is inside a triangle
@@ -2315,14 +2319,14 @@ Function 232: CheckCollisionPointTriangle() (4 input parameters)
Param[2]: p1 (type: Vector2)
Param[3]: p2 (type: Vector2)
Param[4]: p3 (type: Vector2)
-Function 233: CheckCollisionPointPoly() (3 input parameters)
+Function 231: CheckCollisionPointPoly() (3 input parameters)
Name: CheckCollisionPointPoly
Return type: bool
Description: Check if point is within a polygon described by array of vertices
Param[1]: point (type: Vector2)
Param[2]: points (type: Vector2 *)
Param[3]: pointCount (type: int)
-Function 234: CheckCollisionLines() (5 input parameters)
+Function 232: CheckCollisionLines() (5 input parameters)
Name: CheckCollisionLines
Return type: bool
Description: Check the collision between two lines defined by two points each, returns collision point by reference
@@ -2331,7 +2335,7 @@ Function 234: CheckCollisionLines() (5 input parameters)
Param[3]: startPos2 (type: Vector2)
Param[4]: endPos2 (type: Vector2)
Param[5]: collisionPoint (type: Vector2 *)
-Function 235: CheckCollisionPointLine() (4 input parameters)
+Function 233: CheckCollisionPointLine() (4 input parameters)
Name: CheckCollisionPointLine
Return type: bool
Description: Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]
@@ -2339,18 +2343,18 @@ Function 235: CheckCollisionPointLine() (4 input parameters)
Param[2]: p1 (type: Vector2)
Param[3]: p2 (type: Vector2)
Param[4]: threshold (type: int)
-Function 236: GetCollisionRec() (2 input parameters)
+Function 234: GetCollisionRec() (2 input parameters)
Name: GetCollisionRec
Return type: Rectangle
Description: Get collision rectangle for two rectangles collision
Param[1]: rec1 (type: Rectangle)
Param[2]: rec2 (type: Rectangle)
-Function 237: LoadImage() (1 input parameters)
+Function 235: LoadImage() (1 input parameters)
Name: LoadImage
Return type: Image
Description: Load image from file into CPU memory (RAM)
Param[1]: fileName (type: const char *)
-Function 238: LoadImageRaw() (5 input parameters)
+Function 236: LoadImageRaw() (5 input parameters)
Name: LoadImageRaw
Return type: Image
Description: Load image from RAW file data
@@ -2359,54 +2363,59 @@ Function 238: LoadImageRaw() (5 input parameters)
Param[3]: height (type: int)
Param[4]: format (type: int)
Param[5]: headerSize (type: int)
-Function 239: LoadImageAnim() (2 input parameters)
+Function 237: LoadImageAnim() (2 input parameters)
Name: LoadImageAnim
Return type: Image
Description: Load image sequence from file (frames appended to image.data)
Param[1]: fileName (type: const char *)
Param[2]: frames (type: int *)
-Function 240: LoadImageFromMemory() (3 input parameters)
+Function 238: LoadImageFromMemory() (3 input parameters)
Name: LoadImageFromMemory
Return type: Image
Description: Load image from memory buffer, fileType refers to extension: i.e. '.png'
Param[1]: fileType (type: const char *)
Param[2]: fileData (type: const unsigned char *)
Param[3]: dataSize (type: int)
-Function 241: LoadImageFromTexture() (1 input parameters)
+Function 239: LoadImageFromTexture() (1 input parameters)
Name: LoadImageFromTexture
Return type: Image
Description: Load image from GPU texture data
Param[1]: texture (type: Texture2D)
-Function 242: LoadImageFromScreen() (0 input parameters)
+Function 240: LoadImageFromScreen() (0 input parameters)
Name: LoadImageFromScreen
Return type: Image
Description: Load image from screen buffer and (screenshot)
No input parameters
-Function 243: UnloadImage() (1 input parameters)
+Function 241: IsImageReady() (1 input parameters)
+ Name: IsImageReady
+ Return type: bool
+ Description: Check if an image is ready
+ Param[1]: image (type: Image)
+Function 242: UnloadImage() (1 input parameters)
Name: UnloadImage
Return type: void
Description: Unload image from CPU memory (RAM)
Param[1]: image (type: Image)
-Function 244: ExportImage() (2 input parameters)
+Function 243: ExportImage() (2 input parameters)
Name: ExportImage
Return type: bool
Description: Export image data to file, returns true on success
Param[1]: image (type: Image)
Param[2]: fileName (type: const char *)
-Function 245: ExportImageAsCode() (2 input parameters)
+Function 244: ExportImageAsCode() (2 input parameters)
Name: ExportImageAsCode
Return type: bool
Description: Export image as code file defining an array of bytes, returns true on success
Param[1]: image (type: Image)
Param[2]: fileName (type: const char *)
-Function 246: GenImageColor() (3 input parameters)
+Function 245: GenImageColor() (3 input parameters)
Name: GenImageColor
Return type: Image
Description: Generate image: plain color
Param[1]: width (type: int)
Param[2]: height (type: int)
Param[3]: color (type: Color)
-Function 247: GenImageGradientV() (4 input parameters)
+Function 246: GenImageGradientV() (4 input parameters)
Name: GenImageGradientV
Return type: Image
Description: Generate image: vertical gradient
@@ -2414,7 +2423,7 @@ Function 247: GenImageGradientV() (4 input parameters)
Param[2]: height (type: int)
Param[3]: top (type: Color)
Param[4]: bottom (type: Color)
-Function 248: GenImageGradientH() (4 input parameters)
+Function 247: GenImageGradientH() (4 input parameters)
Name: GenImageGradientH
Return type: Image
Description: Generate image: horizontal gradient
@@ -2422,7 +2431,7 @@ Function 248: GenImageGradientH() (4 input parameters)
Param[2]: height (type: int)
Param[3]: left (type: Color)
Param[4]: right (type: Color)
-Function 249: GenImageGradientRadial() (5 input parameters)
+Function 248: GenImageGradientRadial() (5 input parameters)
Name: GenImageGradientRadial
Return type: Image
Description: Generate image: radial gradient
@@ -2431,7 +2440,7 @@ Function 249: GenImageGradientRadial() (5 input parameters)
Param[3]: density (type: float)
Param[4]: inner (type: Color)
Param[5]: outer (type: Color)
-Function 250: GenImageChecked() (6 input parameters)
+Function 249: GenImageChecked() (6 input parameters)
Name: GenImageChecked
Return type: Image
Description: Generate image: checked
@@ -2441,14 +2450,14 @@ Function 250: GenImageChecked() (6 input parameters)
Param[4]: checksY (type: int)
Param[5]: col1 (type: Color)
Param[6]: col2 (type: Color)
-Function 251: GenImageWhiteNoise() (3 input parameters)
+Function 250: GenImageWhiteNoise() (3 input parameters)
Name: GenImageWhiteNoise
Return type: Image
Description: Generate image: white noise
Param[1]: width (type: int)
Param[2]: height (type: int)
Param[3]: factor (type: float)
-Function 252: GenImagePerlinNoise() (5 input parameters)
+Function 251: GenImagePerlinNoise() (5 input parameters)
Name: GenImagePerlinNoise
Return type: Image
Description: Generate image: perlin noise
@@ -2457,13 +2466,20 @@ Function 252: GenImagePerlinNoise() (5 input parameters)
Param[3]: offsetX (type: int)
Param[4]: offsetY (type: int)
Param[5]: scale (type: float)
-Function 253: GenImageCellular() (3 input parameters)
+Function 252: GenImageCellular() (3 input parameters)
Name: GenImageCellular
Return type: Image
Description: Generate image: cellular algorithm, bigger tileSize means bigger cells
Param[1]: width (type: int)
Param[2]: height (type: int)
Param[3]: tileSize (type: int)
+Function 253: GenImageText() (3 input parameters)
+ Name: GenImageText
+ Return type: Image
+ Description: Generate image: grayscale image from text data
+ Param[1]: width (type: int)
+ Param[2]: height (type: int)
+ Param[3]: text (type: const char *)
Function 254: ImageCopy() (1 input parameters)
Name: ImageCopy
Return type: Image
@@ -2533,21 +2549,27 @@ Function 264: ImageAlphaPremultiply() (1 input parameters)
Return type: void
Description: Premultiply alpha channel
Param[1]: image (type: Image *)
-Function 265: ImageResize() (3 input parameters)
+Function 265: ImageBlurGaussian() (2 input parameters)
+ Name: ImageBlurGaussian
+ Return type: void
+ Description: Apply Gaussian blur using a box blur approximation
+ Param[1]: image (type: Image *)
+ Param[2]: blurSize (type: int)
+Function 266: ImageResize() (3 input parameters)
Name: ImageResize
Return type: void
Description: Resize image (Bicubic scaling algorithm)
Param[1]: image (type: Image *)
Param[2]: newWidth (type: int)
Param[3]: newHeight (type: int)
-Function 266: ImageResizeNN() (3 input parameters)
+Function 267: ImageResizeNN() (3 input parameters)
Name: ImageResizeNN
Return type: void
Description: Resize image (Nearest-Neighbor scaling algorithm)
Param[1]: image (type: Image *)
Param[2]: newWidth (type: int)
Param[3]: newHeight (type: int)
-Function 267: ImageResizeCanvas() (6 input parameters)
+Function 268: ImageResizeCanvas() (6 input parameters)
Name: ImageResizeCanvas
Return type: void
Description: Resize canvas and fill with color
@@ -2557,12 +2579,12 @@ Function 267: ImageResizeCanvas() (6 input parameters)
Param[4]: offsetX (type: int)
Param[5]: offsetY (type: int)
Param[6]: fill (type: Color)
-Function 268: ImageMipmaps() (1 input parameters)
+Function 269: ImageMipmaps() (1 input parameters)
Name: ImageMipmaps
Return type: void
Description: Compute all mipmap levels for a provided image
Param[1]: image (type: Image *)
-Function 269: ImageDither() (5 input parameters)
+Function 270: ImageDither() (5 input parameters)
Name: ImageDither
Return type: void
Description: Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
@@ -2571,103 +2593,103 @@ Function 269: ImageDither() (5 input parameters)
Param[3]: gBpp (type: int)
Param[4]: bBpp (type: int)
Param[5]: aBpp (type: int)
-Function 270: ImageFlipVertical() (1 input parameters)
+Function 271: ImageFlipVertical() (1 input parameters)
Name: ImageFlipVertical
Return type: void
Description: Flip image vertically
Param[1]: image (type: Image *)
-Function 271: ImageFlipHorizontal() (1 input parameters)
+Function 272: ImageFlipHorizontal() (1 input parameters)
Name: ImageFlipHorizontal
Return type: void
Description: Flip image horizontally
Param[1]: image (type: Image *)
-Function 272: ImageRotateCW() (1 input parameters)
+Function 273: ImageRotateCW() (1 input parameters)
Name: ImageRotateCW
Return type: void
Description: Rotate image clockwise 90deg
Param[1]: image (type: Image *)
-Function 273: ImageRotateCCW() (1 input parameters)
+Function 274: ImageRotateCCW() (1 input parameters)
Name: ImageRotateCCW
Return type: void
Description: Rotate image counter-clockwise 90deg
Param[1]: image (type: Image *)
-Function 274: ImageColorTint() (2 input parameters)
+Function 275: ImageColorTint() (2 input parameters)
Name: ImageColorTint
Return type: void
Description: Modify image color: tint
Param[1]: image (type: Image *)
Param[2]: color (type: Color)
-Function 275: ImageColorInvert() (1 input parameters)
+Function 276: ImageColorInvert() (1 input parameters)
Name: ImageColorInvert
Return type: void
Description: Modify image color: invert
Param[1]: image (type: Image *)
-Function 276: ImageColorGrayscale() (1 input parameters)
+Function 277: ImageColorGrayscale() (1 input parameters)
Name: ImageColorGrayscale
Return type: void
Description: Modify image color: grayscale
Param[1]: image (type: Image *)
-Function 277: ImageColorContrast() (2 input parameters)
+Function 278: ImageColorContrast() (2 input parameters)
Name: ImageColorContrast
Return type: void
Description: Modify image color: contrast (-100 to 100)
Param[1]: image (type: Image *)
Param[2]: contrast (type: float)
-Function 278: ImageColorBrightness() (2 input parameters)
+Function 279: ImageColorBrightness() (2 input parameters)
Name: ImageColorBrightness
Return type: void
Description: Modify image color: brightness (-255 to 255)
Param[1]: image (type: Image *)
Param[2]: brightness (type: int)
-Function 279: ImageColorReplace() (3 input parameters)
+Function 280: ImageColorReplace() (3 input parameters)
Name: ImageColorReplace
Return type: void
Description: Modify image color: replace color
Param[1]: image (type: Image *)
Param[2]: color (type: Color)
Param[3]: replace (type: Color)
-Function 280: LoadImageColors() (1 input parameters)
+Function 281: LoadImageColors() (1 input parameters)
Name: LoadImageColors
Return type: Color *
Description: Load color data from image as a Color array (RGBA - 32bit)
Param[1]: image (type: Image)
-Function 281: LoadImagePalette() (3 input parameters)
+Function 282: LoadImagePalette() (3 input parameters)
Name: LoadImagePalette
Return type: Color *
Description: Load colors palette from image as a Color array (RGBA - 32bit)
Param[1]: image (type: Image)
Param[2]: maxPaletteSize (type: int)
Param[3]: colorCount (type: int *)
-Function 282: UnloadImageColors() (1 input parameters)
+Function 283: UnloadImageColors() (1 input parameters)
Name: UnloadImageColors
Return type: void
Description: Unload color data loaded with LoadImageColors()
Param[1]: colors (type: Color *)
-Function 283: UnloadImagePalette() (1 input parameters)
+Function 284: UnloadImagePalette() (1 input parameters)
Name: UnloadImagePalette
Return type: void
Description: Unload colors palette loaded with LoadImagePalette()
Param[1]: colors (type: Color *)
-Function 284: GetImageAlphaBorder() (2 input parameters)
+Function 285: GetImageAlphaBorder() (2 input parameters)
Name: GetImageAlphaBorder
Return type: Rectangle
Description: Get image alpha border rectangle
Param[1]: image (type: Image)
Param[2]: threshold (type: float)
-Function 285: GetImageColor() (3 input parameters)
+Function 286: GetImageColor() (3 input parameters)
Name: GetImageColor
Return type: Color
Description: Get image pixel color at (x, y) position
Param[1]: image (type: Image)
Param[2]: x (type: int)
Param[3]: y (type: int)
-Function 286: ImageClearBackground() (2 input parameters)
+Function 287: ImageClearBackground() (2 input parameters)
Name: ImageClearBackground
Return type: void
Description: Clear image background with given color
Param[1]: dst (type: Image *)
Param[2]: color (type: Color)
-Function 287: ImageDrawPixel() (4 input parameters)
+Function 288: ImageDrawPixel() (4 input parameters)
Name: ImageDrawPixel
Return type: void
Description: Draw pixel within an image
@@ -2675,14 +2697,14 @@ Function 287: ImageDrawPixel() (4 input parameters)
Param[2]: posX (type: int)
Param[3]: posY (type: int)
Param[4]: color (type: Color)
-Function 288: ImageDrawPixelV() (3 input parameters)
+Function 289: ImageDrawPixelV() (3 input parameters)
Name: ImageDrawPixelV
Return type: void
Description: Draw pixel within an image (Vector version)
Param[1]: dst (type: Image *)
Param[2]: position (type: Vector2)
Param[3]: color (type: Color)
-Function 289: ImageDrawLine() (6 input parameters)
+Function 290: ImageDrawLine() (6 input parameters)
Name: ImageDrawLine
Return type: void
Description: Draw line within an image
@@ -2692,7 +2714,7 @@ Function 289: ImageDrawLine() (6 input parameters)
Param[4]: endPosX (type: int)
Param[5]: endPosY (type: int)
Param[6]: color (type: Color)
-Function 290: ImageDrawLineV() (4 input parameters)
+Function 291: ImageDrawLineV() (4 input parameters)
Name: ImageDrawLineV
Return type: void
Description: Draw line within an image (Vector version)
@@ -2700,7 +2722,7 @@ Function 290: ImageDrawLineV() (4 input parameters)
Param[2]: start (type: Vector2)
Param[3]: end (type: Vector2)
Param[4]: color (type: Color)
-Function 291: ImageDrawCircle() (5 input parameters)
+Function 292: ImageDrawCircle() (5 input parameters)
Name: ImageDrawCircle
Return type: void
Description: Draw a filled circle within an image
@@ -2709,7 +2731,7 @@ Function 291: ImageDrawCircle() (5 input parameters)
Param[3]: centerY (type: int)
Param[4]: radius (type: int)
Param[5]: color (type: Color)
-Function 292: ImageDrawCircleV() (4 input parameters)
+Function 293: ImageDrawCircleV() (4 input parameters)
Name: ImageDrawCircleV
Return type: void
Description: Draw a filled circle within an image (Vector version)
@@ -2717,7 +2739,7 @@ Function 292: ImageDrawCircleV() (4 input parameters)
Param[2]: center (type: Vector2)
Param[3]: radius (type: int)
Param[4]: color (type: Color)
-Function 293: ImageDrawCircleLines() (5 input parameters)
+Function 294: ImageDrawCircleLines() (5 input parameters)
Name: ImageDrawCircleLines
Return type: void
Description: Draw circle outline within an image
@@ -2726,7 +2748,7 @@ Function 293: ImageDrawCircleLines() (5 input parameters)
Param[3]: centerY (type: int)
Param[4]: radius (type: int)
Param[5]: color (type: Color)
-Function 294: ImageDrawCircleLinesV() (4 input parameters)
+Function 295: ImageDrawCircleLinesV() (4 input parameters)
Name: ImageDrawCircleLinesV
Return type: void
Description: Draw circle outline within an image (Vector version)
@@ -2734,7 +2756,7 @@ Function 294: ImageDrawCircleLinesV() (4 input parameters)
Param[2]: center (type: Vector2)
Param[3]: radius (type: int)
Param[4]: color (type: Color)
-Function 295: ImageDrawRectangle() (6 input parameters)
+Function 296: ImageDrawRectangle() (6 input parameters)
Name: ImageDrawRectangle
Return type: void
Description: Draw rectangle within an image
@@ -2744,7 +2766,7 @@ Function 295: ImageDrawRectangle() (6 input parameters)
Param[4]: width (type: int)
Param[5]: height (type: int)
Param[6]: color (type: Color)
-Function 296: ImageDrawRectangleV() (4 input parameters)
+Function 297: ImageDrawRectangleV() (4 input parameters)
Name: ImageDrawRectangleV
Return type: void
Description: Draw rectangle within an image (Vector version)
@@ -2752,14 +2774,14 @@ Function 296: ImageDrawRectangleV() (4 input parameters)
Param[2]: position (type: Vector2)
Param[3]: size (type: Vector2)
Param[4]: color (type: Color)
-Function 297: ImageDrawRectangleRec() (3 input parameters)
+Function 298: ImageDrawRectangleRec() (3 input parameters)
Name: ImageDrawRectangleRec
Return type: void
Description: Draw rectangle within an image
Param[1]: dst (type: Image *)
Param[2]: rec (type: Rectangle)
Param[3]: color (type: Color)
-Function 298: ImageDrawRectangleLines() (4 input parameters)
+Function 299: ImageDrawRectangleLines() (4 input parameters)
Name: ImageDrawRectangleLines
Return type: void
Description: Draw rectangle lines within an image
@@ -2767,7 +2789,7 @@ Function 298: ImageDrawRectangleLines() (4 input parameters)
Param[2]: rec (type: Rectangle)
Param[3]: thick (type: int)
Param[4]: color (type: Color)
-Function 299: ImageDraw() (5 input parameters)
+Function 300: ImageDraw() (5 input parameters)
Name: ImageDraw
Return type: void
Description: Draw a source image within a destination image (tint applied to source)
@@ -2776,7 +2798,7 @@ Function 299: ImageDraw() (5 input parameters)
Param[3]: srcRec (type: Rectangle)
Param[4]: dstRec (type: Rectangle)
Param[5]: tint (type: Color)
-Function 300: ImageDrawText() (6 input parameters)
+Function 301: ImageDrawText() (6 input parameters)
Name: ImageDrawText
Return type: void
Description: Draw text (using default font) within an image (destination)
@@ -2786,7 +2808,7 @@ Function 300: ImageDrawText() (6 input parameters)
Param[4]: posY (type: int)
Param[5]: fontSize (type: int)
Param[6]: color (type: Color)
-Function 301: ImageDrawTextEx() (7 input parameters)
+Function 302: ImageDrawTextEx() (7 input parameters)
Name: ImageDrawTextEx
Return type: void
Description: Draw text (custom sprite font) within an image (destination)
@@ -2797,69 +2819,79 @@ Function 301: ImageDrawTextEx() (7 input parameters)
Param[5]: fontSize (type: float)
Param[6]: spacing (type: float)
Param[7]: tint (type: Color)
-Function 302: LoadTexture() (1 input parameters)
+Function 303: LoadTexture() (1 input parameters)
Name: LoadTexture
Return type: Texture2D
Description: Load texture from file into GPU memory (VRAM)
Param[1]: fileName (type: const char *)
-Function 303: LoadTextureFromImage() (1 input parameters)
+Function 304: LoadTextureFromImage() (1 input parameters)
Name: LoadTextureFromImage
Return type: Texture2D
Description: Load texture from image data
Param[1]: image (type: Image)
-Function 304: LoadTextureCubemap() (2 input parameters)
+Function 305: LoadTextureCubemap() (2 input parameters)
Name: LoadTextureCubemap
Return type: TextureCubemap
Description: Load cubemap from image, multiple image cubemap layouts supported
Param[1]: image (type: Image)
Param[2]: layout (type: int)
-Function 305: LoadRenderTexture() (2 input parameters)
+Function 306: LoadRenderTexture() (2 input parameters)
Name: LoadRenderTexture
Return type: RenderTexture2D
Description: Load texture for rendering (framebuffer)
Param[1]: width (type: int)
Param[2]: height (type: int)
-Function 306: UnloadTexture() (1 input parameters)
+Function 307: IsTextureReady() (1 input parameters)
+ Name: IsTextureReady
+ Return type: bool
+ Description: Check if a texture is ready
+ Param[1]: texture (type: Texture2D)
+Function 308: UnloadTexture() (1 input parameters)
Name: UnloadTexture
Return type: void
Description: Unload texture from GPU memory (VRAM)
Param[1]: texture (type: Texture2D)
-Function 307: UnloadRenderTexture() (1 input parameters)
+Function 309: IsRenderTextureReady() (1 input parameters)
+ Name: IsRenderTextureReady
+ Return type: bool
+ Description: Check if a render texture is ready
+ Param[1]: target (type: RenderTexture2D)
+Function 310: UnloadRenderTexture() (1 input parameters)
Name: UnloadRenderTexture
Return type: void
Description: Unload render texture from GPU memory (VRAM)
Param[1]: target (type: RenderTexture2D)
-Function 308: UpdateTexture() (2 input parameters)
+Function 311: UpdateTexture() (2 input parameters)
Name: UpdateTexture
Return type: void
Description: Update GPU texture with new data
Param[1]: texture (type: Texture2D)
Param[2]: pixels (type: const void *)
-Function 309: UpdateTextureRec() (3 input parameters)
+Function 312: UpdateTextureRec() (3 input parameters)
Name: UpdateTextureRec
Return type: void
Description: Update GPU texture rectangle with new data
Param[1]: texture (type: Texture2D)
Param[2]: rec (type: Rectangle)
Param[3]: pixels (type: const void *)
-Function 310: GenTextureMipmaps() (1 input parameters)
+Function 313: GenTextureMipmaps() (1 input parameters)
Name: GenTextureMipmaps
Return type: void
Description: Generate GPU mipmaps for a texture
Param[1]: texture (type: Texture2D *)
-Function 311: SetTextureFilter() (2 input parameters)
+Function 314: SetTextureFilter() (2 input parameters)
Name: SetTextureFilter
Return type: void
Description: Set texture scaling filter mode
Param[1]: texture (type: Texture2D)
Param[2]: filter (type: int)
-Function 312: SetTextureWrap() (2 input parameters)
+Function 315: SetTextureWrap() (2 input parameters)
Name: SetTextureWrap
Return type: void
Description: Set texture wrapping mode
Param[1]: texture (type: Texture2D)
Param[2]: wrap (type: int)
-Function 313: DrawTexture() (4 input parameters)
+Function 316: DrawTexture() (4 input parameters)
Name: DrawTexture
Return type: void
Description: Draw a Texture2D
@@ -2867,14 +2899,14 @@ Function 313: DrawTexture() (4 input parameters)
Param[2]: posX (type: int)
Param[3]: posY (type: int)
Param[4]: tint (type: Color)
-Function 314: DrawTextureV() (3 input parameters)
+Function 317: DrawTextureV() (3 input parameters)
Name: DrawTextureV
Return type: void
Description: Draw a Texture2D with position defined as Vector2
Param[1]: texture (type: Texture2D)
Param[2]: position (type: Vector2)
Param[3]: tint (type: Color)
-Function 315: DrawTextureEx() (5 input parameters)
+Function 318: DrawTextureEx() (5 input parameters)
Name: DrawTextureEx
Return type: void
Description: Draw a Texture2D with extended parameters
@@ -2883,7 +2915,7 @@ Function 315: DrawTextureEx() (5 input parameters)
Param[3]: rotation (type: float)
Param[4]: scale (type: float)
Param[5]: tint (type: Color)
-Function 316: DrawTextureRec() (4 input parameters)
+Function 319: DrawTextureRec() (4 input parameters)
Name: DrawTextureRec
Return type: void
Description: Draw a part of a texture defined by a rectangle
@@ -2891,27 +2923,7 @@ Function 316: DrawTextureRec() (4 input parameters)
Param[2]: source (type: Rectangle)
Param[3]: position (type: Vector2)
Param[4]: tint (type: Color)
-Function 317: DrawTextureQuad() (5 input parameters)
- Name: DrawTextureQuad
- Return type: void
- Description: Draw texture quad with tiling and offset parameters
- Param[1]: texture (type: Texture2D)
- Param[2]: tiling (type: Vector2)
- Param[3]: offset (type: Vector2)
- Param[4]: quad (type: Rectangle)
- Param[5]: tint (type: Color)
-Function 318: DrawTextureTiled() (7 input parameters)
- Name: DrawTextureTiled
- Return type: void
- Description: Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest.
- Param[1]: texture (type: Texture2D)
- Param[2]: source (type: Rectangle)
- Param[3]: dest (type: Rectangle)
- Param[4]: origin (type: Vector2)
- Param[5]: rotation (type: float)
- Param[6]: scale (type: float)
- Param[7]: tint (type: Color)
-Function 319: DrawTexturePro() (6 input parameters)
+Function 320: DrawTexturePro() (6 input parameters)
Name: DrawTexturePro
Return type: void
Description: Draw a part of a texture defined by a rectangle with 'pro' parameters
@@ -2921,7 +2933,7 @@ Function 319: DrawTexturePro() (6 input parameters)
Param[4]: origin (type: Vector2)
Param[5]: rotation (type: float)
Param[6]: tint (type: Color)
-Function 320: DrawTextureNPatch() (6 input parameters)
+Function 321: DrawTextureNPatch() (6 input parameters)
Name: DrawTextureNPatch
Return type: void
Description: Draws a texture (or part of it) that stretches or shrinks nicely
@@ -2931,16 +2943,6 @@ Function 320: DrawTextureNPatch() (6 input parameters)
Param[4]: origin (type: Vector2)
Param[5]: rotation (type: float)
Param[6]: tint (type: Color)
-Function 321: DrawTexturePoly() (6 input parameters)
- Name: DrawTexturePoly
- Return type: void
- Description: Draw a textured polygon
- Param[1]: texture (type: Texture2D)
- Param[2]: center (type: Vector2)
- Param[3]: points (type: Vector2 *)
- Param[4]: texcoords (type: Vector2 *)
- Param[5]: pointCount (type: int)
- Param[6]: tint (type: Color)
Function 322: Fade() (2 input parameters)
Name: Fade
Return type: Color
@@ -2974,55 +2976,73 @@ Function 327: ColorFromHSV() (3 input parameters)
Param[1]: hue (type: float)
Param[2]: saturation (type: float)
Param[3]: value (type: float)
-Function 328: ColorAlpha() (2 input parameters)
+Function 328: ColorTint() (2 input parameters)
+ Name: ColorTint
+ Return type: Color
+ Description: Get color multiplied with another color
+ Param[1]: color (type: Color)
+ Param[2]: tint (type: Color)
+Function 329: ColorBrightness() (2 input parameters)
+ Name: ColorBrightness
+ Return type: Color
+ Description: Get color with brightness correction, brightness factor goes from -1.0f to 1.0f
+ Param[1]: color (type: Color)
+ Param[2]: factor (type: float)
+Function 330: ColorContrast() (2 input parameters)
+ Name: ColorContrast
+ Return type: Color
+ Description: Get color with contrast correction, contrast values between -1.0f and 1.0f
+ Param[1]: color (type: Color)
+ Param[2]: contrast (type: float)
+Function 331: ColorAlpha() (2 input parameters)
Name: ColorAlpha
Return type: Color
Description: Get color with alpha applied, alpha goes from 0.0f to 1.0f
Param[1]: color (type: Color)
Param[2]: alpha (type: float)
-Function 329: ColorAlphaBlend() (3 input parameters)
+Function 332: ColorAlphaBlend() (3 input parameters)
Name: ColorAlphaBlend
Return type: Color
Description: Get src alpha-blended into dst color with tint
Param[1]: dst (type: Color)
Param[2]: src (type: Color)
Param[3]: tint (type: Color)
-Function 330: GetColor() (1 input parameters)
+Function 333: GetColor() (1 input parameters)
Name: GetColor
Return type: Color
Description: Get Color structure from hexadecimal value
Param[1]: hexValue (type: unsigned int)
-Function 331: GetPixelColor() (2 input parameters)
+Function 334: GetPixelColor() (2 input parameters)
Name: GetPixelColor
Return type: Color
Description: Get Color from a source pixel pointer of certain format
Param[1]: srcPtr (type: void *)
Param[2]: format (type: int)
-Function 332: SetPixelColor() (3 input parameters)
+Function 335: SetPixelColor() (3 input parameters)
Name: SetPixelColor
Return type: void
Description: Set color formatted into destination pixel pointer
Param[1]: dstPtr (type: void *)
Param[2]: color (type: Color)
Param[3]: format (type: int)
-Function 333: GetPixelDataSize() (3 input parameters)
+Function 336: GetPixelDataSize() (3 input parameters)
Name: GetPixelDataSize
Return type: int
Description: Get pixel data size in bytes for certain format
Param[1]: width (type: int)
Param[2]: height (type: int)
Param[3]: format (type: int)
-Function 334: GetFontDefault() (0 input parameters)
+Function 337: GetFontDefault() (0 input parameters)
Name: GetFontDefault
Return type: Font
Description: Get the default Font
No input parameters
-Function 335: LoadFont() (1 input parameters)
+Function 338: LoadFont() (1 input parameters)
Name: LoadFont
Return type: Font
Description: Load font from file into GPU memory (VRAM)
Param[1]: fileName (type: const char *)
-Function 336: LoadFontEx() (4 input parameters)
+Function 339: LoadFontEx() (4 input parameters)
Name: LoadFontEx
Return type: Font
Description: Load font from file with extended parameters, use NULL for fontChars and 0 for glyphCount to load the default character set
@@ -3030,14 +3050,14 @@ Function 336: LoadFontEx() (4 input parameters)
Param[2]: fontSize (type: int)
Param[3]: fontChars (type: int *)
Param[4]: glyphCount (type: int)
-Function 337: LoadFontFromImage() (3 input parameters)
+Function 340: LoadFontFromImage() (3 input parameters)
Name: LoadFontFromImage
Return type: Font
Description: Load font from Image (XNA style)
Param[1]: image (type: Image)
Param[2]: key (type: Color)
Param[3]: firstChar (type: int)
-Function 338: LoadFontFromMemory() (6 input parameters)
+Function 341: LoadFontFromMemory() (6 input parameters)
Name: LoadFontFromMemory
Return type: Font
Description: Load font from memory buffer, fileType refers to extension: i.e. '.ttf'
@@ -3047,7 +3067,12 @@ Function 338: LoadFontFromMemory() (6 input parameters)
Param[4]: fontSize (type: int)
Param[5]: fontChars (type: int *)
Param[6]: glyphCount (type: int)
-Function 339: LoadFontData() (6 input parameters)
+Function 342: IsFontReady() (1 input parameters)
+ Name: IsFontReady
+ Return type: bool
+ Description: Check if a font is ready
+ Param[1]: font (type: Font)
+Function 343: LoadFontData() (6 input parameters)
Name: LoadFontData
Return type: GlyphInfo *
Description: Load font data for further use
@@ -3057,7 +3082,7 @@ Function 339: LoadFontData() (6 input parameters)
Param[4]: fontChars (type: int *)
Param[5]: glyphCount (type: int)
Param[6]: type (type: int)
-Function 340: GenImageFontAtlas() (6 input parameters)
+Function 344: GenImageFontAtlas() (6 input parameters)
Name: GenImageFontAtlas
Return type: Image
Description: Generate image font atlas using chars info
@@ -3067,30 +3092,30 @@ Function 340: GenImageFontAtlas() (6 input parameters)
Param[4]: fontSize (type: int)
Param[5]: padding (type: int)
Param[6]: packMethod (type: int)
-Function 341: UnloadFontData() (2 input parameters)
+Function 345: UnloadFontData() (2 input parameters)
Name: UnloadFontData
Return type: void
Description: Unload font chars info data (RAM)
Param[1]: chars (type: GlyphInfo *)
Param[2]: glyphCount (type: int)
-Function 342: UnloadFont() (1 input parameters)
+Function 346: UnloadFont() (1 input parameters)
Name: UnloadFont
Return type: void
Description: Unload font from GPU memory (VRAM)
Param[1]: font (type: Font)
-Function 343: ExportFontAsCode() (2 input parameters)
+Function 347: ExportFontAsCode() (2 input parameters)
Name: ExportFontAsCode
Return type: bool
Description: Export font as code file, returns true on success
Param[1]: font (type: Font)
Param[2]: fileName (type: const char *)
-Function 344: DrawFPS() (2 input parameters)
+Function 348: DrawFPS() (2 input parameters)
Name: DrawFPS
Return type: void
Description: Draw current FPS
Param[1]: posX (type: int)
Param[2]: posY (type: int)
-Function 345: DrawText() (5 input parameters)
+Function 349: DrawText() (5 input parameters)
Name: DrawText
Return type: void
Description: Draw text (using default font)
@@ -3099,7 +3124,7 @@ Function 345: DrawText() (5 input parameters)
Param[3]: posY (type: int)
Param[4]: fontSize (type: int)
Param[5]: color (type: Color)
-Function 346: DrawTextEx() (6 input parameters)
+Function 350: DrawTextEx() (6 input parameters)
Name: DrawTextEx
Return type: void
Description: Draw text using font and additional parameters
@@ -3109,7 +3134,7 @@ Function 346: DrawTextEx() (6 input parameters)
Param[4]: fontSize (type: float)
Param[5]: spacing (type: float)
Param[6]: tint (type: Color)
-Function 347: DrawTextPro() (8 input parameters)
+Function 351: DrawTextPro() (8 input parameters)
Name: DrawTextPro
Return type: void
Description: Draw text using Font and pro parameters (rotation)
@@ -3121,7 +3146,7 @@ Function 347: DrawTextPro() (8 input parameters)
Param[6]: fontSize (type: float)
Param[7]: spacing (type: float)
Param[8]: tint (type: Color)
-Function 348: DrawTextCodepoint() (5 input parameters)
+Function 352: DrawTextCodepoint() (5 input parameters)
Name: DrawTextCodepoint
Return type: void
Description: Draw one character (codepoint)
@@ -3130,7 +3155,7 @@ Function 348: DrawTextCodepoint() (5 input parameters)
Param[3]: position (type: Vector2)
Param[4]: fontSize (type: float)
Param[5]: tint (type: Color)
-Function 349: DrawTextCodepoints() (7 input parameters)
+Function 353: DrawTextCodepoints() (7 input parameters)
Name: DrawTextCodepoints
Return type: void
Description: Draw multiple character (codepoint)
@@ -3141,13 +3166,13 @@ Function 349: DrawTextCodepoints() (7 input parameters)
Param[5]: fontSize (type: float)
Param[6]: spacing (type: float)
Param[7]: tint (type: Color)
-Function 350: MeasureText() (2 input parameters)
+Function 354: MeasureText() (2 input parameters)
Name: MeasureText
Return type: int
Description: Measure string width for default font
Param[1]: text (type: const char *)
Param[2]: fontSize (type: int)
-Function 351: MeasureTextEx() (4 input parameters)
+Function 355: MeasureTextEx() (4 input parameters)
Name: MeasureTextEx
Return type: Vector2
Description: Measure string size for Font
@@ -3155,180 +3180,180 @@ Function 351: MeasureTextEx() (4 input parameters)
Param[2]: text (type: const char *)
Param[3]: fontSize (type: float)
Param[4]: spacing (type: float)
-Function 352: GetGlyphIndex() (2 input parameters)
+Function 356: GetGlyphIndex() (2 input parameters)
Name: GetGlyphIndex
Return type: int
Description: Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found
Param[1]: font (type: Font)
Param[2]: codepoint (type: int)
-Function 353: GetGlyphInfo() (2 input parameters)
+Function 357: GetGlyphInfo() (2 input parameters)
Name: GetGlyphInfo
Return type: GlyphInfo
Description: Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found
Param[1]: font (type: Font)
Param[2]: codepoint (type: int)
-Function 354: GetGlyphAtlasRec() (2 input parameters)
+Function 358: GetGlyphAtlasRec() (2 input parameters)
Name: GetGlyphAtlasRec
Return type: Rectangle
Description: Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found
Param[1]: font (type: Font)
Param[2]: codepoint (type: int)
-Function 355: LoadUTF8() (2 input parameters)
+Function 359: LoadUTF8() (2 input parameters)
Name: LoadUTF8
Return type: char *
Description: Load UTF-8 text encoded from codepoints array
Param[1]: codepoints (type: const int *)
Param[2]: length (type: int)
-Function 356: UnloadUTF8() (1 input parameters)
+Function 360: UnloadUTF8() (1 input parameters)
Name: UnloadUTF8
Return type: void
Description: Unload UTF-8 text encoded from codepoints array
Param[1]: text (type: char *)
-Function 357: LoadCodepoints() (2 input parameters)
+Function 361: LoadCodepoints() (2 input parameters)
Name: LoadCodepoints
Return type: int *
Description: Load all codepoints from a UTF-8 text string, codepoints count returned by parameter
Param[1]: text (type: const char *)
Param[2]: count (type: int *)
-Function 358: UnloadCodepoints() (1 input parameters)
+Function 362: UnloadCodepoints() (1 input parameters)
Name: UnloadCodepoints
Return type: void
Description: Unload codepoints data from memory
Param[1]: codepoints (type: int *)
-Function 359: GetCodepointCount() (1 input parameters)
+Function 363: GetCodepointCount() (1 input parameters)
Name: GetCodepointCount
Return type: int
Description: Get total number of codepoints in a UTF-8 encoded string
Param[1]: text (type: const char *)
-Function 360: GetCodepoint() (2 input parameters)
+Function 364: GetCodepoint() (2 input parameters)
Name: GetCodepoint
Return type: int
Description: Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
Param[1]: text (type: const char *)
Param[2]: codepointSize (type: int *)
-Function 361: GetCodepointNext() (2 input parameters)
+Function 365: GetCodepointNext() (2 input parameters)
Name: GetCodepointNext
Return type: int
Description: Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
Param[1]: text (type: const char *)
Param[2]: codepointSize (type: int *)
-Function 362: GetCodepointPrevious() (2 input parameters)
+Function 366: GetCodepointPrevious() (2 input parameters)
Name: GetCodepointPrevious
Return type: int
Description: Get previous codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
Param[1]: text (type: const char *)
Param[2]: codepointSize (type: int *)
-Function 363: CodepointToUTF8() (2 input parameters)
+Function 367: CodepointToUTF8() (2 input parameters)
Name: CodepointToUTF8
Return type: const char *
Description: Encode one codepoint into UTF-8 byte array (array length returned as parameter)
Param[1]: codepoint (type: int)
Param[2]: utf8Size (type: int *)
-Function 364: TextCopy() (2 input parameters)
+Function 368: TextCopy() (2 input parameters)
Name: TextCopy
Return type: int
Description: Copy one string to another, returns bytes copied
Param[1]: dst (type: char *)
Param[2]: src (type: const char *)
-Function 365: TextIsEqual() (2 input parameters)
+Function 369: TextIsEqual() (2 input parameters)
Name: TextIsEqual
Return type: bool
Description: Check if two text string are equal
Param[1]: text1 (type: const char *)
Param[2]: text2 (type: const char *)
-Function 366: TextLength() (1 input parameters)
+Function 370: TextLength() (1 input parameters)
Name: TextLength
Return type: unsigned int
Description: Get text length, checks for '\0' ending
Param[1]: text (type: const char *)
-Function 367: TextFormat() (2 input parameters)
+Function 371: TextFormat() (2 input parameters)
Name: TextFormat
Return type: const char *
Description: Text formatting with variables (sprintf() style)
Param[1]: text (type: const char *)
Param[2]: args (type: ...)
-Function 368: TextSubtext() (3 input parameters)
+Function 372: TextSubtext() (3 input parameters)
Name: TextSubtext
Return type: const char *
Description: Get a piece of a text string
Param[1]: text (type: const char *)
Param[2]: position (type: int)
Param[3]: length (type: int)
-Function 369: TextReplace() (3 input parameters)
+Function 373: TextReplace() (3 input parameters)
Name: TextReplace
Return type: char *
Description: Replace text string (WARNING: memory must be freed!)
Param[1]: text (type: char *)
Param[2]: replace (type: const char *)
Param[3]: by (type: const char *)
-Function 370: TextInsert() (3 input parameters)
+Function 374: TextInsert() (3 input parameters)
Name: TextInsert
Return type: char *
Description: Insert text in a position (WARNING: memory must be freed!)
Param[1]: text (type: const char *)
Param[2]: insert (type: const char *)
Param[3]: position (type: int)
-Function 371: TextJoin() (3 input parameters)
+Function 375: TextJoin() (3 input parameters)
Name: TextJoin
Return type: const char *
Description: Join text strings with delimiter
Param[1]: textList (type: const char **)
Param[2]: count (type: int)
Param[3]: delimiter (type: const char *)
-Function 372: TextSplit() (3 input parameters)
+Function 376: TextSplit() (3 input parameters)
Name: TextSplit
Return type: const char **
Description: Split text into multiple strings
Param[1]: text (type: const char *)
Param[2]: delimiter (type: char)
Param[3]: count (type: int *)
-Function 373: TextAppend() (3 input parameters)
+Function 377: TextAppend() (3 input parameters)
Name: TextAppend
Return type: void
Description: Append text at specific position and move cursor!
Param[1]: text (type: char *)
Param[2]: append (type: const char *)
Param[3]: position (type: int *)
-Function 374: TextFindIndex() (2 input parameters)
+Function 378: TextFindIndex() (2 input parameters)
Name: TextFindIndex
Return type: int
Description: Find first text occurrence within a string
Param[1]: text (type: const char *)
Param[2]: find (type: const char *)
-Function 375: TextToUpper() (1 input parameters)
+Function 379: TextToUpper() (1 input parameters)
Name: TextToUpper
Return type: const char *
Description: Get upper case version of provided string
Param[1]: text (type: const char *)
-Function 376: TextToLower() (1 input parameters)
+Function 380: TextToLower() (1 input parameters)
Name: TextToLower
Return type: const char *
Description: Get lower case version of provided string
Param[1]: text (type: const char *)
-Function 377: TextToPascal() (1 input parameters)
+Function 381: TextToPascal() (1 input parameters)
Name: TextToPascal
Return type: const char *
Description: Get Pascal case notation version of provided string
Param[1]: text (type: const char *)
-Function 378: TextToInteger() (1 input parameters)
+Function 382: TextToInteger() (1 input parameters)
Name: TextToInteger
Return type: int
Description: Get integer value from text (negative values not supported)
Param[1]: text (type: const char *)
-Function 379: DrawLine3D() (3 input parameters)
+Function 383: DrawLine3D() (3 input parameters)
Name: DrawLine3D
Return type: void
Description: Draw a line in 3D world space
Param[1]: startPos (type: Vector3)
Param[2]: endPos (type: Vector3)
Param[3]: color (type: Color)
-Function 380: DrawPoint3D() (2 input parameters)
+Function 384: DrawPoint3D() (2 input parameters)
Name: DrawPoint3D
Return type: void
Description: Draw a point in 3D space, actually a small line
Param[1]: position (type: Vector3)
Param[2]: color (type: Color)
-Function 381: DrawCircle3D() (5 input parameters)
+Function 385: DrawCircle3D() (5 input parameters)
Name: DrawCircle3D
Return type: void
Description: Draw a circle in 3D world space
@@ -3337,7 +3362,7 @@ Function 381: DrawCircle3D() (5 input parameters)
Param[3]: rotationAxis (type: Vector3)
Param[4]: rotationAngle (type: float)
Param[5]: color (type: Color)
-Function 382: DrawTriangle3D() (4 input parameters)
+Function 386: DrawTriangle3D() (4 input parameters)
Name: DrawTriangle3D
Return type: void
Description: Draw a color-filled triangle (vertex in counter-clockwise order!)
@@ -3345,14 +3370,14 @@ Function 382: DrawTriangle3D() (4 input parameters)
Param[2]: v2 (type: Vector3)
Param[3]: v3 (type: Vector3)
Param[4]: color (type: Color)
-Function 383: DrawTriangleStrip3D() (3 input parameters)
+Function 387: DrawTriangleStrip3D() (3 input parameters)
Name: DrawTriangleStrip3D
Return type: void
Description: Draw a triangle strip defined by points
Param[1]: points (type: Vector3 *)
Param[2]: pointCount (type: int)
Param[3]: color (type: Color)
-Function 384: DrawCube() (5 input parameters)
+Function 388: DrawCube() (5 input parameters)
Name: DrawCube
Return type: void
Description: Draw cube
@@ -3361,14 +3386,14 @@ Function 384: DrawCube() (5 input parameters)
Param[3]: height (type: float)
Param[4]: length (type: float)
Param[5]: color (type: Color)
-Function 385: DrawCubeV() (3 input parameters)
+Function 389: DrawCubeV() (3 input parameters)
Name: DrawCubeV
Return type: void
Description: Draw cube (Vector version)
Param[1]: position (type: Vector3)
Param[2]: size (type: Vector3)
Param[3]: color (type: Color)
-Function 386: DrawCubeWires() (5 input parameters)
+Function 390: DrawCubeWires() (5 input parameters)
Name: DrawCubeWires
Return type: void
Description: Draw cube wires
@@ -3377,42 +3402,21 @@ Function 386: DrawCubeWires() (5 input parameters)
Param[3]: height (type: float)
Param[4]: length (type: float)
Param[5]: color (type: Color)
-Function 387: DrawCubeWiresV() (3 input parameters)
+Function 391: DrawCubeWiresV() (3 input parameters)
Name: DrawCubeWiresV
Return type: void
Description: Draw cube wires (Vector version)
Param[1]: position (type: Vector3)
Param[2]: size (type: Vector3)
Param[3]: color (type: Color)
-Function 388: DrawCubeTexture() (6 input parameters)
- Name: DrawCubeTexture
- Return type: void
- Description: Draw cube textured
- Param[1]: texture (type: Texture2D)
- Param[2]: position (type: Vector3)
- Param[3]: width (type: float)
- Param[4]: height (type: float)
- Param[5]: length (type: float)
- Param[6]: color (type: Color)
-Function 389: DrawCubeTextureRec() (7 input parameters)
- Name: DrawCubeTextureRec
- Return type: void
- Description: Draw cube with a region of a texture
- Param[1]: texture (type: Texture2D)
- Param[2]: source (type: Rectangle)
- Param[3]: position (type: Vector3)
- Param[4]: width (type: float)
- Param[5]: height (type: float)
- Param[6]: length (type: float)
- Param[7]: color (type: Color)
-Function 390: DrawSphere() (3 input parameters)
+Function 392: DrawSphere() (3 input parameters)
Name: DrawSphere
Return type: void
Description: Draw sphere
Param[1]: centerPos (type: Vector3)
Param[2]: radius (type: float)
Param[3]: color (type: Color)
-Function 391: DrawSphereEx() (5 input parameters)
+Function 393: DrawSphereEx() (5 input parameters)
Name: DrawSphereEx
Return type: void
Description: Draw sphere with extended parameters
@@ -3421,7 +3425,7 @@ Function 391: DrawSphereEx() (5 input parameters)
Param[3]: rings (type: int)
Param[4]: slices (type: int)
Param[5]: color (type: Color)
-Function 392: DrawSphereWires() (5 input parameters)
+Function 394: DrawSphereWires() (5 input parameters)
Name: DrawSphereWires
Return type: void
Description: Draw sphere wires
@@ -3430,7 +3434,7 @@ Function 392: DrawSphereWires() (5 input parameters)
Param[3]: rings (type: int)
Param[4]: slices (type: int)
Param[5]: color (type: Color)
-Function 393: DrawCylinder() (6 input parameters)
+Function 395: DrawCylinder() (6 input parameters)
Name: DrawCylinder
Return type: void
Description: Draw a cylinder/cone
@@ -3440,7 +3444,7 @@ Function 393: DrawCylinder() (6 input parameters)
Param[4]: height (type: float)
Param[5]: slices (type: int)
Param[6]: color (type: Color)
-Function 394: DrawCylinderEx() (6 input parameters)
+Function 396: DrawCylinderEx() (6 input parameters)
Name: DrawCylinderEx
Return type: void
Description: Draw a cylinder with base at startPos and top at endPos
@@ -3450,7 +3454,7 @@ Function 394: DrawCylinderEx() (6 input parameters)
Param[4]: endRadius (type: float)
Param[5]: sides (type: int)
Param[6]: color (type: Color)
-Function 395: DrawCylinderWires() (6 input parameters)
+Function 397: DrawCylinderWires() (6 input parameters)
Name: DrawCylinderWires
Return type: void
Description: Draw a cylinder/cone wires
@@ -3460,7 +3464,7 @@ Function 395: DrawCylinderWires() (6 input parameters)
Param[4]: height (type: float)
Param[5]: slices (type: int)
Param[6]: color (type: Color)
-Function 396: DrawCylinderWiresEx() (6 input parameters)
+Function 398: DrawCylinderWiresEx() (6 input parameters)
Name: DrawCylinderWiresEx
Return type: void
Description: Draw a cylinder wires with base at startPos and top at endPos
@@ -3470,51 +3474,71 @@ Function 396: DrawCylinderWiresEx() (6 input parameters)
Param[4]: endRadius (type: float)
Param[5]: sides (type: int)
Param[6]: color (type: Color)
-Function 397: DrawPlane() (3 input parameters)
+Function 399: DrawCapsule() (6 input parameters)
+ Name: DrawCapsule
+ Return type: void
+ Description: Draw a capsule with the center of its sphere caps at startPos and endPos
+ Param[1]: startPos (type: Vector3)
+ Param[2]: endPos (type: Vector3)
+ Param[3]: radius (type: float)
+ Param[4]: slices (type: int)
+ Param[5]: rings (type: int)
+ Param[6]: color (type: Color)
+Function 400: DrawCapsuleWires() (6 input parameters)
+ Name: DrawCapsuleWires
+ Return type: void
+ Description: Draw capsule wireframe with the center of its sphere caps at startPos and endPos
+ Param[1]: startPos (type: Vector3)
+ Param[2]: endPos (type: Vector3)
+ Param[3]: radius (type: float)
+ Param[4]: slices (type: int)
+ Param[5]: rings (type: int)
+ Param[6]: color (type: Color)
+Function 401: DrawPlane() (3 input parameters)
Name: DrawPlane
Return type: void
Description: Draw a plane XZ
Param[1]: centerPos (type: Vector3)
Param[2]: size (type: Vector2)
Param[3]: color (type: Color)
-Function 398: DrawRay() (2 input parameters)
+Function 402: DrawRay() (2 input parameters)
Name: DrawRay
Return type: void
Description: Draw a ray line
Param[1]: ray (type: Ray)
Param[2]: color (type: Color)
-Function 399: DrawGrid() (2 input parameters)
+Function 403: DrawGrid() (2 input parameters)
Name: DrawGrid
Return type: void
Description: Draw a grid (centered at (0, 0, 0))
Param[1]: slices (type: int)
Param[2]: spacing (type: float)
-Function 400: LoadModel() (1 input parameters)
+Function 404: LoadModel() (1 input parameters)
Name: LoadModel
Return type: Model
Description: Load model from files (meshes and materials)
Param[1]: fileName (type: const char *)
-Function 401: LoadModelFromMesh() (1 input parameters)
+Function 405: LoadModelFromMesh() (1 input parameters)
Name: LoadModelFromMesh
Return type: Model
Description: Load model from generated mesh (default material)
Param[1]: mesh (type: Mesh)
-Function 402: UnloadModel() (1 input parameters)
+Function 406: IsModelReady() (1 input parameters)
+ Name: IsModelReady
+ Return type: bool
+ Description: Check if a model is ready
+ Param[1]: model (type: Model)
+Function 407: UnloadModel() (1 input parameters)
Name: UnloadModel
Return type: void
Description: Unload model (including meshes) from memory (RAM and/or VRAM)
Param[1]: model (type: Model)
-Function 403: UnloadModelKeepMeshes() (1 input parameters)
- Name: UnloadModelKeepMeshes
- Return type: void
- Description: Unload model (but not meshes) from memory (RAM and/or VRAM)
- Param[1]: model (type: Model)
-Function 404: GetModelBoundingBox() (1 input parameters)
+Function 408: GetModelBoundingBox() (1 input parameters)
Name: GetModelBoundingBox
Return type: BoundingBox
Description: Compute model bounding box limits (considers all meshes)
Param[1]: model (type: Model)
-Function 405: DrawModel() (4 input parameters)
+Function 409: DrawModel() (4 input parameters)
Name: DrawModel
Return type: void
Description: Draw a model (with texture if set)
@@ -3522,7 +3546,7 @@ Function 405: DrawModel() (4 input parameters)
Param[2]: position (type: Vector3)
Param[3]: scale (type: float)
Param[4]: tint (type: Color)
-Function 406: DrawModelEx() (6 input parameters)
+Function 410: DrawModelEx() (6 input parameters)
Name: DrawModelEx
Return type: void
Description: Draw a model with extended parameters
@@ -3532,7 +3556,7 @@ Function 406: DrawModelEx() (6 input parameters)
Param[4]: rotationAngle (type: float)
Param[5]: scale (type: Vector3)
Param[6]: tint (type: Color)
-Function 407: DrawModelWires() (4 input parameters)
+Function 411: DrawModelWires() (4 input parameters)
Name: DrawModelWires
Return type: void
Description: Draw a model wires (with texture if set)
@@ -3540,7 +3564,7 @@ Function 407: DrawModelWires() (4 input parameters)
Param[2]: position (type: Vector3)
Param[3]: scale (type: float)
Param[4]: tint (type: Color)
-Function 408: DrawModelWiresEx() (6 input parameters)
+Function 412: DrawModelWiresEx() (6 input parameters)
Name: DrawModelWiresEx
Return type: void
Description: Draw a model wires (with texture if set) with extended parameters
@@ -3550,13 +3574,13 @@ Function 408: DrawModelWiresEx() (6 input parameters)
Param[4]: rotationAngle (type: float)
Param[5]: scale (type: Vector3)
Param[6]: tint (type: Color)
-Function 409: DrawBoundingBox() (2 input parameters)
+Function 413: DrawBoundingBox() (2 input parameters)
Name: DrawBoundingBox
Return type: void
Description: Draw bounding box (wires)
Param[1]: box (type: BoundingBox)
Param[2]: color (type: Color)
-Function 410: DrawBillboard() (5 input parameters)
+Function 414: DrawBillboard() (5 input parameters)
Name: DrawBillboard
Return type: void
Description: Draw a billboard texture
@@ -3565,7 +3589,7 @@ Function 410: DrawBillboard() (5 input parameters)
Param[3]: position (type: Vector3)
Param[4]: size (type: float)
Param[5]: tint (type: Color)
-Function 411: DrawBillboardRec() (6 input parameters)
+Function 415: DrawBillboardRec() (6 input parameters)
Name: DrawBillboardRec
Return type: void
Description: Draw a billboard texture defined by source
@@ -3575,7 +3599,7 @@ Function 411: DrawBillboardRec() (6 input parameters)
Param[4]: position (type: Vector3)
Param[5]: size (type: Vector2)
Param[6]: tint (type: Color)
-Function 412: DrawBillboardPro() (9 input parameters)
+Function 416: DrawBillboardPro() (9 input parameters)
Name: DrawBillboardPro
Return type: void
Description: Draw a billboard texture defined by source and rotation
@@ -3588,13 +3612,13 @@ Function 412: DrawBillboardPro() (9 input parameters)
Param[7]: origin (type: Vector2)
Param[8]: rotation (type: float)
Param[9]: tint (type: Color)
-Function 413: UploadMesh() (2 input parameters)
+Function 417: UploadMesh() (2 input parameters)
Name: UploadMesh
Return type: void
Description: Upload mesh vertex data in GPU and provide VAO/VBO ids
Param[1]: mesh (type: Mesh *)
Param[2]: dynamic (type: bool)
-Function 414: UpdateMeshBuffer() (5 input parameters)
+Function 418: UpdateMeshBuffer() (5 input parameters)
Name: UpdateMeshBuffer
Return type: void
Description: Update mesh vertex data in GPU for a specific buffer index
@@ -3603,19 +3627,19 @@ Function 414: UpdateMeshBuffer() (5 input parameters)
Param[3]: data (type: const void *)
Param[4]: dataSize (type: int)
Param[5]: offset (type: int)
-Function 415: UnloadMesh() (1 input parameters)
+Function 419: UnloadMesh() (1 input parameters)
Name: UnloadMesh
Return type: void
Description: Unload mesh data from CPU and GPU
Param[1]: mesh (type: Mesh)
-Function 416: DrawMesh() (3 input parameters)
+Function 420: DrawMesh() (3 input parameters)
Name: DrawMesh
Return type: void
Description: Draw a 3d mesh with material and transform
Param[1]: mesh (type: Mesh)
Param[2]: material (type: Material)
Param[3]: transform (type: Matrix)
-Function 417: DrawMeshInstanced() (4 input parameters)
+Function 421: DrawMeshInstanced() (4 input parameters)
Name: DrawMeshInstanced
Return type: void
Description: Draw multiple mesh instances with material and different transforms
@@ -3623,29 +3647,29 @@ Function 417: DrawMeshInstanced() (4 input parameters)
Param[2]: material (type: Material)
Param[3]: transforms (type: const Matrix *)
Param[4]: instances (type: int)
-Function 418: ExportMesh() (2 input parameters)
+Function 422: ExportMesh() (2 input parameters)
Name: ExportMesh
Return type: bool
Description: Export mesh data to file, returns true on success
Param[1]: mesh (type: Mesh)
Param[2]: fileName (type: const char *)
-Function 419: GetMeshBoundingBox() (1 input parameters)
+Function 423: GetMeshBoundingBox() (1 input parameters)
Name: GetMeshBoundingBox
Return type: BoundingBox
Description: Compute mesh bounding box limits
Param[1]: mesh (type: Mesh)
-Function 420: GenMeshTangents() (1 input parameters)
+Function 424: GenMeshTangents() (1 input parameters)
Name: GenMeshTangents
Return type: void
Description: Compute mesh tangents
Param[1]: mesh (type: Mesh *)
-Function 421: GenMeshPoly() (2 input parameters)
+Function 425: GenMeshPoly() (2 input parameters)
Name: GenMeshPoly
Return type: Mesh
Description: Generate polygonal mesh
Param[1]: sides (type: int)
Param[2]: radius (type: float)
-Function 422: GenMeshPlane() (4 input parameters)
+Function 426: GenMeshPlane() (4 input parameters)
Name: GenMeshPlane
Return type: Mesh
Description: Generate plane mesh (with subdivisions)
@@ -3653,42 +3677,42 @@ Function 422: GenMeshPlane() (4 input parameters)
Param[2]: length (type: float)
Param[3]: resX (type: int)
Param[4]: resZ (type: int)
-Function 423: GenMeshCube() (3 input parameters)
+Function 427: GenMeshCube() (3 input parameters)
Name: GenMeshCube
Return type: Mesh
Description: Generate cuboid mesh
Param[1]: width (type: float)
Param[2]: height (type: float)
Param[3]: length (type: float)
-Function 424: GenMeshSphere() (3 input parameters)
+Function 428: GenMeshSphere() (3 input parameters)
Name: GenMeshSphere
Return type: Mesh
Description: Generate sphere mesh (standard sphere)
Param[1]: radius (type: float)
Param[2]: rings (type: int)
Param[3]: slices (type: int)
-Function 425: GenMeshHemiSphere() (3 input parameters)
+Function 429: GenMeshHemiSphere() (3 input parameters)
Name: GenMeshHemiSphere
Return type: Mesh
Description: Generate half-sphere mesh (no bottom cap)
Param[1]: radius (type: float)
Param[2]: rings (type: int)
Param[3]: slices (type: int)
-Function 426: GenMeshCylinder() (3 input parameters)
+Function 430: GenMeshCylinder() (3 input parameters)
Name: GenMeshCylinder
Return type: Mesh
Description: Generate cylinder mesh
Param[1]: radius (type: float)
Param[2]: height (type: float)
Param[3]: slices (type: int)
-Function 427: GenMeshCone() (3 input parameters)
+Function 431: GenMeshCone() (3 input parameters)
Name: GenMeshCone
Return type: Mesh
Description: Generate cone/pyramid mesh
Param[1]: radius (type: float)
Param[2]: height (type: float)
Param[3]: slices (type: int)
-Function 428: GenMeshTorus() (4 input parameters)
+Function 432: GenMeshTorus() (4 input parameters)
Name: GenMeshTorus
Return type: Mesh
Description: Generate torus mesh
@@ -3696,7 +3720,7 @@ Function 428: GenMeshTorus() (4 input parameters)
Param[2]: size (type: float)
Param[3]: radSeg (type: int)
Param[4]: sides (type: int)
-Function 429: GenMeshKnot() (4 input parameters)
+Function 433: GenMeshKnot() (4 input parameters)
Name: GenMeshKnot
Return type: Mesh
Description: Generate trefoil knot mesh
@@ -3704,79 +3728,84 @@ Function 429: GenMeshKnot() (4 input parameters)
Param[2]: size (type: float)
Param[3]: radSeg (type: int)
Param[4]: sides (type: int)
-Function 430: GenMeshHeightmap() (2 input parameters)
+Function 434: GenMeshHeightmap() (2 input parameters)
Name: GenMeshHeightmap
Return type: Mesh
Description: Generate heightmap mesh from image data
Param[1]: heightmap (type: Image)
Param[2]: size (type: Vector3)
-Function 431: GenMeshCubicmap() (2 input parameters)
+Function 435: GenMeshCubicmap() (2 input parameters)
Name: GenMeshCubicmap
Return type: Mesh
Description: Generate cubes-based map mesh from image data
Param[1]: cubicmap (type: Image)
Param[2]: cubeSize (type: Vector3)
-Function 432: LoadMaterials() (2 input parameters)
+Function 436: LoadMaterials() (2 input parameters)
Name: LoadMaterials
Return type: Material *
Description: Load materials from model file
Param[1]: fileName (type: const char *)
Param[2]: materialCount (type: int *)
-Function 433: LoadMaterialDefault() (0 input parameters)
+Function 437: LoadMaterialDefault() (0 input parameters)
Name: LoadMaterialDefault
Return type: Material
Description: Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps)
No input parameters
-Function 434: UnloadMaterial() (1 input parameters)
+Function 438: IsMaterialReady() (1 input parameters)
+ Name: IsMaterialReady
+ Return type: bool
+ Description: Check if a material is ready
+ Param[1]: material (type: Material)
+Function 439: UnloadMaterial() (1 input parameters)
Name: UnloadMaterial
Return type: void
Description: Unload material from GPU memory (VRAM)
Param[1]: material (type: Material)
-Function 435: SetMaterialTexture() (3 input parameters)
+Function 440: SetMaterialTexture() (3 input parameters)
Name: SetMaterialTexture
Return type: void
Description: Set texture for a material map type (MATERIAL_MAP_DIFFUSE, MATERIAL_MAP_SPECULAR...)
Param[1]: material (type: Material *)
Param[2]: mapType (type: int)
Param[3]: texture (type: Texture2D)
-Function 436: SetModelMeshMaterial() (3 input parameters)
+Function 441: SetModelMeshMaterial() (3 input parameters)
Name: SetModelMeshMaterial
Return type: void
Description: Set material for a mesh
Param[1]: model (type: Model *)
Param[2]: meshId (type: int)
Param[3]: materialId (type: int)
-Function 437: LoadModelAnimations() (2 input parameters)
+Function 442: LoadModelAnimations() (2 input parameters)
Name: LoadModelAnimations
Return type: ModelAnimation *
Description: Load model animations from file
Param[1]: fileName (type: const char *)
Param[2]: animCount (type: unsigned int *)
-Function 438: UpdateModelAnimation() (3 input parameters)
+Function 443: UpdateModelAnimation() (3 input parameters)
Name: UpdateModelAnimation
Return type: void
Description: Update model animation pose
Param[1]: model (type: Model)
Param[2]: anim (type: ModelAnimation)
Param[3]: frame (type: int)
-Function 439: UnloadModelAnimation() (1 input parameters)
+Function 444: UnloadModelAnimation() (1 input parameters)
Name: UnloadModelAnimation
Return type: void
Description: Unload animation data
Param[1]: anim (type: ModelAnimation)
-Function 440: UnloadModelAnimations() (2 input parameters)
+Function 445: UnloadModelAnimations() (2 input parameters)
Name: UnloadModelAnimations
Return type: void
Description: Unload animation array data
Param[1]: animations (type: ModelAnimation *)
Param[2]: count (type: unsigned int)
-Function 441: IsModelAnimationValid() (2 input parameters)
+Function 446: IsModelAnimationValid() (2 input parameters)
Name: IsModelAnimationValid
Return type: bool
Description: Check model animation skeleton match
Param[1]: model (type: Model)
Param[2]: anim (type: ModelAnimation)
-Function 442: CheckCollisionSpheres() (4 input parameters)
+Function 447: CheckCollisionSpheres() (4 input parameters)
Name: CheckCollisionSpheres
Return type: bool
Description: Check collision between two spheres
@@ -3784,40 +3813,40 @@ Function 442: CheckCollisionSpheres() (4 input parameters)
Param[2]: radius1 (type: float)
Param[3]: center2 (type: Vector3)
Param[4]: radius2 (type: float)
-Function 443: CheckCollisionBoxes() (2 input parameters)
+Function 448: CheckCollisionBoxes() (2 input parameters)
Name: CheckCollisionBoxes
Return type: bool
Description: Check collision between two bounding boxes
Param[1]: box1 (type: BoundingBox)
Param[2]: box2 (type: BoundingBox)
-Function 444: CheckCollisionBoxSphere() (3 input parameters)
+Function 449: CheckCollisionBoxSphere() (3 input parameters)
Name: CheckCollisionBoxSphere
Return type: bool
Description: Check collision between box and sphere
Param[1]: box (type: BoundingBox)
Param[2]: center (type: Vector3)
Param[3]: radius (type: float)
-Function 445: GetRayCollisionSphere() (3 input parameters)
+Function 450: GetRayCollisionSphere() (3 input parameters)
Name: GetRayCollisionSphere
Return type: RayCollision
Description: Get collision info between ray and sphere
Param[1]: ray (type: Ray)
Param[2]: center (type: Vector3)
Param[3]: radius (type: float)
-Function 446: GetRayCollisionBox() (2 input parameters)
+Function 451: GetRayCollisionBox() (2 input parameters)
Name: GetRayCollisionBox
Return type: RayCollision
Description: Get collision info between ray and box
Param[1]: ray (type: Ray)
Param[2]: box (type: BoundingBox)
-Function 447: GetRayCollisionMesh() (3 input parameters)
+Function 452: GetRayCollisionMesh() (3 input parameters)
Name: GetRayCollisionMesh
Return type: RayCollision
Description: Get collision info between ray and mesh
Param[1]: ray (type: Ray)
Param[2]: mesh (type: Mesh)
Param[3]: transform (type: Matrix)
-Function 448: GetRayCollisionTriangle() (4 input parameters)
+Function 453: GetRayCollisionTriangle() (4 input parameters)
Name: GetRayCollisionTriangle
Return type: RayCollision
Description: Get collision info between ray and triangle
@@ -3825,7 +3854,7 @@ Function 448: GetRayCollisionTriangle() (4 input parameters)
Param[2]: p1 (type: Vector3)
Param[3]: p2 (type: Vector3)
Param[4]: p3 (type: Vector3)
-Function 449: GetRayCollisionQuad() (5 input parameters)
+Function 454: GetRayCollisionQuad() (5 input parameters)
Name: GetRayCollisionQuad
Return type: RayCollision
Description: Get collision info between ray and quad
@@ -3834,148 +3863,143 @@ Function 449: GetRayCollisionQuad() (5 input parameters)
Param[3]: p2 (type: Vector3)
Param[4]: p3 (type: Vector3)
Param[5]: p4 (type: Vector3)
-Function 450: InitAudioDevice() (0 input parameters)
+Function 455: InitAudioDevice() (0 input parameters)
Name: InitAudioDevice
Return type: void
Description: Initialize audio device and context
No input parameters
-Function 451: CloseAudioDevice() (0 input parameters)
+Function 456: CloseAudioDevice() (0 input parameters)
Name: CloseAudioDevice
Return type: void
Description: Close the audio device and context
No input parameters
-Function 452: IsAudioDeviceReady() (0 input parameters)
+Function 457: IsAudioDeviceReady() (0 input parameters)
Name: IsAudioDeviceReady
Return type: bool
Description: Check if audio device has been initialized successfully
No input parameters
-Function 453: SetMasterVolume() (1 input parameters)
+Function 458: SetMasterVolume() (1 input parameters)
Name: SetMasterVolume
Return type: void
Description: Set master volume (listener)
Param[1]: volume (type: float)
-Function 454: LoadWave() (1 input parameters)
+Function 459: LoadWave() (1 input parameters)
Name: LoadWave
Return type: Wave
Description: Load wave data from file
Param[1]: fileName (type: const char *)
-Function 455: LoadWaveFromMemory() (3 input parameters)
+Function 460: LoadWaveFromMemory() (3 input parameters)
Name: LoadWaveFromMemory
Return type: Wave
Description: Load wave from memory buffer, fileType refers to extension: i.e. '.wav'
Param[1]: fileType (type: const char *)
Param[2]: fileData (type: const unsigned char *)
Param[3]: dataSize (type: int)
-Function 456: LoadSound() (1 input parameters)
+Function 461: IsWaveReady() (1 input parameters)
+ Name: IsWaveReady
+ Return type: bool
+ Description: Checks if wave data is ready
+ Param[1]: wave (type: Wave)
+Function 462: LoadSound() (1 input parameters)
Name: LoadSound
Return type: Sound
Description: Load sound from file
Param[1]: fileName (type: const char *)
-Function 457: LoadSoundFromWave() (1 input parameters)
+Function 463: LoadSoundFromWave() (1 input parameters)
Name: LoadSoundFromWave
Return type: Sound
Description: Load sound from wave data
Param[1]: wave (type: Wave)
-Function 458: UpdateSound() (3 input parameters)
+Function 464: IsSoundReady() (1 input parameters)
+ Name: IsSoundReady
+ Return type: bool
+ Description: Checks if a sound is ready
+ Param[1]: sound (type: Sound)
+Function 465: UpdateSound() (3 input parameters)
Name: UpdateSound
Return type: void
Description: Update sound buffer with new data
Param[1]: sound (type: Sound)
Param[2]: data (type: const void *)
Param[3]: sampleCount (type: int)
-Function 459: UnloadWave() (1 input parameters)
+Function 466: UnloadWave() (1 input parameters)
Name: UnloadWave
Return type: void
Description: Unload wave data
Param[1]: wave (type: Wave)
-Function 460: UnloadSound() (1 input parameters)
+Function 467: UnloadSound() (1 input parameters)
Name: UnloadSound
Return type: void
Description: Unload sound
Param[1]: sound (type: Sound)
-Function 461: ExportWave() (2 input parameters)
+Function 468: ExportWave() (2 input parameters)
Name: ExportWave
Return type: bool
Description: Export wave data to file, returns true on success
Param[1]: wave (type: Wave)
Param[2]: fileName (type: const char *)
-Function 462: ExportWaveAsCode() (2 input parameters)
+Function 469: ExportWaveAsCode() (2 input parameters)
Name: ExportWaveAsCode
Return type: bool
Description: Export wave sample data to code (.h), returns true on success
Param[1]: wave (type: Wave)
Param[2]: fileName (type: const char *)
-Function 463: PlaySound() (1 input parameters)
+Function 470: PlaySound() (1 input parameters)
Name: PlaySound
Return type: void
Description: Play a sound
Param[1]: sound (type: Sound)
-Function 464: StopSound() (1 input parameters)
+Function 471: StopSound() (1 input parameters)
Name: StopSound
Return type: void
Description: Stop playing a sound
Param[1]: sound (type: Sound)
-Function 465: PauseSound() (1 input parameters)
+Function 472: PauseSound() (1 input parameters)
Name: PauseSound
Return type: void
Description: Pause a sound
Param[1]: sound (type: Sound)
-Function 466: ResumeSound() (1 input parameters)
+Function 473: ResumeSound() (1 input parameters)
Name: ResumeSound
Return type: void
Description: Resume a paused sound
Param[1]: sound (type: Sound)
-Function 467: PlaySoundMulti() (1 input parameters)
- Name: PlaySoundMulti
- Return type: void
- Description: Play a sound (using multichannel buffer pool)
- Param[1]: sound (type: Sound)
-Function 468: StopSoundMulti() (0 input parameters)
- Name: StopSoundMulti
- Return type: void
- Description: Stop any sound playing (using multichannel buffer pool)
- No input parameters
-Function 469: GetSoundsPlaying() (0 input parameters)
- Name: GetSoundsPlaying
- Return type: int
- Description: Get number of sounds playing in the multichannel
- No input parameters
-Function 470: IsSoundPlaying() (1 input parameters)
+Function 474: IsSoundPlaying() (1 input parameters)
Name: IsSoundPlaying
Return type: bool
Description: Check if a sound is currently playing
Param[1]: sound (type: Sound)
-Function 471: SetSoundVolume() (2 input parameters)
+Function 475: SetSoundVolume() (2 input parameters)
Name: SetSoundVolume
Return type: void
Description: Set volume for a sound (1.0 is max level)
Param[1]: sound (type: Sound)
Param[2]: volume (type: float)
-Function 472: SetSoundPitch() (2 input parameters)
+Function 476: SetSoundPitch() (2 input parameters)
Name: SetSoundPitch
Return type: void
Description: Set pitch for a sound (1.0 is base level)
Param[1]: sound (type: Sound)
Param[2]: pitch (type: float)
-Function 473: SetSoundPan() (2 input parameters)
+Function 477: SetSoundPan() (2 input parameters)
Name: SetSoundPan
Return type: void
Description: Set pan for a sound (0.5 is center)
Param[1]: sound (type: Sound)
Param[2]: pan (type: float)
-Function 474: WaveCopy() (1 input parameters)
+Function 478: WaveCopy() (1 input parameters)
Name: WaveCopy
Return type: Wave
Description: Copy a wave to a new wave
Param[1]: wave (type: Wave)
-Function 475: WaveCrop() (3 input parameters)
+Function 479: WaveCrop() (3 input parameters)
Name: WaveCrop
Return type: void
Description: Crop a wave to defined samples range
Param[1]: wave (type: Wave *)
Param[2]: initSample (type: int)
Param[3]: finalSample (type: int)
-Function 476: WaveFormat() (4 input parameters)
+Function 480: WaveFormat() (4 input parameters)
Name: WaveFormat
Return type: void
Description: Convert wave data to desired format
@@ -3983,184 +4007,204 @@ Function 476: WaveFormat() (4 input parameters)
Param[2]: sampleRate (type: int)
Param[3]: sampleSize (type: int)
Param[4]: channels (type: int)
-Function 477: LoadWaveSamples() (1 input parameters)
+Function 481: LoadWaveSamples() (1 input parameters)
Name: LoadWaveSamples
Return type: float *
Description: Load samples data from wave as a 32bit float data array
Param[1]: wave (type: Wave)
-Function 478: UnloadWaveSamples() (1 input parameters)
+Function 482: UnloadWaveSamples() (1 input parameters)
Name: UnloadWaveSamples
Return type: void
Description: Unload samples data loaded with LoadWaveSamples()
Param[1]: samples (type: float *)
-Function 479: LoadMusicStream() (1 input parameters)
+Function 483: LoadMusicStream() (1 input parameters)
Name: LoadMusicStream
Return type: Music
Description: Load music stream from file
Param[1]: fileName (type: const char *)
-Function 480: LoadMusicStreamFromMemory() (3 input parameters)
+Function 484: LoadMusicStreamFromMemory() (3 input parameters)
Name: LoadMusicStreamFromMemory
Return type: Music
Description: Load music stream from data
Param[1]: fileType (type: const char *)
Param[2]: data (type: const unsigned char *)
Param[3]: dataSize (type: int)
-Function 481: UnloadMusicStream() (1 input parameters)
+Function 485: IsMusicReady() (1 input parameters)
+ Name: IsMusicReady
+ Return type: bool
+ Description: Checks if a music stream is ready
+ Param[1]: music (type: Music)
+Function 486: UnloadMusicStream() (1 input parameters)
Name: UnloadMusicStream
Return type: void
Description: Unload music stream
Param[1]: music (type: Music)
-Function 482: PlayMusicStream() (1 input parameters)
+Function 487: PlayMusicStream() (1 input parameters)
Name: PlayMusicStream
Return type: void
Description: Start music playing
Param[1]: music (type: Music)
-Function 483: IsMusicStreamPlaying() (1 input parameters)
+Function 488: IsMusicStreamPlaying() (1 input parameters)
Name: IsMusicStreamPlaying
Return type: bool
Description: Check if music is playing
Param[1]: music (type: Music)
-Function 484: UpdateMusicStream() (1 input parameters)
+Function 489: UpdateMusicStream() (1 input parameters)
Name: UpdateMusicStream
Return type: void
Description: Updates buffers for music streaming
Param[1]: music (type: Music)
-Function 485: StopMusicStream() (1 input parameters)
+Function 490: StopMusicStream() (1 input parameters)
Name: StopMusicStream
Return type: void
Description: Stop music playing
Param[1]: music (type: Music)
-Function 486: PauseMusicStream() (1 input parameters)
+Function 491: PauseMusicStream() (1 input parameters)
Name: PauseMusicStream
Return type: void
Description: Pause music playing
Param[1]: music (type: Music)
-Function 487: ResumeMusicStream() (1 input parameters)
+Function 492: ResumeMusicStream() (1 input parameters)
Name: ResumeMusicStream
Return type: void
Description: Resume playing paused music
Param[1]: music (type: Music)
-Function 488: SeekMusicStream() (2 input parameters)
+Function 493: SeekMusicStream() (2 input parameters)
Name: SeekMusicStream
Return type: void
Description: Seek music to a position (in seconds)
Param[1]: music (type: Music)
Param[2]: position (type: float)
-Function 489: SetMusicVolume() (2 input parameters)
+Function 494: SetMusicVolume() (2 input parameters)
Name: SetMusicVolume
Return type: void
Description: Set volume for music (1.0 is max level)
Param[1]: music (type: Music)
Param[2]: volume (type: float)
-Function 490: SetMusicPitch() (2 input parameters)
+Function 495: SetMusicPitch() (2 input parameters)
Name: SetMusicPitch
Return type: void
Description: Set pitch for a music (1.0 is base level)
Param[1]: music (type: Music)
Param[2]: pitch (type: float)
-Function 491: SetMusicPan() (2 input parameters)
+Function 496: SetMusicPan() (2 input parameters)
Name: SetMusicPan
Return type: void
Description: Set pan for a music (0.5 is center)
Param[1]: music (type: Music)
Param[2]: pan (type: float)
-Function 492: GetMusicTimeLength() (1 input parameters)
+Function 497: GetMusicTimeLength() (1 input parameters)
Name: GetMusicTimeLength
Return type: float
Description: Get music time length (in seconds)
Param[1]: music (type: Music)
-Function 493: GetMusicTimePlayed() (1 input parameters)
+Function 498: GetMusicTimePlayed() (1 input parameters)
Name: GetMusicTimePlayed
Return type: float
Description: Get current music time played (in seconds)
Param[1]: music (type: Music)
-Function 494: LoadAudioStream() (3 input parameters)
+Function 499: LoadAudioStream() (3 input parameters)
Name: LoadAudioStream
Return type: AudioStream
Description: Load audio stream (to stream raw audio pcm data)
Param[1]: sampleRate (type: unsigned int)
Param[2]: sampleSize (type: unsigned int)
Param[3]: channels (type: unsigned int)
-Function 495: UnloadAudioStream() (1 input parameters)
+Function 500: IsAudioStreamReady() (1 input parameters)
+ Name: IsAudioStreamReady
+ Return type: bool
+ Description: Checks if an audio stream is ready
+ Param[1]: stream (type: AudioStream)
+Function 501: UnloadAudioStream() (1 input parameters)
Name: UnloadAudioStream
Return type: void
Description: Unload audio stream and free memory
Param[1]: stream (type: AudioStream)
-Function 496: UpdateAudioStream() (3 input parameters)
+Function 502: UpdateAudioStream() (3 input parameters)
Name: UpdateAudioStream
Return type: void
Description: Update audio stream buffers with data
Param[1]: stream (type: AudioStream)
Param[2]: data (type: const void *)
Param[3]: frameCount (type: int)
-Function 497: IsAudioStreamProcessed() (1 input parameters)
+Function 503: IsAudioStreamProcessed() (1 input parameters)
Name: IsAudioStreamProcessed
Return type: bool
Description: Check if any audio stream buffers requires refill
Param[1]: stream (type: AudioStream)
-Function 498: PlayAudioStream() (1 input parameters)
+Function 504: PlayAudioStream() (1 input parameters)
Name: PlayAudioStream
Return type: void
Description: Play audio stream
Param[1]: stream (type: AudioStream)
-Function 499: PauseAudioStream() (1 input parameters)
+Function 505: PauseAudioStream() (1 input parameters)
Name: PauseAudioStream
Return type: void
Description: Pause audio stream
Param[1]: stream (type: AudioStream)
-Function 500: ResumeAudioStream() (1 input parameters)
+Function 506: ResumeAudioStream() (1 input parameters)
Name: ResumeAudioStream
Return type: void
Description: Resume audio stream
Param[1]: stream (type: AudioStream)
-Function 501: IsAudioStreamPlaying() (1 input parameters)
+Function 507: IsAudioStreamPlaying() (1 input parameters)
Name: IsAudioStreamPlaying
Return type: bool
Description: Check if audio stream is playing
Param[1]: stream (type: AudioStream)
-Function 502: StopAudioStream() (1 input parameters)
+Function 508: StopAudioStream() (1 input parameters)
Name: StopAudioStream
Return type: void
Description: Stop audio stream
Param[1]: stream (type: AudioStream)
-Function 503: SetAudioStreamVolume() (2 input parameters)
+Function 509: SetAudioStreamVolume() (2 input parameters)
Name: SetAudioStreamVolume
Return type: void
Description: Set volume for audio stream (1.0 is max level)
Param[1]: stream (type: AudioStream)
Param[2]: volume (type: float)
-Function 504: SetAudioStreamPitch() (2 input parameters)
+Function 510: SetAudioStreamPitch() (2 input parameters)
Name: SetAudioStreamPitch
Return type: void
Description: Set pitch for audio stream (1.0 is base level)
Param[1]: stream (type: AudioStream)
Param[2]: pitch (type: float)
-Function 505: SetAudioStreamPan() (2 input parameters)
+Function 511: SetAudioStreamPan() (2 input parameters)
Name: SetAudioStreamPan
Return type: void
Description: Set pan for audio stream (0.5 is centered)
Param[1]: stream (type: AudioStream)
Param[2]: pan (type: float)
-Function 506: SetAudioStreamBufferSizeDefault() (1 input parameters)
+Function 512: SetAudioStreamBufferSizeDefault() (1 input parameters)
Name: SetAudioStreamBufferSizeDefault
Return type: void
Description: Default size for new audio streams
Param[1]: size (type: int)
-Function 507: SetAudioStreamCallback() (2 input parameters)
+Function 513: SetAudioStreamCallback() (2 input parameters)
Name: SetAudioStreamCallback
Return type: void
Description: Audio thread callback to request new data
Param[1]: stream (type: AudioStream)
Param[2]: callback (type: AudioCallback)
-Function 508: AttachAudioStreamProcessor() (2 input parameters)
+Function 514: AttachAudioStreamProcessor() (2 input parameters)
Name: AttachAudioStreamProcessor
Return type: void
Description: Attach audio stream processor to stream
Param[1]: stream (type: AudioStream)
Param[2]: processor (type: AudioCallback)
-Function 509: DetachAudioStreamProcessor() (2 input parameters)
+Function 515: DetachAudioStreamProcessor() (2 input parameters)
Name: DetachAudioStreamProcessor
Return type: void
Description: Detach audio stream processor from stream
Param[1]: stream (type: AudioStream)
Param[2]: processor (type: AudioCallback)
+Function 516: AttachAudioMixedProcessor() (1 input parameters)
+ Name: AttachAudioMixedProcessor
+ Return type: void
+ Description: Attach audio stream processor to the entire audio pipeline
+ Param[1]: processor (type: AudioCallback)
+Function 517: DetachAudioMixedProcessor() (1 input parameters)
+ Name: DetachAudioMixedProcessor
+ Return type: void
+ Description: Detach audio stream processor from the entire audio pipeline
+ Param[1]: processor (type: AudioCallback)
diff --git a/parser/output/raylib_api.xml b/parser/output/raylib_api.xml
index a28cd779e..45305951f 100644
--- a/parser/output/raylib_api.xml
+++ b/parser/output/raylib_api.xml
@@ -1,8 +1,11 @@
-
+
-
+
+
+
+
@@ -71,7 +74,7 @@
-
+
@@ -219,8 +222,8 @@
-
-
+
+
@@ -446,7 +449,7 @@
-
+
@@ -575,10 +578,10 @@
-
+
-
+
@@ -592,8 +595,8 @@
-
-
+
+
@@ -652,7 +655,7 @@
-
+
@@ -693,9 +696,13 @@
-
+
+
+
+
+
@@ -843,6 +850,9 @@
+
+
+
@@ -976,7 +986,7 @@
-
+
@@ -1190,29 +1200,15 @@
-
-
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
@@ -1533,6 +1529,9 @@
+
+
+
@@ -1593,6 +1592,11 @@
+
+
+
+
+
@@ -1640,6 +1644,10 @@
+
+
+
+
@@ -1844,9 +1852,15 @@
+
+
+
+
+
+
@@ -1894,22 +1908,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1926,14 +1924,6 @@
-
-
-
-
-
-
-
-
@@ -1955,6 +1945,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -2005,6 +2007,9 @@
+
+
+
@@ -2244,23 +2249,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -2312,6 +2300,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -2331,10 +2335,10 @@
-
+
-
+
@@ -2494,6 +2498,9 @@
+
+
+
@@ -2586,12 +2593,18 @@
+
+
+
+
+
+
@@ -2623,13 +2636,6 @@
-
-
-
-
-
-
-
@@ -2673,6 +2679,9 @@
+
+
+
@@ -2721,6 +2730,9 @@
+
+
+
@@ -2774,5 +2786,11 @@
+
+
+
+
+
+
diff --git a/projects/Notepad++/c_raylib.xml b/projects/Notepad++/c_raylib.xml
deleted file mode 100644
index 521c8a768..000000000
--- a/projects/Notepad++/c_raylib.xml
+++ /dev/null
@@ -1,3144 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/projects/Notepad++/npes_saved_w64devkit.txt b/projects/Notepad++/npes_saved_w64devkit.txt
index ec5f0412f..92375c24a 100644
Binary files a/projects/Notepad++/npes_saved_w64devkit.txt and b/projects/Notepad++/npes_saved_w64devkit.txt differ
diff --git a/projects/Notepad++/raylib_npp_parser/raylib_npp.xml b/projects/Notepad++/raylib_npp_parser/raylib_npp.xml
index 521c8a768..e764a1b63 100644
--- a/projects/Notepad++/raylib_npp_parser/raylib_npp.xml
+++ b/projects/Notepad++/raylib_npp_parser/raylib_npp.xml
@@ -65,10 +65,16 @@
-
+
+
+
+
+
+
+
@@ -181,7 +187,7 @@
-
+
@@ -313,6 +319,11 @@
+
+
+
+
+
@@ -459,7 +470,7 @@
-
+
@@ -521,7 +532,7 @@
-
+
@@ -878,41 +889,18 @@
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
@@ -1287,6 +1275,13 @@
+
+
+
+
+
+
+
@@ -1316,7 +1311,7 @@
-
+
@@ -1352,6 +1347,11 @@
+
+
+
+
+
@@ -1420,6 +1420,15 @@
+
+
+
+
+
+
+
+
+
@@ -1427,6 +1436,13 @@
+
+
+
+
+
+
+
@@ -1498,6 +1514,12 @@
+
+
+
+
+
+
@@ -1669,7 +1691,7 @@
-
+
@@ -1678,7 +1700,24 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1773,11 +1812,21 @@
+
+
+
+
+
+
+
+
+
+
@@ -1849,26 +1898,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1889,16 +1918,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -1934,6 +1953,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -2004,6 +2041,11 @@
+
+
+
+
+
@@ -2136,6 +2178,17 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -2155,19 +2208,25 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
@@ -2339,27 +2398,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -2425,6 +2463,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -2460,13 +2518,13 @@
-
-
+
+
-
-
+
+
@@ -2694,6 +2752,11 @@
+
+
+
+
+
@@ -2839,6 +2902,11 @@
+
+
+
+
+
@@ -2849,6 +2917,11 @@
+
+
+
+
+
@@ -2900,17 +2973,6 @@
-
-
-
-
-
-
-
-
-
-
-
@@ -2978,6 +3040,11 @@
+
+
+
+
+
@@ -3056,6 +3123,11 @@
+
+
+
+
+
@@ -3141,4 +3213,15 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/projects/Notepad++/raylib_npp_parser/raylib_to_parse.h b/projects/Notepad++/raylib_npp_parser/raylib_to_parse.h
index 4a9daf896..96732e319 100644
--- a/projects/Notepad++/raylib_npp_parser/raylib_to_parse.h
+++ b/projects/Notepad++/raylib_npp_parser/raylib_to_parse.h
@@ -20,7 +20,8 @@ RLAPI void ToggleFullscreen(void); // Toggle wind
RLAPI void MaximizeWindow(void); // Set window state: maximized, if resizable (only PLATFORM_DESKTOP)
RLAPI void MinimizeWindow(void); // Set window state: minimized, if resizable (only PLATFORM_DESKTOP)
RLAPI void RestoreWindow(void); // Set window state: not minimized/maximized (only PLATFORM_DESKTOP)
-RLAPI void SetWindowIcon(Image image); // Set icon for window (only PLATFORM_DESKTOP)
+RLAPI void SetWindowIcon(Image image); // Set icon for window (single image, RGBA 32bit, only PLATFORM_DESKTOP)
+RLAPI void SetWindowIcons(Image *images, int count); // Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP)
RLAPI void SetWindowTitle(const char *title); // Set title for window (only PLATFORM_DESKTOP)
RLAPI void SetWindowPosition(int x, int y); // Set window position on screen (only PLATFORM_DESKTOP)
RLAPI void SetWindowMonitor(int monitor); // Set monitor for the current window (fullscreen mode)
@@ -50,7 +51,7 @@ RLAPI void DisableEventWaiting(void); // Disable wai
// Custom frame control functions
// NOTE: Those functions are intended for advance users that want full control over the frame processing
-// By default EndDrawing() does this job: draws everything + SwapScreenBuffer() + manage frame timming + PollInputEvents()
+// By default EndDrawing() does this job: draws everything + SwapScreenBuffer() + manage frame timing + PollInputEvents()
// To avoid that behaviour and control frame processes manually, enable in config.h: SUPPORT_CUSTOM_FRAME_CONTROL
RLAPI void SwapScreenBuffer(void); // Swap back buffer with front buffer (screen drawing)
RLAPI void PollInputEvents(void); // Register all input events
@@ -91,6 +92,7 @@ RLAPI void UnloadVrStereoConfig(VrStereoConfig config); // Unload VR s
// NOTE: Shader functionality is not available on OpenGL 1.1
RLAPI Shader LoadShader(const char *vsFileName, const char *fsFileName); // Load shader from files and bind default locations
RLAPI Shader LoadShaderFromMemory(const char *vsCode, const char *fsCode); // Load shader from code strings and bind default locations
+RLAPI bool IsShaderReady(Shader shader); // Check if a shader is ready
RLAPI int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location
RLAPI int GetShaderLocationAttrib(Shader shader, const char *attribName); // Get shader attribute location
RLAPI void SetShaderValue(Shader shader, int locIndex, const void *value, int uniformType); // Set shader uniform value
@@ -122,8 +124,8 @@ RLAPI void SetConfigFlags(unsigned int flags); // Setup init
RLAPI void TraceLog(int logLevel, const char *text, ...); // Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...)
RLAPI void SetTraceLogLevel(int logLevel); // Set the current threshold (minimum) log level
-RLAPI void *MemAlloc(int size); // Internal memory allocator
-RLAPI void *MemRealloc(void *ptr, int size); // Internal memory reallocator
+RLAPI void *MemAlloc(unsigned int size); // Internal memory allocator
+RLAPI void *MemRealloc(void *ptr, unsigned int size); // Internal memory reallocator
RLAPI void MemFree(void *ptr); // Internal memory free
RLAPI void OpenURL(const char *url); // Open URL with default system browser (if available)
@@ -140,7 +142,7 @@ RLAPI void SetSaveFileTextCallback(SaveFileTextCallback callback); // Set custom
RLAPI unsigned char *LoadFileData(const char *fileName, unsigned int *bytesRead); // Load file data as byte array (read)
RLAPI void UnloadFileData(unsigned char *data); // Unload file data allocated by LoadFileData()
RLAPI bool SaveFileData(const char *fileName, void *data, unsigned int bytesToWrite); // Save data to file from byte array (write), returns true on success
-RLAPI bool ExportDataAsCode(const char *data, unsigned int size, const char *fileName); // Export data to code (.h), returns true on success
+RLAPI bool ExportDataAsCode(const unsigned char *data, unsigned int size, const char *fileName); // Export data to code (.h), returns true on success
RLAPI char *LoadFileText(const char *fileName); // Load text data from file (read), returns a '\0' terminated string
RLAPI void UnloadFileText(char *text); // Unload file text data allocated by LoadFileText()
RLAPI bool SaveFileText(const char *fileName, char *text); // Save text data to file (write), string must be '\0' terminated, returns true on success
@@ -234,13 +236,8 @@ RLAPI float GetGesturePinchAngle(void); // Get gesture pinch ang
//------------------------------------------------------------------------------------
// Camera System Functions (Module: rcamera)
//------------------------------------------------------------------------------------
-RLAPI void SetCameraMode(Camera camera, int mode); // Set camera mode (multiple camera modes available)
-RLAPI void UpdateCamera(Camera *camera); // Update camera position for selected mode
-
-RLAPI void SetCameraPanControl(int keyPan); // Set camera pan key to combine with mouse movement (free camera)
-RLAPI void SetCameraAltControl(int keyAlt); // Set camera alt key to combine with mouse movement (free camera)
-RLAPI void SetCameraSmoothZoomControl(int keySmoothZoom); // Set camera smooth zoom key to combine with mouse (free camera)
-RLAPI void SetCameraMoveControls(int keyFront, int keyBack, int keyRight, int keyLeft, int keyUp, int keyDown); // Set camera move controls (1st person and 3rd person cameras)
+RLAPI void UpdateCamera(Camera *camera, int mode); // Update camera position for selected mode
+RLAPI void UpdateCameraPro(Camera *camera, Vector3 movement, Vector3 rotation, float zoom); // Update camera movement/rotation
//------------------------------------------------------------------------------------
// Basic Shapes Drawing Functions (Module: shapes)
@@ -296,6 +293,7 @@ RLAPI bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec);
RLAPI bool CheckCollisionPointRec(Vector2 point, Rectangle rec); // Check if point is inside rectangle
RLAPI bool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius); // Check if point is inside circle
RLAPI bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3); // Check if point is inside a triangle
+RLAPI bool CheckCollisionPointPoly(Vector2 point, Vector2 *points, int pointCount); // Check if point is within a polygon described by array of vertices
RLAPI bool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, Vector2 *collisionPoint); // Check the collision between two lines defined by two points each, returns collision point by reference
RLAPI bool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshold); // Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]
RLAPI Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2); // Get collision rectangle for two rectangles collision
@@ -305,13 +303,14 @@ RLAPI Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2);
//------------------------------------------------------------------------------------
// Image loading functions
-// NOTE: This functions do not require GPU access
+// NOTE: These functions do not require GPU access
RLAPI Image LoadImage(const char *fileName); // Load image from file into CPU memory (RAM)
RLAPI Image LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize); // Load image from RAW file data
RLAPI Image LoadImageAnim(const char *fileName, int *frames); // Load image sequence from file (frames appended to image.data)
RLAPI Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, int dataSize); // Load image from memory buffer, fileType refers to extension: i.e. '.png'
RLAPI Image LoadImageFromTexture(Texture2D texture); // Load image from GPU texture data
RLAPI Image LoadImageFromScreen(void); // Load image from screen buffer and (screenshot)
+RLAPI bool IsImageReady(Image image); // Check if an image is ready
RLAPI void UnloadImage(Image image); // Unload image from CPU memory (RAM)
RLAPI bool ExportImage(Image image, const char *fileName); // Export image data to file, returns true on success
RLAPI bool ExportImageAsCode(Image image, const char *fileName); // Export image as code file defining an array of bytes, returns true on success
@@ -323,7 +322,9 @@ RLAPI Image GenImageGradientH(int width, int height, Color left, Color right);
RLAPI Image GenImageGradientRadial(int width, int height, float density, Color inner, Color outer); // Generate image: radial gradient
RLAPI Image GenImageChecked(int width, int height, int checksX, int checksY, Color col1, Color col2); // Generate image: checked
RLAPI Image GenImageWhiteNoise(int width, int height, float factor); // Generate image: white noise
+RLAPI Image GenImagePerlinNoise(int width, int height, int offsetX, int offsetY, float scale); // Generate image: perlin noise
RLAPI Image GenImageCellular(int width, int height, int tileSize); // Generate image: cellular algorithm, bigger tileSize means bigger cells
+RLAPI Image GenImageText(int width, int height, const char *text); // Generate image: grayscale image from text data
// Image manipulation functions
RLAPI Image ImageCopy(Image image); // Create an image duplicate (useful for transformations)
@@ -337,6 +338,7 @@ RLAPI void ImageAlphaCrop(Image *image, float threshold);
RLAPI void ImageAlphaClear(Image *image, Color color, float threshold); // Clear alpha channel to desired color
RLAPI void ImageAlphaMask(Image *image, Image alphaMask); // Apply alpha mask to image
RLAPI void ImageAlphaPremultiply(Image *image); // Premultiply alpha channel
+RLAPI void ImageBlurGaussian(Image *image, int blurSize); // Apply Gaussian blur using a box blur approximation
RLAPI void ImageResize(Image *image, int newWidth, int newHeight); // Resize image (Bicubic scaling algorithm)
RLAPI void ImageResizeNN(Image *image, int newWidth,int newHeight); // Resize image (Nearest-Neighbor scaling algorithm)
RLAPI void ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, int offsetY, Color fill); // Resize canvas and fill with color
@@ -366,8 +368,10 @@ RLAPI void ImageDrawPixel(Image *dst, int posX, int posY, Color color);
RLAPI void ImageDrawPixelV(Image *dst, Vector2 position, Color color); // Draw pixel within an image (Vector version)
RLAPI void ImageDrawLine(Image *dst, int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw line within an image
RLAPI void ImageDrawLineV(Image *dst, Vector2 start, Vector2 end, Color color); // Draw line within an image (Vector version)
-RLAPI void ImageDrawCircle(Image *dst, int centerX, int centerY, int radius, Color color); // Draw circle within an image
-RLAPI void ImageDrawCircleV(Image *dst, Vector2 center, int radius, Color color); // Draw circle within an image (Vector version)
+RLAPI void ImageDrawCircle(Image *dst, int centerX, int centerY, int radius, Color color); // Draw a filled circle within an image
+RLAPI void ImageDrawCircleV(Image *dst, Vector2 center, int radius, Color color); // Draw a filled circle within an image (Vector version)
+RLAPI void ImageDrawCircleLines(Image *dst, int centerX, int centerY, int radius, Color color); // Draw circle outline within an image
+RLAPI void ImageDrawCircleLinesV(Image *dst, Vector2 center, int radius, Color color); // Draw circle outline within an image (Vector version)
RLAPI void ImageDrawRectangle(Image *dst, int posX, int posY, int width, int height, Color color); // Draw rectangle within an image
RLAPI void ImageDrawRectangleV(Image *dst, Vector2 position, Vector2 size, Color color); // Draw rectangle within an image (Vector version)
RLAPI void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color); // Draw rectangle within an image
@@ -382,7 +386,9 @@ RLAPI Texture2D LoadTexture(const char *fileName);
RLAPI Texture2D LoadTextureFromImage(Image image); // Load texture from image data
RLAPI TextureCubemap LoadTextureCubemap(Image image, int layout); // Load cubemap from image, multiple image cubemap layouts supported
RLAPI RenderTexture2D LoadRenderTexture(int width, int height); // Load texture for rendering (framebuffer)
+RLAPI bool IsTextureReady(Texture2D texture); // Check if a texture is ready
RLAPI void UnloadTexture(Texture2D texture); // Unload texture from GPU memory (VRAM)
+RLAPI bool IsRenderTextureReady(RenderTexture2D target); // Check if a render texture is ready
RLAPI void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory (VRAM)
RLAPI void UpdateTexture(Texture2D texture, const void *pixels); // Update GPU texture with new data
RLAPI void UpdateTextureRec(Texture2D texture, Rectangle rec, const void *pixels); // Update GPU texture rectangle with new data
@@ -397,11 +403,8 @@ RLAPI void DrawTexture(Texture2D texture, int posX, int posY, Color tint);
RLAPI void DrawTextureV(Texture2D texture, Vector2 position, Color tint); // Draw a Texture2D with position defined as Vector2
RLAPI void DrawTextureEx(Texture2D texture, Vector2 position, float rotation, float scale, Color tint); // Draw a Texture2D with extended parameters
RLAPI void DrawTextureRec(Texture2D texture, Rectangle source, Vector2 position, Color tint); // Draw a part of a texture defined by a rectangle
-RLAPI void DrawTextureQuad(Texture2D texture, Vector2 tiling, Vector2 offset, Rectangle quad, Color tint); // Draw texture quad with tiling and offset parameters
-RLAPI void DrawTextureTiled(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, float scale, Color tint); // Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest.
-RLAPI void DrawTexturePro(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, Color tint); // Draw a part of a texture defined by a rectangle with 'pro' parameters
-RLAPI void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest, Vector2 origin, float rotation, Color tint); // Draws a texture (or part of it) that stretches or shrinks nicely
-RLAPI void DrawTexturePoly(Texture2D texture, Vector2 center, Vector2 *points, Vector2 *texcoords, int pointCount, Color tint); // Draw a textured polygon
+RLAPI void DrawTexturePro(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, Color tint); // Draw a part of a texture defined by a rectangle with 'pro' parameters
+RLAPI void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest, Vector2 origin, float rotation, Color tint); // Draws a texture (or part of it) that stretches or shrinks nicely
// Color/pixel related functions
RLAPI Color Fade(Color color, float alpha); // Get color with alpha applied, alpha goes from 0.0f to 1.0f
@@ -410,6 +413,9 @@ RLAPI Vector4 ColorNormalize(Color color); // G
RLAPI Color ColorFromNormalized(Vector4 normalized); // Get Color from normalized values [0..1]
RLAPI Vector3 ColorToHSV(Color color); // Get HSV values for a Color, hue [0..360], saturation/value [0..1]
RLAPI Color ColorFromHSV(float hue, float saturation, float value); // Get a Color from HSV values, hue [0..360], saturation/value [0..1]
+RLAPI Color ColorTint(Color color, Color tint); // Get color multiplied with another color
+RLAPI Color ColorBrightness(Color color, float factor); // Get color with brightness correction, brightness factor goes from -1.0f to 1.0f
+RLAPI Color ColorContrast(Color color, float contrast); // Get color with contrast correction, contrast values between -1.0f and 1.0f
RLAPI Color ColorAlpha(Color color, float alpha); // Get color with alpha applied, alpha goes from 0.0f to 1.0f
RLAPI Color ColorAlphaBlend(Color dst, Color src, Color tint); // Get src alpha-blended into dst color with tint
RLAPI Color GetColor(unsigned int hexValue); // Get Color structure from hexadecimal value
@@ -427,6 +433,7 @@ RLAPI Font LoadFont(const char *fileName);
RLAPI Font LoadFontEx(const char *fileName, int fontSize, int *fontChars, int glyphCount); // Load font from file with extended parameters, use NULL for fontChars and 0 for glyphCount to load the default character set
RLAPI Font LoadFontFromImage(Image image, Color key, int firstChar); // Load font from Image (XNA style)
RLAPI Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, int *fontChars, int glyphCount); // Load font from memory buffer, fileType refers to extension: i.e. '.ttf'
+RLAPI bool IsFontReady(Font font); // Check if a font is ready
RLAPI GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSize, int *fontChars, int glyphCount, int type); // Load font data for further use
RLAPI Image GenImageFontAtlas(const GlyphInfo *chars, Rectangle **recs, int glyphCount, int fontSize, int padding, int packMethod); // Generate image font atlas using chars info
RLAPI void UnloadFontData(GlyphInfo *chars, int glyphCount); // Unload font chars info data (RAM)
@@ -449,12 +456,15 @@ RLAPI GlyphInfo GetGlyphInfo(Font font, int codepoint);
RLAPI Rectangle GetGlyphAtlasRec(Font font, int codepoint); // Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found
// Text codepoints management functions (unicode characters)
-RLAPI int *LoadCodepoints(const char *text, int *count); // Load all codepoints from a UTF-8 text string, codepoints count returned by parameter
-RLAPI void UnloadCodepoints(int *codepoints); // Unload codepoints data from memory
-RLAPI int GetCodepointCount(const char *text); // Get total number of codepoints in a UTF-8 encoded string
-RLAPI int GetCodepoint(const char *text, int *bytesProcessed); // Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
-RLAPI const char *CodepointToUTF8(int codepoint, int *byteSize); // Encode one codepoint into UTF-8 byte array (array length returned as parameter)
-RLAPI char *TextCodepointsToUTF8(const int *codepoints, int length); // Encode text as codepoints array into UTF-8 text string (WARNING: memory must be freed!)
+RLAPI char *LoadUTF8(const int *codepoints, int length); // Load UTF-8 text encoded from codepoints array
+RLAPI void UnloadUTF8(char *text); // Unload UTF-8 text encoded from codepoints array
+RLAPI int *LoadCodepoints(const char *text, int *count); // Load all codepoints from a UTF-8 text string, codepoints count returned by parameter
+RLAPI void UnloadCodepoints(int *codepoints); // Unload codepoints data from memory
+RLAPI int GetCodepointCount(const char *text); // Get total number of codepoints in a UTF-8 encoded string
+RLAPI int GetCodepoint(const char *text, int *codepointSize); // Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
+RLAPI int GetCodepointNext(const char *text, int *codepointSize); // Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
+RLAPI int GetCodepointPrevious(const char *text, int *codepointSize); // Get previous codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
+RLAPI const char *CodepointToUTF8(int codepoint, int *utf8Size); // Encode one codepoint into UTF-8 byte array (array length returned as parameter)
// Text strings management functions (no UTF-8 strings, only byte chars)
// NOTE: Some strings allocate memory internally for returned strings, just be careful!
@@ -488,8 +498,6 @@ RLAPI void DrawCube(Vector3 position, float width, float height, float length, C
RLAPI void DrawCubeV(Vector3 position, Vector3 size, Color color); // Draw cube (Vector version)
RLAPI void DrawCubeWires(Vector3 position, float width, float height, float length, Color color); // Draw cube wires
RLAPI void DrawCubeWiresV(Vector3 position, Vector3 size, Color color); // Draw cube wires (Vector version)
-RLAPI void DrawCubeTexture(Texture2D texture, Vector3 position, float width, float height, float length, Color color); // Draw cube textured
-RLAPI void DrawCubeTextureRec(Texture2D texture, Rectangle source, Vector3 position, float width, float height, float length, Color color); // Draw cube with a region of a texture
RLAPI void DrawSphere(Vector3 centerPos, float radius, Color color); // Draw sphere
RLAPI void DrawSphereEx(Vector3 centerPos, float radius, int rings, int slices, Color color); // Draw sphere with extended parameters
RLAPI void DrawSphereWires(Vector3 centerPos, float radius, int rings, int slices, Color color); // Draw sphere wires
@@ -497,6 +505,8 @@ RLAPI void DrawCylinder(Vector3 position, float radiusTop, float radiusBottom, f
RLAPI void DrawCylinderEx(Vector3 startPos, Vector3 endPos, float startRadius, float endRadius, int sides, Color color); // Draw a cylinder with base at startPos and top at endPos
RLAPI void DrawCylinderWires(Vector3 position, float radiusTop, float radiusBottom, float height, int slices, Color color); // Draw a cylinder/cone wires
RLAPI void DrawCylinderWiresEx(Vector3 startPos, Vector3 endPos, float startRadius, float endRadius, int sides, Color color); // Draw a cylinder wires with base at startPos and top at endPos
+RLAPI void DrawCapsule(Vector3 startPos, Vector3 endPos, float radius, int slices, int rings, Color color); // Draw a capsule with the center of its sphere caps at startPos and endPos
+RLAPI void DrawCapsuleWires(Vector3 startPos, Vector3 endPos, float radius, int slices, int rings, Color color); // Draw capsule wireframe with the center of its sphere caps at startPos and endPos
RLAPI void DrawPlane(Vector3 centerPos, Vector2 size, Color color); // Draw a plane XZ
RLAPI void DrawRay(Ray ray, Color color); // Draw a ray line
RLAPI void DrawGrid(int slices, float spacing); // Draw a grid (centered at (0, 0, 0))
@@ -508,16 +518,16 @@ RLAPI void DrawGrid(int slices, float spacing);
// Model management functions
RLAPI Model LoadModel(const char *fileName); // Load model from files (meshes and materials)
RLAPI Model LoadModelFromMesh(Mesh mesh); // Load model from generated mesh (default material)
+RLAPI bool IsModelReady(Model model); // Check if a model is ready
RLAPI void UnloadModel(Model model); // Unload model (including meshes) from memory (RAM and/or VRAM)
-RLAPI void UnloadModelKeepMeshes(Model model); // Unload model (but not meshes) from memory (RAM and/or VRAM)
RLAPI BoundingBox GetModelBoundingBox(Model model); // Compute model bounding box limits (considers all meshes)
// Model drawing functions
-RLAPI void DrawModel(Model model, Vector3 position, float scale, Color tint); // Draw a model (with texture if set)
+RLAPI void DrawModel(Model model, Vector3 position, float scale, Color tint); // Draw a model (with texture if set)
RLAPI void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model with extended parameters
-RLAPI void DrawModelWires(Model model, Vector3 position, float scale, Color tint); // Draw a model wires (with texture if set)
+RLAPI void DrawModelWires(Model model, Vector3 position, float scale, Color tint); // Draw a model wires (with texture if set)
RLAPI void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model wires (with texture if set) with extended parameters
-RLAPI void DrawBoundingBox(BoundingBox box, Color color); // Draw bounding box (wires)
+RLAPI void DrawBoundingBox(BoundingBox box, Color color); // Draw bounding box (wires)
RLAPI void DrawBillboard(Camera camera, Texture2D texture, Vector3 position, float size, Color tint); // Draw a billboard texture
RLAPI void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector2 size, Color tint); // Draw a billboard texture defined by source
RLAPI void DrawBillboardPro(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector3 up, Vector2 size, Vector2 origin, float rotation, Color tint); // Draw a billboard texture defined by source and rotation
@@ -548,6 +558,7 @@ RLAPI Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize);
// Material loading/unloading functions
RLAPI Material *LoadMaterials(const char *fileName, int *materialCount); // Load materials from model file
RLAPI Material LoadMaterialDefault(void); // Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps)
+RLAPI bool IsMaterialReady(Material material); // Check if a material is ready
RLAPI void UnloadMaterial(Material material); // Unload material from GPU memory (VRAM)
RLAPI void SetMaterialTexture(Material *material, int mapType, Texture2D texture); // Set texture for a material map type (MATERIAL_MAP_DIFFUSE, MATERIAL_MAP_SPECULAR...)
RLAPI void SetModelMeshMaterial(Model *model, int meshId, int materialId); // Set material for a mesh
@@ -583,8 +594,10 @@ RLAPI void SetMasterVolume(float volume); // Set mas
// Wave/Sound loading/unloading functions
RLAPI Wave LoadWave(const char *fileName); // Load wave data from file
RLAPI Wave LoadWaveFromMemory(const char *fileType, const unsigned char *fileData, int dataSize); // Load wave from memory buffer, fileType refers to extension: i.e. '.wav'
+RLAPI bool IsWaveReady(Wave wave); // Checks if wave data is ready
RLAPI Sound LoadSound(const char *fileName); // Load sound from file
RLAPI Sound LoadSoundFromWave(Wave wave); // Load sound from wave data
+RLAPI bool IsSoundReady(Sound sound); // Checks if a sound is ready
RLAPI void UpdateSound(Sound sound, const void *data, int sampleCount); // Update sound buffer with new data
RLAPI void UnloadWave(Wave wave); // Unload wave data
RLAPI void UnloadSound(Sound sound); // Unload sound
@@ -596,9 +609,6 @@ RLAPI void PlaySound(Sound sound); // Play a
RLAPI void StopSound(Sound sound); // Stop playing a sound
RLAPI void PauseSound(Sound sound); // Pause a sound
RLAPI void ResumeSound(Sound sound); // Resume a paused sound
-RLAPI void PlaySoundMulti(Sound sound); // Play a sound (using multichannel buffer pool)
-RLAPI void StopSoundMulti(void); // Stop any sound playing (using multichannel buffer pool)
-RLAPI int GetSoundsPlaying(void); // Get number of sounds playing in the multichannel
RLAPI bool IsSoundPlaying(Sound sound); // Check if a sound is currently playing
RLAPI void SetSoundVolume(Sound sound, float volume); // Set volume for a sound (1.0 is max level)
RLAPI void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level)
@@ -612,6 +622,7 @@ RLAPI void UnloadWaveSamples(float *samples); // Unload
// Music management functions
RLAPI Music LoadMusicStream(const char *fileName); // Load music stream from file
RLAPI Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data, int dataSize); // Load music stream from data
+RLAPI bool IsMusicReady(Music music); // Checks if a music stream is ready
RLAPI void UnloadMusicStream(Music music); // Unload music stream
RLAPI void PlayMusicStream(Music music); // Start music playing
RLAPI bool IsMusicStreamPlaying(Music music); // Check if music is playing
@@ -628,6 +639,7 @@ RLAPI float GetMusicTimePlayed(Music music); // Get cur
// AudioStream management functions
RLAPI AudioStream LoadAudioStream(unsigned int sampleRate, unsigned int sampleSize, unsigned int channels); // Load audio stream (to stream raw audio pcm data)
+RLAPI bool IsAudioStreamReady(AudioStream stream); // Checks if an audio stream is ready
RLAPI void UnloadAudioStream(AudioStream stream); // Unload audio stream and free memory
RLAPI void UpdateAudioStream(AudioStream stream, const void *data, int frameCount); // Update audio stream buffers with data
RLAPI bool IsAudioStreamProcessed(AudioStream stream); // Check if any audio stream buffers requires refill
@@ -645,3 +657,6 @@ RLAPI void SetAudioStreamCallback(AudioStream stream, AudioCallback callback);
RLAPI void AttachAudioStreamProcessor(AudioStream stream, AudioCallback processor); // Attach audio stream processor to stream
RLAPI void DetachAudioStreamProcessor(AudioStream stream, AudioCallback processor); // Detach audio stream processor from stream
+RLAPI void AttachAudioMixedProcessor(AudioCallback processor); // Attach audio stream processor to the entire audio pipeline
+RLAPI void DetachAudioMixedProcessor(AudioCallback processor); // Detach audio stream processor from the entire audio pipeline
+
diff --git a/projects/VS2022/examples/audio_multichannel_sound.vcxproj b/projects/VS2022/examples/audio_multichannel_sound.vcxproj
deleted file mode 100644
index 91ab9095d..000000000
--- a/projects/VS2022/examples/audio_multichannel_sound.vcxproj
+++ /dev/null
@@ -1,390 +0,0 @@
-
-
-
-
- Debug.DLL
- Win32
-
-
- Debug.DLL
- x64
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release.DLL
- Win32
-
-
- Release.DLL
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {9875B0C8-3893-43F8-88B2-4BAAAE3E8E6F}
- Win32Proj
- audio_multichannel_sound
- 10.0
- audio_multichannel_sound
-
-
-
- Application
- true
- $(DefaultPlatformToolset)
- Unicode
-
-
- Application
- true
- $(DefaultPlatformToolset)
- Unicode
-
-
- Application
- true
- $(DefaultPlatformToolset)
- Unicode
-
-
- Application
- true
- $(DefaultPlatformToolset)
- Unicode
-
-
- Application
- false
- $(DefaultPlatformToolset)
- true
- Unicode
-
-
- Application
- false
- $(DefaultPlatformToolset)
- true
- Unicode
-
-
- Application
- false
- $(DefaultPlatformToolset)
- true
- Unicode
-
-
- Application
- false
- $(DefaultPlatformToolset)
- true
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- true
- $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\
- $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\
-
-
- true
- $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\
- $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\
-
-
- true
- $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\
- $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\
-
-
- true
- $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\
- $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\
-
-
- false
- $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\
- $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\
-
-
- false
- $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\
- $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\
-
-
- false
- $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\
- $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\
-
-
- false
- $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\
- $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\
-
-
- $(SolutionDir)..\..\examples\audio
- WindowsLocalDebugger
-
-
- $(SolutionDir)..\..\examples\audio
- WindowsLocalDebugger
-
-
- $(SolutionDir)..\..\examples\audio
- WindowsLocalDebugger
-
-
- $(SolutionDir)..\..\examples\audio
- WindowsLocalDebugger
-
-
- $(SolutionDir)..\..\examples\audio
- WindowsLocalDebugger
-
-
- $(SolutionDir)..\..\examples\audio
- WindowsLocalDebugger
-
-
- $(SolutionDir)..\..\examples\audio
- WindowsLocalDebugger
-
-
- $(SolutionDir)..\..\examples\audio
- WindowsLocalDebugger
-
-
-
-
-
- Level3
- Disabled
- WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions)
- CompileAsC
- $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)
-
-
- Console
- true
- $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\
- raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
-
-
-
-
-
-
- Level3
- Disabled
- WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions)
- CompileAsC
- $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)
- /FS %(AdditionalOptions)
-
-
- Console
- true
- $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\
- raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
-
-
-
-
-
-
- Level3
- Disabled
- WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions)
- CompileAsC
- $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)
-
-
- Console
- true
- $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\
- raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
-
-
- xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)"
- Copy Debug DLL to output directory
-
-
-
-
-
-
- Level3
- Disabled
- WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions)
- CompileAsC
- $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)
-
-
- Console
- true
- $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\
- raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
-
-
- xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)"
- Copy Debug DLL to output directory
-
-
-
-
- Level3
-
-
- MaxSpeed
- true
- true
- WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP
- $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)
- CompileAsC
- true
-
-
- Console
- true
- true
- true
- raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
- $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\
-
-
-
-
- Level3
-
-
- MaxSpeed
- true
- true
- WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP
- $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)
- CompileAsC
- true
-
-
- Console
- true
- true
- true
- raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
- $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\
-
-
-
-
- Level3
-
-
- MaxSpeed
- true
- true
- WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP
- $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)
- CompileAsC
- true
-
-
- Console
- true
- true
- true
- raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
- $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\
-
-
- xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)"
-
-
- Copy Release DLL to output directory
-
-
-
-
- Level3
-
-
- MaxSpeed
- true
- true
- WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP
- $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)
- CompileAsC
- true
-
-
- Console
- true
- true
- true
- raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
- $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\
-
-
- xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)"
-
-
- Copy Release DLL to output directory
-
-
-
-
-
-
-
-
-
-
- {e89d61ac-55de-4482-afd4-df7242ebc859}
-
-
-
-
-
-
\ No newline at end of file
diff --git a/projects/VS2022/raylib.sln b/projects/VS2022/raylib.sln
index 06166cdd0..f58f2ed75 100644
--- a/projects/VS2022/raylib.sln
+++ b/projects/VS2022/raylib.sln
@@ -17,8 +17,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "textures_image_drawing", "e
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "audio_module_playing", "examples\audio_module_playing.vcxproj", "{E6784F91-4E4E-4956-A079-73FAB1AC7BE6}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "audio_multichannel_sound", "examples\audio_multichannel_sound.vcxproj", "{9875B0C8-3893-43F8-88B2-4BAAAE3E8E6F}"
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "audio_music_stream", "examples\audio_music_stream.vcxproj", "{BFB22AB2-041B-4A1B-80C0-1D4BE410C8A9}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "audio_raw_stream", "examples\audio_raw_stream.vcxproj", "{93A1F656-0D29-4C5E-B140-11F23FF5D6AB}"
@@ -2289,7 +2287,6 @@ Global
{103B292B-049B-4B15-85A1-9F902840DB2C} = {DA049009-21FF-4AC0-84E4-830DD1BCD0CE}
{0C2D2F82-AE67-400C-B19C-8C9B957B132A} = {DA049009-21FF-4AC0-84E4-830DD1BCD0CE}
{E6784F91-4E4E-4956-A079-73FAB1AC7BE6} = {CC132A4D-D081-4C26-BFB9-AB11984054F8}
- {9875B0C8-3893-43F8-88B2-4BAAAE3E8E6F} = {CC132A4D-D081-4C26-BFB9-AB11984054F8}
{BFB22AB2-041B-4A1B-80C0-1D4BE410C8A9} = {CC132A4D-D081-4C26-BFB9-AB11984054F8}
{93A1F656-0D29-4C5E-B140-11F23FF5D6AB} = {CC132A4D-D081-4C26-BFB9-AB11984054F8}
{F81C5819-85B6-4D2E-B6DC-104A7634461B} = {CC132A4D-D081-4C26-BFB9-AB11984054F8}
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 690f970a4..9087f8eea 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -62,7 +62,7 @@ if (NOT BUILD_SHARED_LIBS)
add_library(raylib_static ALIAS raylib)
else()
MESSAGE(STATUS "Building raylib shared library")
- if (MSVC)
+ if (WIN32)
target_compile_definitions(raylib
PRIVATE $
INTERFACE $
diff --git a/src/Makefile b/src/Makefile
index 4d9c8723b..5d7086d8a 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -4,7 +4,7 @@
#
# Platforms supported:
# PLATFORM_DESKTOP: Windows (Win32, Win64)
-# PLATFORM_DESKTOP: Linux (i386, x64)
+# PLATFORM_DESKTOP: Linux (arm64, i386, x64)
# PLATFORM_DESKTOP: OSX/macOS (arm64, x86_64)
# PLATFORM_DESKTOP: FreeBSD, OpenBSD, NetBSD, DragonFly
# PLATFORM_ANDROID: Android (arm, i686, arm64, x86_64)
@@ -45,8 +45,8 @@
PLATFORM ?= PLATFORM_DESKTOP
# Define required raylib variables
-RAYLIB_VERSION = 4.2.0
-RAYLIB_API_VERSION = 420
+RAYLIB_VERSION = 4.5.0
+RAYLIB_API_VERSION = 450
# Define raylib source code path
RAYLIB_SRC_PATH ?= ../src
@@ -231,8 +231,10 @@ endif
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# By default use OpenGL 3.3 on desktop platforms
GRAPHICS ?= GRAPHICS_API_OPENGL_33
- #GRAPHICS = GRAPHICS_API_OPENGL_11 # Uncomment to use OpenGL 1.1
- #GRAPHICS = GRAPHICS_API_OPENGL_21 # Uncomment to use OpenGL 2.1
+ #GRAPHICS = GRAPHICS_API_OPENGL_11 # Uncomment to use OpenGL 1.1
+ #GRAPHICS = GRAPHICS_API_OPENGL_21 # Uncomment to use OpenGL 2.1
+ #GRAPHICS = GRAPHICS_API_OPENGL_43 # Uncomment to use OpenGL 4.3
+ #GRAPHICS = GRAPHICS_API_OPENGL_ES2 # Uncomment to use OpenGL ES 2.0 (ANGLE)
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
# On RPI OpenGL ES 2.0 must be used
diff --git a/src/config.h b/src/config.h
index de9f4641a..fbc7a5b47 100644
--- a/src/config.h
+++ b/src/config.h
@@ -239,6 +239,6 @@
// utils: Configuration values
//------------------------------------------------------------------------------------
-#define MAX_TRACELOG_MSG_LENGTH 128 // Max length of one trace-log message
+#define MAX_TRACELOG_MSG_LENGTH 256 // Max length of one trace-log message
#endif // CONFIG_H
diff --git a/src/external/miniaudio.h b/src/external/miniaudio.h
index ad3651503..74d584153 100644
--- a/src/external/miniaudio.h
+++ b/src/external/miniaudio.h
@@ -1,6 +1,6 @@
/*
Audio playback and capture library. Choice of public domain or MIT-0. See license statements at the end of this file.
-miniaudio - v0.11.11 - 2022-11-04
+miniaudio - v0.11.12 - TBD
David Reid - mackron@gmail.com
@@ -38,7 +38,7 @@ A config/init pattern is used throughout the entire library. The idea is that yo
object and pass that into the initialization routine. The advantage to this system is that the
config object can be initialized with logical defaults and new properties added to it without
breaking the API. The config object can be allocated on the stack and does not need to be
-maintained after initialization of the corresponding object.
+maintained after initialization of the corresponding object.
1.1. Low Level API
@@ -363,7 +363,7 @@ initialized. The easiest but least flexible way of playing a sound is like so:
This plays what miniaudio calls an "inline" sound. It plays the sound once, and then puts the
internal sound up for recycling. The last parameter is used to specify which sound group the sound
should be associated with which will be explained later. This particular way of playing a sound is
-simple, but lacks flexibility and features. A more flexible way of playing a sound is to first
+simple, but lacks flexibility and features. A more flexible way of playing a sound is to first
initialize a sound:
```c
@@ -460,6 +460,8 @@ is at the end, use `ma_sound_at_end()`. Looping of a sound can be controlled wit
miniaudio should work cleanly out of the box without the need to download or install any
dependencies. See below for platform-specific details.
+Note that GCC and Clang require `-msse2`, `-mavx2`, etc. for SIMD optimizations.
+
2.1. Windows
------------
@@ -489,9 +491,10 @@ notarization process. To fix this there are two options. The first is to use the
#include "miniaudio.h"
```
-This will require linking with `-framework CoreFoundation -framework CoreAudio -framework AudioUnit`.
-Alternatively, if you would rather keep using runtime linking you can add the following to your
-entitlements.xcent file:
+This will require linking with `-framework CoreFoundation -framework CoreAudio -framework AudioToolbox`.
+If you get errors about AudioToolbox, try with `-framework AudioUnit` instead. You may get this when
+using older versions of iOS. Alternatively, if you would rather keep using runtime linking you can
+add the following to your entitlements.xcent file:
```
com.apple.security.cs.allow-dyld-environment-variables
@@ -748,7 +751,7 @@ To read data from a data source:
ma_result result;
ma_uint64 framesRead;
- result = ma_data_source_read_pcm_frames(pDataSource, pFramesOut, frameCount, &framesRead, loop);
+ result = ma_data_source_read_pcm_frames(pDataSource, pFramesOut, frameCount, &framesRead);
if (result != MA_SUCCESS) {
return result; // Failed to read data from the data source.
}
@@ -768,7 +771,7 @@ you could plug in a decoder like so:
ma_uint64 framesRead;
ma_decoder decoder; // <-- This would be initialized with `ma_decoder_init_*()`.
- result = ma_data_source_read_pcm_frames(&decoder, pFramesOut, frameCount, &framesRead, loop);
+ result = ma_data_source_read_pcm_frames(&decoder, pFramesOut, frameCount, &framesRead);
if (result != MA_SUCCESS) {
return result; // Failed to read data from the decoder.
}
@@ -822,7 +825,7 @@ retrieved like so:
ma_uint32 channels;
ma_uint32 sampleRate;
ma_channel channelMap[MA_MAX_CHANNELS];
-
+
result = ma_data_source_get_data_format(pDataSource, &format, &channels, &sampleRate, channelMap, MA_MAX_CHANNELS);
if (result != MA_SUCCESS) {
return result; // Failed to retrieve data format.
@@ -842,7 +845,9 @@ read data within a certain range of the underlying data. To do this you can use
```
This is useful if you have a sound bank where many sounds are stored in the same file and you want
-the data source to only play one of those sub-sounds.
+the data source to only play one of those sub-sounds. Note that once the range is set, everything
+that takes a position, such as cursors and loop points, should always be relatvie to the start of
+the range. When the range is set, any previously defined loop point will be reset.
Custom loop points can also be used with data sources. By default, data sources will loop after
they reach the end of the data source, but if you need to loop at a specific location, you can do
@@ -871,19 +876,19 @@ To do this, you can use chaining:
return result; // Failed to set the next data source.
}
- result = ma_data_source_read_pcm_frames(&decoder1, pFramesOut, frameCount, pFramesRead, MA_FALSE);
+ result = ma_data_source_read_pcm_frames(&decoder1, pFramesOut, frameCount, pFramesRead);
if (result != MA_SUCCESS) {
return result; // Failed to read from the decoder.
}
```
In the example above we're using decoders. When reading from a chain, you always want to read from
-the top level data source in the chain. In the example above, `decoder1` is the top level data
+the top level data source in the chain. In the example above, `decoder1` is the top level data
source in the chain. When `decoder1` reaches the end, `decoder2` will start seamlessly without any
gaps.
-Note that the `loop` parameter is set to false in the example above. When this is set to true, only
-the current data source will be looped. You can loop the entire chain by linking in a loop like so:
+Note that when looping is enabled, only the current data source will be looped. You can loop the
+entire chain by linking in a loop like so:
```c
ma_data_source_set_next(&decoder1, &decoder2); // decoder1 -> decoder2
@@ -894,9 +899,9 @@ Note that setting up chaining is not thread safe, so care needs to be taken if y
changing links while the audio thread is in the middle of reading.
Do not use `ma_decoder_seek_to_pcm_frame()` as a means to reuse a data source to play multiple
-instances of the same sound simultaneously. Instead, initialize multiple data sources for each
-instance. This can be extremely inefficient depending on the data source and can result in
-glitching due to subtle changes to the state of internal filters.
+instances of the same sound simultaneously. This can be extremely inefficient depending on the type
+of data source and can result in glitching due to subtle changes to the state of internal filters.
+Instead, initialize multiple data sources for each instance.
4.1. Custom Data Sources
@@ -971,7 +976,7 @@ base object (`ma_data_source_base`):
void my_data_source_uninit(my_data_source* pMyDataSource)
{
// ... do the uninitialization of your custom data source here ...
-
+
// You must uninitialize the base data source.
ma_data_source_uninit(&pMyDataSource->base);
}
@@ -1020,7 +1025,7 @@ configure the engine with an engine config:
ma_engine_config engineConfig;
engineConfig = ma_engine_config_init();
- engineConfig.pPlaybackDevice = &myDevice;
+ engineConfig.pDevice = &myDevice;
result = ma_engine_init(&engineConfig, &engine);
if (result != MA_SUCCESS) {
@@ -1061,7 +1066,7 @@ Note that when you're not using a device, you must set the channel count and sam
config or else miniaudio won't know what to use (miniaudio will use the device to determine this
normally). When not using a device, you need to use `ma_engine_read_pcm_frames()` to process audio
data from the engine. This kind of setup is useful if you want to do something like offline
-processing.
+processing or want to use a different audio system for playback such as SDL.
When a sound is loaded it goes through a resource manager. By default the engine will initialize a
resource manager internally, but you can also specify a pre-initialized resource manager:
@@ -1226,7 +1231,7 @@ might be beneficial to pre-decode the sound. You can do this with the `MA_SOUND_
By default, sounds will be loaded synchronously, meaning `ma_sound_init_*()` will not return until
the sound has been fully loaded. If this is prohibitive you can instead load sounds asynchronously
-by specificying the `MA_SOUND_FLAG_ASYNC` flag:
+by specifying the `MA_SOUND_FLAG_ASYNC` flag:
```c
ma_sound_init_from_file(&engine, "my_sound.wav", MA_SOUND_FLAG_DECODE | MA_SOUND_FLAG_ASYNC, pGroup, NULL, &sound);
@@ -1247,7 +1252,7 @@ counter hit's zero. You can specify a fence like so:
ma_sound sounds[4];
result = ma_fence_init(&fence);
- if (result != MA_SUCCES) {
+ if (result != MA_SUCCESS) {
return result;
}
@@ -2028,14 +2033,14 @@ data from the graph:
```
When you read audio data, miniaudio starts at the node graph's endpoint node which then pulls in
-data from it's input attachments, which in turn recusively pull in data from their inputs, and so
+data from it's input attachments, which in turn recursively pull in data from their inputs, and so
on. At the start of the graph there will be some kind of data source node which will have zero
inputs and will instead read directly from a data source. The base nodes don't literally need to
read from a `ma_data_source` object, but they will always have some kind of underlying object that
sources some kind of audio. The `ma_data_source_node` node can be used to read from a
`ma_data_source`. Data is always in floating-point format and in the number of channels you
specified when the graph was initialized. The sample rate is defined by the underlying data sources.
-It's up to you to ensure they use a consistent and appropraite sample rate.
+It's up to you to ensure they use a consistent and appropriate sample rate.
The `ma_node` API is designed to allow custom nodes to be implemented with relative ease, but
miniaudio includes a few stock nodes for common functionality. This is how you would initialize a
@@ -2076,7 +2081,7 @@ another, you do not need to detach first. You can just call `ma_node_attach_outp
deal with it for you.
Less frequently you may want to create a specialized node. This will be a node where you implement
-your own processing callback to apply a custom effect of some kind. This is similar to initalizing
+your own processing callback to apply a custom effect of some kind. This is similar to initializing
one of the stock node types, only this time you need to specify a pointer to a vtable containing a
pointer to the processing function and the number of input and output buses. Example:
@@ -2115,7 +2120,7 @@ pointer to the processing function and the number of input and output buses. Exa
// Each bus needs to have a channel count specified. To do this you need to specify the channel
// counts in an array and then pass that into the node config.
ma_uint32 inputChannels[2]; // Equal in size to the number of input channels specified in the vtable.
- ma_uint32 outputChannels[1]; // Equal in size to the number of output channels specicied in the vtable.
+ ma_uint32 outputChannels[1]; // Equal in size to the number of output channels specified in the vtable.
inputChannels[0] = channelsIn;
inputChannels[1] = channelsIn;
@@ -2199,10 +2204,19 @@ and include the following:
+-----------------------------------------+---------------------------------------------------+
| MA_NODE_FLAG_CONTINUOUS_PROCESSING | Causes the processing callback to be called even |
| | when no data is available to be read from input |
- | | attachments. This is useful for effects like |
+ | | attachments. When a node has at least one input |
+ | | bus, but there are no inputs attached or the |
+ | | inputs do not deliver any data, the node's |
+ | | processing callback will not get fired. This flag |
+ | | will make it so the callback is always fired |
+ | | regardless of whether or not any input data is |
+ | | received. This is useful for effects like |
| | echos where there will be a tail of audio data |
| | that still needs to be processed even when the |
- | | original data sources have reached their ends. |
+ | | original data sources have reached their ends. It |
+ | | may also be useful for nodes that must always |
+ | | have their processing callback fired when there |
+ | | are no inputs attached. |
+-----------------------------------------+---------------------------------------------------+
| MA_NODE_FLAG_ALLOW_NULL_INPUT | Used in conjunction with |
| | `MA_NODE_FLAG_CONTINUOUS_PROCESSING`. When this |
@@ -2393,7 +2407,7 @@ bus and input bus is locked. This locking is specifically for attaching and deta
different threads and does not affect `ma_node_graph_read_pcm_frames()` in any way. The locking and
unlocking is mostly self-explanatory, but a slightly less intuitive aspect comes into it when
considering that iterating over attachments must not break as a result of attaching or detaching a
-node while iteration is occuring.
+node while iteration is occurring.
Attaching and detaching are both quite simple. When an output bus of a node is attached to an input
bus of another node, it's added to a linked list. Basically, an input bus is a linked list, where
@@ -2459,7 +2473,7 @@ implementation:
#define MA_NO_FLAC
```
-Disabling built-in decoding libraries is useful if you use these libraries independantly of the
+Disabling built-in decoding libraries is useful if you use these libraries independently of the
`ma_decoder` API.
A decoder can be initialized from a file with `ma_decoder_init_file()`, a block of memory with
@@ -2561,7 +2575,7 @@ The `ma_decoding_backend_vtable` vtable has the following functions:
```
onInit
- onInitFile
+ onInitFile
onInitFileW
onInitMemory
onUninit
@@ -2573,11 +2587,11 @@ these are not specified, miniaudio will deal with it for you via a generic imple
When you initialize a custom data source (by implementing the `onInit` function in the vtable) you
will need to output a pointer to a `ma_data_source` which implements your custom decoder. See the
-section about data sources for details on how to implemen this. Alternatively, see the
+section about data sources for details on how to implement this. Alternatively, see the
"custom_decoders" example in the miniaudio repository.
The `onInit` function takes a pointer to some callbacks for the purpose of reading raw audio data
-from some abitrary source. You'll use these functions to read from the raw data and perform the
+from some arbitrary source. You'll use these functions to read from the raw data and perform the
decoding. When you call them, you will pass in the `pReadSeekTellUserData` pointer to the relevant
parameter.
@@ -2728,7 +2742,7 @@ To perform the conversion simply call `ma_channel_converter_process_pcm_frames()
}
```
-It is up to the caller to ensure the output buffer is large enough to accomodate the new PCM
+It is up to the caller to ensure the output buffer is large enough to accommodate the new PCM
frames.
Input and output PCM frames are always interleaved. Deinterleaved layouts are not supported.
@@ -3174,7 +3188,7 @@ you can chain first and second order filters together.
If you need to change the configuration of the filter, but need to maintain the state of internal
registers you can do so with `ma_lpf_reinit()`. This may be useful if you need to change the sample
-rate and/or cutoff frequency dynamically while maintaing smooth transitions. Note that changing the
+rate and/or cutoff frequency dynamically while maintaining smooth transitions. Note that changing the
format or channel count after initialization is invalid and will result in an error.
The `ma_lpf` object supports a configurable order, but if you only need a first order filter you
@@ -3347,8 +3361,8 @@ The noise API uses simple LCG random number generation. It supports a custom see
for things like automated testing requiring reproducibility. Setting the seed to zero will default
to `MA_DEFAULT_LCG_SEED`.
-The amplitude, seed, and type can be changed dynamically with `ma_noise_set_amplitude()`,
-`ma_noise_set_seed()`, and `ma_noise_set_type()` respectively.
+The amplitude and seed can be changed dynamically with `ma_noise_set_amplitude()` and
+`ma_noise_set_seed()` respectively.
By default, the noise API will use different values for different channels. So, for example, the
left side in a stereo stream will be different to the right side. To instead have each channel use
@@ -3496,7 +3510,7 @@ you will want to use. To initialize a ring buffer, do something like the followi
```
The `ma_pcm_rb_init()` function takes the sample format and channel count as parameters because
-it's the PCM varient of the ring buffer API. For the regular ring buffer that operates on bytes you
+it's the PCM variant of the ring buffer API. For the regular ring buffer that operates on bytes you
would call `ma_rb_init()` which leaves these out and just takes the size of the buffer in bytes
instead of frames. The fourth parameter is an optional pre-allocated buffer and the fifth parameter
is a pointer to a `ma_allocation_callbacks` structure for custom memory allocation routines.
@@ -3555,7 +3569,7 @@ example, ALSA, which is specific to Linux, will not be included in the Windows b
+-------------+-----------------------+--------------------------------------------------------+
| WASAPI | ma_backend_wasapi | Windows Vista+ |
| DirectSound | ma_backend_dsound | Windows XP+ |
- | WinMM | ma_backend_winmm | Windows XP+ (may work on older versions, but untested) |
+ | WinMM | ma_backend_winmm | Windows 95+ |
| Core Audio | ma_backend_coreaudio | macOS, iOS |
| sndio | ma_backend_sndio | OpenBSD |
| audio(4) | ma_backend_audio4 | NetBSD, OpenBSD |
@@ -3601,6 +3615,12 @@ Some backends have some nuance details you may want to be aware of.
miniaudio's built-in resampler is to take advantage of any potential device-specific
optimizations the driver may implement.
+BSD
+---
+- The sndio backend is currently only enabled on OpenBSD builds.
+- The audio(4) backend is supported on OpenBSD, but you may need to disable sndiod before you can
+ use it.
+
15.4. UWP
---------
- UWP only supports default playback and capture devices.
@@ -3631,14 +3651,28 @@ Some backends have some nuance details you may want to be aware of.
16. Optimization Tips
=====================
+See below for some tips on improving performance.
-16.1. High Level API
+16.1. Low Level API
+-------------------
+- In the data callback, if your data is already clipped prior to copying it into the output buffer,
+ set the `noClip` config option in the device config to true. This will disable miniaudio's built
+ in clipping function.
+- By default, miniaudio will pre-silence the data callback's output buffer. If you know that you
+ will always write valid data to the output buffer you can disable pre-silencing by setting the
+ `noPreSilence` config option in the device config to true.
+
+16.2. High Level API
--------------------
- If a sound does not require doppler or pitch shifting, consider disabling pitching by
initializing the sound with the `MA_SOUND_FLAG_NO_PITCH` flag.
-- If a sound does not require spatialization, disable it by initialzing the sound with the
- `MA_SOUND_FLAG_NO_SPATIALIZATION` flag. It can be renabled again post-initialization with
+- If a sound does not require spatialization, disable it by initializing the sound with the
+ `MA_SOUND_FLAG_NO_SPATIALIZATION` flag. It can be re-enabled again post-initialization with
`ma_sound_set_spatialization_enabled()`.
+- If you know all of your sounds will always be the same sample rate, set the engine's sample
+ rate to match that of the sounds. Likewise, if you're using a self-managed resource manager,
+ consider setting the decoded sample rate to match your sounds. By configuring everything to
+ use a consistent sample rate, sample rate conversion can be avoided.
@@ -3647,17 +3681,6 @@ Some backends have some nuance details you may want to be aware of.
- Automatic stream routing is enabled on a per-backend basis. Support is explicitly enabled for
WASAPI and Core Audio, however other backends such as PulseAudio may naturally support it, though
not all have been tested.
-- The contents of the output buffer passed into the data callback will always be pre-initialized to
- silence unless the `noPreSilencedOutputBuffer` config variable in `ma_device_config` is set to
- true, in which case it'll be undefined which will require you to write something to the entire
- buffer.
-- By default miniaudio will automatically clip samples. This only applies when the playback sample
- format is configured as `ma_format_f32`. If you are doing clipping yourself, you can disable this
- overhead by setting `noClip` to true in the device config.
-- Note that GCC and Clang requires `-msse2`, `-mavx2`, etc. for SIMD optimizations.
-- The sndio backend is currently only enabled on OpenBSD builds.
-- The audio(4) backend is supported on OpenBSD, but you may need to disable sndiod before you can
- use it.
- When compiling with VC6 and earlier, decoding is restricted to files less than 2GB in size. This
is due to 64-bit file APIs not being available.
*/
@@ -3674,7 +3697,7 @@ extern "C" {
#define MA_VERSION_MAJOR 0
#define MA_VERSION_MINOR 11
-#define MA_VERSION_REVISION 11
+#define MA_VERSION_REVISION 12
#define MA_VERSION_STRING MA_XSTRINGIFY(MA_VERSION_MAJOR) "." MA_XSTRINGIFY(MA_VERSION_MINOR) "." MA_XSTRINGIFY(MA_VERSION_REVISION)
#if defined(_MSC_VER) && !defined(__clang__)
@@ -3689,7 +3712,7 @@ extern "C" {
#pragma GCC diagnostic ignored "-Wc11-extensions" /* anonymous unions are a C11 extension */
#endif
#endif
-
+
#if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__)) || defined(_M_X64) || defined(__ia64) || defined(_M_IA64) || defined(__aarch64__) || defined(_M_ARM64) || defined(__powerpc64__)
@@ -3748,6 +3771,10 @@ typedef ma_uint32 ma_bool32;
#define MA_TRUE 1
#define MA_FALSE 0
+/* These float types are not used universally by miniaudio. It's to simplify some macro expansion for atomic types. */
+typedef float ma_float;
+typedef double ma_double;
+
typedef void* ma_handle;
typedef void* ma_ptr;
typedef void (* ma_proc)(void);
@@ -3801,7 +3828,11 @@ typedef ma_uint16 wchar_t;
#ifdef __unix__
#define MA_UNIX
- #if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+ #ifdef __ORBIS__
+ #define MA_ORBIS
+ #elif defined(__PROSPERO__)
+ #define MA_PROSPERO
+ #elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#define MA_BSD
#endif
#endif
@@ -3817,8 +3848,24 @@ typedef ma_uint16 wchar_t;
#ifdef __EMSCRIPTEN__
#define MA_EMSCRIPTEN
#endif
+ #if defined(__NX__)
+ #define MA_NX
+ #endif
#endif
+#if defined(__has_c_attribute)
+ #if __has_c_attribute(fallthrough)
+ #define MA_FALLTHROUGH [[fallthrough]]
+ #endif
+#endif
+#if !defined(MA_FALLTHROUGH) && defined(__has_attribute) && (defined(__clang__) || defined(__GNUC__))
+ #if __has_attribute(fallthrough)
+ #define MA_FALLTHROUGH __attribute__((fallthrough))
+ #endif
+#endif
+#if !defined(MA_FALLTHROUGH)
+ #define MA_FALLTHROUGH ((void)0)
+#endif
#ifdef _MSC_VER
#define MA_INLINE __forceinline
@@ -4068,6 +4115,7 @@ typedef enum
MA_API_NOT_FOUND = -105,
MA_INVALID_DEVICE_CONFIG = -106,
MA_LOOP = -107,
+ MA_BACKEND_NOT_ENABLED = -108,
/* State errors. */
MA_DEVICE_NOT_INITIALIZED = -200,
@@ -4084,7 +4132,7 @@ typedef enum
#define MA_MIN_CHANNELS 1
-#ifndef MA_MAX_CHANNELS
+#ifndef MA_MAX_CHANNELS
#define MA_MAX_CHANNELS 254
#endif
@@ -4195,6 +4243,63 @@ typedef struct
} ma_lcg;
+/*
+Atomics.
+
+These are typesafe structures to prevent errors as a result of forgetting to reference variables atomically. It's too
+easy to introduce subtle bugs where you accidentally do a regular assignment instead of an atomic load/store, etc. By
+using a struct we can enforce the use of atomics at compile time.
+
+These types are declared in the header section because we need to reference them in structs below, but functions for
+using them are only exposed in the implementation section. I do not want these to be part of the public API.
+
+There's a few downsides to this system. The first is that you need to declare a new struct for each type. Below are
+some macros to help with the declarations. They will be named like so:
+
+ ma_atomic_uint32 - atomic ma_uint32
+ ma_atomic_int32 - atomic ma_int32
+ ma_atomic_uint64 - atomic ma_uint64
+ ma_atomic_float - atomic float
+ ma_atomic_bool32 - atomic ma_bool32
+
+The other downside is that atomic pointers are extremely messy. You need to declare a new struct for each specific
+type of pointer you need to make atomic. For example, an atomic ma_node* will look like this:
+
+ MA_ATOMIC_SAFE_TYPE_IMPL_PTR(node)
+
+Which will declare a type struct that's named like so:
+
+ ma_atomic_ptr_node
+
+Functions to use the atomic types are declared in the implementation section. All atomic functions are prefixed with
+the name of the struct. For example:
+
+ ma_atomic_uint32_set() - Atomic store of ma_uint32
+ ma_atomic_uint32_get() - Atomic load of ma_uint32
+ etc.
+
+For pointer types it's the same, which makes them a bit messy to use due to the length of each function name, but in
+return you get type safety and enforcement of atomic operations.
+*/
+#define MA_ATOMIC_SAFE_TYPE_DECL(c89TypeExtension, typeSize, type) \
+ typedef struct \
+ { \
+ MA_ATOMIC(typeSize, ma_##type) value; \
+ } ma_atomic_##type; \
+
+#define MA_ATOMIC_SAFE_TYPE_DECL_PTR(type) \
+ typedef struct \
+ { \
+ MA_ATOMIC(MA_SIZEOF_PTR, ma_##type*) value; \
+ } ma_atomic_ptr_##type; \
+
+MA_ATOMIC_SAFE_TYPE_DECL(32, 4, uint32)
+MA_ATOMIC_SAFE_TYPE_DECL(i32, 4, int32)
+MA_ATOMIC_SAFE_TYPE_DECL(64, 8, uint64)
+MA_ATOMIC_SAFE_TYPE_DECL(f32, 4, float)
+MA_ATOMIC_SAFE_TYPE_DECL(32, 4, bool32)
+
+
/* Spinlocks are 32-bit for compatibility reasons. */
typedef ma_uint32 ma_spinlock;
@@ -4281,7 +4386,7 @@ Logging
#endif
#endif
#ifndef MA_ATTRIBUTE_FORMAT
-#define MA_ATTRIBUTE_FORMAT(fmt,va)
+#define MA_ATTRIBUTE_FORMAT(fmt, va)
#endif
#ifndef MA_MAX_LOG_CALLBACKS
@@ -4312,11 +4417,6 @@ logLevel (in)
pMessage (in)
The log message.
-
-
-Remarks
--------
-Do not modify the state of the device from inside the callback.
*/
typedef void (* ma_log_callback_proc)(void* pUserData, ma_uint32 level, const char* pMessage);
@@ -4811,6 +4911,7 @@ typedef struct
{
ma_gainer_config config;
ma_uint32 t;
+ float masterVolume;
float* pOldGains;
float* pNewGains;
@@ -4826,6 +4927,8 @@ MA_API void ma_gainer_uninit(ma_gainer* pGainer, const ma_allocation_callbacks*
MA_API ma_result ma_gainer_process_pcm_frames(ma_gainer* pGainer, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount);
MA_API ma_result ma_gainer_set_gain(ma_gainer* pGainer, float newGain);
MA_API ma_result ma_gainer_set_gains(ma_gainer* pGainer, float* pNewGains);
+MA_API ma_result ma_gainer_set_master_volume(ma_gainer* pGainer, float volume);
+MA_API ma_result ma_gainer_get_master_volume(const ma_gainer* pGainer, float* pVolume);
@@ -4887,7 +4990,7 @@ MA_API ma_result ma_fader_init(const ma_fader_config* pConfig, ma_fader* pFader)
MA_API ma_result ma_fader_process_pcm_frames(ma_fader* pFader, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount);
MA_API void ma_fader_get_data_format(const ma_fader* pFader, ma_format* pFormat, ma_uint32* pChannels, ma_uint32* pSampleRate);
MA_API void ma_fader_set_fade(ma_fader* pFader, float volumeBeg, float volumeEnd, ma_uint64 lengthInFrames);
-MA_API float ma_fader_get_current_volume(ma_fader* pFader);
+MA_API float ma_fader_get_current_volume(const ma_fader* pFader);
@@ -4899,6 +5002,12 @@ typedef struct
float z;
} ma_vec3f;
+typedef struct
+{
+ ma_vec3f v;
+ ma_spinlock lock;
+} ma_atomic_vec3f;
+
typedef enum
{
ma_attenuation_model_none, /* No distance attenuation and no spatialization. */
@@ -4938,9 +5047,9 @@ MA_API ma_spatializer_listener_config ma_spatializer_listener_config_init(ma_uin
typedef struct
{
ma_spatializer_listener_config config;
- ma_vec3f position; /* The absolute position of the listener. */
- ma_vec3f direction; /* The direction the listener is facing. The world up vector is config.worldUp. */
- ma_vec3f velocity;
+ ma_atomic_vec3f position; /* The absolute position of the listener. */
+ ma_atomic_vec3f direction; /* The direction the listener is facing. The world up vector is config.worldUp. */
+ ma_atomic_vec3f velocity;
ma_bool32 isEnabled;
/* Memory management. */
@@ -5012,9 +5121,9 @@ typedef struct
float dopplerFactor; /* Set to 0 to disable doppler effect. */
float directionalAttenuationFactor; /* Set to 0 to disable directional attenuation. */
ma_uint32 gainSmoothTimeInFrames; /* When the gain of a channel changes during spatialization, the transition will be linearly interpolated over this number of frames. */
- ma_vec3f position;
- ma_vec3f direction;
- ma_vec3f velocity; /* For doppler effect. */
+ ma_atomic_vec3f position;
+ ma_atomic_vec3f direction;
+ ma_atomic_vec3f velocity; /* For doppler effect. */
float dopplerPitch; /* Will be updated by ma_spatializer_process_pcm_frames() and can be used by higher level functions to apply a pitch shift for doppler effect. */
ma_gainer gainer; /* For smooth gain transitions. */
float* pNewChannelGainsOut; /* An offset of _pHeap. Used by ma_spatializer_process_pcm_frames() to store new channel gains. The number of elements in this array is equal to config.channelsOut. */
@@ -5029,6 +5138,8 @@ MA_API ma_result ma_spatializer_init_preallocated(const ma_spatializer_config* p
MA_API ma_result ma_spatializer_init(const ma_spatializer_config* pConfig, const ma_allocation_callbacks* pAllocationCallbacks, ma_spatializer* pSpatializer);
MA_API void ma_spatializer_uninit(ma_spatializer* pSpatializer, const ma_allocation_callbacks* pAllocationCallbacks);
MA_API ma_result ma_spatializer_process_pcm_frames(ma_spatializer* pSpatializer, ma_spatializer_listener* pListener, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount);
+MA_API ma_result ma_spatializer_set_master_volume(ma_spatializer* pSpatializer, float volume);
+MA_API ma_result ma_spatializer_get_master_volume(const ma_spatializer* pSpatializer, float* pVolume);
MA_API ma_uint32 ma_spatializer_get_input_channels(const ma_spatializer* pSpatializer);
MA_API ma_uint32 ma_spatializer_get_output_channels(const ma_spatializer* pSpatializer);
MA_API void ma_spatializer_set_attenuation_model(ma_spatializer* pSpatializer, ma_attenuation_model attenuationModel);
@@ -5225,7 +5336,7 @@ MA_API ma_result ma_resampler_process_pcm_frames(ma_resampler* pResampler, const
/*
-Sets the input and output sample sample rate.
+Sets the input and output sample rate.
*/
MA_API ma_result ma_resampler_set_rate(ma_resampler* pResampler, ma_uint32 sampleRateIn, ma_uint32 sampleRateOut);
@@ -6151,7 +6262,7 @@ This section contains the APIs for device playback and capture. Here is where yo
#define MA_SUPPORT_JACK /* JACK is technically supported on Windows, but I don't know how many people use it in practice... */
#endif
#endif
-#if defined(MA_UNIX)
+#if defined(MA_UNIX) && !defined(MA_ORBIS) && !defined(MA_PROSPERO)
#if defined(MA_LINUX)
#if !defined(MA_ANDROID) /* ALSA is not supported on Android. */
#define MA_SUPPORT_ALSA
@@ -6246,6 +6357,9 @@ typedef enum
ma_device_state_stopping = 4 /* Transitioning from a started state to stopped. */
} ma_device_state;
+MA_ATOMIC_SAFE_TYPE_DECL(i32, 4, device_state)
+
+
#ifdef MA_SUPPORT_WASAPI
/* We need a IMMNotificationClient object for WASAPI. */
typedef struct
@@ -6438,7 +6552,7 @@ DEPRECATED. Use ma_device_notification_proc instead.
The callback for when the device has been stopped.
This will be called when the device is stopped explicitly with `ma_device_stop()` and also called implicitly when the device is stopped through external forces
-such as being unplugged or an internal error occuring.
+such as being unplugged or an internal error occurring.
Parameters
@@ -6567,6 +6681,13 @@ typedef enum
ma_aaudio_input_preset_voice_performance /* AAUDIO_INPUT_PRESET_VOICE_PERFORMANCE */
} ma_aaudio_input_preset;
+typedef enum
+{
+ ma_aaudio_allow_capture_default = 0, /* Leaves the allowed capture policy unset. */
+ ma_aaudio_allow_capture_by_all, /* AAUDIO_ALLOW_CAPTURE_BY_ALL */
+ ma_aaudio_allow_capture_by_system, /* AAUDIO_ALLOW_CAPTURE_BY_SYSTEM */
+ ma_aaudio_allow_capture_by_none /* AAUDIO_ALLOW_CAPTURE_BY_NONE */
+} ma_aaudio_allowed_capture_policy;
typedef union
{
@@ -6694,13 +6815,16 @@ struct ma_device_config
{
ma_opensl_stream_type streamType;
ma_opensl_recording_preset recordingPreset;
+ ma_bool32 enableCompatibilityWorkarounds;
} opensl;
struct
{
ma_aaudio_usage usage;
ma_aaudio_content_type contentType;
ma_aaudio_input_preset inputPreset;
+ ma_aaudio_allowed_capture_policy allowedCapturePolicy;
ma_bool32 noAutoStartAfterReroute;
+ ma_bool32 enableCompatibilityWorkarounds;
} aaudio;
};
@@ -6801,7 +6925,7 @@ If the backend requires absolute flexibility with it's data delivery, it can opt
which will allow it to implement the logic that will run on the audio thread. This is much more advanced and is completely optional.
The audio thread should run data delivery logic in a loop while `ma_device_get_state() == ma_device_state_started` and no errors have been
-encounted. Do not start or stop the device here. That will be handled from outside the `onDeviceDataLoop()` callback.
+encountered. Do not start or stop the device here. That will be handled from outside the `onDeviceDataLoop()` callback.
The invocation of the `onDeviceDataLoop()` callback will be handled by miniaudio. When you start the device, miniaudio will fire this
callback. When the device is stopped, the `ma_device_get_state() == ma_device_state_started` condition will fail and the loop will be terminated
@@ -7214,6 +7338,7 @@ struct ma_context
ma_proc AAudioStreamBuilder_setUsage;
ma_proc AAudioStreamBuilder_setContentType;
ma_proc AAudioStreamBuilder_setInputPreset;
+ ma_proc AAudioStreamBuilder_setAllowedCapturePolicy;
ma_proc AAudioStreamBuilder_openStream;
ma_proc AAudioStream_close;
ma_proc AAudioStream_getState;
@@ -7263,6 +7388,7 @@ struct ma_context
struct
{
/*HMODULE*/ ma_handle hOle32DLL;
+ ma_proc CoInitialize;
ma_proc CoInitializeEx;
ma_proc CoUninitialize;
ma_proc CoCreateInstance;
@@ -7283,22 +7409,7 @@ struct ma_context
#ifdef MA_POSIX
struct
{
- ma_handle pthreadSO;
- ma_proc pthread_create;
- ma_proc pthread_join;
- ma_proc pthread_mutex_init;
- ma_proc pthread_mutex_destroy;
- ma_proc pthread_mutex_lock;
- ma_proc pthread_mutex_unlock;
- ma_proc pthread_cond_init;
- ma_proc pthread_cond_destroy;
- ma_proc pthread_cond_wait;
- ma_proc pthread_cond_signal;
- ma_proc pthread_attr_init;
- ma_proc pthread_attr_destroy;
- ma_proc pthread_attr_setschedpolicy;
- ma_proc pthread_attr_getschedparam;
- ma_proc pthread_attr_setschedparam;
+ int _unused;
} posix;
#endif
int _unused;
@@ -7310,7 +7421,7 @@ struct ma_device
ma_context* pContext;
ma_device_type type;
ma_uint32 sampleRate;
- MA_ATOMIC(4, ma_device_state) state; /* The state of the device is variable and can change at any time on any thread. Must be used atomically. */
+ ma_atomic_device_state state; /* The state of the device is variable and can change at any time on any thread. Must be used atomically. */
ma_device_data_proc onData; /* Set once at initialization time and should not be changed after. */
ma_device_notification_proc onNotification; /* Set once at initialization time and should not be changed after. */
ma_stop_proc onStop; /* DEPRECATED. Use the notification callback instead. Set once at initialization time and should not be changed after. */
@@ -7326,7 +7437,7 @@ struct ma_device
ma_bool8 noClip;
ma_bool8 noDisableDenormals;
ma_bool8 noFixedSizedCallback;
- MA_ATOMIC(4, float) masterVolumeFactor; /* Linear 0..1. Can be read and written simultaneously by different threads. Must be used atomically. */
+ ma_atomic_float masterVolumeFactor; /* Linear 0..1. Can be read and written simultaneously by different threads. Must be used atomically. */
ma_duplex_rb duplexRB; /* Intermediary buffer for duplex device on asynchronous backends. */
struct
{
@@ -7414,8 +7525,8 @@ struct ma_device
void* pMappedBufferPlayback;
ma_uint32 mappedBufferPlaybackCap;
ma_uint32 mappedBufferPlaybackLen;
- MA_ATOMIC(4, ma_bool32) isStartedCapture; /* Can be read and written simultaneously across different threads. Must be used atomically, and must be 32-bit. */
- MA_ATOMIC(4, ma_bool32) isStartedPlayback; /* Can be read and written simultaneously across different threads. Must be used atomically, and must be 32-bit. */
+ ma_atomic_bool32 isStartedCapture; /* Can be read and written simultaneously across different threads. Must be used atomically, and must be 32-bit. */
+ ma_atomic_bool32 isStartedPlayback; /* Can be read and written simultaneously across different threads. Must be used atomically, and must be 32-bit. */
ma_uint32 loopbackProcessID;
ma_bool8 loopbackProcessExclude;
ma_bool8 noAutoConvertSRC; /* When set to true, disables the use of AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM. */
@@ -7426,7 +7537,8 @@ struct ma_device
ma_bool8 isDetachedPlayback;
ma_bool8 isDetachedCapture;
ma_wasapi_usage usage;
- void *hAvrtHandle;
+ void* hAvrtHandle;
+ ma_mutex rerouteLock;
} wasapi;
#endif
#ifdef MA_SUPPORT_DSOUND
@@ -7544,6 +7656,7 @@ struct ma_device
ma_aaudio_usage usage;
ma_aaudio_content_type contentType;
ma_aaudio_input_preset inputPreset;
+ ma_aaudio_allowed_capture_policy allowedCapturePolicy;
ma_bool32 noAutoStartAfterReroute;
} aaudio;
#endif
@@ -7569,6 +7682,20 @@ struct ma_device
#ifdef MA_SUPPORT_WEBAUDIO
struct
{
+ /* AudioWorklets path. */
+ /* EMSCRIPTEN_WEBAUDIO_T */ int audioContextPlayback;
+ /* EMSCRIPTEN_WEBAUDIO_T */ int audioContextCapture;
+ /* EMSCRIPTEN_AUDIO_WORKLET_NODE_T */ int workletNodePlayback;
+ /* EMSCRIPTEN_AUDIO_WORKLET_NODE_T */ int workletNodeCapture;
+ size_t intermediaryBufferSizeInFramesPlayback;
+ size_t intermediaryBufferSizeInFramesCapture;
+ float* pIntermediaryBufferPlayback;
+ float* pIntermediaryBufferCapture;
+ void* pStackBufferPlayback;
+ void* pStackBufferCapture;
+ ma_bool32 isInitialized;
+
+ /* ScriptProcessorNode path. */
int indexPlayback; /* We use a factory on the JavaScript side to manage devices and use an index for JS/C interop. */
int indexCapture;
} webaudio;
@@ -7588,7 +7715,7 @@ struct ma_device
ma_uint32 currentPeriodFramesRemainingCapture;
ma_uint64 lastProcessedFramePlayback;
ma_uint64 lastProcessedFrameCapture;
- MA_ATOMIC(4, ma_bool32) isStarted; /* Read and written by multiple threads. Must be used atomically, and must be 32-bit for compiler compatibility. */
+ ma_atomic_bool32 isStarted; /* Read and written by multiple threads. Must be used atomically, and must be 32-bit for compiler compatibility. */
} null_device;
#endif
};
@@ -8252,7 +8379,7 @@ then be set directly on the structure. Below are the members of the `ma_device_c
A pointer that will passed to callbacks in pBackendVTable.
resampling.linear.lpfOrder
- The linear resampler applies a low-pass filter as part of it's procesing for anti-aliasing. This setting controls the order of the filter. The higher
+ The linear resampler applies a low-pass filter as part of it's processing for anti-aliasing. This setting controls the order of the filter. The higher
the value, the better the quality, in general. Setting this to 0 will disable low-pass filtering altogether. The maximum value is
`MA_MAX_FILTER_ORDER`. The default value is `min(4, MA_MAX_FILTER_ORDER)`.
@@ -9170,6 +9297,11 @@ Retrieves a friendly name for a backend.
*/
MA_API const char* ma_get_backend_name(ma_backend backend);
+/*
+Retrieves the backend enum from the given name.
+*/
+MA_API ma_result ma_get_backend_from_name(const char* pBackendName, ma_backend* pBackend);
+
/*
Determines whether or not the given backend is available by the compilation environment.
*/
@@ -9259,7 +9391,7 @@ MA_API ma_bool32 ma_is_loopback_supported(ma_backend backend);
/************************************************************************************************************************************************************
-Utiltities
+Utilities
************************************************************************************************************************************************************/
@@ -9361,6 +9493,12 @@ Helper for converting gain in decibels to a linear factor.
MA_API float ma_volume_db_to_linear(float gain);
+/*
+Mixes the specified number of frames in floating point format with a volume factor.
+
+This will run on an optimized path when the volume is equal to 1.
+*/
+MA_API ma_result ma_mix_pcm_frames_f32(float* pDst, const float* pSrc, ma_uint64 frameCount, ma_uint32 channels, float volume);
/**************************************************************************************************
@@ -10118,7 +10256,7 @@ struct ma_resource_manager_data_buffer
ma_bool32 seekToCursorOnNextRead; /* On the next read we need to seek to the frame cursor. */
MA_ATOMIC(4, ma_result) result; /* Keeps track of a result of decoding. Set to MA_BUSY while the buffer is still loading. Set to MA_SUCCESS when loading is finished successfully. Otherwise set to some other code. */
MA_ATOMIC(4, ma_bool32) isLooping; /* Can be read and written by different threads at the same time. Must be used atomically. */
- ma_bool32 isConnectorInitialized; /* Used for asynchronous loading to ensure we don't try to initialize the connector multiple times while waiting for the node to fully load. */
+ ma_atomic_bool32 isConnectorInitialized; /* Used for asynchronous loading to ensure we don't try to initialize the connector multiple times while waiting for the node to fully load. */
union
{
ma_decoder decoder; /* Supply type is ma_resource_manager_data_supply_type_encoded */
@@ -10384,7 +10522,7 @@ struct ma_node_output_bus
ma_uint8 channels; /* The number of channels in the audio stream for this bus. */
/* Mutable via multiple threads. Must be used atomically. The weird ordering here is for packing reasons. */
- MA_ATOMIC(1, ma_uint8) inputNodeInputBusIndex; /* The index of the input bus on the input. Required for detaching. */
+ ma_uint8 inputNodeInputBusIndex; /* The index of the input bus on the input. Required for detaching. Will only be used within the spinlock so does not need to be atomic. */
MA_ATOMIC(4, ma_uint32) flags; /* Some state flags for tracking the read state of the output buffer. A combination of MA_NODE_OUTPUT_BUS_FLAG_*. */
MA_ATOMIC(4, ma_uint32) refCount; /* Reference count for some thread-safety when detaching. */
MA_ATOMIC(4, ma_bool32) isAttached; /* This is used to prevent iteration of nodes that are in the middle of being detached. Used for thread safety. */
@@ -10408,7 +10546,7 @@ struct ma_node_input_bus
MA_ATOMIC(4, ma_spinlock) lock; /* Unfortunate lock, but significantly simplifies the implementation. Required for thread-safe attaching and detaching. */
/* Set once at startup. */
- ma_uint8 channels; /* The number of channels in the audio stream for this bus. */
+ ma_uint8 channels; /* The number of channels in the audio stream for this bus. */
};
@@ -10416,7 +10554,7 @@ typedef struct ma_node_base ma_node_base;
struct ma_node_base
{
/* These variables are set once at startup. */
- ma_node_graph* pNodeGraph; /* The graph this node belongs to. */
+ ma_node_graph* pNodeGraph; /* The graph this node belongs to. */
const ma_node_vtable* vtable;
float* pCachedData; /* Allocated on the heap. Fixed size. Needs to be stored on the heap because reading from output buses is done in separate function calls. */
ma_uint16 cachedDataCapInFramesPerBus; /* The capacity of the input data cache in frames, per bus. */
@@ -10518,7 +10656,7 @@ MA_API ma_result ma_data_source_node_set_looping(ma_data_source_node* pDataSourc
MA_API ma_bool32 ma_data_source_node_is_looping(ma_data_source_node* pDataSourceNode);
-/* Splitter Node. 1 input, 2 outputs. Used for splitting/copying a stream so it can be as input into two separate output nodes. */
+/* Splitter Node. 1 input, many outputs. Used for splitting/copying a stream so it can be as input into two separate output nodes. */
typedef struct
{
ma_node_config nodeConfig;
@@ -10791,7 +10929,7 @@ typedef struct
ma_uint32 channelsOut;
ma_uint32 sampleRate; /* Only used when the type is set to ma_engine_node_type_sound. */
ma_mono_expansion_mode monoExpansionMode;
- ma_bool8 isPitchDisabled; /* Pitching can be explicitly disable with MA_SOUND_FLAG_NO_PITCH to optimize processing. */
+ ma_bool8 isPitchDisabled; /* Pitching can be explicitly disabled with MA_SOUND_FLAG_NO_PITCH to optimize processing. */
ma_bool8 isSpatializationDisabled; /* Spatialization can be explicitly disabled with MA_SOUND_FLAG_NO_SPATIALIZATION. */
ma_uint8 pinnedListenerIndex; /* The index of the listener this node should always use for spatialization. If set to MA_LISTENER_INDEX_CLOSEST the engine will use the closest listener. */
} ma_engine_node_config;
@@ -10847,7 +10985,8 @@ typedef struct
ma_uint64 loopPointBegInPCMFrames;
ma_uint64 loopPointEndInPCMFrames;
ma_bool32 isLooping;
- ma_fence* pDoneFence; /* Released when the resource manager has finished decoding the entire sound. Not used with streams. */
+ ma_resource_manager_pipeline_notifications initNotifications;
+ ma_fence* pDoneFence; /* Deprecated. Use initNotifications instead. Released when the resource manager has finished decoding the entire sound. Not used with streams. */
} ma_sound_config;
MA_API ma_sound_config ma_sound_config_init(void); /* Deprecated. Will be removed in version 0.12. Use ma_sound_config_2() instead. */
@@ -11032,7 +11171,7 @@ MA_API void ma_sound_set_directional_attenuation_factor(ma_sound* pSound, float
MA_API float ma_sound_get_directional_attenuation_factor(const ma_sound* pSound);
MA_API void ma_sound_set_fade_in_pcm_frames(ma_sound* pSound, float volumeBeg, float volumeEnd, ma_uint64 fadeLengthInFrames);
MA_API void ma_sound_set_fade_in_milliseconds(ma_sound* pSound, float volumeBeg, float volumeEnd, ma_uint64 fadeLengthInMilliseconds);
-MA_API float ma_sound_get_current_fade_volume(ma_sound* pSound);
+MA_API float ma_sound_get_current_fade_volume(const ma_sound* pSound);
MA_API void ma_sound_set_start_time_in_pcm_frames(ma_sound* pSound, ma_uint64 absoluteGlobalTimeInFrames);
MA_API void ma_sound_set_start_time_in_milliseconds(ma_sound* pSound, ma_uint64 absoluteGlobalTimeInMilliseconds);
MA_API void ma_sound_set_stop_time_in_pcm_frames(ma_sound* pSound, ma_uint64 absoluteGlobalTimeInFrames);
@@ -11155,6 +11294,10 @@ IMPLEMENTATION
#include
#endif
+#ifdef MA_NX
+#include /* For nanosleep() */
+#endif
+
#include /* For fstat(), etc. */
#ifdef MA_EMSCRIPTEN
@@ -11436,23 +11579,6 @@ static MA_INLINE ma_bool32 ma_has_neon(void)
#endif
}
-#define MA_SIMD_NONE 0
-#define MA_SIMD_SSE2 1
-#define MA_SIMD_AVX2 2
-#define MA_SIMD_NEON 3
-
-#ifndef MA_PREFERRED_SIMD
- # if defined(MA_SUPPORT_SSE2) && defined(MA_PREFER_SSE2)
- #define MA_PREFERRED_SIMD MA_SIMD_SSE2
- #elif defined(MA_SUPPORT_AVX2) && defined(MA_PREFER_AVX2)
- #define MA_PREFERRED_SIMD MA_SIMD_AVX2
- #elif defined(MA_SUPPORT_NEON) && defined(MA_PREFER_NEON)
- #define MA_PREFERRED_SIMD MA_SIMD_NEON
- #else
- #define MA_PREFERRED_SIMD MA_SIMD_NONE
- #endif
-#endif
-
#if defined(__has_builtin)
#define MA_COMPILER_HAS_BUILTIN(x) __has_builtin(x)
#else
@@ -11566,7 +11692,7 @@ static void ma_sleep__posix(ma_uint32 milliseconds)
(void)milliseconds;
MA_ASSERT(MA_FALSE); /* The Emscripten build should never sleep. */
#else
- #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309L
+ #if (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309L) || defined(MA_NX)
struct timespec ts;
ts.tv_sec = milliseconds / 1000;
ts.tv_nsec = milliseconds % 1000 * 1000000;
@@ -11714,6 +11840,20 @@ static MA_INLINE void ma_restore_denormals(unsigned int prevState)
}
+#ifdef MA_ANDROID
+#include
+
+int ma_android_sdk_version()
+{
+ char sdkVersion[PROP_VALUE_MAX + 1] = {0, };
+ if (__system_property_get("ro.build.version.sdk", sdkVersion)) {
+ return atoi(sdkVersion);
+ }
+
+ return 0;
+}
+#endif
+
#ifndef MA_COINIT_VALUE
#define MA_COINIT_VALUE 0 /* 0 = COINIT_MULTITHREADED */
@@ -11867,6 +12007,14 @@ MA_API const char* ma_version_string(void)
Standard Library Stuff
******************************************************************************/
+#ifndef MA_ASSERT
+#ifdef MA_WIN32
+#define MA_ASSERT(condition) assert(condition)
+#else
+#define MA_ASSERT(condition) assert(condition)
+#endif
+#endif
+
#ifndef MA_MALLOC
#ifdef MA_WIN32
#define MA_MALLOC(sz) HeapAlloc(GetProcessHeap(), 0, (sz))
@@ -11893,6 +12041,11 @@ Standard Library Stuff
static MA_INLINE void ma_zero_memory_default(void* p, size_t sz)
{
+ if (p == NULL) {
+ MA_ASSERT(sz == 0); /* If this is triggered there's an error with the calling code. */
+ return;
+ }
+
#ifdef MA_WIN32
ZeroMemory(p, sz);
#else
@@ -11922,14 +12075,6 @@ static MA_INLINE void ma_zero_memory_default(void* p, size_t sz)
#endif
#endif
-#ifndef MA_ASSERT
-#ifdef MA_WIN32
-#define MA_ASSERT(condition) assert(condition)
-#else
-#define MA_ASSERT(condition) assert(condition)
-#endif
-#endif
-
#define MA_ZERO_OBJECT(p) MA_ZERO_MEMORY((p), sizeof(*(p)))
#define ma_countof(x) (sizeof(x) / sizeof(x[0]))
@@ -11974,6 +12119,40 @@ static MA_INLINE double ma_sqrtd(double x)
}
+static MA_INLINE float ma_rsqrtf(float x)
+{
+ #if defined(MA_SUPPORT_SSE2) && !defined(MA_NO_SSE2) && (defined(MA_X64) || (defined(_M_IX86_FP) && _M_IX86_FP == 2) || defined(__SSE2__))
+ {
+ /*
+ For SSE we can use RSQRTSS.
+
+ This Stack Overflow post suggests that compilers don't necessarily generate optimal code
+ when using intrinsics:
+
+ https://web.archive.org/web/20221211012522/https://stackoverflow.com/questions/32687079/getting-fewest-instructions-for-rsqrtss-wrapper
+
+ I'm going to do something similar here, but a bit simpler.
+ */
+ #if defined(__GNUC__) || defined(__clang__)
+ {
+ float result;
+ __asm__ __volatile__("rsqrtss %1, %0" : "=x"(result) : "x"(x));
+ return result;
+ }
+ #else
+ {
+ return _mm_cvtss_f32(_mm_rsqrt_ss(_mm_set_ps1(x)));
+ }
+ #endif
+ }
+ #else
+ {
+ return 1 / (float)ma_sqrtd(x);
+ }
+ #endif
+}
+
+
static MA_INLINE float ma_sinf(float x)
{
return (float)ma_sind((float)x);
@@ -13069,6 +13248,9 @@ MA_API const char* ma_log_level_to_string(ma_uint32 logLevel)
}
#if defined(MA_DEBUG_OUTPUT)
+#if defined(MA_ANDROID)
+ #include
+#endif
/* Customize this to use a specific tag in __android_log_print() for debug output messages. */
#ifndef MA_ANDROID_LOG_TAG
@@ -13733,11 +13915,17 @@ typedef unsigned char c89atomic_bool;
#define C89ATOMIC_32BIT
#endif
#endif
+#if defined(__arm__) || defined(_M_ARM)
+#define C89ATOMIC_ARM32
+#endif
+#if defined(__arm64) || defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64)
+#define C89ATOMIC_ARM64
+#endif
#if defined(__x86_64__) || defined(_M_X64)
#define C89ATOMIC_X64
#elif defined(__i386) || defined(_M_IX86)
#define C89ATOMIC_X86
-#elif defined(__arm__) || defined(_M_ARM) || defined(__arm64) || defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64)
+#elif defined(C89ATOMIC_ARM32) || defined(C89ATOMIC_ARM64)
#define C89ATOMIC_ARM
#endif
#if defined(_MSC_VER)
@@ -13758,6 +13946,56 @@ typedef unsigned char c89atomic_bool;
#define C89ATOMIC_HAS_32
#define C89ATOMIC_HAS_64
#if (defined(_MSC_VER) ) || defined(__WATCOMC__) || defined(__DMC__)
+ #define C89ATOMIC_MSVC_ARM_INTRINSIC(dst, src, order, intrin, c89atomicType, msvcType) \
+ c89atomicType result; \
+ switch (order) \
+ { \
+ case c89atomic_memory_order_relaxed: \
+ { \
+ result = (c89atomicType)intrin##_nf((volatile msvcType*)dst, (msvcType)src); \
+ } break; \
+ case c89atomic_memory_order_consume: \
+ case c89atomic_memory_order_acquire: \
+ { \
+ result = (c89atomicType)intrin##_acq((volatile msvcType*)dst, (msvcType)src); \
+ } break; \
+ case c89atomic_memory_order_release: \
+ { \
+ result = (c89atomicType)intrin##_rel((volatile msvcType*)dst, (msvcType)src); \
+ } break; \
+ case c89atomic_memory_order_acq_rel: \
+ case c89atomic_memory_order_seq_cst: \
+ default: \
+ { \
+ result = (c89atomicType)intrin((volatile msvcType*)dst, (msvcType)src); \
+ } break; \
+ } \
+ return result;
+ #define C89ATOMIC_MSVC_ARM_INTRINSIC_COMPARE_EXCHANGE(ptr, expected, desired, order, intrin, c89atomicType, msvcType) \
+ c89atomicType result; \
+ switch (order) \
+ { \
+ case c89atomic_memory_order_relaxed: \
+ { \
+ result = (c89atomicType)intrin##_nf((volatile msvcType*)ptr, (msvcType)expected, (msvcType)desired); \
+ } break; \
+ case c89atomic_memory_order_consume: \
+ case c89atomic_memory_order_acquire: \
+ { \
+ result = (c89atomicType)intrin##_acq((volatile msvcType*)ptr, (msvcType)expected, (msvcType)desired); \
+ } break; \
+ case c89atomic_memory_order_release: \
+ { \
+ result = (c89atomicType)intrin##_rel((volatile msvcType*)ptr, (msvcType)expected, (msvcType)desired); \
+ } break; \
+ case c89atomic_memory_order_acq_rel: \
+ case c89atomic_memory_order_seq_cst: \
+ default: \
+ { \
+ result = (c89atomicType)intrin((volatile msvcType*)ptr, (msvcType)expected, (msvcType)desired); \
+ } break; \
+ } \
+ return result;
#define c89atomic_memory_order_relaxed 0
#define c89atomic_memory_order_consume 1
#define c89atomic_memory_order_acquire 2
@@ -13896,29 +14134,45 @@ typedef unsigned char c89atomic_bool;
#if defined(C89ATOMIC_HAS_8)
static C89ATOMIC_INLINE c89atomic_uint8 __stdcall c89atomic_exchange_explicit_8(volatile c89atomic_uint8* dst, c89atomic_uint8 src, c89atomic_memory_order order)
{
+ #if defined(C89ATOMIC_ARM)
+ C89ATOMIC_MSVC_ARM_INTRINSIC(dst, src, order, _InterlockedExchange8, c89atomic_uint8, char);
+ #else
(void)order;
return (c89atomic_uint8)_InterlockedExchange8((volatile char*)dst, (char)src);
+ #endif
}
#endif
#if defined(C89ATOMIC_HAS_16)
static C89ATOMIC_INLINE c89atomic_uint16 __stdcall c89atomic_exchange_explicit_16(volatile c89atomic_uint16* dst, c89atomic_uint16 src, c89atomic_memory_order order)
{
+ #if defined(C89ATOMIC_ARM)
+ C89ATOMIC_MSVC_ARM_INTRINSIC(dst, src, order, _InterlockedExchange16, c89atomic_uint16, short);
+ #else
(void)order;
return (c89atomic_uint16)_InterlockedExchange16((volatile short*)dst, (short)src);
+ #endif
}
#endif
#if defined(C89ATOMIC_HAS_32)
static C89ATOMIC_INLINE c89atomic_uint32 __stdcall c89atomic_exchange_explicit_32(volatile c89atomic_uint32* dst, c89atomic_uint32 src, c89atomic_memory_order order)
{
+ #if defined(C89ATOMIC_ARM)
+ C89ATOMIC_MSVC_ARM_INTRINSIC(dst, src, order, _InterlockedExchange, c89atomic_uint32, long);
+ #else
(void)order;
return (c89atomic_uint32)_InterlockedExchange((volatile long*)dst, (long)src);
+ #endif
}
#endif
#if defined(C89ATOMIC_HAS_64) && defined(C89ATOMIC_64BIT)
static C89ATOMIC_INLINE c89atomic_uint64 __stdcall c89atomic_exchange_explicit_64(volatile c89atomic_uint64* dst, c89atomic_uint64 src, c89atomic_memory_order order)
{
+ #if defined(C89ATOMIC_ARM)
+ C89ATOMIC_MSVC_ARM_INTRINSIC(dst, src, order, _InterlockedExchange64, c89atomic_uint64, long long);
+ #else
(void)order;
return (c89atomic_uint64)_InterlockedExchange64((volatile long long*)dst, (long long)src);
+ #endif
}
#else
#endif
@@ -13981,29 +14235,45 @@ typedef unsigned char c89atomic_bool;
#if defined(C89ATOMIC_HAS_8)
static C89ATOMIC_INLINE c89atomic_uint8 __stdcall c89atomic_fetch_add_explicit_8(volatile c89atomic_uint8* dst, c89atomic_uint8 src, c89atomic_memory_order order)
{
+ #if defined(C89ATOMIC_ARM)
+ C89ATOMIC_MSVC_ARM_INTRINSIC(dst, src, order, _InterlockedExchangeAdd8, c89atomic_uint8, char);
+ #else
(void)order;
return (c89atomic_uint8)_InterlockedExchangeAdd8((volatile char*)dst, (char)src);
+ #endif
}
#endif
#if defined(C89ATOMIC_HAS_16)
static C89ATOMIC_INLINE c89atomic_uint16 __stdcall c89atomic_fetch_add_explicit_16(volatile c89atomic_uint16* dst, c89atomic_uint16 src, c89atomic_memory_order order)
{
+ #if defined(C89ATOMIC_ARM)
+ C89ATOMIC_MSVC_ARM_INTRINSIC(dst, src, order, _InterlockedExchangeAdd16, c89atomic_uint16, short);
+ #else
(void)order;
return (c89atomic_uint16)_InterlockedExchangeAdd16((volatile short*)dst, (short)src);
+ #endif
}
#endif
#if defined(C89ATOMIC_HAS_32)
static C89ATOMIC_INLINE c89atomic_uint32 __stdcall c89atomic_fetch_add_explicit_32(volatile c89atomic_uint32* dst, c89atomic_uint32 src, c89atomic_memory_order order)
{
+ #if defined(C89ATOMIC_ARM)
+ C89ATOMIC_MSVC_ARM_INTRINSIC(dst, src, order, _InterlockedExchangeAdd, c89atomic_uint32, long);
+ #else
(void)order;
return (c89atomic_uint32)_InterlockedExchangeAdd((volatile long*)dst, (long)src);
+ #endif
}
#endif
#if defined(C89ATOMIC_HAS_64) && defined(C89ATOMIC_64BIT)
static C89ATOMIC_INLINE c89atomic_uint64 __stdcall c89atomic_fetch_add_explicit_64(volatile c89atomic_uint64* dst, c89atomic_uint64 src, c89atomic_memory_order order)
{
+ #if defined(C89ATOMIC_ARM)
+ C89ATOMIC_MSVC_ARM_INTRINSIC(dst, src, order, _InterlockedExchangeAdd64, c89atomic_uint64, long long);
+ #else
(void)order;
return (c89atomic_uint64)_InterlockedExchangeAdd64((volatile long long*)dst, (long long)src);
+ #endif
}
#else
#endif
@@ -14032,6 +14302,8 @@ typedef unsigned char c89atomic_bool;
#else
#if defined(C89ATOMIC_X64)
#define c89atomic_thread_fence(order) __faststorefence(), (void)order
+ #elif defined(C89ATOMIC_ARM64)
+ #define c89atomic_thread_fence(order) __dmb(_ARM64_BARRIER_ISH), (void)order
#else
static C89ATOMIC_INLINE void c89atomic_thread_fence(c89atomic_memory_order order)
{
@@ -14045,29 +14317,45 @@ typedef unsigned char c89atomic_bool;
#if defined(C89ATOMIC_HAS_8)
static C89ATOMIC_INLINE c89atomic_uint8 c89atomic_load_explicit_8(volatile const c89atomic_uint8* ptr, c89atomic_memory_order order)
{
+ #if defined(C89ATOMIC_ARM)
+ C89ATOMIC_MSVC_ARM_INTRINSIC_COMPARE_EXCHANGE(ptr, 0, 0, order, _InterlockedCompareExchange8, c89atomic_uint8, char);
+ #else
(void)order;
return c89atomic_compare_and_swap_8((volatile c89atomic_uint8*)ptr, 0, 0);
+ #endif
}
#endif
#if defined(C89ATOMIC_HAS_16)
static C89ATOMIC_INLINE c89atomic_uint16 c89atomic_load_explicit_16(volatile const c89atomic_uint16* ptr, c89atomic_memory_order order)
{
+ #if defined(C89ATOMIC_ARM)
+ C89ATOMIC_MSVC_ARM_INTRINSIC_COMPARE_EXCHANGE(ptr, 0, 0, order, _InterlockedCompareExchange16, c89atomic_uint16, short);
+ #else
(void)order;
return c89atomic_compare_and_swap_16((volatile c89atomic_uint16*)ptr, 0, 0);
+ #endif
}
#endif
#if defined(C89ATOMIC_HAS_32)
static C89ATOMIC_INLINE c89atomic_uint32 c89atomic_load_explicit_32(volatile const c89atomic_uint32* ptr, c89atomic_memory_order order)
{
+ #if defined(C89ATOMIC_ARM)
+ C89ATOMIC_MSVC_ARM_INTRINSIC_COMPARE_EXCHANGE(ptr, 0, 0, order, _InterlockedCompareExchange, c89atomic_uint32, long);
+ #else
(void)order;
return c89atomic_compare_and_swap_32((volatile c89atomic_uint32*)ptr, 0, 0);
+ #endif
}
#endif
#if defined(C89ATOMIC_HAS_64)
static C89ATOMIC_INLINE c89atomic_uint64 c89atomic_load_explicit_64(volatile const c89atomic_uint64* ptr, c89atomic_memory_order order)
{
+ #if defined(C89ATOMIC_ARM)
+ C89ATOMIC_MSVC_ARM_INTRINSIC_COMPARE_EXCHANGE(ptr, 0, 0, order, _InterlockedCompareExchange64, c89atomic_uint64, long long);
+ #else
(void)order;
return c89atomic_compare_and_swap_64((volatile c89atomic_uint64*)ptr, 0, 0);
+ #endif
}
#endif
#if defined(C89ATOMIC_HAS_8)
@@ -14137,6 +14425,9 @@ typedef unsigned char c89atomic_bool;
#if defined(C89ATOMIC_HAS_8)
static C89ATOMIC_INLINE c89atomic_uint8 __stdcall c89atomic_fetch_and_explicit_8(volatile c89atomic_uint8* dst, c89atomic_uint8 src, c89atomic_memory_order order)
{
+ #if defined(C89ATOMIC_ARM)
+ C89ATOMIC_MSVC_ARM_INTRINSIC(dst, src, order, _InterlockedAnd8, c89atomic_uint8, char);
+ #else
c89atomic_uint8 oldValue;
c89atomic_uint8 newValue;
do {
@@ -14145,11 +14436,15 @@ typedef unsigned char c89atomic_bool;
} while (c89atomic_compare_and_swap_8(dst, oldValue, newValue) != oldValue);
(void)order;
return oldValue;
+ #endif
}
#endif
#if defined(C89ATOMIC_HAS_16)
static C89ATOMIC_INLINE c89atomic_uint16 __stdcall c89atomic_fetch_and_explicit_16(volatile c89atomic_uint16* dst, c89atomic_uint16 src, c89atomic_memory_order order)
{
+ #if defined(C89ATOMIC_ARM)
+ C89ATOMIC_MSVC_ARM_INTRINSIC(dst, src, order, _InterlockedAnd16, c89atomic_uint16, short);
+ #else
c89atomic_uint16 oldValue;
c89atomic_uint16 newValue;
do {
@@ -14158,11 +14453,15 @@ typedef unsigned char c89atomic_bool;
} while (c89atomic_compare_and_swap_16(dst, oldValue, newValue) != oldValue);
(void)order;
return oldValue;
+ #endif
}
#endif
#if defined(C89ATOMIC_HAS_32)
static C89ATOMIC_INLINE c89atomic_uint32 __stdcall c89atomic_fetch_and_explicit_32(volatile c89atomic_uint32* dst, c89atomic_uint32 src, c89atomic_memory_order order)
{
+ #if defined(C89ATOMIC_ARM)
+ C89ATOMIC_MSVC_ARM_INTRINSIC(dst, src, order, _InterlockedAnd, c89atomic_uint32, long);
+ #else
c89atomic_uint32 oldValue;
c89atomic_uint32 newValue;
do {
@@ -14171,11 +14470,15 @@ typedef unsigned char c89atomic_bool;
} while (c89atomic_compare_and_swap_32(dst, oldValue, newValue) != oldValue);
(void)order;
return oldValue;
+ #endif
}
#endif
#if defined(C89ATOMIC_HAS_64)
static C89ATOMIC_INLINE c89atomic_uint64 __stdcall c89atomic_fetch_and_explicit_64(volatile c89atomic_uint64* dst, c89atomic_uint64 src, c89atomic_memory_order order)
{
+ #if defined(C89ATOMIC_ARM)
+ C89ATOMIC_MSVC_ARM_INTRINSIC(dst, src, order, _InterlockedAnd64, c89atomic_uint64, long long);
+ #else
c89atomic_uint64 oldValue;
c89atomic_uint64 newValue;
do {
@@ -14184,11 +14487,15 @@ typedef unsigned char c89atomic_bool;
} while (c89atomic_compare_and_swap_64(dst, oldValue, newValue) != oldValue);
(void)order;
return oldValue;
+ #endif
}
#endif
#if defined(C89ATOMIC_HAS_8)
static C89ATOMIC_INLINE c89atomic_uint8 __stdcall c89atomic_fetch_xor_explicit_8(volatile c89atomic_uint8* dst, c89atomic_uint8 src, c89atomic_memory_order order)
{
+ #if defined(C89ATOMIC_ARM)
+ C89ATOMIC_MSVC_ARM_INTRINSIC(dst, src, order, _InterlockedXor8, c89atomic_uint8, char);
+ #else
c89atomic_uint8 oldValue;
c89atomic_uint8 newValue;
do {
@@ -14197,11 +14504,15 @@ typedef unsigned char c89atomic_bool;
} while (c89atomic_compare_and_swap_8(dst, oldValue, newValue) != oldValue);
(void)order;
return oldValue;
+ #endif
}
#endif
#if defined(C89ATOMIC_HAS_16)
static C89ATOMIC_INLINE c89atomic_uint16 __stdcall c89atomic_fetch_xor_explicit_16(volatile c89atomic_uint16* dst, c89atomic_uint16 src, c89atomic_memory_order order)
{
+ #if defined(C89ATOMIC_ARM)
+ C89ATOMIC_MSVC_ARM_INTRINSIC(dst, src, order, _InterlockedXor16, c89atomic_uint16, short);
+ #else
c89atomic_uint16 oldValue;
c89atomic_uint16 newValue;
do {
@@ -14210,11 +14521,15 @@ typedef unsigned char c89atomic_bool;
} while (c89atomic_compare_and_swap_16(dst, oldValue, newValue) != oldValue);
(void)order;
return oldValue;
+ #endif
}
#endif
#if defined(C89ATOMIC_HAS_32)
static C89ATOMIC_INLINE c89atomic_uint32 __stdcall c89atomic_fetch_xor_explicit_32(volatile c89atomic_uint32* dst, c89atomic_uint32 src, c89atomic_memory_order order)
{
+ #if defined(C89ATOMIC_ARM)
+ C89ATOMIC_MSVC_ARM_INTRINSIC(dst, src, order, _InterlockedXor, c89atomic_uint32, long);
+ #else
c89atomic_uint32 oldValue;
c89atomic_uint32 newValue;
do {
@@ -14223,11 +14538,15 @@ typedef unsigned char c89atomic_bool;
} while (c89atomic_compare_and_swap_32(dst, oldValue, newValue) != oldValue);
(void)order;
return oldValue;
+ #endif
}
#endif
#if defined(C89ATOMIC_HAS_64)
static C89ATOMIC_INLINE c89atomic_uint64 __stdcall c89atomic_fetch_xor_explicit_64(volatile c89atomic_uint64* dst, c89atomic_uint64 src, c89atomic_memory_order order)
{
+ #if defined(C89ATOMIC_ARM)
+ C89ATOMIC_MSVC_ARM_INTRINSIC(dst, src, order, _InterlockedXor64, c89atomic_uint64, long long);
+ #else
c89atomic_uint64 oldValue;
c89atomic_uint64 newValue;
do {
@@ -14236,11 +14555,15 @@ typedef unsigned char c89atomic_bool;
} while (c89atomic_compare_and_swap_64(dst, oldValue, newValue) != oldValue);
(void)order;
return oldValue;
+ #endif
}
#endif
#if defined(C89ATOMIC_HAS_8)
static C89ATOMIC_INLINE c89atomic_uint8 __stdcall c89atomic_fetch_or_explicit_8(volatile c89atomic_uint8* dst, c89atomic_uint8 src, c89atomic_memory_order order)
{
+ #if defined(C89ATOMIC_ARM)
+ C89ATOMIC_MSVC_ARM_INTRINSIC(dst, src, order, _InterlockedOr8, c89atomic_uint8, char);
+ #else
c89atomic_uint8 oldValue;
c89atomic_uint8 newValue;
do {
@@ -14249,11 +14572,15 @@ typedef unsigned char c89atomic_bool;
} while (c89atomic_compare_and_swap_8(dst, oldValue, newValue) != oldValue);
(void)order;
return oldValue;
+ #endif
}
#endif
#if defined(C89ATOMIC_HAS_16)
static C89ATOMIC_INLINE c89atomic_uint16 __stdcall c89atomic_fetch_or_explicit_16(volatile c89atomic_uint16* dst, c89atomic_uint16 src, c89atomic_memory_order order)
{
+ #if defined(C89ATOMIC_ARM)
+ C89ATOMIC_MSVC_ARM_INTRINSIC(dst, src, order, _InterlockedOr16, c89atomic_uint16, short);
+ #else
c89atomic_uint16 oldValue;
c89atomic_uint16 newValue;
do {
@@ -14262,11 +14589,15 @@ typedef unsigned char c89atomic_bool;
} while (c89atomic_compare_and_swap_16(dst, oldValue, newValue) != oldValue);
(void)order;
return oldValue;
+ #endif
}
#endif
#if defined(C89ATOMIC_HAS_32)
static C89ATOMIC_INLINE c89atomic_uint32 __stdcall c89atomic_fetch_or_explicit_32(volatile c89atomic_uint32* dst, c89atomic_uint32 src, c89atomic_memory_order order)
{
+ #if defined(C89ATOMIC_ARM)
+ C89ATOMIC_MSVC_ARM_INTRINSIC(dst, src, order, _InterlockedOr, c89atomic_uint32, long);
+ #else
c89atomic_uint32 oldValue;
c89atomic_uint32 newValue;
do {
@@ -14275,11 +14606,15 @@ typedef unsigned char c89atomic_bool;
} while (c89atomic_compare_and_swap_32(dst, oldValue, newValue) != oldValue);
(void)order;
return oldValue;
+ #endif
}
#endif
#if defined(C89ATOMIC_HAS_64)
static C89ATOMIC_INLINE c89atomic_uint64 __stdcall c89atomic_fetch_or_explicit_64(volatile c89atomic_uint64* dst, c89atomic_uint64 src, c89atomic_memory_order order)
{
+ #if defined(C89ATOMIC_ARM)
+ C89ATOMIC_MSVC_ARM_INTRINSIC(dst, src, order, _InterlockedOr64, c89atomic_uint64, long long);
+ #else
c89atomic_uint64 oldValue;
c89atomic_uint64 newValue;
do {
@@ -14288,6 +14623,7 @@ typedef unsigned char c89atomic_bool;
} while (c89atomic_compare_and_swap_64(dst, oldValue, newValue) != oldValue);
(void)order;
return oldValue;
+ #endif
}
#endif
#if defined(C89ATOMIC_HAS_8)
@@ -15140,10 +15476,10 @@ typedef unsigned char c89atomic_bool;
#define c89atomic_clear_explicit_i16(ptr, order) c89atomic_clear_explicit_16((c89atomic_uint16*)ptr, order)
#define c89atomic_clear_explicit_i32(ptr, order) c89atomic_clear_explicit_32((c89atomic_uint32*)ptr, order)
#define c89atomic_clear_explicit_i64(ptr, order) c89atomic_clear_explicit_64((c89atomic_uint64*)ptr, order)
-#define c89atomic_store_explicit_i8( dst, src, order) (c89atomic_int8 )c89atomic_store_explicit_8( (c89atomic_uint8* )dst, (c89atomic_uint8 )src, order)
-#define c89atomic_store_explicit_i16(dst, src, order) (c89atomic_int16)c89atomic_store_explicit_16((c89atomic_uint16*)dst, (c89atomic_uint16)src, order)
-#define c89atomic_store_explicit_i32(dst, src, order) (c89atomic_int32)c89atomic_store_explicit_32((c89atomic_uint32*)dst, (c89atomic_uint32)src, order)
-#define c89atomic_store_explicit_i64(dst, src, order) (c89atomic_int64)c89atomic_store_explicit_64((c89atomic_uint64*)dst, (c89atomic_uint64)src, order)
+#define c89atomic_store_explicit_i8( dst, src, order) c89atomic_store_explicit_8( (c89atomic_uint8* )dst, (c89atomic_uint8 )src, order)
+#define c89atomic_store_explicit_i16(dst, src, order) c89atomic_store_explicit_16((c89atomic_uint16*)dst, (c89atomic_uint16)src, order)
+#define c89atomic_store_explicit_i32(dst, src, order) c89atomic_store_explicit_32((c89atomic_uint32*)dst, (c89atomic_uint32)src, order)
+#define c89atomic_store_explicit_i64(dst, src, order) c89atomic_store_explicit_64((c89atomic_uint64*)dst, (c89atomic_uint64)src, order)
#define c89atomic_load_explicit_i8( ptr, order) (c89atomic_int8 )c89atomic_load_explicit_8( (c89atomic_uint8* )ptr, order)
#define c89atomic_load_explicit_i16(ptr, order) (c89atomic_int16)c89atomic_load_explicit_16((c89atomic_uint16*)ptr, order)
#define c89atomic_load_explicit_i32(ptr, order) (c89atomic_int32)c89atomic_load_explicit_32((c89atomic_uint32*)ptr, order)
@@ -15284,6 +15620,110 @@ static C89ATOMIC_INLINE double c89atomic_exchange_explicit_f64(volatile double*
r.i = c89atomic_exchange_explicit_64((volatile c89atomic_uint64*)dst, x.i, order);
return r.f;
}
+static C89ATOMIC_INLINE c89atomic_bool c89atomic_compare_exchange_strong_explicit_f32(volatile float* dst, float* expected, float desired, c89atomic_memory_order successOrder, c89atomic_memory_order failureOrder)
+{
+ c89atomic_if32 d;
+ d.f = desired;
+ return c89atomic_compare_exchange_strong_explicit_32((volatile c89atomic_uint32*)dst, (c89atomic_uint32*)expected, d.i, successOrder, failureOrder);
+}
+static C89ATOMIC_INLINE c89atomic_bool c89atomic_compare_exchange_strong_explicit_f64(volatile double* dst, double* expected, double desired, c89atomic_memory_order successOrder, c89atomic_memory_order failureOrder)
+{
+ c89atomic_if64 d;
+ d.f = desired;
+ return c89atomic_compare_exchange_strong_explicit_64((volatile c89atomic_uint64*)dst, (c89atomic_uint64*)expected, d.i, successOrder, failureOrder);
+}
+static C89ATOMIC_INLINE c89atomic_bool c89atomic_compare_exchange_weak_explicit_f32(volatile float* dst, float* expected, float desired, c89atomic_memory_order successOrder, c89atomic_memory_order failureOrder)
+{
+ c89atomic_if32 d;
+ d.f = desired;
+ return c89atomic_compare_exchange_weak_explicit_32((volatile c89atomic_uint32*)dst, (c89atomic_uint32*)expected, d.i, successOrder, failureOrder);
+}
+static C89ATOMIC_INLINE c89atomic_bool c89atomic_compare_exchange_weak_explicit_f64(volatile double* dst, double* expected, double desired, c89atomic_memory_order successOrder, c89atomic_memory_order failureOrder)
+{
+ c89atomic_if64 d;
+ d.f = desired;
+ return c89atomic_compare_exchange_weak_explicit_64((volatile c89atomic_uint64*)dst, (c89atomic_uint64*)expected, d.i, successOrder, failureOrder);
+}
+static C89ATOMIC_INLINE float c89atomic_fetch_add_explicit_f32(volatile float* dst, float src, c89atomic_memory_order order)
+{
+ c89atomic_if32 r;
+ c89atomic_if32 x;
+ x.f = src;
+ r.i = c89atomic_fetch_add_explicit_32((volatile c89atomic_uint32*)dst, x.i, order);
+ return r.f;
+}
+static C89ATOMIC_INLINE double c89atomic_fetch_add_explicit_f64(volatile double* dst, double src, c89atomic_memory_order order)
+{
+ c89atomic_if64 r;
+ c89atomic_if64 x;
+ x.f = src;
+ r.i = c89atomic_fetch_add_explicit_64((volatile c89atomic_uint64*)dst, x.i, order);
+ return r.f;
+}
+static C89ATOMIC_INLINE float c89atomic_fetch_sub_explicit_f32(volatile float* dst, float src, c89atomic_memory_order order)
+{
+ c89atomic_if32 r;
+ c89atomic_if32 x;
+ x.f = src;
+ r.i = c89atomic_fetch_sub_explicit_32((volatile c89atomic_uint32*)dst, x.i, order);
+ return r.f;
+}
+static C89ATOMIC_INLINE double c89atomic_fetch_sub_explicit_f64(volatile double* dst, double src, c89atomic_memory_order order)
+{
+ c89atomic_if64 r;
+ c89atomic_if64 x;
+ x.f = src;
+ r.i = c89atomic_fetch_sub_explicit_64((volatile c89atomic_uint64*)dst, x.i, order);
+ return r.f;
+}
+static C89ATOMIC_INLINE float c89atomic_fetch_or_explicit_f32(volatile float* dst, float src, c89atomic_memory_order order)
+{
+ c89atomic_if32 r;
+ c89atomic_if32 x;
+ x.f = src;
+ r.i = c89atomic_fetch_or_explicit_32((volatile c89atomic_uint32*)dst, x.i, order);
+ return r.f;
+}
+static C89ATOMIC_INLINE double c89atomic_fetch_or_explicit_f64(volatile double* dst, double src, c89atomic_memory_order order)
+{
+ c89atomic_if64 r;
+ c89atomic_if64 x;
+ x.f = src;
+ r.i = c89atomic_fetch_or_explicit_64((volatile c89atomic_uint64*)dst, x.i, order);
+ return r.f;
+}
+static C89ATOMIC_INLINE float c89atomic_fetch_xor_explicit_f32(volatile float* dst, float src, c89atomic_memory_order order)
+{
+ c89atomic_if32 r;
+ c89atomic_if32 x;
+ x.f = src;
+ r.i = c89atomic_fetch_xor_explicit_32((volatile c89atomic_uint32*)dst, x.i, order);
+ return r.f;
+}
+static C89ATOMIC_INLINE double c89atomic_fetch_xor_explicit_f64(volatile double* dst, double src, c89atomic_memory_order order)
+{
+ c89atomic_if64 r;
+ c89atomic_if64 x;
+ x.f = src;
+ r.i = c89atomic_fetch_xor_explicit_64((volatile c89atomic_uint64*)dst, x.i, order);
+ return r.f;
+}
+static C89ATOMIC_INLINE float c89atomic_fetch_and_explicit_f32(volatile float* dst, float src, c89atomic_memory_order order)
+{
+ c89atomic_if32 r;
+ c89atomic_if32 x;
+ x.f = src;
+ r.i = c89atomic_fetch_and_explicit_32((volatile c89atomic_uint32*)dst, x.i, order);
+ return r.f;
+}
+static C89ATOMIC_INLINE double c89atomic_fetch_and_explicit_f64(volatile double* dst, double src, c89atomic_memory_order order)
+{
+ c89atomic_if64 r;
+ c89atomic_if64 x;
+ x.f = src;
+ r.i = c89atomic_fetch_and_explicit_64((volatile c89atomic_uint64*)dst, x.i, order);
+ return r.f;
+}
#define c89atomic_clear_f32(ptr) (float )c89atomic_clear_explicit_f32(ptr, c89atomic_memory_order_seq_cst)
#define c89atomic_clear_f64(ptr) (double)c89atomic_clear_explicit_f64(ptr, c89atomic_memory_order_seq_cst)
#define c89atomic_store_f32(dst, src) c89atomic_store_explicit_f32(dst, src, c89atomic_memory_order_seq_cst)
@@ -15292,6 +15732,38 @@ static C89ATOMIC_INLINE double c89atomic_exchange_explicit_f64(volatile double*
#define c89atomic_load_f64(ptr) (double)c89atomic_load_explicit_f64(ptr, c89atomic_memory_order_seq_cst)
#define c89atomic_exchange_f32(dst, src) (float )c89atomic_exchange_explicit_f32(dst, src, c89atomic_memory_order_seq_cst)
#define c89atomic_exchange_f64(dst, src) (double)c89atomic_exchange_explicit_f64(dst, src, c89atomic_memory_order_seq_cst)
+#define c89atomic_compare_exchange_strong_f32(dst, expected, desired) c89atomic_compare_exchange_strong_explicit_f32(dst, expected, desired, c89atomic_memory_order_seq_cst, c89atomic_memory_order_seq_cst)
+#define c89atomic_compare_exchange_strong_f64(dst, expected, desired) c89atomic_compare_exchange_strong_explicit_f64(dst, expected, desired, c89atomic_memory_order_seq_cst, c89atomic_memory_order_seq_cst)
+#define c89atomic_compare_exchange_weak_f32(dst, expected, desired) c89atomic_compare_exchange_weak_explicit_f32(dst, expected, desired, c89atomic_memory_order_seq_cst, c89atomic_memory_order_seq_cst)
+#define c89atomic_compare_exchange_weak_f64(dst, expected, desired) c89atomic_compare_exchange_weak_explicit_f64(dst, expected, desired, c89atomic_memory_order_seq_cst, c89atomic_memory_order_seq_cst)
+#define c89atomic_fetch_add_f32(dst, src) c89atomic_fetch_add_explicit_f32(dst, src, c89atomic_memory_order_seq_cst)
+#define c89atomic_fetch_add_f64(dst, src) c89atomic_fetch_add_explicit_f64(dst, src, c89atomic_memory_order_seq_cst)
+#define c89atomic_fetch_sub_f32(dst, src) c89atomic_fetch_sub_explicit_f32(dst, src, c89atomic_memory_order_seq_cst)
+#define c89atomic_fetch_sub_f64(dst, src) c89atomic_fetch_sub_explicit_f64(dst, src, c89atomic_memory_order_seq_cst)
+#define c89atomic_fetch_or_f32(dst, src) c89atomic_fetch_or_explicit_f32(dst, src, c89atomic_memory_order_seq_cst)
+#define c89atomic_fetch_or_f64(dst, src) c89atomic_fetch_or_explicit_f64(dst, src, c89atomic_memory_order_seq_cst)
+#define c89atomic_fetch_xor_f32(dst, src) c89atomic_fetch_xor_explicit_f32(dst, src, c89atomic_memory_order_seq_cst)
+#define c89atomic_fetch_xor_f64(dst, src) c89atomic_fetch_xor_explicit_f64(dst, src, c89atomic_memory_order_seq_cst)
+#define c89atomic_fetch_and_f32(dst, src) c89atomic_fetch_and_explicit_f32(dst, src, c89atomic_memory_order_seq_cst)
+#define c89atomic_fetch_and_f64(dst, src) c89atomic_fetch_and_explicit_f64(dst, src, c89atomic_memory_order_seq_cst)
+static C89ATOMIC_INLINE float c89atomic_compare_and_swap_f32(volatile float* dst, float expected, float desired)
+{
+ c89atomic_if32 r;
+ c89atomic_if32 e, d;
+ e.f = expected;
+ d.f = desired;
+ r.i = c89atomic_compare_and_swap_32((volatile c89atomic_uint32*)dst, e.i, d.i);
+ return r.f;
+}
+static C89ATOMIC_INLINE double c89atomic_compare_and_swap_f64(volatile double* dst, double expected, double desired)
+{
+ c89atomic_if64 r;
+ c89atomic_if64 e, d;
+ e.f = expected;
+ d.f = desired;
+ r.i = c89atomic_compare_and_swap_64((volatile c89atomic_uint64*)dst, e.i, d.i);
+ return r.f;
+}
typedef c89atomic_flag c89atomic_spinlock;
static C89ATOMIC_INLINE void c89atomic_spinlock_lock(volatile c89atomic_spinlock* pSpinlock)
{
@@ -15313,6 +15785,76 @@ static C89ATOMIC_INLINE void c89atomic_spinlock_unlock(volatile c89atomic_spinlo
#endif
/* c89atomic.h end */
+#define MA_ATOMIC_SAFE_TYPE_IMPL(c89TypeExtension, type) \
+ static MA_INLINE ma_##type ma_atomic_##type##_get(ma_atomic_##type* x) \
+ { \
+ return (ma_##type)c89atomic_load_##c89TypeExtension(&x->value); \
+ } \
+ static MA_INLINE void ma_atomic_##type##_set(ma_atomic_##type* x, ma_##type value) \
+ { \
+ c89atomic_store_##c89TypeExtension(&x->value, value); \
+ } \
+ static MA_INLINE ma_##type ma_atomic_##type##_exchange(ma_atomic_##type* x, ma_##type value) \
+ { \
+ return (ma_##type)c89atomic_exchange_##c89TypeExtension(&x->value, value); \
+ } \
+ static MA_INLINE ma_bool32 ma_atomic_##type##_compare_exchange(ma_atomic_##type* x, ma_##type* expected, ma_##type desired) \
+ { \
+ return c89atomic_compare_exchange_weak_##c89TypeExtension(&x->value, expected, desired); \
+ } \
+ static MA_INLINE ma_##type ma_atomic_##type##_fetch_add(ma_atomic_##type* x, ma_##type y) \
+ { \
+ return (ma_##type)c89atomic_fetch_add_##c89TypeExtension(&x->value, y); \
+ } \
+ static MA_INLINE ma_##type ma_atomic_##type##_fetch_sub(ma_atomic_##type* x, ma_##type y) \
+ { \
+ return (ma_##type)c89atomic_fetch_sub_##c89TypeExtension(&x->value, y); \
+ } \
+ static MA_INLINE ma_##type ma_atomic_##type##_fetch_or(ma_atomic_##type* x, ma_##type y) \
+ { \
+ return (ma_##type)c89atomic_fetch_or_##c89TypeExtension(&x->value, y); \
+ } \
+ static MA_INLINE ma_##type ma_atomic_##type##_fetch_xor(ma_atomic_##type* x, ma_##type y) \
+ { \
+ return (ma_##type)c89atomic_fetch_xor_##c89TypeExtension(&x->value, y); \
+ } \
+ static MA_INLINE ma_##type ma_atomic_##type##_fetch_and(ma_atomic_##type* x, ma_##type y) \
+ { \
+ return (ma_##type)c89atomic_fetch_and_##c89TypeExtension(&x->value, y); \
+ } \
+ static MA_INLINE ma_##type ma_atomic_##type##_compare_and_swap(ma_atomic_##type* x, ma_##type expected, ma_##type desired) \
+ { \
+ return (ma_##type)c89atomic_compare_and_swap_##c89TypeExtension(&x->value, expected, desired); \
+ } \
+
+#define MA_ATOMIC_SAFE_TYPE_IMPL_PTR(type) \
+ static MA_INLINE ma_##type* ma_atomic_ptr_##type##_get(ma_atomic_ptr_##type* x) \
+ { \
+ return c89atomic_load_ptr((void**)&x->value); \
+ } \
+ static MA_INLINE void ma_atomic_ptr_##type##_set(ma_atomic_ptr_##type* x, ma_##type* value) \
+ { \
+ c89atomic_store_ptr((void**)&x->value, (void*)value); \
+ } \
+ static MA_INLINE ma_##type* ma_atomic_ptr_##type##_exchange(ma_atomic_ptr_##type* x, ma_##type* value) \
+ { \
+ return c89atomic_exchange_ptr((void**)&x->value, (void*)value); \
+ } \
+ static MA_INLINE ma_bool32 ma_atomic_ptr_##type##_compare_exchange(ma_atomic_ptr_##type* x, ma_##type** expected, ma_##type* desired) \
+ { \
+ return c89atomic_compare_exchange_weak_ptr((void**)&x->value, (void*)expected, (void*)desired); \
+ } \
+ static MA_INLINE ma_##type* ma_atomic_ptr_##type##_compare_and_swap(ma_atomic_ptr_##type* x, ma_##type* expected, ma_##type* desired) \
+ { \
+ return (ma_##type*)c89atomic_compare_and_swap_ptr((void**)&x->value, (void*)expected, (void*)desired); \
+ } \
+
+MA_ATOMIC_SAFE_TYPE_IMPL(32, uint32)
+MA_ATOMIC_SAFE_TYPE_IMPL(i32, int32)
+MA_ATOMIC_SAFE_TYPE_IMPL(64, uint64)
+MA_ATOMIC_SAFE_TYPE_IMPL(f32, float)
+MA_ATOMIC_SAFE_TYPE_IMPL(32, bool32)
+MA_ATOMIC_SAFE_TYPE_IMPL(i32, device_state)
MA_API ma_uint64 ma_calculate_frame_count_after_resampling(ma_uint32 sampleRateOut, ma_uint32 sampleRateIn, ma_uint64 frameCountIn)
@@ -15446,7 +15988,9 @@ static int ma_thread_priority_to_win32(ma_thread_priority priority)
static ma_result ma_thread_create__win32(ma_thread* pThread, ma_thread_priority priority, size_t stackSize, ma_thread_entry_proc entryProc, void* pData)
{
- *pThread = CreateThread(NULL, stackSize, entryProc, pData, 0, NULL);
+ DWORD threadID; /* Not used. Only used for passing into CreateThread() so it doesn't fail on Windows 98. */
+
+ *pThread = CreateThread(NULL, stackSize, entryProc, pData, 0, &threadID);
if (*pThread == NULL) {
return ma_result_from_GetLastError(GetLastError());
}
@@ -15465,7 +16009,7 @@ static void ma_thread_wait__win32(ma_thread* pThread)
static ma_result ma_mutex_init__win32(ma_mutex* pMutex)
{
- *pMutex = CreateEventW(NULL, FALSE, TRUE, NULL);
+ *pMutex = CreateEventA(NULL, FALSE, TRUE, NULL);
if (*pMutex == NULL) {
return ma_result_from_GetLastError(GetLastError());
}
@@ -15491,7 +16035,7 @@ static void ma_mutex_unlock__win32(ma_mutex* pMutex)
static ma_result ma_event_init__win32(ma_event* pEvent)
{
- *pEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
+ *pEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
if (*pEvent == NULL) {
return ma_result_from_GetLastError(GetLastError());
}
@@ -15581,6 +16125,10 @@ static ma_result ma_thread_create__posix(ma_thread* pThread, ma_thread_priority
pthread_attr_t attr;
if (pthread_attr_init(&attr) == 0) {
int scheduler = -1;
+
+ /* We successfully initialized our attributes object so we can assign the pointer so it's passed into pthread_create(). */
+ pAttr = &attr;
+
if (priority == ma_thread_priority_idle) {
#ifdef SCHED_IDLE
if (pthread_attr_setschedpolicy(&attr, SCHED_IDLE) == 0) {
@@ -15624,9 +16172,8 @@ static ma_result ma_thread_create__posix(ma_thread* pThread, ma_thread_priority
}
}
- if (pthread_attr_setschedparam(&attr, &sched) == 0) {
- pAttr = &attr;
- }
+ /* I'm not treating a failure of setting the priority as a critical error so not checking the return value here. */
+ pthread_attr_setschedparam(&attr, &sched);
}
}
}
@@ -16748,7 +17295,7 @@ MA_API ma_result ma_job_process(ma_job* pJob)
return MA_INVALID_ARGS;
}
- if (pJob->toc.breakup.code > MA_JOB_TYPE_COUNT) {
+ if (pJob->toc.breakup.code >= MA_JOB_TYPE_COUNT) {
return MA_INVALID_OPERATION;
}
@@ -17141,6 +17688,14 @@ DEVICE I/O
*************************************************************************************************************************************************************
************************************************************************************************************************************************************/
+
+/* Disable run-time linking on certain backends and platforms. */
+#ifndef MA_NO_RUNTIME_LINKING
+ #if defined(MA_EMSCRIPTEN) || defined(MA_ORBIS) || defined(MA_PROSPERO)
+ #define MA_NO_RUNTIME_LINKING
+ #endif
+#endif
+
#ifndef MA_NO_DEVICE_IO
#ifdef MA_WIN32
#include
@@ -17152,33 +17707,18 @@ DEVICE I/O
#include /* For mach_absolute_time() */
#endif
-#ifdef MA_ANDROID
- #include
-#endif
-
#ifdef MA_POSIX
#include
#include
- #include
-#endif
-/*
-Unfortunately using runtime linking for pthreads causes problems. This has occurred for me when testing on FreeBSD. When
-using runtime linking, deadlocks can occur (for me it happens when loading data from fread()). It turns out that doing
-compile-time linking fixes this. I'm not sure why this happens, but the safest way I can think of to fix this is to simply
-disable runtime linking by default. To enable runtime linking, #define this before the implementation of this file. I am
-not officially supporting this, but I'm leaving it here in case it's useful for somebody, somewhere.
-*/
-/*#define MA_USE_RUNTIME_LINKING_FOR_PTHREAD*/
-
-/* Disable run-time linking on certain backends. */
-#ifndef MA_NO_RUNTIME_LINKING
- #if defined(MA_EMSCRIPTEN)
- #define MA_NO_RUNTIME_LINKING
+ /* No need for dlfcn.h if we're not using runtime linking. */
+ #ifndef MA_NO_RUNTIME_LINKING
+ #include
#endif
#endif
+
MA_API void ma_device_info_add_native_data_format(ma_device_info* pDeviceInfo, ma_format format, ma_uint32 channels, ma_uint32 sampleRate, ma_uint32 flags)
{
if (pDeviceInfo == NULL) {
@@ -17195,27 +17735,60 @@ MA_API void ma_device_info_add_native_data_format(ma_device_info* pDeviceInfo, m
}
+typedef struct
+{
+ ma_backend backend;
+ const char* pName;
+} ma_backend_info;
+
+static ma_backend_info gBackendInfo[] = /* Indexed by the backend enum. Must be in the order backends are declared in the ma_backend enum. */
+{
+ {ma_backend_wasapi, "WASAPI"},
+ {ma_backend_dsound, "DirectSound"},
+ {ma_backend_winmm, "WinMM"},
+ {ma_backend_coreaudio, "Core Audio"},
+ {ma_backend_sndio, "sndio"},
+ {ma_backend_audio4, "audio(4)"},
+ {ma_backend_oss, "OSS"},
+ {ma_backend_pulseaudio, "PulseAudio"},
+ {ma_backend_alsa, "ALSA"},
+ {ma_backend_jack, "JACK"},
+ {ma_backend_aaudio, "AAudio"},
+ {ma_backend_opensl, "OpenSL|ES"},
+ {ma_backend_webaudio, "Web Audio"},
+ {ma_backend_custom, "Custom"},
+ {ma_backend_null, "Null"}
+};
+
MA_API const char* ma_get_backend_name(ma_backend backend)
{
- switch (backend)
- {
- case ma_backend_wasapi: return "WASAPI";
- case ma_backend_dsound: return "DirectSound";
- case ma_backend_winmm: return "WinMM";
- case ma_backend_coreaudio: return "Core Audio";
- case ma_backend_sndio: return "sndio";
- case ma_backend_audio4: return "audio(4)";
- case ma_backend_oss: return "OSS";
- case ma_backend_pulseaudio: return "PulseAudio";
- case ma_backend_alsa: return "ALSA";
- case ma_backend_jack: return "JACK";
- case ma_backend_aaudio: return "AAudio";
- case ma_backend_opensl: return "OpenSL|ES";
- case ma_backend_webaudio: return "Web Audio";
- case ma_backend_custom: return "Custom";
- case ma_backend_null: return "Null";
- default: return "Unknown";
+ if (backend < 0 || backend >= (int)ma_countof(gBackendInfo)) {
+ return "Unknown";
}
+
+ return gBackendInfo[backend].pName;
+}
+
+MA_API ma_result ma_get_backend_from_name(const char* pBackendName, ma_backend* pBackend)
+{
+ size_t iBackend;
+
+ if (pBackendName == NULL) {
+ return MA_INVALID_ARGS;
+ }
+
+ for (iBackend = 0; iBackend < ma_countof(gBackendInfo); iBackend += 1) {
+ if (ma_strcmp(pBackendName, gBackendInfo[iBackend].pName) == 0) {
+ if (pBackend != NULL) {
+ *pBackend = gBackendInfo[iBackend].backend;
+ }
+
+ return MA_SUCCESS;
+ }
+ }
+
+ /* Getting here means the backend name is unknown. */
+ return MA_INVALID_ARGS;
}
MA_API ma_bool32 ma_is_backend_enabled(ma_backend backend)
@@ -17290,16 +17863,7 @@ MA_API ma_bool32 ma_is_backend_enabled(ma_backend backend)
#if defined(MA_HAS_AAUDIO)
#if defined(MA_ANDROID)
{
- char sdkVersion[PROP_VALUE_MAX + 1] = {0, };
- if (__system_property_get("ro.build.version.sdk", sdkVersion)) {
- if (atoi(sdkVersion) >= 26) {
- return MA_TRUE;
- } else {
- return MA_FALSE;
- }
- } else {
- return MA_FALSE;
- }
+ return ma_android_sdk_version() >= 26;
}
#else
return MA_FALSE;
@@ -17311,16 +17875,7 @@ MA_API ma_bool32 ma_is_backend_enabled(ma_backend backend)
#if defined(MA_HAS_OPENSL)
#if defined(MA_ANDROID)
{
- char sdkVersion[PROP_VALUE_MAX + 1] = {0, };
- if (__system_property_get("ro.build.version.sdk", sdkVersion)) {
- if (atoi(sdkVersion) >= 9) {
- return MA_TRUE;
- } else {
- return MA_FALSE;
- }
- } else {
- return MA_FALSE;
- }
+ return ma_android_sdk_version() >= 9;
}
#else
return MA_TRUE;
@@ -17570,6 +18125,7 @@ static ma_result ma_result_from_HRESULT(HRESULT hr)
}
}
+typedef HRESULT (WINAPI * MA_PFN_CoInitialize)(LPVOID pvReserved);
typedef HRESULT (WINAPI * MA_PFN_CoInitializeEx)(LPVOID pvReserved, DWORD dwCoInit);
typedef void (WINAPI * MA_PFN_CoUninitialize)(void);
typedef HRESULT (WINAPI * MA_PFN_CoCreateInstance)(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID *ppv);
@@ -17713,6 +18269,7 @@ Dynamic Linking
*******************************************************************************/
MA_API ma_handle ma_dlopen(ma_context* pContext, const char* filename)
{
+#ifndef MA_NO_RUNTIME_LINKING
ma_handle handle;
ma_log_postf(ma_context_get_log(pContext), MA_LOG_LEVEL_DEBUG, "Loading library: %s\n", filename);
@@ -17744,10 +18301,17 @@ MA_API ma_handle ma_dlopen(ma_context* pContext, const char* filename)
(void)pContext; /* It's possible for pContext to be unused. */
return handle;
+#else
+ /* Runtime linking is disabled. */
+ (void)pContext;
+ (void)filename;
+ return NULL;
+#endif
}
MA_API void ma_dlclose(ma_context* pContext, ma_handle handle)
{
+#ifndef MA_NO_RUNTIME_LINKING
#ifdef _WIN32
FreeLibrary((HMODULE)handle);
#else
@@ -17755,10 +18319,16 @@ MA_API void ma_dlclose(ma_context* pContext, ma_handle handle)
#endif
(void)pContext;
+#else
+ /* Runtime linking is disabled. */
+ (void)pContext;
+ (void)handle;
+#endif
}
MA_API ma_proc ma_dlsym(ma_context* pContext, ma_handle handle, const char* symbol)
{
+#ifndef MA_NO_RUNTIME_LINKING
ma_proc proc;
ma_log_postf(ma_context_get_log(pContext), MA_LOG_LEVEL_DEBUG, "Loading symbol: %s\n", symbol);
@@ -17782,6 +18352,13 @@ MA_API ma_proc ma_dlsym(ma_context* pContext, ma_handle handle, const char* symb
(void)pContext; /* It's possible for pContext to be unused. */
return proc;
+#else
+ /* Runtime linking is disabled. */
+ (void)pContext;
+ (void)handle;
+ (void)symbol;
+ return NULL;
+#endif
}
@@ -17986,7 +18563,7 @@ static void ma_device__on_data(ma_device* pDevice, void* pFramesOut, const void*
/* The intermediary buffer has just been filled. */
pDevice->playback.intermediaryBufferLen = pDevice->playback.intermediaryBufferCap;
}
- }
+ }
}
/* If we're in duplex mode we might need to do a refill of the data. */
@@ -18338,7 +18915,7 @@ static ma_result ma_device__handle_duplex_callback_playback(ma_device* pDevice,
/* A helper for changing the state of the device. */
static MA_INLINE void ma_device__set_state(ma_device* pDevice, ma_device_state newState)
{
- c89atomic_exchange_i32((ma_int32*)&pDevice->state, (ma_int32)newState);
+ ma_atomic_device_state_set(&pDevice->state, newState);
}
@@ -18849,7 +19426,7 @@ static ma_result ma_device_start__null(ma_device* pDevice)
ma_device_do_operation__null(pDevice, MA_DEVICE_OP_START__NULL);
- c89atomic_exchange_32(&pDevice->null_device.isStarted, MA_TRUE);
+ ma_atomic_bool32_set(&pDevice->null_device.isStarted, MA_TRUE);
return MA_SUCCESS;
}
@@ -18859,10 +19436,17 @@ static ma_result ma_device_stop__null(ma_device* pDevice)
ma_device_do_operation__null(pDevice, MA_DEVICE_OP_SUSPEND__NULL);
- c89atomic_exchange_32(&pDevice->null_device.isStarted, MA_FALSE);
+ ma_atomic_bool32_set(&pDevice->null_device.isStarted, MA_FALSE);
return MA_SUCCESS;
}
+static ma_bool32 ma_device_is_started__null(ma_device* pDevice)
+{
+ MA_ASSERT(pDevice != NULL);
+
+ return ma_atomic_bool32_get(&pDevice->null_device.isStarted);
+}
+
static ma_result ma_device_write__null(ma_device* pDevice, const void* pPCMFrames, ma_uint32 frameCount, ma_uint32* pFramesWritten)
{
ma_result result = MA_SUCCESS;
@@ -18873,7 +19457,7 @@ static ma_result ma_device_write__null(ma_device* pDevice, const void* pPCMFrame
*pFramesWritten = 0;
}
- wasStartedOnEntry = c89atomic_load_32(&pDevice->null_device.isStarted);
+ wasStartedOnEntry = ma_device_is_started__null(pDevice);
/* Keep going until everything has been read. */
totalPCMFramesProcessed = 0;
@@ -18899,7 +19483,7 @@ static ma_result ma_device_write__null(ma_device* pDevice, const void* pPCMFrame
if (pDevice->null_device.currentPeriodFramesRemainingPlayback == 0) {
pDevice->null_device.currentPeriodFramesRemainingPlayback = 0;
- if (!c89atomic_load_32(&pDevice->null_device.isStarted) && !wasStartedOnEntry) {
+ if (!ma_device_is_started__null(pDevice) && !wasStartedOnEntry) {
result = ma_device_start__null(pDevice);
if (result != MA_SUCCESS) {
break;
@@ -18919,7 +19503,7 @@ static ma_result ma_device_write__null(ma_device* pDevice, const void* pPCMFrame
ma_uint64 currentFrame;
/* Stop waiting if the device has been stopped. */
- if (!c89atomic_load_32(&pDevice->null_device.isStarted)) {
+ if (!ma_device_is_started__null(pDevice)) {
break;
}
@@ -18990,7 +19574,7 @@ static ma_result ma_device_read__null(ma_device* pDevice, void* pPCMFrames, ma_u
ma_uint64 currentFrame;
/* Stop waiting if the device has been stopped. */
- if (!c89atomic_load_32(&pDevice->null_device.isStarted)) {
+ if (!ma_device_is_started__null(pDevice)) {
break;
}
@@ -19056,7 +19640,7 @@ WIN32 COMMON
*******************************************************************************/
#if defined(MA_WIN32)
#if defined(MA_WIN32_DESKTOP)
- #define ma_CoInitializeEx(pContext, pvReserved, dwCoInit) ((MA_PFN_CoInitializeEx)pContext->win32.CoInitializeEx)(pvReserved, dwCoInit)
+ #define ma_CoInitializeEx(pContext, pvReserved, dwCoInit) ((pContext->win32.CoInitializeEx) ? ((MA_PFN_CoInitializeEx)pContext->win32.CoInitializeEx)(pvReserved, dwCoInit) : ((MA_PFN_CoInitialize)pContext->win32.CoInitialize)(pvReserved))
#define ma_CoUninitialize(pContext) ((MA_PFN_CoUninitialize)pContext->win32.CoUninitialize)()
#define ma_CoCreateInstance(pContext, rclsid, pUnkOuter, dwClsContext, riid, ppv) ((MA_PFN_CoCreateInstance)pContext->win32.CoCreateInstance)(rclsid, pUnkOuter, dwClsContext, riid, ppv)
#define ma_CoTaskMemFree(pContext, pv) ((MA_PFN_CoTaskMemFree)pContext->win32.CoTaskMemFree)(pv)
@@ -19917,7 +20501,7 @@ static ma_result ma_completion_handler_uwp_init(ma_completion_handler_uwp* pHand
pHandler->lpVtbl = &g_maCompletionHandlerVtblInstance;
pHandler->counter = 1;
- pHandler->hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
+ pHandler->hEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
if (pHandler->hEvent == NULL) {
return ma_result_from_GetLastError(GetLastError());
}
@@ -20093,12 +20677,18 @@ static HRESULT STDMETHODCALLTYPE ma_IMMNotificationClient_OnDefaultDeviceChanged
}
/* We only care about devices with the same data flow and role as the current device. */
- if ((pThis->pDevice->type == ma_device_type_playback && dataFlow != ma_eRender) ||
- (pThis->pDevice->type == ma_device_type_capture && dataFlow != ma_eCapture)) {
+ if ((pThis->pDevice->type == ma_device_type_playback && dataFlow != ma_eRender) ||
+ (pThis->pDevice->type == ma_device_type_capture && dataFlow != ma_eCapture) ||
+ (pThis->pDevice->type == ma_device_type_loopback && dataFlow != ma_eRender)) {
ma_log_postf(ma_device_get_log(pThis->pDevice), MA_LOG_LEVEL_DEBUG, "[WASAPI] Stream rerouting abandoned because dataFlow does match device type.\n");
return S_OK;
}
+ /* We need to consider dataFlow as ma_eCapture if device is ma_device_type_loopback */
+ if (pThis->pDevice->type == ma_device_type_loopback) {
+ dataFlow = ma_eCapture;
+ }
+
/* Don't do automatic stream routing if we're not allowed. */
if ((dataFlow == ma_eRender && pThis->pDevice->wasapi.allowPlaybackAutoStreamRouting == MA_FALSE) ||
(dataFlow == ma_eCapture && pThis->pDevice->wasapi.allowCaptureAutoStreamRouting == MA_FALSE)) {
@@ -20119,7 +20709,6 @@ static HRESULT STDMETHODCALLTYPE ma_IMMNotificationClient_OnDefaultDeviceChanged
-
/*
Second attempt at device rerouting. We're going to retrieve the device's state at the time of
the route change. We're then going to stop the device, reinitialize the device, and then start
@@ -20129,37 +20718,49 @@ static HRESULT STDMETHODCALLTYPE ma_IMMNotificationClient_OnDefaultDeviceChanged
ma_uint32 previousState = ma_device_get_state(pThis->pDevice);
ma_bool8 restartDevice = MA_FALSE;
+ if (previousState == ma_device_state_uninitialized || previousState == ma_device_state_starting) {
+ ma_log_postf(ma_device_get_log(pThis->pDevice), MA_LOG_LEVEL_DEBUG, "[WASAPI] Stream rerouting abandoned because the device is in the process of starting.\n");
+ return S_OK;
+ }
+
if (previousState == ma_device_state_started) {
ma_device_stop(pThis->pDevice);
restartDevice = MA_TRUE;
}
if (pDefaultDeviceID != NULL) { /* <-- The input device ID will be null if there's no other device available. */
- if (dataFlow == ma_eRender) {
- ma_device_reroute__wasapi(pThis->pDevice, ma_device_type_playback);
+ ma_mutex_lock(&pThis->pDevice->wasapi.rerouteLock);
+ {
+ if (dataFlow == ma_eRender) {
+ ma_device_reroute__wasapi(pThis->pDevice, ma_device_type_playback);
- if (pThis->pDevice->wasapi.isDetachedPlayback) {
- pThis->pDevice->wasapi.isDetachedPlayback = MA_FALSE;
+ if (pThis->pDevice->wasapi.isDetachedPlayback) {
+ pThis->pDevice->wasapi.isDetachedPlayback = MA_FALSE;
- if (pThis->pDevice->type == ma_device_type_duplex && pThis->pDevice->wasapi.isDetachedCapture) {
- restartDevice = MA_FALSE; /* It's a duplex device and the capture side is detached. We cannot be restarting the device just yet. */
- } else {
- restartDevice = MA_TRUE; /* It's not a duplex device, or the capture side is also attached so we can go ahead and restart the device. */
+ if (pThis->pDevice->type == ma_device_type_duplex && pThis->pDevice->wasapi.isDetachedCapture) {
+ restartDevice = MA_FALSE; /* It's a duplex device and the capture side is detached. We cannot be restarting the device just yet. */
+ }
+ else {
+ restartDevice = MA_TRUE; /* It's not a duplex device, or the capture side is also attached so we can go ahead and restart the device. */
+ }
}
}
- } else {
- ma_device_reroute__wasapi(pThis->pDevice, (pThis->pDevice->type == ma_device_type_loopback) ? ma_device_type_loopback : ma_device_type_capture);
+ else {
+ ma_device_reroute__wasapi(pThis->pDevice, (pThis->pDevice->type == ma_device_type_loopback) ? ma_device_type_loopback : ma_device_type_capture);
- if (pThis->pDevice->wasapi.isDetachedCapture) {
- pThis->pDevice->wasapi.isDetachedCapture = MA_FALSE;
+ if (pThis->pDevice->wasapi.isDetachedCapture) {
+ pThis->pDevice->wasapi.isDetachedCapture = MA_FALSE;
- if (pThis->pDevice->type == ma_device_type_duplex && pThis->pDevice->wasapi.isDetachedPlayback) {
- restartDevice = MA_FALSE; /* It's a duplex device and the playback side is detached. We cannot be restarting the device just yet. */
- } else {
- restartDevice = MA_TRUE; /* It's not a duplex device, or the playback side is also attached so we can go ahead and restart the device. */
+ if (pThis->pDevice->type == ma_device_type_duplex && pThis->pDevice->wasapi.isDetachedPlayback) {
+ restartDevice = MA_FALSE; /* It's a duplex device and the playback side is detached. We cannot be restarting the device just yet. */
+ }
+ else {
+ restartDevice = MA_TRUE; /* It's not a duplex device, or the playback side is also attached so we can go ahead and restart the device. */
+ }
}
}
}
+ ma_mutex_unlock(&pThis->pDevice->wasapi.rerouteLock);
if (restartDevice) {
ma_device_start(pThis->pDevice);
@@ -21797,7 +22398,7 @@ static ma_result ma_device_init__wasapi(ma_device* pDevice, const ma_device_conf
The event for capture needs to be manual reset for the same reason as playback. We keep the initial state set to unsignaled,
however, because we want to block until we actually have something for the first call to ma_device_read().
*/
- pDevice->wasapi.hEventCapture = CreateEventW(NULL, FALSE, FALSE, NULL); /* Auto reset, unsignaled by default. */
+ pDevice->wasapi.hEventCapture = CreateEventA(NULL, FALSE, FALSE, NULL); /* Auto reset, unsignaled by default. */
if (pDevice->wasapi.hEventCapture == NULL) {
result = ma_result_from_GetLastError(GetLastError());
@@ -21879,7 +22480,7 @@ static ma_result ma_device_init__wasapi(ma_device* pDevice, const ma_device_conf
The playback event also needs to be initially set to a signaled state so that the first call to ma_device_write() is able
to get passed WaitForMultipleObjects().
*/
- pDevice->wasapi.hEventPlayback = CreateEventW(NULL, FALSE, TRUE, NULL); /* Auto reset, signaled by default. */
+ pDevice->wasapi.hEventPlayback = CreateEventA(NULL, FALSE, TRUE, NULL); /* Auto reset, signaled by default. */
if (pDevice->wasapi.hEventPlayback == NULL) {
result = ma_result_from_GetLastError(GetLastError());
@@ -21933,7 +22534,7 @@ static ma_result ma_device_init__wasapi(ma_device* pDevice, const ma_device_conf
*/
#if defined(MA_WIN32_DESKTOP) || defined(MA_WIN32_GDK)
if (pConfig->wasapi.noAutoStreamRouting == MA_FALSE) {
- if ((pConfig->deviceType == ma_device_type_capture || pConfig->deviceType == ma_device_type_duplex) && pConfig->capture.pDeviceID == NULL) {
+ if ((pConfig->deviceType == ma_device_type_capture || pConfig->deviceType == ma_device_type_duplex || pConfig->deviceType == ma_device_type_loopback) && pConfig->capture.pDeviceID == NULL) {
pDevice->wasapi.allowCaptureAutoStreamRouting = MA_TRUE;
}
if ((pConfig->deviceType == ma_device_type_playback || pConfig->deviceType == ma_device_type_duplex) && pConfig->playback.pDeviceID == NULL) {
@@ -21941,6 +22542,8 @@ static ma_result ma_device_init__wasapi(ma_device* pDevice, const ma_device_conf
}
}
+ ma_mutex_init(&pDevice->wasapi.rerouteLock);
+
hr = ma_CoCreateInstance(pDevice->pContext, MA_CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, MA_IID_IMMDeviceEnumerator, (void**)&pDeviceEnumerator);
if (FAILED(hr)) {
ma_device_uninit__wasapi(pDevice);
@@ -21961,8 +22564,8 @@ static ma_result ma_device_init__wasapi(ma_device* pDevice, const ma_device_conf
}
#endif
- c89atomic_exchange_32(&pDevice->wasapi.isStartedCapture, MA_FALSE);
- c89atomic_exchange_32(&pDevice->wasapi.isStartedPlayback, MA_FALSE);
+ ma_atomic_bool32_set(&pDevice->wasapi.isStartedCapture, MA_FALSE);
+ ma_atomic_bool32_set(&pDevice->wasapi.isStartedPlayback, MA_FALSE);
return MA_SUCCESS;
}
@@ -22040,18 +22643,17 @@ static ma_result ma_device_reroute__wasapi(ma_device* pDevice, ma_device_type de
}
ma_device__post_init_setup(pDevice, deviceType);
-
ma_device__on_notification_rerouted(pDevice);
+ ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, "=== DEVICE CHANGED ===\n");
+
return MA_SUCCESS;
}
-static ma_result ma_device_start__wasapi(ma_device* pDevice)
+static ma_result ma_device_start__wasapi_nolock(ma_device* pDevice)
{
HRESULT hr;
- MA_ASSERT(pDevice != NULL);
-
if (pDevice->pContext->wasapi.hAvrt) {
LPCWSTR pTaskName = ma_to_usage_string__wasapi(pDevice->wasapi.usage);
if (pTaskName) {
@@ -22067,7 +22669,7 @@ static ma_result ma_device_start__wasapi(ma_device* pDevice)
return ma_result_from_HRESULT(hr);
}
- c89atomic_exchange_32(&pDevice->wasapi.isStartedCapture, MA_TRUE);
+ ma_atomic_bool32_set(&pDevice->wasapi.isStartedCapture, MA_TRUE);
}
if (pDevice->type == ma_device_type_playback || pDevice->type == ma_device_type_duplex) {
@@ -22077,13 +22679,29 @@ static ma_result ma_device_start__wasapi(ma_device* pDevice)
return ma_result_from_HRESULT(hr);
}
- c89atomic_exchange_32(&pDevice->wasapi.isStartedPlayback, MA_TRUE);
+ ma_atomic_bool32_set(&pDevice->wasapi.isStartedPlayback, MA_TRUE);
}
return MA_SUCCESS;
}
-static ma_result ma_device_stop__wasapi(ma_device* pDevice)
+static ma_result ma_device_start__wasapi(ma_device* pDevice)
+{
+ ma_result result;
+
+ MA_ASSERT(pDevice != NULL);
+
+ /* Wait for any rerouting to finish before attempting to start the device. */
+ ma_mutex_lock(&pDevice->wasapi.rerouteLock);
+ {
+ result = ma_device_start__wasapi_nolock(pDevice);
+ }
+ ma_mutex_unlock(&pDevice->wasapi.rerouteLock);
+
+ return result;
+}
+
+static ma_result ma_device_stop__wasapi_nolock(ma_device* pDevice)
{
ma_result result;
HRESULT hr;
@@ -22112,12 +22730,12 @@ static ma_result ma_device_stop__wasapi(ma_device* pDevice)
/* If we have a mapped buffer we need to release it. */
if (pDevice->wasapi.pMappedBufferCapture != NULL) {
ma_IAudioCaptureClient_ReleaseBuffer((ma_IAudioCaptureClient*)pDevice->wasapi.pCaptureClient, pDevice->wasapi.mappedBufferCaptureCap);
- pDevice->wasapi.pMappedBufferCapture = NULL;
+ pDevice->wasapi.pMappedBufferCapture = NULL;
pDevice->wasapi.mappedBufferCaptureCap = 0;
pDevice->wasapi.mappedBufferCaptureLen = 0;
}
- c89atomic_exchange_32(&pDevice->wasapi.isStartedCapture, MA_FALSE);
+ ma_atomic_bool32_set(&pDevice->wasapi.isStartedCapture, MA_FALSE);
}
if (pDevice->type == ma_device_type_playback || pDevice->type == ma_device_type_duplex) {
@@ -22125,13 +22743,14 @@ static ma_result ma_device_stop__wasapi(ma_device* pDevice)
The buffer needs to be drained before stopping the device. Not doing this will result in the last few frames not getting output to
the speakers. This is a problem for very short sounds because it'll result in a significant portion of it not getting played.
*/
- if (c89atomic_load_32(&pDevice->wasapi.isStartedPlayback)) {
+ if (ma_atomic_bool32_get(&pDevice->wasapi.isStartedPlayback)) {
/* We need to make sure we put a timeout here or else we'll risk getting stuck in a deadlock in some cases. */
DWORD waitTime = pDevice->wasapi.actualBufferSizeInFramesPlayback / pDevice->playback.internalSampleRate;
if (pDevice->playback.shareMode == ma_share_mode_exclusive) {
WaitForSingleObject(pDevice->wasapi.hEventPlayback, waitTime);
- } else {
+ }
+ else {
ma_uint32 prevFramesAvaialablePlayback = (ma_uint32)-1;
ma_uint32 framesAvailablePlayback;
for (;;) {
@@ -22174,17 +22793,33 @@ static ma_result ma_device_stop__wasapi(ma_device* pDevice)
if (pDevice->wasapi.pMappedBufferPlayback != NULL) {
ma_IAudioRenderClient_ReleaseBuffer((ma_IAudioRenderClient*)pDevice->wasapi.pRenderClient, pDevice->wasapi.mappedBufferPlaybackCap, 0);
- pDevice->wasapi.pMappedBufferPlayback = NULL;
+ pDevice->wasapi.pMappedBufferPlayback = NULL;
pDevice->wasapi.mappedBufferPlaybackCap = 0;
pDevice->wasapi.mappedBufferPlaybackLen = 0;
}
- c89atomic_exchange_32(&pDevice->wasapi.isStartedPlayback, MA_FALSE);
+ ma_atomic_bool32_set(&pDevice->wasapi.isStartedPlayback, MA_FALSE);
}
return MA_SUCCESS;
}
+static ma_result ma_device_stop__wasapi(ma_device* pDevice)
+{
+ ma_result result;
+
+ MA_ASSERT(pDevice != NULL);
+
+ /* Wait for any rerouting to finish before attempting to stop the device. */
+ ma_mutex_lock(&pDevice->wasapi.rerouteLock);
+ {
+ result = ma_device_stop__wasapi_nolock(pDevice);
+ }
+ ma_mutex_unlock(&pDevice->wasapi.rerouteLock);
+
+ return result;
+}
+
#ifndef MA_WASAPI_WAIT_TIMEOUT_MILLISECONDS
#define MA_WASAPI_WAIT_TIMEOUT_MILLISECONDS 5000
@@ -22291,7 +22926,7 @@ static ma_result ma_device_read__wasapi(ma_device* pDevice, void* pFrames, ma_ui
for (i = 0; i < iterationCount; i += 1) {
hr = ma_IAudioCaptureClient_ReleaseBuffer((ma_IAudioCaptureClient*)pDevice->wasapi.pCaptureClient, pDevice->wasapi.mappedBufferCaptureCap);
if (FAILED(hr)) {
- ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, "[WASAPI] Data discontinuity recovery: IAudioCaptureClient_ReleaseBuffer() failed with %d.\n", hr);
+ ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, "[WASAPI] Data discontinuity recovery: IAudioCaptureClient_ReleaseBuffer() failed with %ld.\n", hr);
break;
}
@@ -22316,7 +22951,7 @@ static ma_result ma_device_read__wasapi(ma_device* pDevice, void* pFrames, ma_ui
}
if (FAILED(hr)) {
- ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, "[WASAPI] Data discontinuity recovery: IAudioCaptureClient_GetBuffer() failed with %d.\n", hr);
+ ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, "[WASAPI] Data discontinuity recovery: IAudioCaptureClient_GetBuffer() failed with %ld.\n", hr);
}
break;
@@ -23708,6 +24343,8 @@ static ma_result ma_device_init__dsound(ma_device* pDevice, const ma_device_conf
ma_uint32 periodSizeInFrames;
ma_uint32 periodCount;
MA_DSBUFFERDESC descDS;
+ WORD nativeChannelCount;
+ DWORD nativeChannelMask = 0;
result = ma_config_to_WAVEFORMATEXTENSIBLE(pDescriptorPlayback->format, pDescriptorPlayback->channels, pDescriptorPlayback->sampleRate, pDescriptorPlayback->channelMap, &wf);
if (result != MA_SUCCESS) {
@@ -23741,21 +24378,25 @@ static ma_result ma_device_init__dsound(ma_device* pDevice, const ma_device_conf
return ma_result_from_HRESULT(hr);
}
- if (pDescriptorPlayback->channels == 0) {
- if ((caps.dwFlags & MA_DSCAPS_PRIMARYSTEREO) != 0) {
- DWORD speakerConfig;
+ if ((caps.dwFlags & MA_DSCAPS_PRIMARYSTEREO) != 0) {
+ DWORD speakerConfig;
- /* It supports at least stereo, but could support more. */
- wf.Format.nChannels = 2;
+ /* It supports at least stereo, but could support more. */
+ nativeChannelCount = 2;
- /* Look at the speaker configuration to get a better idea on the channel count. */
- if (SUCCEEDED(ma_IDirectSound_GetSpeakerConfig((ma_IDirectSound*)pDevice->dsound.pPlayback, &speakerConfig))) {
- ma_get_channels_from_speaker_config__dsound(speakerConfig, &wf.Format.nChannels, &wf.dwChannelMask);
- }
- } else {
- /* It does not support stereo, which means we are stuck with mono. */
- wf.Format.nChannels = 1;
+ /* Look at the speaker configuration to get a better idea on the channel count. */
+ if (SUCCEEDED(ma_IDirectSound_GetSpeakerConfig((ma_IDirectSound*)pDevice->dsound.pPlayback, &speakerConfig))) {
+ ma_get_channels_from_speaker_config__dsound(speakerConfig, &nativeChannelCount, &nativeChannelMask);
}
+ } else {
+ /* It does not support stereo, which means we are stuck with mono. */
+ nativeChannelCount = 1;
+ nativeChannelMask = 0x00000001;
+ }
+
+ if (pDescriptorPlayback->channels == 0) {
+ wf.Format.nChannels = nativeChannelCount;
+ wf.dwChannelMask = nativeChannelMask;
}
if (pDescriptorPlayback->sampleRate == 0) {
@@ -23777,11 +24418,28 @@ static ma_result ma_device_init__dsound(ma_device* pDevice, const ma_device_conf
supported format. To determine whether this has happened, an application can call the GetFormat method for the primary buffer
and compare the result with the format that was requested with the SetFormat method.
*/
- hr = ma_IDirectSoundBuffer_SetFormat((ma_IDirectSoundBuffer*)pDevice->dsound.pPlaybackPrimaryBuffer, (WAVEFORMATEX*)&wf);
+ hr = ma_IDirectSoundBuffer_SetFormat((ma_IDirectSoundBuffer*)pDevice->dsound.pPlaybackPrimaryBuffer, &wf.Format);
if (FAILED(hr)) {
- ma_device_uninit__dsound(pDevice);
- ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[DirectSound] Failed to set format of playback device's primary buffer.");
- return ma_result_from_HRESULT(hr);
+ /*
+ If setting of the format failed we'll try again with some fallback settings. On Windows 98 I have
+ observed that IEEE_FLOAT does not work. We'll therefore enforce PCM. I also had issues where a
+ sample rate of 48000 did not work correctly. Not sure if it was a driver issue or not, but will
+ use 44100 for the sample rate.
+ */
+ wf.Format.cbSize = sizeof(wf.Format);
+ wf.Format.wFormatTag = WAVE_FORMAT_PCM;
+ wf.Format.wBitsPerSample = 16;
+ wf.Format.nChannels = nativeChannelCount;
+ wf.Format.nSamplesPerSec = 44100;
+ wf.Format.nBlockAlign = wf.Format.nChannels * (wf.Format.wBitsPerSample / 8);
+ wf.Format.nAvgBytesPerSec = wf.Format.nSamplesPerSec * wf.Format.nBlockAlign;
+
+ hr = ma_IDirectSoundBuffer_SetFormat((ma_IDirectSoundBuffer*)pDevice->dsound.pPlaybackPrimaryBuffer, &wf.Format);
+ if (FAILED(hr)) {
+ ma_device_uninit__dsound(pDevice);
+ ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[DirectSound] Failed to set format of playback device's primary buffer.");
+ return ma_result_from_HRESULT(hr);
+ }
}
/* Get the _actual_ properties of the buffer. */
@@ -23828,7 +24486,7 @@ static ma_result ma_device_init__dsound(ma_device* pDevice, const ma_device_conf
descDS.dwSize = sizeof(descDS);
descDS.dwFlags = MA_DSBCAPS_CTRLPOSITIONNOTIFY | MA_DSBCAPS_GLOBALFOCUS | MA_DSBCAPS_GETCURRENTPOSITION2;
descDS.dwBufferBytes = periodSizeInFrames * periodCount * ma_get_bytes_per_frame(pDescriptorPlayback->format, pDescriptorPlayback->channels);
- descDS.lpwfxFormat = (WAVEFORMATEX*)&wf;
+ descDS.lpwfxFormat = &pActualFormat->Format;
hr = ma_IDirectSound_CreateSoundBuffer((ma_IDirectSound*)pDevice->dsound.pPlayback, &descDS, (ma_IDirectSoundBuffer**)&pDevice->dsound.pPlaybackBuffer, NULL);
if (FAILED(hr)) {
ma_device_uninit__dsound(pDevice);
@@ -24385,6 +25043,18 @@ static ma_result ma_context_init__dsound(ma_context* pContext, const ma_context_
pContext->dsound.DirectSoundCaptureCreate = ma_dlsym(pContext, pContext->dsound.hDSoundDLL, "DirectSoundCaptureCreate");
pContext->dsound.DirectSoundCaptureEnumerateA = ma_dlsym(pContext, pContext->dsound.hDSoundDLL, "DirectSoundCaptureEnumerateA");
+ /*
+ We need to support all functions or nothing. DirectSound with Windows 95 seems to not work too
+ well in my testing. For example, it's missing DirectSoundCaptureEnumerateA(). This is a convenient
+ place to just disable the DirectSound backend for Windows 95.
+ */
+ if (pContext->dsound.DirectSoundCreate == NULL ||
+ pContext->dsound.DirectSoundEnumerateA == NULL ||
+ pContext->dsound.DirectSoundCaptureCreate == NULL ||
+ pContext->dsound.DirectSoundCaptureEnumerateA == NULL) {
+ return MA_API_NOT_FOUND;
+ }
+
pCallbacks->onContextInit = ma_context_init__dsound;
pCallbacks->onContextUninit = ma_context_uninit__dsound;
pCallbacks->onContextEnumerateDevices = ma_context_enumerate_devices__dsound;
@@ -24934,7 +25604,7 @@ static ma_result ma_device_init__winmm(ma_device* pDevice, const ma_device_confi
MMRESULT resultMM;
/* We use an event to know when a new fragment needs to be enqueued. */
- pDevice->winmm.hEventCapture = (ma_handle)CreateEventW(NULL, TRUE, TRUE, NULL);
+ pDevice->winmm.hEventCapture = (ma_handle)CreateEventA(NULL, TRUE, TRUE, NULL);
if (pDevice->winmm.hEventCapture == NULL) {
errorMsg = "[WinMM] Failed to create event for fragment enqueing for the capture device.", errorCode = ma_result_from_GetLastError(GetLastError());
goto on_error;
@@ -24972,7 +25642,7 @@ static ma_result ma_device_init__winmm(ma_device* pDevice, const ma_device_confi
MMRESULT resultMM;
/* We use an event to know when a new fragment needs to be enqueued. */
- pDevice->winmm.hEventPlayback = (ma_handle)CreateEventW(NULL, TRUE, TRUE, NULL);
+ pDevice->winmm.hEventPlayback = (ma_handle)CreateEventA(NULL, TRUE, TRUE, NULL);
if (pDevice->winmm.hEventPlayback == NULL) {
errorMsg = "[WinMM] Failed to create event for fragment enqueing for the playback device.", errorCode = ma_result_from_GetLastError(GetLastError());
goto on_error;
@@ -26617,7 +27287,7 @@ static ma_result ma_device_init_by_type__alsa(ma_device* pDevice, const ma_devic
isUsingMMap = MA_FALSE;
#if 0 /* NOTE: MMAP mode temporarily disabled. */
if (deviceType != ma_device_type_capture) { /* <-- Disabling MMAP mode for capture devices because I apparently do not have a device that supports it which means I can't test it... Contributions welcome. */
- if (!pConfig->alsa.noMMap && ma_device__is_async(pDevice)) {
+ if (!pConfig->alsa.noMMap) {
if (((ma_snd_pcm_hw_params_set_access_proc)pDevice->pContext->alsa.snd_pcm_hw_params_set_access)(pPCM, pHWParams, MA_SND_PCM_ACCESS_MMAP_INTERLEAVED) == 0) {
pDevice->alsa.isUsingMMap = MA_TRUE;
}
@@ -29300,7 +29970,7 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi
sampleRate = pDescriptorCapture->sampleRate;
}
-
+
result = ma_init_pa_mainloop_and_pa_context__pulse(pDevice->pContext, pDevice->pContext->pulse.pApplicationName, pDevice->pContext->pulse.pServerName, MA_FALSE, &pDevice->pulse.pMainLoop, &pDevice->pulse.pPulseContext);
if (result != MA_SUCCESS) {
@@ -31092,15 +31762,15 @@ static ma_result ma_get_channel_map_from_AudioChannelLayout(AudioChannelLayout*
{
pChannelMap[7] = MA_CHANNEL_SIDE_RIGHT;
pChannelMap[6] = MA_CHANNEL_SIDE_LEFT;
- } /* Intentional fallthrough. */
+ } MA_FALLTHROUGH; /* Intentional fallthrough. */
case kAudioChannelLayoutTag_Hexagonal:
{
pChannelMap[5] = MA_CHANNEL_BACK_CENTER;
- } /* Intentional fallthrough. */
+ } MA_FALLTHROUGH; /* Intentional fallthrough. */
case kAudioChannelLayoutTag_Pentagonal:
{
pChannelMap[4] = MA_CHANNEL_FRONT_CENTER;
- } /* Intentional fallghrough. */
+ } MA_FALLTHROUGH; /* Intentional fallthrough. */
case kAudioChannelLayoutTag_Quadraphonic:
{
pChannelMap[3] = MA_CHANNEL_BACK_RIGHT;
@@ -32438,7 +33108,7 @@ static OSStatus ma_on_input__coreaudio(void* pUserData, AudioUnitRenderActionFla
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, "Failed to allocate AudioBufferList for capture.\n");
return noErr;
}
-
+
pRenderedBufferList = (AudioBufferList*)pDevice->coreaudio.pAudioBufferList;
MA_ASSERT(pRenderedBufferList);
@@ -32876,7 +33546,7 @@ static ma_result ma_device__untrack__coreaudio(ma_device* pDevice)
*/
ma_device__on_notification_interruption_began(m_pDevice);
} break;
-
+
case AVAudioSessionInterruptionTypeEnded:
{
ma_log_postf(ma_device_get_log(m_pDevice), MA_LOG_LEVEL_INFO, "[Core Audio] Interruption: AVAudioSessionInterruptionTypeEnded\n");
@@ -32930,7 +33600,7 @@ static ma_result ma_device__untrack__coreaudio(ma_device* pDevice)
}
ma_log_postf(ma_device_get_log(m_pDevice), MA_LOG_LEVEL_DEBUG, "[Core Audio] Changing Route. inputNumberChannels=%d; outputNumberOfChannels=%d\n", (int)pSession.inputNumberOfChannels, (int)pSession.outputNumberOfChannels);
-
+
/* Let the application know about the route change. */
ma_device__on_notification_rerouted(m_pDevice);
}
@@ -33303,7 +33973,7 @@ static ma_result ma_device_init_internal__coreaudio(ma_context* pContext, ma_dev
@autoreleasepool {
AVAudioSession* pAudioSession = [AVAudioSession sharedInstance];
MA_ASSERT(pAudioSession != NULL);
-
+
[pAudioSession setPreferredIOBufferDuration:((float)actualPeriodSizeInFrames / pAudioSession.sampleRate) error:nil];
actualPeriodSizeInFrames = ma_next_power_of_2((ma_uint32)(pAudioSession.IOBufferDuration * pAudioSession.sampleRate));
}
@@ -33544,7 +34214,7 @@ static ma_result ma_device_init__coreaudio(ma_device* pDevice, const ma_device_c
#if defined(MA_APPLE_DESKTOP)
ma_get_AudioObject_uid(pDevice->pContext, pDevice->coreaudio.deviceObjectIDCapture, sizeof(pDevice->capture.id.coreaudio), pDevice->capture.id.coreaudio);
-
+
/*
If we are using the default device we'll need to listen for changes to the system's default device so we can seemlessly
switch the device in the background.
@@ -33608,7 +34278,7 @@ static ma_result ma_device_init__coreaudio(ma_device* pDevice, const ma_device_c
#if defined(MA_APPLE_DESKTOP)
ma_get_AudioObject_uid(pDevice->pContext, pDevice->coreaudio.deviceObjectIDPlayback, sizeof(pDevice->playback.id.coreaudio), pDevice->playback.id.coreaudio);
-
+
/*
If we are using the default device we'll need to listen for changes to the system's default device so we can seemlessly
switch the device in the background.
@@ -36255,6 +36925,9 @@ static ma_result ma_context_init__oss(ma_context* pContext, const ma_context_con
#endif /* OSS */
+
+
+
/******************************************************************************
AAudio Backend
@@ -36273,6 +36946,7 @@ typedef int32_t ma_aaudio_performance_mo
typedef int32_t ma_aaudio_usage_t;
typedef int32_t ma_aaudio_content_type_t;
typedef int32_t ma_aaudio_input_preset_t;
+typedef int32_t ma_aaudio_allowed_capture_policy_t;
typedef int32_t ma_aaudio_data_callback_result_t;
typedef struct ma_AAudioStreamBuilder_t* ma_AAudioStreamBuilder;
typedef struct ma_AAudioStream_t* ma_AAudioStream;
@@ -36347,6 +37021,11 @@ typedef struct ma_AAudioStream_t* ma_AAudioStream;
#define MA_AAUDIO_INPUT_PRESET_UNPROCESSED 9
#define MA_AAUDIO_INPUT_PRESET_VOICE_PERFORMANCE 10
+/* Allowed Capture Policies */
+#define MA_AAUDIO_ALLOW_CAPTURE_BY_ALL 1
+#define MA_AAUDIO_ALLOW_CAPTURE_BY_SYSTEM 2
+#define MA_AAUDIO_ALLOW_CAPTURE_BY_NONE 3
+
/* Callback results. */
#define MA_AAUDIO_CALLBACK_RESULT_CONTINUE 0
#define MA_AAUDIO_CALLBACK_RESULT_STOP 1
@@ -36371,6 +37050,7 @@ typedef void (* MA_PFN_AAudioStreamBuilder_setPerformanceMod
typedef void (* MA_PFN_AAudioStreamBuilder_setUsage) (ma_AAudioStreamBuilder* pBuilder, ma_aaudio_usage_t contentType);
typedef void (* MA_PFN_AAudioStreamBuilder_setContentType) (ma_AAudioStreamBuilder* pBuilder, ma_aaudio_content_type_t contentType);
typedef void (* MA_PFN_AAudioStreamBuilder_setInputPreset) (ma_AAudioStreamBuilder* pBuilder, ma_aaudio_input_preset_t inputPreset);
+typedef void (* MA_PFN_AAudioStreamBuilder_setAllowedCapturePolicy) (ma_AAudioStreamBuilder* pBuilder, ma_aaudio_allowed_capture_policy_t policy);
typedef ma_aaudio_result_t (* MA_PFN_AAudioStreamBuilder_openStream) (ma_AAudioStreamBuilder* pBuilder, ma_AAudioStream** ppStream);
typedef ma_aaudio_result_t (* MA_PFN_AAudioStream_close) (ma_AAudioStream* pStream);
typedef ma_aaudio_stream_state_t (* MA_PFN_AAudioStream_getState) (ma_AAudioStream* pStream);
@@ -36448,8 +37128,22 @@ static ma_aaudio_input_preset_t ma_to_input_preset__aaudio(ma_aaudio_input_prese
return MA_AAUDIO_INPUT_PRESET_GENERIC;
}
+static ma_aaudio_allowed_capture_policy_t ma_to_allowed_capture_policy__aaudio(ma_aaudio_allowed_capture_policy allowedCapturePolicy)
+{
+ switch (allowedCapturePolicy) {
+ case ma_aaudio_allow_capture_by_all: return MA_AAUDIO_ALLOW_CAPTURE_BY_ALL;
+ case ma_aaudio_allow_capture_by_system: return MA_AAUDIO_ALLOW_CAPTURE_BY_SYSTEM;
+ case ma_aaudio_allow_capture_by_none: return MA_AAUDIO_ALLOW_CAPTURE_BY_NONE;
+ default: break;
+ }
+
+ return MA_AAUDIO_ALLOW_CAPTURE_BY_ALL;
+}
+
static void ma_stream_error_callback__aaudio(ma_AAudioStream* pStream, void* pUserData, ma_aaudio_result_t error)
{
+ ma_result result;
+ ma_job job;
ma_device* pDevice = (ma_device*)pUserData;
MA_ASSERT(pDevice != NULL);
@@ -36458,26 +37152,24 @@ static void ma_stream_error_callback__aaudio(ma_AAudioStream* pStream, void* pUs
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[AAudio] ERROR CALLBACK: error=%d, AAudioStream_getState()=%d\n", error, ((MA_PFN_AAudioStream_getState)pDevice->pContext->aaudio.AAudioStream_getState)(pStream));
/*
- From the documentation for AAudio, when a device is disconnected all we can do is stop it. However, we cannot stop it from the callback - we need
- to do it from another thread. Therefore we are going to use an event thread for the AAudio backend to do this cleanly and safely.
+ When we get an error, we'll assume that the stream is in an erroneous state and needs to be restarted. From the documentation,
+ we cannot do this from the error callback. Therefore we are going to use an event thread for the AAudio backend to do this
+ cleanly and safely.
*/
- if (((MA_PFN_AAudioStream_getState)pDevice->pContext->aaudio.AAudioStream_getState)(pStream) == MA_AAUDIO_STREAM_STATE_DISCONNECTED) {
- /* We need to post a job to the job thread for processing. This will reroute the device by reinitializing the stream. */
- ma_result result;
- ma_job job = ma_job_init(MA_JOB_TYPE_DEVICE_AAUDIO_REROUTE);
- job.data.device.aaudio.reroute.pDevice = pDevice;
+ job = ma_job_init(MA_JOB_TYPE_DEVICE_AAUDIO_REROUTE);
+ job.data.device.aaudio.reroute.pDevice = pDevice;
- if (pStream == pDevice->aaudio.pStreamCapture) {
- job.data.device.aaudio.reroute.deviceType = ma_device_type_capture;
- } else {
- job.data.device.aaudio.reroute.deviceType = ma_device_type_playback;
- }
+ if (pStream == pDevice->aaudio.pStreamCapture) {
+ job.data.device.aaudio.reroute.deviceType = ma_device_type_capture;
+ }
+ else {
+ job.data.device.aaudio.reroute.deviceType = ma_device_type_playback;
+ }
- result = ma_device_job_thread_post(&pDevice->pContext->aaudio.jobThread, &job);
- if (result != MA_SUCCESS) {
- ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[AAudio] Device Disconnected. Failed to post job for rerouting.\n");
- return;
- }
+ result = ma_device_job_thread_post(&pDevice->pContext->aaudio.jobThread, &job);
+ if (result != MA_SUCCESS) {
+ ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[AAudio] Device Disconnected. Failed to post job for rerouting.\n");
+ return;
}
}
@@ -36507,7 +37199,6 @@ static ma_result ma_create_and_configure_AAudioStreamBuilder__aaudio(ma_context*
{
ma_AAudioStreamBuilder* pBuilder;
ma_aaudio_result_t resultAA;
- ma_uint32 bufferCapacityInFrames;
/* Safety. */
*ppBuilder = NULL;
@@ -36549,17 +37240,26 @@ static ma_result ma_create_and_configure_AAudioStreamBuilder__aaudio(ma_context*
}
}
+
/*
- AAudio is annoying when it comes to it's buffer calculation stuff because it doesn't let you
- retrieve the actual sample rate until after you've opened the stream. But you need to configure
- the buffer capacity before you open the stream... :/
-
- To solve, we're just going to assume MA_DEFAULT_SAMPLE_RATE (48000) and move on.
+ There have been reports where setting the frames per data callback results in an error
+ later on from Android. To address this, I'm experimenting with simply not setting it on
+ anything from Android 11 and earlier. Suggestions welcome on how we might be able to make
+ this more targetted.
*/
- bufferCapacityInFrames = ma_calculate_buffer_size_in_frames_from_descriptor(pDescriptor, pDescriptor->sampleRate, pConfig->performanceProfile) * pDescriptor->periodCount;
+ if (pConfig->aaudio.enableCompatibilityWorkarounds && ma_android_sdk_version() > 30) {
+ /*
+ AAudio is annoying when it comes to it's buffer calculation stuff because it doesn't let you
+ retrieve the actual sample rate until after you've opened the stream. But you need to configure
+ the buffer capacity before you open the stream... :/
- ((MA_PFN_AAudioStreamBuilder_setBufferCapacityInFrames)pContext->aaudio.AAudioStreamBuilder_setBufferCapacityInFrames)(pBuilder, bufferCapacityInFrames);
- ((MA_PFN_AAudioStreamBuilder_setFramesPerDataCallback)pContext->aaudio.AAudioStreamBuilder_setFramesPerDataCallback)(pBuilder, bufferCapacityInFrames / pDescriptor->periodCount);
+ To solve, we're just going to assume MA_DEFAULT_SAMPLE_RATE (48000) and move on.
+ */
+ ma_uint32 bufferCapacityInFrames = ma_calculate_buffer_size_in_frames_from_descriptor(pDescriptor, pDescriptor->sampleRate, pConfig->performanceProfile) * pDescriptor->periodCount;
+
+ ((MA_PFN_AAudioStreamBuilder_setBufferCapacityInFrames)pContext->aaudio.AAudioStreamBuilder_setBufferCapacityInFrames)(pBuilder, bufferCapacityInFrames);
+ ((MA_PFN_AAudioStreamBuilder_setFramesPerDataCallback)pContext->aaudio.AAudioStreamBuilder_setFramesPerDataCallback)(pBuilder, bufferCapacityInFrames / pDescriptor->periodCount);
+ }
if (deviceType == ma_device_type_capture) {
if (pConfig->aaudio.inputPreset != ma_aaudio_input_preset_default && pContext->aaudio.AAudioStreamBuilder_setInputPreset != NULL) {
@@ -36576,6 +37276,10 @@ static ma_result ma_create_and_configure_AAudioStreamBuilder__aaudio(ma_context*
((MA_PFN_AAudioStreamBuilder_setContentType)pContext->aaudio.AAudioStreamBuilder_setContentType)(pBuilder, ma_to_content_type__aaudio(pConfig->aaudio.contentType));
}
+ if (pConfig->aaudio.allowedCapturePolicy != ma_aaudio_allow_capture_default && pContext->aaudio.AAudioStreamBuilder_setAllowedCapturePolicy != NULL) {
+ ((MA_PFN_AAudioStreamBuilder_setAllowedCapturePolicy)pContext->aaudio.AAudioStreamBuilder_setAllowedCapturePolicy)(pBuilder, ma_to_allowed_capture_policy__aaudio(pConfig->aaudio.allowedCapturePolicy));
+ }
+
((MA_PFN_AAudioStreamBuilder_setDataCallback)pContext->aaudio.AAudioStreamBuilder_setDataCallback)(pBuilder, ma_stream_data_callback_playback__aaudio, (void*)pDevice);
}
@@ -36843,6 +37547,7 @@ static ma_result ma_device_init__aaudio(ma_device* pDevice, const ma_device_conf
pDevice->aaudio.usage = pConfig->aaudio.usage;
pDevice->aaudio.contentType = pConfig->aaudio.contentType;
pDevice->aaudio.inputPreset = pConfig->aaudio.inputPreset;
+ pDevice->aaudio.allowedCapturePolicy = pConfig->aaudio.allowedCapturePolicy;
pDevice->aaudio.noAutoStartAfterReroute = pConfig->aaudio.noAutoStartAfterReroute;
if (pConfig->deviceType == ma_device_type_capture || pConfig->deviceType == ma_device_type_duplex) {
@@ -37019,6 +37724,7 @@ static ma_result ma_device_reinit__aaudio(ma_device* pDevice, ma_device_type dev
deviceConfig.aaudio.usage = pDevice->aaudio.usage;
deviceConfig.aaudio.contentType = pDevice->aaudio.contentType;
deviceConfig.aaudio.inputPreset = pDevice->aaudio.inputPreset;
+ deviceConfig.aaudio.allowedCapturePolicy = pDevice->aaudio.allowedCapturePolicy;
deviceConfig.aaudio.noAutoStartAfterReroute = pDevice->aaudio.noAutoStartAfterReroute;
deviceConfig.periods = 1;
@@ -37154,6 +37860,7 @@ static ma_result ma_context_init__aaudio(ma_context* pContext, const ma_context_
pContext->aaudio.AAudioStreamBuilder_setUsage = (ma_proc)ma_dlsym(pContext, pContext->aaudio.hAAudio, "AAudioStreamBuilder_setUsage");
pContext->aaudio.AAudioStreamBuilder_setContentType = (ma_proc)ma_dlsym(pContext, pContext->aaudio.hAAudio, "AAudioStreamBuilder_setContentType");
pContext->aaudio.AAudioStreamBuilder_setInputPreset = (ma_proc)ma_dlsym(pContext, pContext->aaudio.hAAudio, "AAudioStreamBuilder_setInputPreset");
+ pContext->aaudio.AAudioStreamBuilder_setAllowedCapturePolicy = (ma_proc)ma_dlsym(pContext, pContext->aaudio.hAAudio, "AAudioStreamBuilder_setAllowedCapturePolicy");
pContext->aaudio.AAudioStreamBuilder_openStream = (ma_proc)ma_dlsym(pContext, pContext->aaudio.hAAudio, "AAudioStreamBuilder_openStream");
pContext->aaudio.AAudioStream_close = (ma_proc)ma_dlsym(pContext, pContext->aaudio.hAAudio, "AAudioStream_close");
pContext->aaudio.AAudioStream_getState = (ma_proc)ma_dlsym(pContext, pContext->aaudio.hAAudio, "AAudioStream_getState");
@@ -37196,7 +37903,7 @@ static ma_result ma_context_init__aaudio(ma_context* pContext, const ma_context_
return result;
}
}
-
+
(void)pConfig;
return MA_SUCCESS;
@@ -38495,6 +39202,29 @@ Web Audio Backend
#ifdef MA_HAS_WEBAUDIO
#include
+#if (__EMSCRIPTEN_major__ > 3) || (__EMSCRIPTEN_major__ == 3 && (__EMSCRIPTEN_minor__ > 1 || (__EMSCRIPTEN_minor__ == 1 && __EMSCRIPTEN_tiny__ >= 32)))
+ #include
+ #define MA_SUPPORT_AUDIO_WORKLETS
+#endif
+
+/*
+TODO: Version 0.12: Swap this logic around so that AudioWorklets are used by default. Add MA_NO_AUDIO_WORKLETS.
+*/
+#if defined(MA_ENABLE_AUDIO_WORKLETS) && defined(MA_SUPPORT_AUDIO_WORKLETS)
+ #define MA_USE_AUDIO_WORKLETS
+#endif
+
+/* The thread stack size must be a multiple of 16. */
+#ifndef MA_AUDIO_WORKLETS_THREAD_STACK_SIZE
+#define MA_AUDIO_WORKLETS_THREAD_STACK_SIZE 16384
+#endif
+
+#if defined(MA_USE_AUDIO_WORKLETS)
+#define MA_WEBAUDIO_LATENCY_HINT_BALANCED "balanced"
+#define MA_WEBAUDIO_LATENCY_HINT_INTERACTIVE "interactive"
+#define MA_WEBAUDIO_LATENCY_HINT_PLAYBACK "playback"
+#endif
+
static ma_bool32 ma_is_capture_supported__webaudio()
{
return EM_ASM_INT({
@@ -38505,6 +39235,16 @@ static ma_bool32 ma_is_capture_supported__webaudio()
#ifdef __cplusplus
extern "C" {
#endif
+void* EMSCRIPTEN_KEEPALIVE ma_malloc_emscripten(size_t sz, const ma_allocation_callbacks* pAllocationCallbacks)
+{
+ return ma_malloc(sz, pAllocationCallbacks);
+}
+
+void EMSCRIPTEN_KEEPALIVE ma_free_emscripten(void* p, const ma_allocation_callbacks* pAllocationCallbacks)
+{
+ ma_free(p, pAllocationCallbacks);
+}
+
void EMSCRIPTEN_KEEPALIVE ma_device_process_pcm_frames_capture__webaudio(ma_device* pDevice, int frameCount, float* pFrames)
{
ma_device_handle_backend_data_callback(pDevice, NULL, pFrames, (ma_uint32)frameCount);
@@ -38595,13 +39335,14 @@ static ma_result ma_context_get_device_info__webaudio(ma_context* pContext, ma_d
return MA_SUCCESS;
}
-
+#if !defined(MA_USE_AUDIO_WORKLETS)
static void ma_device_uninit_by_index__webaudio(ma_device* pDevice, ma_device_type deviceType, int deviceIndex)
{
MA_ASSERT(pDevice != NULL);
EM_ASM({
var device = miniaudio.get_device_by_index($0);
+ var pAllocationCallbacks = $3;
/* Make sure all nodes are disconnected and marked for collection. */
if (device.scriptNode !== undefined) {
@@ -38623,7 +39364,7 @@ static void ma_device_uninit_by_index__webaudio(ma_device* pDevice, ma_device_ty
/* Can't forget to free the intermediary buffer. This is the buffer that's shared between JavaScript and C. */
if (device.intermediaryBuffer !== undefined) {
- Module._free(device.intermediaryBuffer);
+ _ma_free_emscripten(device.intermediaryBuffer, pAllocationCallbacks);
device.intermediaryBuffer = undefined;
device.intermediaryBufferView = undefined;
device.intermediaryBufferSizeInBytes = undefined;
@@ -38631,7 +39372,32 @@ static void ma_device_uninit_by_index__webaudio(ma_device* pDevice, ma_device_ty
/* Make sure the device is untracked so the slot can be reused later. */
miniaudio.untrack_device_by_index($0);
- }, deviceIndex, deviceType);
+ }, deviceIndex, deviceType, &pDevice->pContext->allocationCallbacks);
+}
+#endif
+
+static void ma_device_uninit_by_type__webaudio(ma_device* pDevice, ma_device_type deviceType)
+{
+ MA_ASSERT(pDevice != NULL);
+ MA_ASSERT(deviceType == ma_device_type_capture || deviceType == ma_device_type_playback);
+
+#if defined(MA_USE_AUDIO_WORKLETS)
+ if (deviceType == ma_device_type_capture) {
+ ma_free(pDevice->webaudio.pIntermediaryBufferCapture, &pDevice->pContext->allocationCallbacks);
+ ma_free(pDevice->webaudio.pStackBufferCapture, &pDevice->pContext->allocationCallbacks);
+ emscripten_destroy_audio_context(pDevice->webaudio.audioContextCapture);
+ } else {
+ ma_free(pDevice->webaudio.pIntermediaryBufferPlayback, &pDevice->pContext->allocationCallbacks);
+ ma_free(pDevice->webaudio.pStackBufferPlayback, &pDevice->pContext->allocationCallbacks);
+ emscripten_destroy_audio_context(pDevice->webaudio.audioContextPlayback);
+ }
+#else
+ if (deviceType == ma_device_type_capture) {
+ ma_device_uninit_by_index__webaudio(pDevice, ma_device_type_capture, pDevice->webaudio.indexCapture);
+ } else {
+ ma_device_uninit_by_index__webaudio(pDevice, ma_device_type_playback, pDevice->webaudio.indexPlayback);
+ }
+#endif
}
static ma_result ma_device_uninit__webaudio(ma_device* pDevice)
@@ -38639,11 +39405,11 @@ static ma_result ma_device_uninit__webaudio(ma_device* pDevice)
MA_ASSERT(pDevice != NULL);
if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) {
- ma_device_uninit_by_index__webaudio(pDevice, ma_device_type_capture, pDevice->webaudio.indexCapture);
+ ma_device_uninit_by_type__webaudio(pDevice, ma_device_type_capture);
}
if (pDevice->type == ma_device_type_playback || pDevice->type == ma_device_type_duplex) {
- ma_device_uninit_by_index__webaudio(pDevice, ma_device_type_playback, pDevice->webaudio.indexPlayback);
+ ma_device_uninit_by_type__webaudio(pDevice, ma_device_type_playback);
}
return MA_SUCCESS;
@@ -38651,10 +39417,16 @@ static ma_result ma_device_uninit__webaudio(ma_device* pDevice)
static ma_uint32 ma_calculate_period_size_in_frames_from_descriptor__webaudio(const ma_device_descriptor* pDescriptor, ma_uint32 nativeSampleRate, ma_performance_profile performanceProfile)
{
+#if defined(MA_USE_AUDIO_WORKLETS)
+ (void)pDescriptor;
+ (void)nativeSampleRate;
+ (void)performanceProfile;
+
+ return 256;
+#else
/*
- There have been reports of the default buffer size being too small on some browsers. There have been reports of the default buffer
- size being too small on some browsers. If we're using default buffer size, we'll make sure the period size is a big biffer than our
- standard defaults.
+ There have been reports of the default buffer size being too small on some browsers. If we're using
+ the default buffer size, we'll make sure the period size is bigger than our standard defaults.
*/
ma_uint32 periodSizeInFrames;
@@ -38682,11 +39454,177 @@ static ma_uint32 ma_calculate_period_size_in_frames_from_descriptor__webaudio(co
}
return periodSizeInFrames;
+#endif
}
+
+#if defined(MA_USE_AUDIO_WORKLETS)
+typedef struct
+{
+ ma_device* pDevice;
+ const ma_device_config* pConfig;
+ ma_device_descriptor* pDescriptor;
+ ma_device_type deviceType;
+ ma_uint32 channels;
+} ma_audio_worklet_thread_initialized_data;
+
+static EM_BOOL ma_audio_worklet_process_callback__webaudio(int inputCount, const AudioSampleFrame* pInputs, int outputCount, AudioSampleFrame* pOutputs, int paramCount, const AudioParamFrame* pParams, void* pUserData)
+{
+ ma_device* pDevice = (ma_device*)pUserData;
+ ma_uint32 frameCount;
+ ma_uint32 framesProcessed;
+
+ (void)paramCount;
+ (void)pParams;
+
+ /*
+ The Emscripten documentation says that it'll always be 128 frames being passed in. Hard coding it like that feels
+ like a very bad idea to me. Even if it's hard coded in the backend, the API and documentation should always refer
+ to variables instead of a hard coded number. In any case, will follow along for the time being.
+
+ Unfortunately the audio data is not interleaved so we'll need to convert it before we give the data to miniaudio
+ for further processing.
+ */
+ frameCount = 128;
+
+ /* Run the conversion logic in a loop for robustness. */
+ framesProcessed = 0;
+ while (framesProcessed < frameCount) {
+ ma_uint32 framesToProcessThisIteration = frameCount - framesProcessed;
+
+ if (inputCount > 0) {
+ if (framesToProcessThisIteration > pDevice->webaudio.intermediaryBufferSizeInFramesPlayback) {
+ framesToProcessThisIteration = pDevice->webaudio.intermediaryBufferSizeInFramesPlayback;
+ }
+
+ /* Input data needs to be interleaved before we hand it to the client. */
+ for (ma_uint32 iFrame = 0; iFrame < framesToProcessThisIteration; iFrame += 1) {
+ for (ma_uint32 iChannel = 0; iChannel < pDevice->capture.internalChannels; iChannel += 1) {
+ pDevice->webaudio.pIntermediaryBufferCapture[iFrame*pDevice->capture.internalChannels + iChannel] = pInputs[0].data[frameCount*iChannel + framesProcessed + iFrame];
+ }
+ }
+
+ ma_device_process_pcm_frames_capture__webaudio(pDevice, framesToProcessThisIteration, pDevice->webaudio.pIntermediaryBufferCapture);
+ }
+
+ if (outputCount > 0) {
+ ma_device_process_pcm_frames_playback__webaudio(pDevice, framesToProcessThisIteration, pDevice->webaudio.pIntermediaryBufferPlayback);
+
+ /* We've read the data from the client. Now we need to deinterleave the buffer and output to the output buffer. */
+ for (ma_uint32 iFrame = 0; iFrame < framesToProcessThisIteration; iFrame += 1) {
+ for (ma_uint32 iChannel = 0; iChannel < pDevice->playback.internalChannels; iChannel += 1) {
+ pOutputs[0].data[frameCount*iChannel + framesProcessed + iFrame] = pDevice->webaudio.pIntermediaryBufferPlayback[iFrame*pDevice->playback.internalChannels + iChannel];
+ }
+ }
+ }
+
+ framesProcessed += framesToProcessThisIteration;
+ }
+
+ return EM_TRUE;
+}
+
+
+static void ma_audio_worklet_processor_created__webaudio(EMSCRIPTEN_WEBAUDIO_T audioContext, EM_BOOL success, void* pUserData)
+{
+ ma_audio_worklet_thread_initialized_data* pParameters = (ma_audio_worklet_thread_initialized_data*)pUserData;
+ EmscriptenAudioWorkletNodeCreateOptions workletNodeOptions;
+ EMSCRIPTEN_AUDIO_WORKLET_NODE_T workletNode;
+ int outputChannelCount = 0;
+
+ if (success == EM_FALSE) {
+ pParameters->pDevice->webaudio.isInitialized = MA_TRUE;
+ return;
+ }
+
+ MA_ZERO_OBJECT(&workletNodeOptions);
+
+ if (pParameters->deviceType == ma_device_type_capture) {
+ workletNodeOptions.numberOfInputs = 1;
+ } else {
+ outputChannelCount = (int)pParameters->channels; /* Safe cast. */
+
+ workletNodeOptions.numberOfOutputs = 1;
+ workletNodeOptions.outputChannelCounts = &outputChannelCount;
+ }
+
+ /* Here is where we create the node that will do our processing. */
+ workletNode = emscripten_create_wasm_audio_worklet_node(audioContext, "miniaudio", &workletNodeOptions, &ma_audio_worklet_process_callback__webaudio, pParameters->pDevice);
+
+ if (pParameters->deviceType == ma_device_type_capture) {
+ pParameters->pDevice->webaudio.workletNodeCapture = workletNode;
+ } else {
+ pParameters->pDevice->webaudio.workletNodePlayback = workletNode;
+ }
+
+ /*
+ With the worklet node created we can now attach it to the graph. This is done differently depending on whether or not
+ it's capture or playback mode.
+ */
+ if (pParameters->deviceType == ma_device_type_capture) {
+ EM_ASM({
+ var workletNode = emscriptenGetAudioObject($0);
+ var audioContext = emscriptenGetAudioObject($1);
+
+ navigator.mediaDevices.getUserMedia({audio:true, video:false})
+ .then(function(stream) {
+ audioContext.streamNode = audioContext.createMediaStreamSource(stream);
+ audioContext.streamNode.connect(workletNode);
+
+ /*
+ Now that the worklet node has been connected, do we need to inspect workletNode.channelCount
+ to check the actual channel count, or is it safe to assume it's always 2?
+ */
+ })
+ .catch(function(error) {
+
+ });
+ }, workletNode, audioContext);
+ } else {
+ EM_ASM({
+ var workletNode = emscriptenGetAudioObject($0);
+ var audioContext = emscriptenGetAudioObject($1);
+ workletNode.connect(audioContext.destination);
+ }, workletNode, audioContext);
+ }
+
+ pParameters->pDevice->webaudio.isInitialized = MA_TRUE;
+
+ ma_log_postf(ma_device_get_log(pParameters->pDevice), MA_LOG_LEVEL_DEBUG, "AudioWorklets: Created worklet node: %d\n", workletNode);
+
+ /* Our parameter data is no longer needed. */
+ ma_free(pParameters, &pParameters->pDevice->pContext->allocationCallbacks);
+}
+
+
+
+static void ma_audio_worklet_thread_initialized__webaudio(EMSCRIPTEN_WEBAUDIO_T audioContext, EM_BOOL success, void* pUserData)
+{
+ ma_audio_worklet_thread_initialized_data* pParameters = (ma_audio_worklet_thread_initialized_data*)pUserData;
+ WebAudioWorkletProcessorCreateOptions workletProcessorOptions;
+
+ MA_ASSERT(pParameters != NULL);
+
+ if (success == EM_FALSE) {
+ pParameters->pDevice->webaudio.isInitialized = MA_TRUE;
+ return;
+ }
+
+ MA_ZERO_OBJECT(&workletProcessorOptions);
+ workletProcessorOptions.name = "miniaudio"; /* I'm not entirely sure what to call this. Does this need to be globally unique, or does it need only be unique for a given AudioContext? */
+
+ emscripten_create_wasm_audio_worklet_processor_async(audioContext, &workletProcessorOptions, ma_audio_worklet_processor_created__webaudio, pParameters);
+}
+#endif
+
static ma_result ma_device_init_by_type__webaudio(ma_device* pDevice, const ma_device_config* pConfig, ma_device_descriptor* pDescriptor, ma_device_type deviceType)
{
- int deviceIndex;
+#if defined(MA_USE_AUDIO_WORKLETS)
+ EMSCRIPTEN_WEBAUDIO_T audioContext;
+ void* pStackBuffer;
+ size_t intermediaryBufferSizeInFrames;
+ float* pIntermediaryBuffer;
+#endif
ma_uint32 channels;
ma_uint32 sampleRate;
ma_uint32 periodSizeInFrames;
@@ -38706,13 +39644,99 @@ static ma_result ma_device_init_by_type__webaudio(ma_device* pDevice, const ma_d
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, "periodSizeInFrames = %d\n", (int)periodSizeInFrames);
+#if defined(MA_USE_AUDIO_WORKLETS)
+ {
+ ma_audio_worklet_thread_initialized_data* pInitParameters;
+ EmscriptenWebAudioCreateAttributes audioContextAttributes;
+
+ audioContextAttributes.latencyHint = MA_WEBAUDIO_LATENCY_HINT_INTERACTIVE;
+ audioContextAttributes.sampleRate = sampleRate;
+
+ /* It's not clear if this can return an error. None of the tests in the Emscripten repository check for this, so neither am I for now. */
+ audioContext = emscripten_create_audio_context(&audioContextAttributes);
+
+ ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, "TRACE: AUDIO CONTEXT CREATED\n");
+
+ /*
+ We now need to create a worker thread. This is a bit weird because we need to allocate our
+ own buffer for the thread's stack. The stack needs to be aligned to 16 bytes. I'm going to
+ allocate this on the heap to keep it simple.
+ */
+ pStackBuffer = ma_aligned_malloc(MA_AUDIO_WORKLETS_THREAD_STACK_SIZE, 16, &pDevice->pContext->allocationCallbacks);
+ if (pStackBuffer == NULL) {
+ emscripten_destroy_audio_context(audioContext);
+ return MA_OUT_OF_MEMORY;
+ }
+
+ /*
+ We need an intermediary buffer for data conversion. WebAudio reports data in uninterleaved
+ format whereas we require it to be interleaved. We'll do this in chunks of 128 frames.
+ */
+ intermediaryBufferSizeInFrames = 128;
+ pIntermediaryBuffer = ma_malloc(intermediaryBufferSizeInFrames * channels * sizeof(float), &pDevice->pContext->allocationCallbacks);
+ if (pIntermediaryBuffer == NULL) {
+ ma_free(pStackBuffer, &pDevice->pContext->allocationCallbacks);
+ emscripten_destroy_audio_context(audioContext);
+ return MA_OUT_OF_MEMORY;
+ }
+
+ pInitParameters = ma_malloc(sizeof(*pInitParameters), &pDevice->pContext->allocationCallbacks);
+ if (pInitParameters == NULL) {
+ ma_free(pIntermediaryBuffer, &pDevice->pContext->allocationCallbacks);
+ ma_free(pStackBuffer, &pDevice->pContext->allocationCallbacks);
+ emscripten_destroy_audio_context(audioContext);
+ return MA_OUT_OF_MEMORY;
+ }
+
+ pInitParameters->pDevice = pDevice;
+ pInitParameters->pConfig = pConfig;
+ pInitParameters->pDescriptor = pDescriptor;
+ pInitParameters->deviceType = deviceType;
+ pInitParameters->channels = channels;
+
+ /*
+ We need to flag the device as not yet initialized so we can wait on it later. Unfortunately all of
+ the Emscripten WebAudio stuff is asynchronous.
+ */
+ pDevice->webaudio.isInitialized = MA_FALSE;
+
+ ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, "TRACE: CREATING WORKLET\n");
+
+ emscripten_start_wasm_audio_worklet_thread_async(audioContext, pStackBuffer, MA_AUDIO_WORKLETS_THREAD_STACK_SIZE, ma_audio_worklet_thread_initialized__webaudio, pInitParameters);
+
+ /* We must wait for initialization to complete. We're just spinning here. The emscripten_sleep() call is why we need to build with `-sASYNCIFY`. */
+ while (pDevice->webaudio.isInitialized == MA_FALSE) {
+ emscripten_sleep(1);
+ }
+
+ /*
+ Now that initialization is finished we can go ahead and extract our channel count so that
+ miniaudio can set up a data converter at a higher level.
+ */
+ if (deviceType == ma_device_type_capture) {
+ /*
+ For capture we won't actually know what the channel count is. Everything I've seen seems
+ to indicate that the default channel count is 2, so I'm sticking with that.
+ */
+ channels = 2;
+ } else {
+ /* Get the channel count from the audio context. */
+ channels = (ma_uint32)EM_ASM_INT({
+ return emscriptenGetAudioObject($0).destination.channelCount;
+ }, audioContext);
+ }
+
+ ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, "TRACE: INITIALIZED. channels = %u\n", channels);
+ }
+#else
/* We create the device on the JavaScript side and reference it using an index. We use this to make it possible to reference the device between JavaScript and C. */
- deviceIndex = EM_ASM_INT({
- var channels = $0;
- var sampleRate = $1;
- var bufferSize = $2; /* In PCM frames. */
- var isCapture = $3;
- var pDevice = $4;
+ int deviceIndex = EM_ASM_INT({
+ var channels = $0;
+ var sampleRate = $1;
+ var bufferSize = $2; /* In PCM frames. */
+ var isCapture = $3;
+ var pDevice = $4;
+ var pAllocationCallbacks = $5;
if (typeof(window.miniaudio) === 'undefined') {
return -1; /* Context not initialized. */
@@ -38725,12 +39749,9 @@ static ma_result ma_device_init_by_type__webaudio(ma_device* pDevice, const ma_d
device.webaudio.suspend();
device.state = 1; /* ma_device_state_stopped */
- /*
- We need an intermediary buffer which we use for JavaScript and C interop. This buffer stores interleaved f32 PCM data. Because it's passed between
- JavaScript and C it needs to be allocated and freed using Module._malloc() and Module._free().
- */
+ /* We need an intermediary buffer which we use for JavaScript and C interop. This buffer stores interleaved f32 PCM data. */
device.intermediaryBufferSizeInBytes = channels * bufferSize * 4;
- device.intermediaryBuffer = Module._malloc(device.intermediaryBufferSizeInBytes);
+ device.intermediaryBuffer = _ma_malloc_emscripten(device.intermediaryBufferSizeInBytes, pAllocationCallbacks);
device.intermediaryBufferView = new Float32Array(Module.HEAPF32.buffer, device.intermediaryBuffer, device.intermediaryBufferSizeInBytes);
/*
@@ -38871,25 +39892,45 @@ static ma_result ma_device_init_by_type__webaudio(ma_device* pDevice, const ma_d
}
return miniaudio.track_device(device);
- }, channels, sampleRate, periodSizeInFrames, deviceType == ma_device_type_capture, pDevice);
+ }, channels, sampleRate, periodSizeInFrames, deviceType == ma_device_type_capture, pDevice, &pDevice->pContext->allocationCallbacks);
if (deviceIndex < 0) {
return MA_FAILED_TO_OPEN_BACKEND_DEVICE;
}
+#endif
+#if defined(MA_USE_AUDIO_WORKLETS)
+ if (deviceType == ma_device_type_capture) {
+ pDevice->webaudio.audioContextCapture = audioContext;
+ pDevice->webaudio.pStackBufferCapture = pStackBuffer;
+ pDevice->webaudio.intermediaryBufferSizeInFramesCapture = intermediaryBufferSizeInFrames;
+ pDevice->webaudio.pIntermediaryBufferCapture = pIntermediaryBuffer;
+ } else {
+ pDevice->webaudio.audioContextPlayback = audioContext;
+ pDevice->webaudio.pStackBufferPlayback = pStackBuffer;
+ pDevice->webaudio.intermediaryBufferSizeInFramesPlayback = intermediaryBufferSizeInFrames;
+ pDevice->webaudio.pIntermediaryBufferPlayback = pIntermediaryBuffer;
+ }
+#else
if (deviceType == ma_device_type_capture) {
pDevice->webaudio.indexCapture = deviceIndex;
} else {
pDevice->webaudio.indexPlayback = deviceIndex;
}
+#endif
pDescriptor->format = ma_format_f32;
pDescriptor->channels = channels;
ma_channel_map_init_standard(ma_standard_channel_map_webaudio, pDescriptor->channelMap, ma_countof(pDescriptor->channelMap), pDescriptor->channels);
- pDescriptor->sampleRate = EM_ASM_INT({ return miniaudio.get_device_by_index($0).webaudio.sampleRate; }, deviceIndex);
pDescriptor->periodSizeInFrames = periodSizeInFrames;
pDescriptor->periodCount = 1;
+#if defined(MA_USE_AUDIO_WORKLETS)
+ pDescriptor->sampleRate = sampleRate; /* Is this good enough to be used in the general case? */
+#else
+ pDescriptor->sampleRate = EM_ASM_INT({ return miniaudio.get_device_by_index($0).webaudio.sampleRate; }, deviceIndex);
+#endif
+
return MA_SUCCESS;
}
@@ -38918,7 +39959,7 @@ static ma_result ma_device_init__webaudio(ma_device* pDevice, const ma_device_co
result = ma_device_init_by_type__webaudio(pDevice, pConfig, pDescriptorPlayback, ma_device_type_playback);
if (result != MA_SUCCESS) {
if (pConfig->deviceType == ma_device_type_duplex) {
- ma_device_uninit_by_index__webaudio(pDevice, ma_device_type_capture, pDevice->webaudio.indexCapture);
+ ma_device_uninit_by_type__webaudio(pDevice, ma_device_type_capture);
}
return result;
}
@@ -38931,6 +39972,15 @@ static ma_result ma_device_start__webaudio(ma_device* pDevice)
{
MA_ASSERT(pDevice != NULL);
+#if defined(MA_USE_AUDIO_WORKLETS)
+ if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) {
+ emscripten_resume_audio_context_sync(pDevice->webaudio.audioContextCapture);
+ }
+
+ if (pDevice->type == ma_device_type_playback || pDevice->type == ma_device_type_duplex) {
+ emscripten_resume_audio_context_sync(pDevice->webaudio.audioContextPlayback);
+ }
+#else
if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) {
EM_ASM({
var device = miniaudio.get_device_by_index($0);
@@ -38946,6 +39996,7 @@ static ma_result ma_device_start__webaudio(ma_device* pDevice)
device.state = 2; /* ma_device_state_started */
}, pDevice->webaudio.indexPlayback);
}
+#endif
return MA_SUCCESS;
}
@@ -38964,6 +40015,20 @@ static ma_result ma_device_stop__webaudio(ma_device* pDevice)
do any kind of explicit draining.
*/
+#if defined(MA_USE_AUDIO_WORKLETS)
+ /* I can't seem to find a way to suspend an AudioContext via the C Emscripten API. Is this an oversight? */
+ if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) {
+ EM_ASM({
+ emscriptenGetAudioObject($0).suspend();
+ }, pDevice->webaudio.audioContextCapture);
+ }
+
+ if (pDevice->type == ma_device_type_playback || pDevice->type == ma_device_type_duplex) {
+ EM_ASM({
+ emscriptenGetAudioObject($0).suspend();
+ }, pDevice->webaudio.audioContextPlayback);
+ }
+#else
if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) {
EM_ASM({
var device = miniaudio.get_device_by_index($0);
@@ -38979,6 +40044,7 @@ static ma_result ma_device_stop__webaudio(ma_device* pDevice)
device.state = 1; /* ma_device_state_stopped */
}, pDevice->webaudio.indexPlayback);
}
+#endif
ma_device__on_notification_stopped(pDevice);
@@ -39138,6 +40204,22 @@ static ma_bool32 ma__is_channel_map_valid(const ma_channel* pChannelMap, ma_uint
}
+static ma_bool32 ma_context_is_backend_asynchronous(ma_context* pContext)
+{
+ MA_ASSERT(pContext != NULL);
+
+ if (pContext->callbacks.onDeviceRead == NULL && pContext->callbacks.onDeviceWrite == NULL) {
+ if (pContext->callbacks.onDeviceDataLoop == NULL) {
+ return MA_TRUE;
+ } else {
+ return MA_FALSE;
+ }
+ } else {
+ return MA_FALSE;
+ }
+}
+
+
static ma_result ma_device__post_init_setup(ma_device* pDevice, ma_device_type deviceType)
{
ma_result result;
@@ -39257,8 +40339,23 @@ static ma_result ma_device__post_init_setup(ma_device* pDevice, ma_device_type d
/*
- In playback mode, if the data converter does not support retrieval of the required number of
- input frames given a number of output frames, we need to fall back to a heap-allocated cache.
+ If the device is doing playback (ma_device_type_playback or ma_device_type_duplex), there's
+ a couple of situations where we'll need a heap allocated cache.
+
+ The first is a duplex device for backends that use a callback for data delivery. The reason
+ this is needed is that the input stage needs to have a buffer to place the input data while it
+ waits for the playback stage, after which the miniaudio data callback will get fired. This is
+ not needed for backends that use a blocking API because miniaudio manages temporary buffers on
+ the stack to achieve this.
+
+ The other situation is when the data converter does not have the ability to query the number
+ of input frames that are required in order to process a given number of output frames. When
+ performing data conversion, it's useful if miniaudio know exactly how many frames it needs
+ from the client in order to generate a given number of output frames. This way, only exactly
+ the number of frames are needed to be read from the client which means no cache is necessary.
+ On the other hand, if miniaudio doesn't know how many frames to read, it is forced to read
+ in fixed sized chunks and then cache any residual unused input frames, those of which will be
+ processed at a later stage.
*/
if (deviceType == ma_device_type_playback || deviceType == ma_device_type_duplex) {
ma_uint64 unused;
@@ -39266,7 +40363,9 @@ static ma_result ma_device__post_init_setup(ma_device* pDevice, ma_device_type d
pDevice->playback.inputCacheConsumed = 0;
pDevice->playback.inputCacheRemaining = 0;
- if (deviceType == ma_device_type_duplex || ma_data_converter_get_required_input_frame_count(&pDevice->playback.converter, 1, &unused) != MA_SUCCESS) {
+ if ((pDevice->type == ma_device_type_duplex && ma_context_is_backend_asynchronous(pDevice->pContext)) || /* Duplex with asynchronous backend. */
+ ma_data_converter_get_required_input_frame_count(&pDevice->playback.converter, 1, &unused) != MA_SUCCESS) /* Data conversion required input frame calculation not supported. */
+ {
/* We need a heap allocated cache. We want to size this based on the period size. */
void* pNewInputCache;
ma_uint64 newInputCacheCap;
@@ -39282,7 +40381,7 @@ static ma_result ma_device__post_init_setup(ma_device* pDevice, ma_device_type d
return MA_OUT_OF_MEMORY; /* Allocation too big. Should never hit this, but makes the cast below safer for 32-bit builds. */
}
- pNewInputCache = ma_realloc(pDevice->playback.pInputCache, (size_t)newInputCacheSizeInBytes, &pDevice->pContext->allocationCallbacks);
+ pNewInputCache = ma_realloc(pDevice->playback.pInputCache, (size_t)newInputCacheSizeInBytes, &pDevice->pContext->allocationCallbacks);
if (pNewInputCache == NULL) {
ma_free(pDevice->playback.pInputCache, &pDevice->pContext->allocationCallbacks);
pDevice->playback.pInputCache = NULL;
@@ -39523,6 +40622,7 @@ static ma_result ma_context_init_backend_apis__win32(ma_context* pContext)
return MA_FAILED_TO_INIT_BACKEND;
}
+ pContext->win32.CoInitialize = (ma_proc)ma_dlsym(pContext, pContext->win32.hOle32DLL, "CoInitialize");
pContext->win32.CoInitializeEx = (ma_proc)ma_dlsym(pContext, pContext->win32.hOle32DLL, "CoInitializeEx");
pContext->win32.CoUninitialize = (ma_proc)ma_dlsym(pContext, pContext->win32.hOle32DLL, "CoUninitialize");
pContext->win32.CoCreateInstance = (ma_proc)ma_dlsym(pContext, pContext->win32.hOle32DLL, "CoCreateInstance");
@@ -39560,71 +40660,14 @@ static ma_result ma_context_init_backend_apis__win32(ma_context* pContext)
#else
static ma_result ma_context_uninit_backend_apis__nix(ma_context* pContext)
{
-#if defined(MA_USE_RUNTIME_LINKING_FOR_PTHREAD) && !defined(MA_NO_RUNTIME_LINKING)
- ma_dlclose(pContext, pContext->posix.pthreadSO);
-#else
(void)pContext;
-#endif
return MA_SUCCESS;
}
static ma_result ma_context_init_backend_apis__nix(ma_context* pContext)
{
- /* pthread */
-#if defined(MA_USE_RUNTIME_LINKING_FOR_PTHREAD) && !defined(MA_NO_RUNTIME_LINKING)
- const char* libpthreadFileNames[] = {
- "libpthread.so",
- "libpthread.so.0",
- "libpthread.dylib"
- };
- size_t i;
-
- for (i = 0; i < sizeof(libpthreadFileNames) / sizeof(libpthreadFileNames[0]); ++i) {
- pContext->posix.pthreadSO = ma_dlopen(pContext, libpthreadFileNames[i]);
- if (pContext->posix.pthreadSO != NULL) {
- break;
- }
- }
-
- if (pContext->posix.pthreadSO == NULL) {
- return MA_FAILED_TO_INIT_BACKEND;
- }
-
- pContext->posix.pthread_create = (ma_proc)ma_dlsym(pContext, pContext->posix.pthreadSO, "pthread_create");
- pContext->posix.pthread_join = (ma_proc)ma_dlsym(pContext, pContext->posix.pthreadSO, "pthread_join");
- pContext->posix.pthread_mutex_init = (ma_proc)ma_dlsym(pContext, pContext->posix.pthreadSO, "pthread_mutex_init");
- pContext->posix.pthread_mutex_destroy = (ma_proc)ma_dlsym(pContext, pContext->posix.pthreadSO, "pthread_mutex_destroy");
- pContext->posix.pthread_mutex_lock = (ma_proc)ma_dlsym(pContext, pContext->posix.pthreadSO, "pthread_mutex_lock");
- pContext->posix.pthread_mutex_unlock = (ma_proc)ma_dlsym(pContext, pContext->posix.pthreadSO, "pthread_mutex_unlock");
- pContext->posix.pthread_cond_init = (ma_proc)ma_dlsym(pContext, pContext->posix.pthreadSO, "pthread_cond_init");
- pContext->posix.pthread_cond_destroy = (ma_proc)ma_dlsym(pContext, pContext->posix.pthreadSO, "pthread_cond_destroy");
- pContext->posix.pthread_cond_wait = (ma_proc)ma_dlsym(pContext, pContext->posix.pthreadSO, "pthread_cond_wait");
- pContext->posix.pthread_cond_signal = (ma_proc)ma_dlsym(pContext, pContext->posix.pthreadSO, "pthread_cond_signal");
- pContext->posix.pthread_attr_init = (ma_proc)ma_dlsym(pContext, pContext->posix.pthreadSO, "pthread_attr_init");
- pContext->posix.pthread_attr_destroy = (ma_proc)ma_dlsym(pContext, pContext->posix.pthreadSO, "pthread_attr_destroy");
- pContext->posix.pthread_attr_setschedpolicy = (ma_proc)ma_dlsym(pContext, pContext->posix.pthreadSO, "pthread_attr_setschedpolicy");
- pContext->posix.pthread_attr_getschedparam = (ma_proc)ma_dlsym(pContext, pContext->posix.pthreadSO, "pthread_attr_getschedparam");
- pContext->posix.pthread_attr_setschedparam = (ma_proc)ma_dlsym(pContext, pContext->posix.pthreadSO, "pthread_attr_setschedparam");
-#else
- pContext->posix.pthread_create = (ma_proc)pthread_create;
- pContext->posix.pthread_join = (ma_proc)pthread_join;
- pContext->posix.pthread_mutex_init = (ma_proc)pthread_mutex_init;
- pContext->posix.pthread_mutex_destroy = (ma_proc)pthread_mutex_destroy;
- pContext->posix.pthread_mutex_lock = (ma_proc)pthread_mutex_lock;
- pContext->posix.pthread_mutex_unlock = (ma_proc)pthread_mutex_unlock;
- pContext->posix.pthread_cond_init = (ma_proc)pthread_cond_init;
- pContext->posix.pthread_cond_destroy = (ma_proc)pthread_cond_destroy;
- pContext->posix.pthread_cond_wait = (ma_proc)pthread_cond_wait;
- pContext->posix.pthread_cond_signal = (ma_proc)pthread_cond_signal;
- pContext->posix.pthread_attr_init = (ma_proc)pthread_attr_init;
- pContext->posix.pthread_attr_destroy = (ma_proc)pthread_attr_destroy;
-#if !defined(__EMSCRIPTEN__)
- pContext->posix.pthread_attr_setschedpolicy = (ma_proc)pthread_attr_setschedpolicy;
- pContext->posix.pthread_attr_getschedparam = (ma_proc)pthread_attr_getschedparam;
- pContext->posix.pthread_attr_setschedparam = (ma_proc)pthread_attr_setschedparam;
-#endif
-#endif
+ (void)pContext;
return MA_SUCCESS;
}
@@ -39655,22 +40698,6 @@ static ma_result ma_context_uninit_backend_apis(ma_context* pContext)
}
-static ma_bool32 ma_context_is_backend_asynchronous(ma_context* pContext)
-{
- MA_ASSERT(pContext != NULL);
-
- if (pContext->callbacks.onDeviceRead == NULL && pContext->callbacks.onDeviceWrite == NULL) {
- if (pContext->callbacks.onDeviceDataLoop == NULL) {
- return MA_TRUE;
- } else {
- return MA_FALSE;
- }
- } else {
- return MA_FALSE;
- }
-}
-
-
/* The default capacity doesn't need to be too big. */
#ifndef MA_DEFAULT_DEVICE_JOB_QUEUE_CAPACITY
#define MA_DEFAULT_DEVICE_JOB_QUEUE_CAPACITY 32
@@ -39730,7 +40757,7 @@ MA_API ma_result ma_device_job_thread_init(const ma_device_job_thread_config* pC
/* Initialize the job queue before the thread to ensure it's in a valid state. */
- jobQueueConfig = ma_job_queue_config_init(pConfig->jobQueueFlags, pConfig->jobQueueCapacity);
+ jobQueueConfig = ma_job_queue_config_init(pConfig->jobQueueFlags, pConfig->jobQueueCapacity);
result = ma_job_queue_init(&jobQueueConfig, pAllocationCallbacks, &pJobThread->jobQueue);
if (result != MA_SUCCESS) {
@@ -39983,7 +41010,16 @@ MA_API ma_result ma_context_init(const ma_backend backends[], ma_uint32 backendC
ma_log_postf(ma_context_get_log(pContext), MA_LOG_LEVEL_DEBUG, "Attempting to initialize %s backend...\n", ma_get_backend_name(backend));
result = pContext->callbacks.onContextInit(pContext, pConfig, &pContext->callbacks);
} else {
- result = MA_NO_BACKEND;
+ /* Getting here means the onContextInit callback is not set which means the backend is not enabled. Special case for the custom backend. */
+ if (backend != ma_backend_custom) {
+ result = MA_BACKEND_NOT_ENABLED;
+ } else {
+ #if !defined(MA_HAS_CUSTOM)
+ result = MA_BACKEND_NOT_ENABLED;
+ #else
+ result = MA_NO_BACKEND;
+ #endif
+ }
}
/* If this iteration was successful, return. */
@@ -40007,7 +41043,11 @@ MA_API ma_result ma_context_init(const ma_backend backends[], ma_uint32 backendC
pContext->backend = backend;
return result;
} else {
- ma_log_postf(ma_context_get_log(pContext), MA_LOG_LEVEL_DEBUG, "Failed to initialize %s backend.\n", ma_get_backend_name(backend));
+ if (result == MA_BACKEND_NOT_ENABLED) {
+ ma_log_postf(ma_context_get_log(pContext), MA_LOG_LEVEL_DEBUG, "%s backend is disabled.\n", ma_get_backend_name(backend));
+ } else {
+ ma_log_postf(ma_context_get_log(pContext), MA_LOG_LEVEL_DEBUG, "Failed to initialize %s backend.\n", ma_get_backend_name(backend));
+ }
}
}
@@ -40303,7 +41343,7 @@ MA_API ma_result ma_device_init(ma_context* pContext, const ma_device_config* pC
pDevice->noClip = pConfig->noClip;
pDevice->noDisableDenormals = pConfig->noDisableDenormals;
pDevice->noFixedSizedCallback = pConfig->noFixedSizedCallback;
- pDevice->masterVolumeFactor = 1;
+ ma_atomic_float_set(&pDevice->masterVolumeFactor, 1);
pDevice->type = pConfig->deviceType;
pDevice->sampleRate = pConfig->sampleRate;
@@ -40525,7 +41565,7 @@ MA_API ma_result ma_device_init(ma_context* pContext, const ma_device_config* pC
if (pConfig->deviceType == ma_device_type_playback || pConfig->deviceType == ma_device_type_duplex) {
ma_uint64 intermediaryBufferSizeInBytes;
-
+
pDevice->playback.intermediaryBufferLen = 0;
if (pConfig->deviceType == ma_device_type_duplex) {
pDevice->playback.intermediaryBufferCap = pDevice->capture.intermediaryBufferCap; /* In duplex mode, make sure the intermediary buffer is always the same size as the capture side. */
@@ -40537,7 +41577,7 @@ MA_API ma_result ma_device_init(ma_context* pContext, const ma_device_config* pC
}
intermediaryBufferSizeInBytes = pDevice->playback.intermediaryBufferCap * ma_get_bytes_per_frame(pDevice->playback.format, pDevice->playback.channels);
-
+
pDevice->playback.pIntermediaryBuffer = ma_malloc((size_t)intermediaryBufferSizeInBytes, &pContext->allocationCallbacks);
if (pDevice->playback.pIntermediaryBuffer == NULL) {
ma_device_uninit(pDevice);
@@ -40663,7 +41703,6 @@ MA_API ma_result ma_device_init_ex(const ma_backend backends[], ma_uint32 backen
allocationCallbacks = ma_allocation_callbacks_init_default();
}
-
pContext = (ma_context*)ma_malloc(sizeof(*pContext), &allocationCallbacks);
if (pContext == NULL) {
return MA_OUT_OF_MEMORY;
@@ -41011,7 +42050,7 @@ MA_API ma_device_state ma_device_get_state(const ma_device* pDevice)
return ma_device_state_uninitialized;
}
- return (ma_device_state)c89atomic_load_i32((ma_int32*)&pDevice->state); /* Naughty cast to get rid of a const warning. */
+ return ma_atomic_device_state_get((ma_atomic_device_state*)&pDevice->state); /* Naughty cast to get rid of a const warning. */
}
MA_API ma_result ma_device_set_master_volume(ma_device* pDevice, float volume)
@@ -41024,7 +42063,7 @@ MA_API ma_result ma_device_set_master_volume(ma_device* pDevice, float volume)
return MA_INVALID_ARGS;
}
- c89atomic_exchange_f32(&pDevice->masterVolumeFactor, volume);
+ ma_atomic_float_set(&pDevice->masterVolumeFactor, volume);
return MA_SUCCESS;
}
@@ -41040,7 +42079,7 @@ MA_API ma_result ma_device_get_master_volume(ma_device* pDevice, float* pVolume)
return MA_INVALID_ARGS;
}
- *pVolume = c89atomic_load_f32(&pDevice->masterVolumeFactor);
+ *pVolume = ma_atomic_float_get(&pDevice->masterVolumeFactor);
return MA_SUCCESS;
}
@@ -41635,6 +42674,35 @@ MA_API float ma_volume_db_to_linear(float gain)
}
+MA_API ma_result ma_mix_pcm_frames_f32(float* pDst, const float* pSrc, ma_uint64 frameCount, ma_uint32 channels, float volume)
+{
+ ma_uint64 iSample;
+ ma_uint64 sampleCount;
+
+ if (pDst == NULL || pSrc == NULL || channels == 0) {
+ return MA_INVALID_ARGS;
+ }
+
+ if (volume == 0) {
+ return MA_SUCCESS; /* No changes if the volume is 0. */
+ }
+
+ sampleCount = frameCount * channels;
+
+ if (volume == 1) {
+ for (iSample = 0; iSample < sampleCount; iSample += 1) {
+ pDst[iSample] += pSrc[iSample];
+ }
+ } else {
+ for (iSample = 0; iSample < sampleCount; iSample += 1) {
+ pDst[iSample] += ma_apply_volume_unclipped_f32(pSrc[iSample], volume);
+ }
+ }
+
+ return MA_SUCCESS;
+}
+
+
/**************************************************************************************************************************************************************
@@ -41700,12 +42768,6 @@ static MA_INLINE void ma_pcm_u8_to_s16__sse2(void* dst, const void* src, ma_uint
ma_pcm_u8_to_s16__optimized(dst, src, count, ditherMode);
}
#endif
-#if defined(MA_SUPPORT_AVX2)
-static MA_INLINE void ma_pcm_u8_to_s16__avx2(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
-{
- ma_pcm_u8_to_s16__optimized(dst, src, count, ditherMode);
-}
-#endif
#if defined(MA_SUPPORT_NEON)
static MA_INLINE void ma_pcm_u8_to_s16__neon(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
{
@@ -41718,15 +42780,11 @@ MA_API void ma_pcm_u8_to_s16(void* dst, const void* src, ma_uint64 count, ma_dit
#ifdef MA_USE_REFERENCE_CONVERSION_APIS
ma_pcm_u8_to_s16__reference(dst, src, count, ditherMode);
#else
- # if MA_PREFERRED_SIMD == MA_SIMD_AVX2
- if (ma_has_avx2()) {
- ma_pcm_u8_to_s16__avx2(dst, src, count, ditherMode);
- } else
- #elif MA_PREFERRED_SIMD == MA_SIMD_SSE2
+ # if defined(MA_SUPPORT_SSE2)
if (ma_has_sse2()) {
ma_pcm_u8_to_s16__sse2(dst, src, count, ditherMode);
} else
- #elif MA_PREFERRED_SIMD == MA_SIMD_NEON
+ #elif defined(MA_SUPPORT_NEON)
if (ma_has_neon()) {
ma_pcm_u8_to_s16__neon(dst, src, count, ditherMode);
} else
@@ -41767,12 +42825,6 @@ static MA_INLINE void ma_pcm_u8_to_s24__sse2(void* dst, const void* src, ma_uint
ma_pcm_u8_to_s24__optimized(dst, src, count, ditherMode);
}
#endif
-#if defined(MA_SUPPORT_AVX2)
-static MA_INLINE void ma_pcm_u8_to_s24__avx2(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
-{
- ma_pcm_u8_to_s24__optimized(dst, src, count, ditherMode);
-}
-#endif
#if defined(MA_SUPPORT_NEON)
static MA_INLINE void ma_pcm_u8_to_s24__neon(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
{
@@ -41785,15 +42837,11 @@ MA_API void ma_pcm_u8_to_s24(void* dst, const void* src, ma_uint64 count, ma_dit
#ifdef MA_USE_REFERENCE_CONVERSION_APIS
ma_pcm_u8_to_s24__reference(dst, src, count, ditherMode);
#else
- # if MA_PREFERRED_SIMD == MA_SIMD_AVX2
- if (ma_has_avx2()) {
- ma_pcm_u8_to_s24__avx2(dst, src, count, ditherMode);
- } else
- #elif MA_PREFERRED_SIMD == MA_SIMD_SSE2
+ # if defined(MA_SUPPORT_SSE2)
if (ma_has_sse2()) {
ma_pcm_u8_to_s24__sse2(dst, src, count, ditherMode);
} else
- #elif MA_PREFERRED_SIMD == MA_SIMD_NEON
+ #elif defined(MA_SUPPORT_NEON)
if (ma_has_neon()) {
ma_pcm_u8_to_s24__neon(dst, src, count, ditherMode);
} else
@@ -41832,12 +42880,6 @@ static MA_INLINE void ma_pcm_u8_to_s32__sse2(void* dst, const void* src, ma_uint
ma_pcm_u8_to_s32__optimized(dst, src, count, ditherMode);
}
#endif
-#if defined(MA_SUPPORT_AVX2)
-static MA_INLINE void ma_pcm_u8_to_s32__avx2(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
-{
- ma_pcm_u8_to_s32__optimized(dst, src, count, ditherMode);
-}
-#endif
#if defined(MA_SUPPORT_NEON)
static MA_INLINE void ma_pcm_u8_to_s32__neon(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
{
@@ -41850,15 +42892,11 @@ MA_API void ma_pcm_u8_to_s32(void* dst, const void* src, ma_uint64 count, ma_dit
#ifdef MA_USE_REFERENCE_CONVERSION_APIS
ma_pcm_u8_to_s32__reference(dst, src, count, ditherMode);
#else
- # if MA_PREFERRED_SIMD == MA_SIMD_AVX2
- if (ma_has_avx2()) {
- ma_pcm_u8_to_s32__avx2(dst, src, count, ditherMode);
- } else
- #elif MA_PREFERRED_SIMD == MA_SIMD_SSE2
+ # if defined(MA_SUPPORT_SSE2)
if (ma_has_sse2()) {
ma_pcm_u8_to_s32__sse2(dst, src, count, ditherMode);
} else
- #elif MA_PREFERRED_SIMD == MA_SIMD_NEON
+ #elif defined(MA_SUPPORT_NEON)
if (ma_has_neon()) {
ma_pcm_u8_to_s32__neon(dst, src, count, ditherMode);
} else
@@ -41898,12 +42936,6 @@ static MA_INLINE void ma_pcm_u8_to_f32__sse2(void* dst, const void* src, ma_uint
ma_pcm_u8_to_f32__optimized(dst, src, count, ditherMode);
}
#endif
-#if defined(MA_SUPPORT_AVX2)
-static MA_INLINE void ma_pcm_u8_to_f32__avx2(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
-{
- ma_pcm_u8_to_f32__optimized(dst, src, count, ditherMode);
-}
-#endif
#if defined(MA_SUPPORT_NEON)
static MA_INLINE void ma_pcm_u8_to_f32__neon(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
{
@@ -41916,15 +42948,11 @@ MA_API void ma_pcm_u8_to_f32(void* dst, const void* src, ma_uint64 count, ma_dit
#ifdef MA_USE_REFERENCE_CONVERSION_APIS
ma_pcm_u8_to_f32__reference(dst, src, count, ditherMode);
#else
- # if MA_PREFERRED_SIMD == MA_SIMD_AVX2
- if (ma_has_avx2()) {
- ma_pcm_u8_to_f32__avx2(dst, src, count, ditherMode);
- } else
- #elif MA_PREFERRED_SIMD == MA_SIMD_SSE2
+ # if defined(MA_SUPPORT_SSE2)
if (ma_has_sse2()) {
ma_pcm_u8_to_f32__sse2(dst, src, count, ditherMode);
} else
- #elif MA_PREFERRED_SIMD == MA_SIMD_NEON
+ #elif defined(MA_SUPPORT_NEON)
if (ma_has_neon()) {
ma_pcm_u8_to_f32__neon(dst, src, count, ditherMode);
} else
@@ -42060,12 +43088,6 @@ static MA_INLINE void ma_pcm_s16_to_u8__sse2(void* dst, const void* src, ma_uint
ma_pcm_s16_to_u8__optimized(dst, src, count, ditherMode);
}
#endif
-#if defined(MA_SUPPORT_AVX2)
-static MA_INLINE void ma_pcm_s16_to_u8__avx2(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
-{
- ma_pcm_s16_to_u8__optimized(dst, src, count, ditherMode);
-}
-#endif
#if defined(MA_SUPPORT_NEON)
static MA_INLINE void ma_pcm_s16_to_u8__neon(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
{
@@ -42078,15 +43100,11 @@ MA_API void ma_pcm_s16_to_u8(void* dst, const void* src, ma_uint64 count, ma_dit
#ifdef MA_USE_REFERENCE_CONVERSION_APIS
ma_pcm_s16_to_u8__reference(dst, src, count, ditherMode);
#else
- # if MA_PREFERRED_SIMD == MA_SIMD_AVX2
- if (ma_has_avx2()) {
- ma_pcm_s16_to_u8__avx2(dst, src, count, ditherMode);
- } else
- #elif MA_PREFERRED_SIMD == MA_SIMD_SSE2
+ # if defined(MA_SUPPORT_SSE2)
if (ma_has_sse2()) {
ma_pcm_s16_to_u8__sse2(dst, src, count, ditherMode);
} else
- #elif MA_PREFERRED_SIMD == MA_SIMD_NEON
+ #elif defined(MA_SUPPORT_NEON)
if (ma_has_neon()) {
ma_pcm_s16_to_u8__neon(dst, src, count, ditherMode);
} else
@@ -42131,12 +43149,6 @@ static MA_INLINE void ma_pcm_s16_to_s24__sse2(void* dst, const void* src, ma_uin
ma_pcm_s16_to_s24__optimized(dst, src, count, ditherMode);
}
#endif
-#if defined(MA_SUPPORT_AVX2)
-static MA_INLINE void ma_pcm_s16_to_s24__avx2(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
-{
- ma_pcm_s16_to_s24__optimized(dst, src, count, ditherMode);
-}
-#endif
#if defined(MA_SUPPORT_NEON)
static MA_INLINE void ma_pcm_s16_to_s24__neon(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
{
@@ -42149,15 +43161,11 @@ MA_API void ma_pcm_s16_to_s24(void* dst, const void* src, ma_uint64 count, ma_di
#ifdef MA_USE_REFERENCE_CONVERSION_APIS
ma_pcm_s16_to_s24__reference(dst, src, count, ditherMode);
#else
- # if MA_PREFERRED_SIMD == MA_SIMD_AVX2
- if (ma_has_avx2()) {
- ma_pcm_s16_to_s24__avx2(dst, src, count, ditherMode);
- } else
- #elif MA_PREFERRED_SIMD == MA_SIMD_SSE2
+ # if defined(MA_SUPPORT_SSE2)
if (ma_has_sse2()) {
ma_pcm_s16_to_s24__sse2(dst, src, count, ditherMode);
} else
- #elif MA_PREFERRED_SIMD == MA_SIMD_NEON
+ #elif defined(MA_SUPPORT_NEON)
if (ma_has_neon()) {
ma_pcm_s16_to_s24__neon(dst, src, count, ditherMode);
} else
@@ -42193,12 +43201,6 @@ static MA_INLINE void ma_pcm_s16_to_s32__sse2(void* dst, const void* src, ma_uin
ma_pcm_s16_to_s32__optimized(dst, src, count, ditherMode);
}
#endif
-#if defined(MA_SUPPORT_AVX2)
-static MA_INLINE void ma_pcm_s16_to_s32__avx2(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
-{
- ma_pcm_s16_to_s32__optimized(dst, src, count, ditherMode);
-}
-#endif
#if defined(MA_SUPPORT_NEON)
static MA_INLINE void ma_pcm_s16_to_s32__neon(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
{
@@ -42211,15 +43213,11 @@ MA_API void ma_pcm_s16_to_s32(void* dst, const void* src, ma_uint64 count, ma_di
#ifdef MA_USE_REFERENCE_CONVERSION_APIS
ma_pcm_s16_to_s32__reference(dst, src, count, ditherMode);
#else
- # if MA_PREFERRED_SIMD == MA_SIMD_AVX2
- if (ma_has_avx2()) {
- ma_pcm_s16_to_s32__avx2(dst, src, count, ditherMode);
- } else
- #elif MA_PREFERRED_SIMD == MA_SIMD_SSE2
+ # if defined(MA_SUPPORT_SSE2)
if (ma_has_sse2()) {
ma_pcm_s16_to_s32__sse2(dst, src, count, ditherMode);
} else
- #elif MA_PREFERRED_SIMD == MA_SIMD_NEON
+ #elif defined(MA_SUPPORT_NEON)
if (ma_has_neon()) {
ma_pcm_s16_to_s32__neon(dst, src, count, ditherMode);
} else
@@ -42267,12 +43265,6 @@ static MA_INLINE void ma_pcm_s16_to_f32__sse2(void* dst, const void* src, ma_uin
ma_pcm_s16_to_f32__optimized(dst, src, count, ditherMode);
}
#endif
-#if defined(MA_SUPPORT_AVX2)
-static MA_INLINE void ma_pcm_s16_to_f32__avx2(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
-{
- ma_pcm_s16_to_f32__optimized(dst, src, count, ditherMode);
-}
-#endif
#if defined(MA_SUPPORT_NEON)
static MA_INLINE void ma_pcm_s16_to_f32__neon(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
{
@@ -42285,15 +43277,11 @@ MA_API void ma_pcm_s16_to_f32(void* dst, const void* src, ma_uint64 count, ma_di
#ifdef MA_USE_REFERENCE_CONVERSION_APIS
ma_pcm_s16_to_f32__reference(dst, src, count, ditherMode);
#else
- # if MA_PREFERRED_SIMD == MA_SIMD_AVX2
- if (ma_has_avx2()) {
- ma_pcm_s16_to_f32__avx2(dst, src, count, ditherMode);
- } else
- #elif MA_PREFERRED_SIMD == MA_SIMD_SSE2
+ # if defined(MA_SUPPORT_SSE2)
if (ma_has_sse2()) {
ma_pcm_s16_to_f32__sse2(dst, src, count, ditherMode);
} else
- #elif MA_PREFERRED_SIMD == MA_SIMD_NEON
+ #elif defined(MA_SUPPORT_NEON)
if (ma_has_neon()) {
ma_pcm_s16_to_f32__neon(dst, src, count, ditherMode);
} else
@@ -42405,12 +43393,6 @@ static MA_INLINE void ma_pcm_s24_to_u8__sse2(void* dst, const void* src, ma_uint
ma_pcm_s24_to_u8__optimized(dst, src, count, ditherMode);
}
#endif
-#if defined(MA_SUPPORT_AVX2)
-static MA_INLINE void ma_pcm_s24_to_u8__avx2(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
-{
- ma_pcm_s24_to_u8__optimized(dst, src, count, ditherMode);
-}
-#endif
#if defined(MA_SUPPORT_NEON)
static MA_INLINE void ma_pcm_s24_to_u8__neon(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
{
@@ -42423,15 +43405,11 @@ MA_API void ma_pcm_s24_to_u8(void* dst, const void* src, ma_uint64 count, ma_dit
#ifdef MA_USE_REFERENCE_CONVERSION_APIS
ma_pcm_s24_to_u8__reference(dst, src, count, ditherMode);
#else
- # if MA_PREFERRED_SIMD == MA_SIMD_AVX2
- if (ma_has_avx2()) {
- ma_pcm_s24_to_u8__avx2(dst, src, count, ditherMode);
- } else
- #elif MA_PREFERRED_SIMD == MA_SIMD_SSE2
+ # if defined(MA_SUPPORT_SSE2)
if (ma_has_sse2()) {
ma_pcm_s24_to_u8__sse2(dst, src, count, ditherMode);
} else
- #elif MA_PREFERRED_SIMD == MA_SIMD_NEON
+ #elif defined(MA_SUPPORT_NEON)
if (ma_has_neon()) {
ma_pcm_s24_to_u8__neon(dst, src, count, ditherMode);
} else
@@ -42485,12 +43463,6 @@ static MA_INLINE void ma_pcm_s24_to_s16__sse2(void* dst, const void* src, ma_uin
ma_pcm_s24_to_s16__optimized(dst, src, count, ditherMode);
}
#endif
-#if defined(MA_SUPPORT_AVX2)
-static MA_INLINE void ma_pcm_s24_to_s16__avx2(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
-{
- ma_pcm_s24_to_s16__optimized(dst, src, count, ditherMode);
-}
-#endif
#if defined(MA_SUPPORT_NEON)
static MA_INLINE void ma_pcm_s24_to_s16__neon(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
{
@@ -42503,15 +43475,11 @@ MA_API void ma_pcm_s24_to_s16(void* dst, const void* src, ma_uint64 count, ma_di
#ifdef MA_USE_REFERENCE_CONVERSION_APIS
ma_pcm_s24_to_s16__reference(dst, src, count, ditherMode);
#else
- # if MA_PREFERRED_SIMD == MA_SIMD_AVX2
- if (ma_has_avx2()) {
- ma_pcm_s24_to_s16__avx2(dst, src, count, ditherMode);
- } else
- #elif MA_PREFERRED_SIMD == MA_SIMD_SSE2
+ # if defined(MA_SUPPORT_SSE2)
if (ma_has_sse2()) {
ma_pcm_s24_to_s16__sse2(dst, src, count, ditherMode);
} else
- #elif MA_PREFERRED_SIMD == MA_SIMD_NEON
+ #elif defined(MA_SUPPORT_NEON)
if (ma_has_neon()) {
ma_pcm_s24_to_s16__neon(dst, src, count, ditherMode);
} else
@@ -42555,12 +43523,6 @@ static MA_INLINE void ma_pcm_s24_to_s32__sse2(void* dst, const void* src, ma_uin
ma_pcm_s24_to_s32__optimized(dst, src, count, ditherMode);
}
#endif
-#if defined(MA_SUPPORT_AVX2)
-static MA_INLINE void ma_pcm_s24_to_s32__avx2(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
-{
- ma_pcm_s24_to_s32__optimized(dst, src, count, ditherMode);
-}
-#endif
#if defined(MA_SUPPORT_NEON)
static MA_INLINE void ma_pcm_s24_to_s32__neon(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
{
@@ -42573,15 +43535,11 @@ MA_API void ma_pcm_s24_to_s32(void* dst, const void* src, ma_uint64 count, ma_di
#ifdef MA_USE_REFERENCE_CONVERSION_APIS
ma_pcm_s24_to_s32__reference(dst, src, count, ditherMode);
#else
- # if MA_PREFERRED_SIMD == MA_SIMD_AVX2
- if (ma_has_avx2()) {
- ma_pcm_s24_to_s32__avx2(dst, src, count, ditherMode);
- } else
- #elif MA_PREFERRED_SIMD == MA_SIMD_SSE2
+ # if defined(MA_SUPPORT_SSE2)
if (ma_has_sse2()) {
ma_pcm_s24_to_s32__sse2(dst, src, count, ditherMode);
} else
- #elif MA_PREFERRED_SIMD == MA_SIMD_NEON
+ #elif defined(MA_SUPPORT_NEON)
if (ma_has_neon()) {
ma_pcm_s24_to_s32__neon(dst, src, count, ditherMode);
} else
@@ -42629,12 +43587,6 @@ static MA_INLINE void ma_pcm_s24_to_f32__sse2(void* dst, const void* src, ma_uin
ma_pcm_s24_to_f32__optimized(dst, src, count, ditherMode);
}
#endif
-#if defined(MA_SUPPORT_AVX2)
-static MA_INLINE void ma_pcm_s24_to_f32__avx2(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
-{
- ma_pcm_s24_to_f32__optimized(dst, src, count, ditherMode);
-}
-#endif
#if defined(MA_SUPPORT_NEON)
static MA_INLINE void ma_pcm_s24_to_f32__neon(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
{
@@ -42647,15 +43599,11 @@ MA_API void ma_pcm_s24_to_f32(void* dst, const void* src, ma_uint64 count, ma_di
#ifdef MA_USE_REFERENCE_CONVERSION_APIS
ma_pcm_s24_to_f32__reference(dst, src, count, ditherMode);
#else
- # if MA_PREFERRED_SIMD == MA_SIMD_AVX2
- if (ma_has_avx2()) {
- ma_pcm_s24_to_f32__avx2(dst, src, count, ditherMode);
- } else
- #elif MA_PREFERRED_SIMD == MA_SIMD_SSE2
+ # if defined(MA_SUPPORT_SSE2)
if (ma_has_sse2()) {
ma_pcm_s24_to_f32__sse2(dst, src, count, ditherMode);
} else
- #elif MA_PREFERRED_SIMD == MA_SIMD_NEON
+ #elif defined(MA_SUPPORT_NEON)
if (ma_has_neon()) {
ma_pcm_s24_to_f32__neon(dst, src, count, ditherMode);
} else
@@ -42775,12 +43723,6 @@ static MA_INLINE void ma_pcm_s32_to_u8__sse2(void* dst, const void* src, ma_uint
ma_pcm_s32_to_u8__optimized(dst, src, count, ditherMode);
}
#endif
-#if defined(MA_SUPPORT_AVX2)
-static MA_INLINE void ma_pcm_s32_to_u8__avx2(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
-{
- ma_pcm_s32_to_u8__optimized(dst, src, count, ditherMode);
-}
-#endif
#if defined(MA_SUPPORT_NEON)
static MA_INLINE void ma_pcm_s32_to_u8__neon(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
{
@@ -42793,15 +43735,11 @@ MA_API void ma_pcm_s32_to_u8(void* dst, const void* src, ma_uint64 count, ma_dit
#ifdef MA_USE_REFERENCE_CONVERSION_APIS
ma_pcm_s32_to_u8__reference(dst, src, count, ditherMode);
#else
- # if MA_PREFERRED_SIMD == MA_SIMD_AVX2
- if (ma_has_avx2()) {
- ma_pcm_s32_to_u8__avx2(dst, src, count, ditherMode);
- } else
- #elif MA_PREFERRED_SIMD == MA_SIMD_SSE2
+ # if defined(MA_SUPPORT_SSE2)
if (ma_has_sse2()) {
ma_pcm_s32_to_u8__sse2(dst, src, count, ditherMode);
} else
- #elif MA_PREFERRED_SIMD == MA_SIMD_NEON
+ #elif defined(MA_SUPPORT_NEON)
if (ma_has_neon()) {
ma_pcm_s32_to_u8__neon(dst, src, count, ditherMode);
} else
@@ -42855,12 +43793,6 @@ static MA_INLINE void ma_pcm_s32_to_s16__sse2(void* dst, const void* src, ma_uin
ma_pcm_s32_to_s16__optimized(dst, src, count, ditherMode);
}
#endif
-#if defined(MA_SUPPORT_AVX2)
-static MA_INLINE void ma_pcm_s32_to_s16__avx2(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
-{
- ma_pcm_s32_to_s16__optimized(dst, src, count, ditherMode);
-}
-#endif
#if defined(MA_SUPPORT_NEON)
static MA_INLINE void ma_pcm_s32_to_s16__neon(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
{
@@ -42873,15 +43805,11 @@ MA_API void ma_pcm_s32_to_s16(void* dst, const void* src, ma_uint64 count, ma_di
#ifdef MA_USE_REFERENCE_CONVERSION_APIS
ma_pcm_s32_to_s16__reference(dst, src, count, ditherMode);
#else
- # if MA_PREFERRED_SIMD == MA_SIMD_AVX2
- if (ma_has_avx2()) {
- ma_pcm_s32_to_s16__avx2(dst, src, count, ditherMode);
- } else
- #elif MA_PREFERRED_SIMD == MA_SIMD_SSE2
+ # if defined(MA_SUPPORT_SSE2)
if (ma_has_sse2()) {
ma_pcm_s32_to_s16__sse2(dst, src, count, ditherMode);
} else
- #elif MA_PREFERRED_SIMD == MA_SIMD_NEON
+ #elif defined(MA_SUPPORT_NEON)
if (ma_has_neon()) {
ma_pcm_s32_to_s16__neon(dst, src, count, ditherMode);
} else
@@ -42920,12 +43848,6 @@ static MA_INLINE void ma_pcm_s32_to_s24__sse2(void* dst, const void* src, ma_uin
ma_pcm_s32_to_s24__optimized(dst, src, count, ditherMode);
}
#endif
-#if defined(MA_SUPPORT_AVX2)
-static MA_INLINE void ma_pcm_s32_to_s24__avx2(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
-{
- ma_pcm_s32_to_s24__optimized(dst, src, count, ditherMode);
-}
-#endif
#if defined(MA_SUPPORT_NEON)
static MA_INLINE void ma_pcm_s32_to_s24__neon(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
{
@@ -42938,15 +43860,11 @@ MA_API void ma_pcm_s32_to_s24(void* dst, const void* src, ma_uint64 count, ma_di
#ifdef MA_USE_REFERENCE_CONVERSION_APIS
ma_pcm_s32_to_s24__reference(dst, src, count, ditherMode);
#else
- # if MA_PREFERRED_SIMD == MA_SIMD_AVX2
- if (ma_has_avx2()) {
- ma_pcm_s32_to_s24__avx2(dst, src, count, ditherMode);
- } else
- #elif MA_PREFERRED_SIMD == MA_SIMD_SSE2
+ # if defined(MA_SUPPORT_SSE2)
if (ma_has_sse2()) {
ma_pcm_s32_to_s24__sse2(dst, src, count, ditherMode);
} else
- #elif MA_PREFERRED_SIMD == MA_SIMD_NEON
+ #elif defined(MA_SUPPORT_NEON)
if (ma_has_neon()) {
ma_pcm_s32_to_s24__neon(dst, src, count, ditherMode);
} else
@@ -43000,12 +43918,6 @@ static MA_INLINE void ma_pcm_s32_to_f32__sse2(void* dst, const void* src, ma_uin
ma_pcm_s32_to_f32__optimized(dst, src, count, ditherMode);
}
#endif
-#if defined(MA_SUPPORT_AVX2)
-static MA_INLINE void ma_pcm_s32_to_f32__avx2(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
-{
- ma_pcm_s32_to_f32__optimized(dst, src, count, ditherMode);
-}
-#endif
#if defined(MA_SUPPORT_NEON)
static MA_INLINE void ma_pcm_s32_to_f32__neon(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
{
@@ -43018,15 +43930,11 @@ MA_API void ma_pcm_s32_to_f32(void* dst, const void* src, ma_uint64 count, ma_di
#ifdef MA_USE_REFERENCE_CONVERSION_APIS
ma_pcm_s32_to_f32__reference(dst, src, count, ditherMode);
#else
- # if MA_PREFERRED_SIMD == MA_SIMD_AVX2
- if (ma_has_avx2()) {
- ma_pcm_s32_to_f32__avx2(dst, src, count, ditherMode);
- } else
- #elif MA_PREFERRED_SIMD == MA_SIMD_SSE2
+ # if defined(MA_SUPPORT_SSE2)
if (ma_has_sse2()) {
ma_pcm_s32_to_f32__sse2(dst, src, count, ditherMode);
} else
- #elif MA_PREFERRED_SIMD == MA_SIMD_NEON
+ #elif defined(MA_SUPPORT_NEON)
if (ma_has_neon()) {
ma_pcm_s32_to_f32__neon(dst, src, count, ditherMode);
} else
@@ -43133,12 +44041,6 @@ static MA_INLINE void ma_pcm_f32_to_u8__sse2(void* dst, const void* src, ma_uint
ma_pcm_f32_to_u8__optimized(dst, src, count, ditherMode);
}
#endif
-#if defined(MA_SUPPORT_AVX2)
-static MA_INLINE void ma_pcm_f32_to_u8__avx2(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
-{
- ma_pcm_f32_to_u8__optimized(dst, src, count, ditherMode);
-}
-#endif
#if defined(MA_SUPPORT_NEON)
static MA_INLINE void ma_pcm_f32_to_u8__neon(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
{
@@ -43151,15 +44053,11 @@ MA_API void ma_pcm_f32_to_u8(void* dst, const void* src, ma_uint64 count, ma_dit
#ifdef MA_USE_REFERENCE_CONVERSION_APIS
ma_pcm_f32_to_u8__reference(dst, src, count, ditherMode);
#else
- # if MA_PREFERRED_SIMD == MA_SIMD_AVX2
- if (ma_has_avx2()) {
- ma_pcm_f32_to_u8__avx2(dst, src, count, ditherMode);
- } else
- #elif MA_PREFERRED_SIMD == MA_SIMD_SSE2
+ # if defined(MA_SUPPORT_SSE2)
if (ma_has_sse2()) {
ma_pcm_f32_to_u8__sse2(dst, src, count, ditherMode);
} else
- #elif MA_PREFERRED_SIMD == MA_SIMD_NEON
+ #elif defined(MA_SUPPORT_NEON)
if (ma_has_neon()) {
ma_pcm_f32_to_u8__neon(dst, src, count, ditherMode);
} else
@@ -43363,129 +44261,6 @@ static MA_INLINE void ma_pcm_f32_to_s16__sse2(void* dst, const void* src, ma_uin
}
#endif /* SSE2 */
-#if defined(MA_SUPPORT_AVX2)
-static MA_INLINE void ma_pcm_f32_to_s16__avx2(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
-{
- ma_uint64 i;
- ma_uint64 i16;
- ma_uint64 count16;
- ma_int16* dst_s16;
- const float* src_f32;
- float ditherMin;
- float ditherMax;
-
- /* Both the input and output buffers need to be aligned to 32 bytes. */
- if ((((ma_uintptr)dst & 31) != 0) || (((ma_uintptr)src & 31) != 0)) {
- ma_pcm_f32_to_s16__optimized(dst, src, count, ditherMode);
- return;
- }
-
- dst_s16 = (ma_int16*)dst;
- src_f32 = (const float*)src;
-
- ditherMin = 0;
- ditherMax = 0;
- if (ditherMode != ma_dither_mode_none) {
- ditherMin = 1.0f / -32768;
- ditherMax = 1.0f / 32767;
- }
-
- i = 0;
-
- /* AVX2. AVX2 allows us to output 16 s16's at a time which means our loop is unrolled 16 times. */
- count16 = count >> 4;
- for (i16 = 0; i16 < count16; i16 += 1) {
- __m256 d0;
- __m256 d1;
- __m256 x0;
- __m256 x1;
- __m256i i0;
- __m256i i1;
- __m256i p0;
- __m256i p1;
- __m256i r;
-
- if (ditherMode == ma_dither_mode_none) {
- d0 = _mm256_set1_ps(0);
- d1 = _mm256_set1_ps(0);
- } else if (ditherMode == ma_dither_mode_rectangle) {
- d0 = _mm256_set_ps(
- ma_dither_f32_rectangle(ditherMin, ditherMax),
- ma_dither_f32_rectangle(ditherMin, ditherMax),
- ma_dither_f32_rectangle(ditherMin, ditherMax),
- ma_dither_f32_rectangle(ditherMin, ditherMax),
- ma_dither_f32_rectangle(ditherMin, ditherMax),
- ma_dither_f32_rectangle(ditherMin, ditherMax),
- ma_dither_f32_rectangle(ditherMin, ditherMax),
- ma_dither_f32_rectangle(ditherMin, ditherMax)
- );
- d1 = _mm256_set_ps(
- ma_dither_f32_rectangle(ditherMin, ditherMax),
- ma_dither_f32_rectangle(ditherMin, ditherMax),
- ma_dither_f32_rectangle(ditherMin, ditherMax),
- ma_dither_f32_rectangle(ditherMin, ditherMax),
- ma_dither_f32_rectangle(ditherMin, ditherMax),
- ma_dither_f32_rectangle(ditherMin, ditherMax),
- ma_dither_f32_rectangle(ditherMin, ditherMax),
- ma_dither_f32_rectangle(ditherMin, ditherMax)
- );
- } else {
- d0 = _mm256_set_ps(
- ma_dither_f32_triangle(ditherMin, ditherMax),
- ma_dither_f32_triangle(ditherMin, ditherMax),
- ma_dither_f32_triangle(ditherMin, ditherMax),
- ma_dither_f32_triangle(ditherMin, ditherMax),
- ma_dither_f32_triangle(ditherMin, ditherMax),
- ma_dither_f32_triangle(ditherMin, ditherMax),
- ma_dither_f32_triangle(ditherMin, ditherMax),
- ma_dither_f32_triangle(ditherMin, ditherMax)
- );
- d1 = _mm256_set_ps(
- ma_dither_f32_triangle(ditherMin, ditherMax),
- ma_dither_f32_triangle(ditherMin, ditherMax),
- ma_dither_f32_triangle(ditherMin, ditherMax),
- ma_dither_f32_triangle(ditherMin, ditherMax),
- ma_dither_f32_triangle(ditherMin, ditherMax),
- ma_dither_f32_triangle(ditherMin, ditherMax),
- ma_dither_f32_triangle(ditherMin, ditherMax),
- ma_dither_f32_triangle(ditherMin, ditherMax)
- );
- }
-
- x0 = *((__m256*)(src_f32 + i) + 0);
- x1 = *((__m256*)(src_f32 + i) + 1);
-
- x0 = _mm256_add_ps(x0, d0);
- x1 = _mm256_add_ps(x1, d1);
-
- x0 = _mm256_mul_ps(x0, _mm256_set1_ps(32767.0f));
- x1 = _mm256_mul_ps(x1, _mm256_set1_ps(32767.0f));
-
- /* Computing the final result is a little more complicated for AVX2 than SSE2. */
- i0 = _mm256_cvttps_epi32(x0);
- i1 = _mm256_cvttps_epi32(x1);
- p0 = _mm256_permute2x128_si256(i0, i1, 0 | 32);
- p1 = _mm256_permute2x128_si256(i0, i1, 1 | 48);
- r = _mm256_packs_epi32(p0, p1);
-
- _mm256_stream_si256(((__m256i*)(dst_s16 + i)), r);
-
- i += 16;
- }
-
-
- /* Leftover. */
- for (; i < count; i += 1) {
- float x = src_f32[i];
- x = x + ma_dither_f32(ditherMode, ditherMin, ditherMax);
- x = ((x < -1) ? -1 : ((x > 1) ? 1 : x)); /* clip */
- x = x * 32767.0f; /* -1..1 to -32767..32767 */
-
- dst_s16[i] = (ma_int16)x;
- }
-}
-#endif /* AVX2 */
-
#if defined(MA_SUPPORT_NEON)
static MA_INLINE void ma_pcm_f32_to_s16__neon(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
{
@@ -43498,7 +44273,8 @@ static MA_INLINE void ma_pcm_f32_to_s16__neon(void* dst, const void* src, ma_uin
float ditherMax;
if (!ma_has_neon()) {
- return ma_pcm_f32_to_s16__optimized(dst, src, count, ditherMode);
+ ma_pcm_f32_to_s16__optimized(dst, src, count, ditherMode);
+ return;
}
/* Both the input and output buffers need to be aligned to 16 bytes. */
@@ -43597,15 +44373,11 @@ MA_API void ma_pcm_f32_to_s16(void* dst, const void* src, ma_uint64 count, ma_di
#ifdef MA_USE_REFERENCE_CONVERSION_APIS
ma_pcm_f32_to_s16__reference(dst, src, count, ditherMode);
#else
- # if MA_PREFERRED_SIMD == MA_SIMD_AVX2
- if (ma_has_avx2()) {
- ma_pcm_f32_to_s16__avx2(dst, src, count, ditherMode);
- } else
- #elif MA_PREFERRED_SIMD == MA_SIMD_SSE2
+ # if defined(MA_SUPPORT_SSE2)
if (ma_has_sse2()) {
ma_pcm_f32_to_s16__sse2(dst, src, count, ditherMode);
} else
- #elif MA_PREFERRED_SIMD == MA_SIMD_NEON
+ #elif defined(MA_SUPPORT_NEON)
if (ma_has_neon()) {
ma_pcm_f32_to_s16__neon(dst, src, count, ditherMode);
} else
@@ -43658,12 +44430,6 @@ static MA_INLINE void ma_pcm_f32_to_s24__sse2(void* dst, const void* src, ma_uin
ma_pcm_f32_to_s24__optimized(dst, src, count, ditherMode);
}
#endif
-#if defined(MA_SUPPORT_AVX2)
-static MA_INLINE void ma_pcm_f32_to_s24__avx2(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
-{
- ma_pcm_f32_to_s24__optimized(dst, src, count, ditherMode);
-}
-#endif
#if defined(MA_SUPPORT_NEON)
static MA_INLINE void ma_pcm_f32_to_s24__neon(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
{
@@ -43676,15 +44442,11 @@ MA_API void ma_pcm_f32_to_s24(void* dst, const void* src, ma_uint64 count, ma_di
#ifdef MA_USE_REFERENCE_CONVERSION_APIS
ma_pcm_f32_to_s24__reference(dst, src, count, ditherMode);
#else
- # if MA_PREFERRED_SIMD == MA_SIMD_AVX2
- if (ma_has_avx2()) {
- ma_pcm_f32_to_s24__avx2(dst, src, count, ditherMode);
- } else
- #elif MA_PREFERRED_SIMD == MA_SIMD_SSE2
+ # if defined(MA_SUPPORT_SSE2)
if (ma_has_sse2()) {
ma_pcm_f32_to_s24__sse2(dst, src, count, ditherMode);
} else
- #elif MA_PREFERRED_SIMD == MA_SIMD_NEON
+ #elif defined(MA_SUPPORT_NEON)
if (ma_has_neon()) {
ma_pcm_f32_to_s24__neon(dst, src, count, ditherMode);
} else
@@ -43733,12 +44495,6 @@ static MA_INLINE void ma_pcm_f32_to_s32__sse2(void* dst, const void* src, ma_uin
ma_pcm_f32_to_s32__optimized(dst, src, count, ditherMode);
}
#endif
-#if defined(MA_SUPPORT_AVX2)
-static MA_INLINE void ma_pcm_f32_to_s32__avx2(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
-{
- ma_pcm_f32_to_s32__optimized(dst, src, count, ditherMode);
-}
-#endif
#if defined(MA_SUPPORT_NEON)
static MA_INLINE void ma_pcm_f32_to_s32__neon(void* dst, const void* src, ma_uint64 count, ma_dither_mode ditherMode)
{
@@ -43751,15 +44507,11 @@ MA_API void ma_pcm_f32_to_s32(void* dst, const void* src, ma_uint64 count, ma_di
#ifdef MA_USE_REFERENCE_CONVERSION_APIS
ma_pcm_f32_to_s32__reference(dst, src, count, ditherMode);
#else
- # if MA_PREFERRED_SIMD == MA_SIMD_AVX2
- if (ma_has_avx2()) {
- ma_pcm_f32_to_s32__avx2(dst, src, count, ditherMode);
- } else
- #elif MA_PREFERRED_SIMD == MA_SIMD_SSE2
+ # if defined(MA_SUPPORT_SSE2)
if (ma_has_sse2()) {
ma_pcm_f32_to_s32__sse2(dst, src, count, ditherMode);
} else
- #elif MA_PREFERRED_SIMD == MA_SIMD_NEON
+ #elif defined(MA_SUPPORT_NEON)
if (ma_has_neon()) {
ma_pcm_f32_to_s32__neon(dst, src, count, ditherMode);
} else
@@ -45134,7 +45886,7 @@ static MA_INLINE void ma_lpf_process_pcm_frame_f32(ma_lpf* pLPF, float* pY, cons
MA_ASSERT(pLPF->format == ma_format_f32);
- MA_COPY_MEMORY(pY, pX, ma_get_bytes_per_frame(pLPF->format, pLPF->channels));
+ MA_MOVE_MEMORY(pY, pX, ma_get_bytes_per_frame(pLPF->format, pLPF->channels));
for (ilpf1 = 0; ilpf1 < pLPF->lpf1Count; ilpf1 += 1) {
ma_lpf1_process_pcm_frame_f32(&pLPF->pLPF1[ilpf1], pY, pY);
@@ -45152,7 +45904,7 @@ static MA_INLINE void ma_lpf_process_pcm_frame_s16(ma_lpf* pLPF, ma_int16* pY, c
MA_ASSERT(pLPF->format == ma_format_s16);
- MA_COPY_MEMORY(pY, pX, ma_get_bytes_per_frame(pLPF->format, pLPF->channels));
+ MA_MOVE_MEMORY(pY, pX, ma_get_bytes_per_frame(pLPF->format, pLPF->channels));
for (ilpf1 = 0; ilpf1 < pLPF->lpf1Count; ilpf1 += 1) {
ma_lpf1_process_pcm_frame_s16(&pLPF->pLPF1[ilpf1], pY, pY);
@@ -47491,6 +48243,7 @@ MA_API ma_result ma_gainer_init_preallocated(const ma_gainer_config* pConfig, vo
pGainer->pOldGains = (float*)ma_offset_ptr(pHeap, heapLayout.oldGainsOffset);
pGainer->pNewGains = (float*)ma_offset_ptr(pHeap, heapLayout.newGainsOffset);
+ pGainer->masterVolume = 1;
pGainer->config = *pConfig;
pGainer->t = (ma_uint32)-1; /* No interpolation by default. */
@@ -47550,20 +48303,256 @@ static float ma_gainer_calculate_current_gain(const ma_gainer* pGainer, ma_uint3
return ma_mix_f32_fast(pGainer->pOldGains[channel], pGainer->pNewGains[channel], a);
}
-MA_API ma_result ma_gainer_process_pcm_frames(ma_gainer* pGainer, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount)
+static /*__attribute__((noinline))*/ ma_result ma_gainer_process_pcm_frames_internal(ma_gainer * pGainer, void* MA_RESTRICT pFramesOut, const void* MA_RESTRICT pFramesIn, ma_uint64 frameCount)
{
ma_uint64 iFrame;
ma_uint32 iChannel;
- float* pFramesOutF32 = (float*)pFramesOut;
- const float* pFramesInF32 = (const float*)pFramesIn;
+ ma_uint64 interpolatedFrameCount;
- if (pGainer == NULL) {
- return MA_INVALID_ARGS;
+ MA_ASSERT(pGainer != NULL);
+
+ /*
+ We don't necessarily need to apply a linear interpolation for the entire frameCount frames. When
+ linear interpolation is not needed we can do a simple volume adjustment which will be more
+ efficient than a lerp with an alpha value of 1.
+
+ To do this, all we need to do is determine how many frames need to have a lerp applied. Then we
+ just process that number of frames with linear interpolation. After that we run on an optimized
+ path which just applies the new gains without a lerp.
+ */
+ if (pGainer->t >= pGainer->config.smoothTimeInFrames) {
+ interpolatedFrameCount = 0;
+ } else {
+ interpolatedFrameCount = pGainer->t - pGainer->config.smoothTimeInFrames;
+ if (interpolatedFrameCount > frameCount) {
+ interpolatedFrameCount = frameCount;
+ }
}
+ /*
+ Start off with our interpolated frames. When we do this, we'll adjust frameCount and our pointers
+ so that the fast path can work naturally without consideration of the interpolated path.
+ */
+ if (interpolatedFrameCount > 0) {
+ /* We can allow the input and output buffers to be null in which case we'll just update the internal timer. */
+ if (pFramesOut != NULL && pFramesIn != NULL) {
+ /*
+ All we're really doing here is moving the old gains towards the new gains. We don't want to
+ be modifying the gains inside the ma_gainer object because that will break things. Instead
+ we can make a copy here on the stack. For extreme channel counts we can fall back to a slower
+ implementation which just uses a standard lerp.
+ */
+ float* pFramesOutF32 = (float*)pFramesOut;
+ const float* pFramesInF32 = (const float*)pFramesIn;
+ float a = (float)pGainer->t / pGainer->config.smoothTimeInFrames;
+ float d = 1.0f / pGainer->config.smoothTimeInFrames;
+
+ if (pGainer->config.channels <= 32) {
+ float pRunningGain[32];
+ float pRunningGainDelta[32]; /* Could this be heap-allocated as part of the ma_gainer object? */
+
+ /* Initialize the running gain. */
+ for (iChannel = 0; iChannel < pGainer->config.channels; iChannel += 1) {
+ float t = (pGainer->pOldGains[iChannel] - pGainer->pNewGains[iChannel]) * pGainer->masterVolume;
+ pRunningGainDelta[iChannel] = t * d;
+ pRunningGain[iChannel] = (pGainer->pOldGains[iChannel] * pGainer->masterVolume) + (t * a);
+ }
+
+ iFrame = 0;
+
+ /* Optimized paths for common channel counts. This is mostly just experimenting with some SIMD ideas. It's not necessarily final. */
+ if (pGainer->config.channels == 2) {
+ #if defined(MA_SUPPORT_SSE2)
+ if (ma_has_sse2()) {
+ ma_uint64 unrolledLoopCount = interpolatedFrameCount >> 1;
+
+ /* Expand some arrays so we can have a clean SIMD loop below. */
+ __m128 runningGainDelta0 = _mm_set_ps(pRunningGainDelta[1], pRunningGainDelta[0], pRunningGainDelta[1], pRunningGainDelta[0]);
+ __m128 runningGain0 = _mm_set_ps(pRunningGain[1] + pRunningGainDelta[1], pRunningGain[0] + pRunningGainDelta[0], pRunningGain[1], pRunningGain[0]);
+
+ for (; iFrame < unrolledLoopCount; iFrame += 1) {
+ _mm_storeu_ps(&pFramesOutF32[iFrame*4 + 0], _mm_mul_ps(_mm_loadu_ps(&pFramesInF32[iFrame*4 + 0]), runningGain0));
+ runningGain0 = _mm_add_ps(runningGain0, runningGainDelta0);
+ }
+
+ iFrame = unrolledLoopCount << 1;
+ } else
+ #endif
+ {
+ /*
+ Two different scalar implementations here. Clang (and I assume GCC) will vectorize
+ both of these, but the bottom version results in a nicer vectorization with less
+ instructions emitted. The problem, however, is that the bottom version runs slower
+ when compiled with MSVC. The top version will be partially vectorized by MSVC.
+ */
+ #if defined(_MSC_VER) && !defined(__clang__)
+ ma_uint64 unrolledLoopCount = interpolatedFrameCount >> 1;
+
+ /* Expand some arrays so we can have a clean 4x SIMD operation in the loop. */
+ pRunningGainDelta[2] = pRunningGainDelta[0];
+ pRunningGainDelta[3] = pRunningGainDelta[1];
+ pRunningGain[2] = pRunningGain[0] + pRunningGainDelta[0];
+ pRunningGain[3] = pRunningGain[1] + pRunningGainDelta[1];
+
+ for (; iFrame < unrolledLoopCount; iFrame += 1) {
+ pFramesOutF32[iFrame*4 + 0] = pFramesInF32[iFrame*4 + 0] * pRunningGain[0];
+ pFramesOutF32[iFrame*4 + 1] = pFramesInF32[iFrame*4 + 1] * pRunningGain[1];
+ pFramesOutF32[iFrame*4 + 2] = pFramesInF32[iFrame*4 + 2] * pRunningGain[2];
+ pFramesOutF32[iFrame*4 + 3] = pFramesInF32[iFrame*4 + 3] * pRunningGain[3];
+
+ /* Move the running gain forward towards the new gain. */
+ pRunningGain[0] += pRunningGainDelta[0];
+ pRunningGain[1] += pRunningGainDelta[1];
+ pRunningGain[2] += pRunningGainDelta[2];
+ pRunningGain[3] += pRunningGainDelta[3];
+ }
+
+ iFrame = unrolledLoopCount << 1;
+ #else
+ for (; iFrame < interpolatedFrameCount; iFrame += 1) {
+ for (iChannel = 0; iChannel < 2; iChannel += 1) {
+ pFramesOutF32[iFrame*2 + iChannel] = pFramesInF32[iFrame*2 + iChannel] * pRunningGain[iChannel];
+ }
+
+ for (iChannel = 0; iChannel < 2; iChannel += 1) {
+ pRunningGain[iChannel] += pRunningGainDelta[iChannel];
+ }
+ }
+ #endif
+ }
+ } else if (pGainer->config.channels == 6) {
+ #if defined(MA_SUPPORT_SSE2)
+ if (ma_has_sse2()) {
+ /*
+ For 6 channels things are a bit more complicated because 6 isn't cleanly divisible by 4. We need to do 2 frames
+ at a time, meaning we'll be doing 12 samples in a group. Like the stereo case we'll need to expand some arrays
+ so we can do clean 4x SIMD operations.
+ */
+ ma_uint64 unrolledLoopCount = interpolatedFrameCount >> 1;
+
+ /* Expand some arrays so we can have a clean SIMD loop below. */
+ __m128 runningGainDelta0 = _mm_set_ps(pRunningGainDelta[3], pRunningGainDelta[2], pRunningGainDelta[1], pRunningGainDelta[0]);
+ __m128 runningGainDelta1 = _mm_set_ps(pRunningGainDelta[1], pRunningGainDelta[0], pRunningGainDelta[5], pRunningGainDelta[4]);
+ __m128 runningGainDelta2 = _mm_set_ps(pRunningGainDelta[5], pRunningGainDelta[4], pRunningGainDelta[3], pRunningGainDelta[2]);
+
+ __m128 runningGain0 = _mm_set_ps(pRunningGain[3], pRunningGain[2], pRunningGain[1], pRunningGain[0]);
+ __m128 runningGain1 = _mm_set_ps(pRunningGain[1] + pRunningGainDelta[1], pRunningGain[0] + pRunningGainDelta[0], pRunningGain[5], pRunningGain[4]);
+ __m128 runningGain2 = _mm_set_ps(pRunningGain[5] + pRunningGainDelta[5], pRunningGain[4] + pRunningGainDelta[4], pRunningGain[3] + pRunningGainDelta[3], pRunningGain[2] + pRunningGainDelta[2]);
+
+ for (; iFrame < unrolledLoopCount; iFrame += 1) {
+ _mm_storeu_ps(&pFramesOutF32[iFrame*12 + 0], _mm_mul_ps(_mm_loadu_ps(&pFramesInF32[iFrame*12 + 0]), runningGain0));
+ _mm_storeu_ps(&pFramesOutF32[iFrame*12 + 4], _mm_mul_ps(_mm_loadu_ps(&pFramesInF32[iFrame*12 + 4]), runningGain1));
+ _mm_storeu_ps(&pFramesOutF32[iFrame*12 + 8], _mm_mul_ps(_mm_loadu_ps(&pFramesInF32[iFrame*12 + 8]), runningGain2));
+
+ runningGain0 = _mm_add_ps(runningGain0, runningGainDelta0);
+ runningGain1 = _mm_add_ps(runningGain1, runningGainDelta1);
+ runningGain2 = _mm_add_ps(runningGain2, runningGainDelta2);
+ }
+
+ iFrame = unrolledLoopCount << 1;
+ } else
+ #endif
+ {
+ for (; iFrame < interpolatedFrameCount; iFrame += 1) {
+ for (iChannel = 0; iChannel < 6; iChannel += 1) {
+ pFramesOutF32[iFrame*6 + iChannel] = pFramesInF32[iFrame*6 + iChannel] * pRunningGain[iChannel];
+ }
+
+ /* Move the running gain forward towards the new gain. */
+ for (iChannel = 0; iChannel < 6; iChannel += 1) {
+ pRunningGain[iChannel] += pRunningGainDelta[iChannel];
+ }
+ }
+ }
+ } else if (pGainer->config.channels == 8) {
+ /* For 8 channels we can just go over frame by frame and do all eight channels as 2 separate 4x SIMD operations. */
+ #if defined(MA_SUPPORT_SSE2)
+ if (ma_has_sse2()) {
+ __m128 runningGainDelta0 = _mm_loadu_ps(&pRunningGainDelta[0]);
+ __m128 runningGainDelta1 = _mm_loadu_ps(&pRunningGainDelta[4]);
+ __m128 runningGain0 = _mm_loadu_ps(&pRunningGain[0]);
+ __m128 runningGain1 = _mm_loadu_ps(&pRunningGain[4]);
+
+ for (; iFrame < interpolatedFrameCount; iFrame += 1) {
+ _mm_storeu_ps(&pFramesOutF32[iFrame*8 + 0], _mm_mul_ps(_mm_loadu_ps(&pFramesInF32[iFrame*8 + 0]), runningGain0));
+ _mm_storeu_ps(&pFramesOutF32[iFrame*8 + 4], _mm_mul_ps(_mm_loadu_ps(&pFramesInF32[iFrame*8 + 4]), runningGain1));
+
+ runningGain0 = _mm_add_ps(runningGain0, runningGainDelta0);
+ runningGain1 = _mm_add_ps(runningGain1, runningGainDelta1);
+ }
+ } else
+ #endif
+ {
+ /* This is crafted so that it auto-vectorizes when compiled with Clang. */
+ for (; iFrame < interpolatedFrameCount; iFrame += 1) {
+ for (iChannel = 0; iChannel < 8; iChannel += 1) {
+ pFramesOutF32[iFrame*8 + iChannel] = pFramesInF32[iFrame*8 + iChannel] * pRunningGain[iChannel];
+ }
+
+ /* Move the running gain forward towards the new gain. */
+ for (iChannel = 0; iChannel < 8; iChannel += 1) {
+ pRunningGain[iChannel] += pRunningGainDelta[iChannel];
+ }
+ }
+ }
+ }
+
+ for (; iFrame < interpolatedFrameCount; iFrame += 1) {
+ for (iChannel = 0; iChannel < pGainer->config.channels; iChannel += 1) {
+ pFramesOutF32[iFrame*pGainer->config.channels + iChannel] = pFramesInF32[iFrame*pGainer->config.channels + iChannel] * pRunningGain[iChannel];
+ pRunningGain[iChannel] += pRunningGainDelta[iChannel];
+ }
+ }
+ } else {
+ /* Slower path for extreme channel counts where we can't fit enough on the stack. We could also move this to the heap as part of the ma_gainer object which might even be better since it'll only be updated when the gains actually change. */
+ for (iFrame = 0; iFrame < interpolatedFrameCount; iFrame += 1) {
+ for (iChannel = 0; iChannel < pGainer->config.channels; iChannel += 1) {
+ pFramesOutF32[iFrame*pGainer->config.channels + iChannel] = pFramesInF32[iFrame*pGainer->config.channels + iChannel] * ma_mix_f32_fast(pGainer->pOldGains[iChannel], pGainer->pNewGains[iChannel], a) * pGainer->masterVolume;
+ }
+
+ a += d;
+ }
+ }
+ }
+
+ /* Make sure the timer is updated. */
+ pGainer->t = (ma_uint32)ma_min(pGainer->t + interpolatedFrameCount, pGainer->config.smoothTimeInFrames);
+
+ /* Adjust our arguments so the next part can work normally. */
+ frameCount -= interpolatedFrameCount;
+ pFramesOut = ma_offset_ptr(pFramesOut, interpolatedFrameCount * sizeof(float));
+ pFramesIn = ma_offset_ptr(pFramesIn, interpolatedFrameCount * sizeof(float));
+ }
+
+ /* All we need to do here is apply the new gains using an optimized path. */
+ if (pFramesOut != NULL && pFramesIn != NULL) {
+ if (pGainer->config.channels <= 32) {
+ float gains[32];
+ for (iChannel = 0; iChannel < pGainer->config.channels; iChannel += 1) {
+ gains[iChannel] = pGainer->pNewGains[iChannel] * pGainer->masterVolume;
+ }
+
+ ma_copy_and_apply_volume_factor_per_channel_f32((float*)pFramesOut, (const float*)pFramesIn, frameCount, pGainer->config.channels, gains);
+ } else {
+ /* Slow path. Too many channels to fit on the stack. Need to apply a master volume as a separate path. */
+ for (iFrame = 0; iFrame < frameCount; iFrame += 1) {
+ for (iChannel = 0; iChannel < pGainer->config.channels; iChannel += 1) {
+ ((float*)pFramesOut)[iFrame*pGainer->config.channels + iChannel] = ((const float*)pFramesIn)[iFrame*pGainer->config.channels + iChannel] * pGainer->pNewGains[iChannel] * pGainer->masterVolume;
+ }
+ }
+ }
+ }
+
+ /* Now that some frames have been processed we need to make sure future changes to the gain are interpolated. */
+ if (pGainer->t == (ma_uint32)-1) {
+ pGainer->t = (ma_uint32)ma_min(pGainer->config.smoothTimeInFrames, frameCount);
+ }
+
+#if 0
if (pGainer->t >= pGainer->config.smoothTimeInFrames) {
/* Fast path. No gain calculation required. */
ma_copy_and_apply_volume_factor_per_channel_f32(pFramesOutF32, pFramesInF32, frameCount, pGainer->config.channels, pGainer->pNewGains);
+ ma_apply_volume_factor_f32(pFramesOutF32, frameCount * pGainer->config.channels, pGainer->masterVolume);
/* Now that some frames have been processed we need to make sure future changes to the gain are interpolated. */
if (pGainer->t == (ma_uint32)-1) {
@@ -47580,7 +48569,7 @@ MA_API ma_result ma_gainer_process_pcm_frames(ma_gainer* pGainer, void* pFramesO
for (iFrame = 0; iFrame < frameCount; iFrame += 1) {
for (iChannel = 0; iChannel < channelCount; iChannel += 1) {
- pFramesOutF32[iChannel] = pFramesInF32[iChannel] * ma_mix_f32_fast(pGainer->pOldGains[iChannel], pGainer->pNewGains[iChannel], a);
+ pFramesOutF32[iChannel] = pFramesInF32[iChannel] * ma_mix_f32_fast(pGainer->pOldGains[iChannel], pGainer->pNewGains[iChannel], a) * pGainer->masterVolume;
}
pFramesOutF32 += channelCount;
@@ -47600,7 +48589,7 @@ MA_API ma_result ma_gainer_process_pcm_frames(ma_gainer* pGainer, void* pFramesO
/* We can allow the input and output buffers to be null in which case we'll just update the internal timer. */
if (pFramesOut != NULL && pFramesIn != NULL) {
for (iChannel = 0; iChannel < pGainer->config.channels; iChannel += 1) {
- pFramesOutF32[iFrame*pGainer->config.channels + iChannel] = pFramesInF32[iFrame*pGainer->config.channels + iChannel] * ma_gainer_calculate_current_gain(pGainer, iChannel);
+ pFramesOutF32[iFrame * pGainer->config.channels + iChannel] = pFramesInF32[iFrame * pGainer->config.channels + iChannel] * ma_gainer_calculate_current_gain(pGainer, iChannel) * pGainer->masterVolume;
}
}
@@ -47609,10 +48598,24 @@ MA_API ma_result ma_gainer_process_pcm_frames(ma_gainer* pGainer, void* pFramesO
}
#endif
}
+#endif
return MA_SUCCESS;
}
+MA_API ma_result ma_gainer_process_pcm_frames(ma_gainer* pGainer, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount)
+{
+ if (pGainer == NULL) {
+ return MA_INVALID_ARGS;
+ }
+
+ /*
+ ma_gainer_process_pcm_frames_internal() marks pFramesOut and pFramesIn with MA_RESTRICT which
+ helps with auto-vectorization.
+ */
+ return ma_gainer_process_pcm_frames_internal(pGainer, pFramesOut, pFramesIn, frameCount);
+}
+
static void ma_gainer_set_gain_by_index(ma_gainer* pGainer, float newGain, ma_uint32 iChannel)
{
pGainer->pOldGains[iChannel] = ma_gainer_calculate_current_gain(pGainer, iChannel);
@@ -47664,6 +48667,28 @@ MA_API ma_result ma_gainer_set_gains(ma_gainer* pGainer, float* pNewGains)
return MA_SUCCESS;
}
+MA_API ma_result ma_gainer_set_master_volume(ma_gainer* pGainer, float volume)
+{
+ if (pGainer == NULL) {
+ return MA_INVALID_ARGS;
+ }
+
+ pGainer->masterVolume = volume;
+
+ return MA_SUCCESS;
+}
+
+MA_API ma_result ma_gainer_get_master_volume(const ma_gainer* pGainer, float* pVolume)
+{
+ if (pGainer == NULL || pVolume == NULL) {
+ return MA_INVALID_ARGS;
+ }
+
+ *pVolume = pGainer->masterVolume;
+
+ return MA_SUCCESS;
+}
+
MA_API ma_panner_config ma_panner_config_init(ma_format format, ma_uint32 channels)
{
@@ -48013,7 +49038,7 @@ MA_API void ma_fader_set_fade(ma_fader* pFader, float volumeBeg, float volumeEnd
pFader->cursorInFrames = 0; /* Reset cursor. */
}
-MA_API float ma_fader_get_current_volume(ma_fader* pFader)
+MA_API float ma_fader_get_current_volume(const ma_fader* pFader)
{
if (pFader == NULL) {
return 0.0f;
@@ -48078,6 +49103,8 @@ MA_API float ma_vec3f_len(ma_vec3f v)
return (float)ma_sqrtd(ma_vec3f_len2(v));
}
+
+
MA_API float ma_vec3f_dist(ma_vec3f a, ma_vec3f b)
{
return ma_vec3f_len(ma_vec3f_sub(a, b));
@@ -48085,16 +49112,16 @@ MA_API float ma_vec3f_dist(ma_vec3f a, ma_vec3f b)
MA_API ma_vec3f ma_vec3f_normalize(ma_vec3f v)
{
- float f;
- float l = ma_vec3f_len(v);
- if (l == 0) {
+ float invLen;
+ float len2 = ma_vec3f_len2(v);
+ if (len2 == 0) {
return ma_vec3f_init_3f(0, 0, 0);
}
- f = 1 / l;
- v.x *= f;
- v.y *= f;
- v.z *= f;
+ invLen = ma_rsqrtf(len2);
+ v.x *= invLen;
+ v.y *= invLen;
+ v.z *= invLen;
return v;
}
@@ -48109,6 +49136,35 @@ MA_API ma_vec3f ma_vec3f_cross(ma_vec3f a, ma_vec3f b)
}
+MA_API void ma_atomic_vec3f_init(ma_atomic_vec3f* v, ma_vec3f value)
+{
+ v->v = value;
+ v->lock = 0; /* Important this is initialized to 0. */
+}
+
+MA_API void ma_atomic_vec3f_set(ma_atomic_vec3f* v, ma_vec3f value)
+{
+ ma_spinlock_lock(&v->lock);
+ {
+ v->v = value;
+ }
+ ma_spinlock_unlock(&v->lock);
+}
+
+MA_API ma_vec3f ma_atomic_vec3f_get(ma_atomic_vec3f* v)
+{
+ ma_vec3f r;
+
+ ma_spinlock_lock(&v->lock);
+ {
+ r = v->v;
+ }
+ ma_spinlock_unlock(&v->lock);
+
+ return r;
+}
+
+
static void ma_channel_map_apply_f32(float* pFramesOut, const ma_channel* pChannelMapOut, ma_uint32 channelsOut, const float* pFramesIn, const ma_channel* pChannelMapIn, ma_uint32 channelsIn, ma_uint64 frameCount, ma_channel_mix_mode mode, ma_mono_expansion_mode monoExpansionMode);
static ma_bool32 ma_is_spatial_channel_position(ma_channel channelPosition);
@@ -48359,14 +49415,15 @@ MA_API ma_result ma_spatializer_listener_init_preallocated(const ma_spatializer_
MA_ZERO_MEMORY(pHeap, heapLayout.sizeInBytes);
pListener->config = *pConfig;
- pListener->position = ma_vec3f_init_3f(0, 0, 0);
- pListener->direction = ma_vec3f_init_3f(0, 0, -1);
- pListener->velocity = ma_vec3f_init_3f(0, 0, 0);
+ ma_atomic_vec3f_init(&pListener->position, ma_vec3f_init_3f(0, 0, 0));
+ ma_atomic_vec3f_init(&pListener->direction, ma_vec3f_init_3f(0, 0, -1));
+ ma_atomic_vec3f_init(&pListener->velocity, ma_vec3f_init_3f(0, 0, 0));
pListener->isEnabled = MA_TRUE;
/* Swap the forward direction if we're left handed (it was initialized based on right handed). */
if (pListener->config.handedness == ma_handedness_left) {
- pListener->direction = ma_vec3f_neg(pListener->direction);
+ ma_vec3f negDir = ma_vec3f_neg(ma_spatializer_listener_get_direction(pListener));
+ ma_spatializer_listener_set_direction(pListener, negDir.x, negDir.y, negDir.z);
}
@@ -48469,7 +49526,7 @@ MA_API void ma_spatializer_listener_set_position(ma_spatializer_listener* pListe
return;
}
- pListener->position = ma_vec3f_init_3f(x, y, z);
+ ma_atomic_vec3f_set(&pListener->position, ma_vec3f_init_3f(x, y, z));
}
MA_API ma_vec3f ma_spatializer_listener_get_position(const ma_spatializer_listener* pListener)
@@ -48478,7 +49535,7 @@ MA_API ma_vec3f ma_spatializer_listener_get_position(const ma_spatializer_listen
return ma_vec3f_init_3f(0, 0, 0);
}
- return pListener->position;
+ return ma_atomic_vec3f_get((ma_atomic_vec3f*)&pListener->position); /* Naughty const-cast. It's just for atomically loading the vec3 which should be safe. */
}
MA_API void ma_spatializer_listener_set_direction(ma_spatializer_listener* pListener, float x, float y, float z)
@@ -48487,7 +49544,7 @@ MA_API void ma_spatializer_listener_set_direction(ma_spatializer_listener* pList
return;
}
- pListener->direction = ma_vec3f_init_3f(x, y, z);
+ ma_atomic_vec3f_set(&pListener->direction, ma_vec3f_init_3f(x, y, z));
}
MA_API ma_vec3f ma_spatializer_listener_get_direction(const ma_spatializer_listener* pListener)
@@ -48496,7 +49553,7 @@ MA_API ma_vec3f ma_spatializer_listener_get_direction(const ma_spatializer_liste
return ma_vec3f_init_3f(0, 0, -1);
}
- return pListener->direction;
+ return ma_atomic_vec3f_get((ma_atomic_vec3f*)&pListener->direction); /* Naughty const-cast. It's just for atomically loading the vec3 which should be safe. */
}
MA_API void ma_spatializer_listener_set_velocity(ma_spatializer_listener* pListener, float x, float y, float z)
@@ -48505,7 +49562,7 @@ MA_API void ma_spatializer_listener_set_velocity(ma_spatializer_listener* pListe
return;
}
- pListener->velocity = ma_vec3f_init_3f(x, y, z);
+ ma_atomic_vec3f_set(&pListener->velocity, ma_vec3f_init_3f(x, y, z));
}
MA_API ma_vec3f ma_spatializer_listener_get_velocity(const ma_spatializer_listener* pListener)
@@ -48514,7 +49571,7 @@ MA_API ma_vec3f ma_spatializer_listener_get_velocity(const ma_spatializer_listen
return ma_vec3f_init_3f(0, 0, 0);
}
- return pListener->velocity;
+ return ma_atomic_vec3f_get((ma_atomic_vec3f*)&pListener->velocity); /* Naughty const-cast. It's just for atomically loading the vec3 which should be safe. */
}
MA_API void ma_spatializer_listener_set_speed_of_sound(ma_spatializer_listener* pListener, float speedOfSound)
@@ -48737,14 +49794,15 @@ MA_API ma_result ma_spatializer_init_preallocated(const ma_spatializer_config* p
pSpatializer->dopplerFactor = pConfig->dopplerFactor;
pSpatializer->directionalAttenuationFactor = pConfig->directionalAttenuationFactor;
pSpatializer->gainSmoothTimeInFrames = pConfig->gainSmoothTimeInFrames;
- pSpatializer->position = ma_vec3f_init_3f(0, 0, 0);
- pSpatializer->direction = ma_vec3f_init_3f(0, 0, -1);
- pSpatializer->velocity = ma_vec3f_init_3f(0, 0, 0);
+ ma_atomic_vec3f_init(&pSpatializer->position, ma_vec3f_init_3f(0, 0, 0));
+ ma_atomic_vec3f_init(&pSpatializer->direction, ma_vec3f_init_3f(0, 0, -1));
+ ma_atomic_vec3f_init(&pSpatializer->velocity, ma_vec3f_init_3f(0, 0, 0));
pSpatializer->dopplerPitch = 1;
/* Swap the forward direction if we're left handed (it was initialized based on right handed). */
if (pSpatializer->handedness == ma_handedness_left) {
- pSpatializer->direction = ma_vec3f_neg(pSpatializer->direction);
+ ma_vec3f negDir = ma_vec3f_neg(ma_spatializer_get_direction(pSpatializer));
+ ma_spatializer_set_direction(pSpatializer, negDir.x, negDir.y, negDir.z);
}
/* Channel map. This will be on the heap. */
@@ -48909,7 +49967,7 @@ MA_API ma_result ma_spatializer_process_pcm_frames(ma_spatializer* pSpatializer,
defined by the listener, so we'll grab that here too.
*/
if (pListener != NULL) {
- listenerVel = pListener->velocity;
+ listenerVel = ma_spatializer_listener_get_velocity(pListener);
speedOfSound = pListener->config.speedOfSound;
} else {
listenerVel = ma_vec3f_init_3f(0, 0, 0);
@@ -48918,8 +49976,8 @@ MA_API ma_result ma_spatializer_process_pcm_frames(ma_spatializer* pSpatializer,
if (pListener == NULL || ma_spatializer_get_positioning(pSpatializer) == ma_positioning_relative) {
/* There's no listener or we're using relative positioning. */
- relativePos = pSpatializer->position;
- relativeDir = pSpatializer->direction;
+ relativePos = ma_spatializer_get_position(pSpatializer);
+ relativeDir = ma_spatializer_get_direction(pSpatializer);
} else {
/*
We've found a listener and we're using absolute positioning. We need to transform the
@@ -49079,7 +50137,7 @@ MA_API ma_result ma_spatializer_process_pcm_frames(ma_spatializer* pSpatializer,
0, panning will be most extreme and any sounds that are positioned on the opposite side of the
speaker will be completely silent from that speaker. Not only does this feel uncomfortable, it
doesn't even remotely represent the real world at all because sounds that come from your right side
- are still clearly audible from your left side. Setting "dMin" to 1 will result in no panning at
+ are still clearly audible from your left side. Setting "dMin" to 1 will result in no panning at
all, which is also not ideal. By setting it to something greater than 0, the spatialization effect
becomes much less dramatic and a lot more bearable.
@@ -49148,7 +50206,7 @@ MA_API ma_result ma_spatializer_process_pcm_frames(ma_spatializer* pSpatializer,
source.
*/
if (dopplerFactor > 0) {
- pSpatializer->dopplerPitch = ma_doppler_pitch(ma_vec3f_sub(pListener->position, pSpatializer->position), pSpatializer->velocity, listenerVel, speedOfSound, dopplerFactor);
+ pSpatializer->dopplerPitch = ma_doppler_pitch(ma_vec3f_sub(ma_spatializer_listener_get_position(pListener), ma_spatializer_get_position(pSpatializer)), ma_spatializer_get_velocity(pSpatializer), listenerVel, speedOfSound, dopplerFactor);
} else {
pSpatializer->dopplerPitch = 1;
}
@@ -49157,6 +50215,24 @@ MA_API ma_result ma_spatializer_process_pcm_frames(ma_spatializer* pSpatializer,
return MA_SUCCESS;
}
+MA_API ma_result ma_spatializer_set_master_volume(ma_spatializer* pSpatializer, float volume)
+{
+ if (pSpatializer == NULL) {
+ return MA_INVALID_ARGS;
+ }
+
+ return ma_gainer_set_master_volume(&pSpatializer->gainer, volume);
+}
+
+MA_API ma_result ma_spatializer_get_master_volume(const ma_spatializer* pSpatializer, float* pVolume)
+{
+ if (pSpatializer == NULL) {
+ return MA_INVALID_ARGS;
+ }
+
+ return ma_gainer_get_master_volume(&pSpatializer->gainer, pVolume);
+}
+
MA_API ma_uint32 ma_spatializer_get_input_channels(const ma_spatializer* pSpatializer)
{
if (pSpatializer == NULL) {
@@ -49373,7 +50449,7 @@ MA_API void ma_spatializer_set_position(ma_spatializer* pSpatializer, float x, f
return;
}
- pSpatializer->position = ma_vec3f_init_3f(x, y, z);
+ ma_atomic_vec3f_set(&pSpatializer->position, ma_vec3f_init_3f(x, y, z));
}
MA_API ma_vec3f ma_spatializer_get_position(const ma_spatializer* pSpatializer)
@@ -49382,7 +50458,7 @@ MA_API ma_vec3f ma_spatializer_get_position(const ma_spatializer* pSpatializer)
return ma_vec3f_init_3f(0, 0, 0);
}
- return pSpatializer->position;
+ return ma_atomic_vec3f_get((ma_atomic_vec3f*)&pSpatializer->position); /* Naughty const-cast. It's just for atomically loading the vec3 which should be safe. */
}
MA_API void ma_spatializer_set_direction(ma_spatializer* pSpatializer, float x, float y, float z)
@@ -49391,7 +50467,7 @@ MA_API void ma_spatializer_set_direction(ma_spatializer* pSpatializer, float x,
return;
}
- pSpatializer->direction = ma_vec3f_init_3f(x, y, z);
+ ma_atomic_vec3f_set(&pSpatializer->direction, ma_vec3f_init_3f(x, y, z));
}
MA_API ma_vec3f ma_spatializer_get_direction(const ma_spatializer* pSpatializer)
@@ -49400,7 +50476,7 @@ MA_API ma_vec3f ma_spatializer_get_direction(const ma_spatializer* pSpatializer)
return ma_vec3f_init_3f(0, 0, -1);
}
- return pSpatializer->direction;
+ return ma_atomic_vec3f_get((ma_atomic_vec3f*)&pSpatializer->direction); /* Naughty const-cast. It's just for atomically loading the vec3 which should be safe. */
}
MA_API void ma_spatializer_set_velocity(ma_spatializer* pSpatializer, float x, float y, float z)
@@ -49409,7 +50485,7 @@ MA_API void ma_spatializer_set_velocity(ma_spatializer* pSpatializer, float x, f
return;
}
- pSpatializer->velocity = ma_vec3f_init_3f(x, y, z);
+ ma_atomic_vec3f_set(&pSpatializer->velocity, ma_vec3f_init_3f(x, y, z));
}
MA_API ma_vec3f ma_spatializer_get_velocity(const ma_spatializer* pSpatializer)
@@ -49418,7 +50494,7 @@ MA_API ma_vec3f ma_spatializer_get_velocity(const ma_spatializer* pSpatializer)
return ma_vec3f_init_3f(0, 0, 0);
}
- return pSpatializer->velocity;
+ return ma_atomic_vec3f_get((ma_atomic_vec3f*)&pSpatializer->velocity); /* Naughty const-cast. It's just for atomically loading the vec3 which should be safe. */
}
MA_API void ma_spatializer_get_relative_position_and_direction(const ma_spatializer* pSpatializer, const ma_spatializer_listener* pListener, ma_vec3f* pRelativePos, ma_vec3f* pRelativeDir)
@@ -49442,23 +50518,32 @@ MA_API void ma_spatializer_get_relative_position_and_direction(const ma_spatiali
if (pListener == NULL || ma_spatializer_get_positioning(pSpatializer) == ma_positioning_relative) {
/* There's no listener or we're using relative positioning. */
if (pRelativePos != NULL) {
- *pRelativePos = pSpatializer->position;
+ *pRelativePos = ma_spatializer_get_position(pSpatializer);
}
if (pRelativeDir != NULL) {
- *pRelativeDir = pSpatializer->direction;
+ *pRelativeDir = ma_spatializer_get_direction(pSpatializer);
}
} else {
+ ma_vec3f spatializerPosition;
+ ma_vec3f spatializerDirection;
+ ma_vec3f listenerPosition;
+ ma_vec3f listenerDirection;
ma_vec3f v;
ma_vec3f axisX;
ma_vec3f axisY;
ma_vec3f axisZ;
float m[4][4];
+ spatializerPosition = ma_spatializer_get_position(pSpatializer);
+ spatializerDirection = ma_spatializer_get_direction(pSpatializer);
+ listenerPosition = ma_spatializer_listener_get_position(pListener);
+ listenerDirection = ma_spatializer_listener_get_direction(pListener);
+
/*
We need to calcualte the right vector from our forward and up vectors. This is done with
a cross product.
*/
- axisZ = ma_vec3f_normalize(pListener->direction); /* Normalization required here because we can't trust the caller. */
+ axisZ = ma_vec3f_normalize(listenerDirection); /* Normalization required here because we can't trust the caller. */
axisX = ma_vec3f_normalize(ma_vec3f_cross(axisZ, pListener->config.worldUp)); /* Normalization required here because the world up vector may not be perpendicular with the forward vector. */
/*
@@ -49483,9 +50568,9 @@ MA_API void ma_spatializer_get_relative_position_and_direction(const ma_spatiali
}
/* Lookat. */
- m[0][0] = axisX.x; m[1][0] = axisX.y; m[2][0] = axisX.z; m[3][0] = -ma_vec3f_dot(axisX, pListener->position);
- m[0][1] = axisY.x; m[1][1] = axisY.y; m[2][1] = axisY.z; m[3][1] = -ma_vec3f_dot(axisY, pListener->position);
- m[0][2] = -axisZ.x; m[1][2] = -axisZ.y; m[2][2] = -axisZ.z; m[3][2] = -ma_vec3f_dot(ma_vec3f_neg(axisZ), pListener->position);
+ m[0][0] = axisX.x; m[1][0] = axisX.y; m[2][0] = axisX.z; m[3][0] = -ma_vec3f_dot(axisX, listenerPosition);
+ m[0][1] = axisY.x; m[1][1] = axisY.y; m[2][1] = axisY.z; m[3][1] = -ma_vec3f_dot(axisY, listenerPosition);
+ m[0][2] = -axisZ.x; m[1][2] = -axisZ.y; m[2][2] = -axisZ.z; m[3][2] = -ma_vec3f_dot(ma_vec3f_neg(axisZ), listenerPosition);
m[0][3] = 0; m[1][3] = 0; m[2][3] = 0; m[3][3] = 1;
/*
@@ -49494,7 +50579,7 @@ MA_API void ma_spatializer_get_relative_position_and_direction(const ma_spatiali
origin which makes things simpler.
*/
if (pRelativePos != NULL) {
- v = pSpatializer->position;
+ v = spatializerPosition;
pRelativePos->x = m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z + m[3][0] * 1;
pRelativePos->y = m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z + m[3][1] * 1;
pRelativePos->z = m[0][2] * v.x + m[1][2] * v.y + m[2][2] * v.z + m[3][2] * 1;
@@ -49505,7 +50590,7 @@ MA_API void ma_spatializer_get_relative_position_and_direction(const ma_spatiali
rotation of the listener.
*/
if (pRelativeDir != NULL) {
- v = pSpatializer->direction;
+ v = spatializerDirection;
pRelativeDir->x = m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z;
pRelativeDir->y = m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z;
pRelativeDir->z = m[0][2] * v.x + m[1][2] * v.y + m[2][2] * v.z;
@@ -51245,7 +52330,7 @@ static ma_result ma_channel_map_apply_mono_out_f32(float* pFramesOut, const floa
return MA_SUCCESS;
}
-static ma_result ma_channel_map_apply_mono_in_f32(float* pFramesOut, const ma_channel* pChannelMapOut, ma_uint32 channelsOut, const float* pFramesIn, ma_uint64 frameCount, ma_mono_expansion_mode monoExpansionMode)
+static ma_result ma_channel_map_apply_mono_in_f32(float* MA_RESTRICT pFramesOut, const ma_channel* pChannelMapOut, ma_uint32 channelsOut, const float* MA_RESTRICT pFramesIn, ma_uint64 frameCount, ma_mono_expansion_mode monoExpansionMode)
{
ma_uint64 iFrame;
ma_uint32 iChannelOut;
@@ -51350,16 +52435,123 @@ static ma_result ma_channel_map_apply_mono_in_f32(float* pFramesOut, const ma_ch
{
default_handler:
{
- for (iFrame = 0; iFrame < frameCount; iFrame += 1) {
+ if (channelsOut <= MA_MAX_CHANNELS) {
+ ma_bool32 hasEmptyChannel = MA_FALSE;
+ ma_channel channelPositions[MA_MAX_CHANNELS];
for (iChannelOut = 0; iChannelOut < channelsOut; iChannelOut += 1) {
- ma_channel channelOut = ma_channel_map_get_channel(pChannelMapOut, channelsOut, iChannelOut);
- if (channelOut != MA_CHANNEL_NONE) {
- pFramesOut[iChannelOut] = pFramesIn[0];
+ channelPositions[iChannelOut] = ma_channel_map_get_channel(pChannelMapOut, channelsOut, iChannelOut);
+ if (channelPositions[iChannelOut] == MA_CHANNEL_NONE) {
+ hasEmptyChannel = MA_TRUE;
}
}
- pFramesOut += channelsOut;
- pFramesIn += 1;
+ if (hasEmptyChannel == MA_FALSE) {
+ /*
+ Faster path when there's no MA_CHANNEL_NONE channel positions. This should hopefully
+ help the compiler with auto-vectorization.m
+ */
+ if (channelsOut == 2) {
+ #if defined(MA_SUPPORT_SSE2)
+ if (ma_has_sse2()) {
+ /* We want to do two frames in each iteration. */
+ ma_uint64 unrolledFrameCount = frameCount >> 1;
+
+ for (iFrame = 0; iFrame < unrolledFrameCount; iFrame += 1) {
+ __m128 in0 = _mm_set1_ps(pFramesIn[iFrame*2 + 0]);
+ __m128 in1 = _mm_set1_ps(pFramesIn[iFrame*2 + 1]);
+ _mm_storeu_ps(&pFramesOut[iFrame*4 + 0], _mm_shuffle_ps(in1, in0, _MM_SHUFFLE(0, 0, 0, 0)));
+ }
+
+ /* Tail. */
+ iFrame = unrolledFrameCount << 1;
+ goto generic_on_fastpath;
+ } else
+ #endif
+ {
+ for (iFrame = 0; iFrame < frameCount; iFrame += 1) {
+ for (iChannelOut = 0; iChannelOut < 2; iChannelOut += 1) {
+ pFramesOut[iFrame*2 + iChannelOut] = pFramesIn[iFrame];
+ }
+ }
+ }
+ } else if (channelsOut == 6) {
+ #if defined(MA_SUPPORT_SSE2)
+ if (ma_has_sse2()) {
+ /* We want to do two frames in each iteration so we can have a multiple of 4 samples. */
+ ma_uint64 unrolledFrameCount = frameCount >> 1;
+
+ for (iFrame = 0; iFrame < unrolledFrameCount; iFrame += 1) {
+ __m128 in0 = _mm_set1_ps(pFramesIn[iFrame*2 + 0]);
+ __m128 in1 = _mm_set1_ps(pFramesIn[iFrame*2 + 1]);
+
+ _mm_storeu_ps(&pFramesOut[iFrame*12 + 0], in0);
+ _mm_storeu_ps(&pFramesOut[iFrame*12 + 4], _mm_shuffle_ps(in1, in0, _MM_SHUFFLE(0, 0, 0, 0)));
+ _mm_storeu_ps(&pFramesOut[iFrame*12 + 8], in1);
+ }
+
+ /* Tail. */
+ iFrame = unrolledFrameCount << 1;
+ goto generic_on_fastpath;
+ } else
+ #endif
+ {
+ for (iFrame = 0; iFrame < frameCount; iFrame += 1) {
+ for (iChannelOut = 0; iChannelOut < 6; iChannelOut += 1) {
+ pFramesOut[iFrame*6 + iChannelOut] = pFramesIn[iFrame];
+ }
+ }
+ }
+ } else if (channelsOut == 8) {
+ #if defined(MA_SUPPORT_SSE2)
+ if (ma_has_sse2()) {
+ for (iFrame = 0; iFrame < frameCount; iFrame += 1) {
+ __m128 in = _mm_set1_ps(pFramesIn[iFrame]);
+ _mm_storeu_ps(&pFramesOut[iFrame*8 + 0], in);
+ _mm_storeu_ps(&pFramesOut[iFrame*8 + 4], in);
+ }
+ } else
+ #endif
+ {
+ for (iFrame = 0; iFrame < frameCount; iFrame += 1) {
+ for (iChannelOut = 0; iChannelOut < 8; iChannelOut += 1) {
+ pFramesOut[iFrame*8 + iChannelOut] = pFramesIn[iFrame];
+ }
+ }
+ }
+ } else {
+ iFrame = 0;
+
+ #if defined(MA_SUPPORT_SSE2) /* For silencing a warning with non-x86 builds. */
+ generic_on_fastpath:
+ #endif
+ {
+ for (; iFrame < frameCount; iFrame += 1) {
+ for (iChannelOut = 0; iChannelOut < channelsOut; iChannelOut += 1) {
+ pFramesOut[iFrame*channelsOut + iChannelOut] = pFramesIn[iFrame];
+ }
+ }
+ }
+ }
+ } else {
+ /* Slow path. Need to handle MA_CHANNEL_NONE. */
+ for (iFrame = 0; iFrame < frameCount; iFrame += 1) {
+ for (iChannelOut = 0; iChannelOut < channelsOut; iChannelOut += 1) {
+ if (channelPositions[iChannelOut] != MA_CHANNEL_NONE) {
+ pFramesOut[iFrame*channelsOut + iChannelOut] = pFramesIn[iFrame];
+ }
+ }
+ }
+ }
+ } else {
+ /* Slow path. Too many channels to store on the stack. */
+ for (iFrame = 0; iFrame < frameCount; iFrame += 1) {
+ for (iChannelOut = 0; iChannelOut < channelsOut; iChannelOut += 1) {
+ ma_channel channelOut = ma_channel_map_get_channel(pChannelMapOut, channelsOut, iChannelOut);
+ if (channelOut != MA_CHANNEL_NONE) {
+ pFramesOut[iFrame*channelsOut + iChannelOut] = pFramesIn[iFrame];
+ }
+ }
+ }
}
}
} break;
@@ -51426,19 +52618,105 @@ static void ma_channel_map_apply_f32(float* pFramesOut, const ma_channel* pChann
}
}
- for (iFrame = 0; iFrame < frameCount; iFrame += 1) {
+ iFrame = 0;
+
+ /* Experiment: Try an optimized unroll for some specific cases to see how it improves performance. RESULT: Good gains. */
+ if (channelsOut == 8) {
+ /* Experiment 2: Expand the inner loop to see what kind of different it makes. RESULT: Small, but worthwhile gain. */
+ if (channelsIn == 2) {
+ for (; iFrame < frameCount; iFrame += 1) {
+ float accumulation[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+
+ accumulation[0] += pFramesIn[iFrame*2 + 0] * weights[0][0];
+ accumulation[1] += pFramesIn[iFrame*2 + 0] * weights[1][0];
+ accumulation[2] += pFramesIn[iFrame*2 + 0] * weights[2][0];
+ accumulation[3] += pFramesIn[iFrame*2 + 0] * weights[3][0];
+ accumulation[4] += pFramesIn[iFrame*2 + 0] * weights[4][0];
+ accumulation[5] += pFramesIn[iFrame*2 + 0] * weights[5][0];
+ accumulation[6] += pFramesIn[iFrame*2 + 0] * weights[6][0];
+ accumulation[7] += pFramesIn[iFrame*2 + 0] * weights[7][0];
+
+ accumulation[0] += pFramesIn[iFrame*2 + 1] * weights[0][1];
+ accumulation[1] += pFramesIn[iFrame*2 + 1] * weights[1][1];
+ accumulation[2] += pFramesIn[iFrame*2 + 1] * weights[2][1];
+ accumulation[3] += pFramesIn[iFrame*2 + 1] * weights[3][1];
+ accumulation[4] += pFramesIn[iFrame*2 + 1] * weights[4][1];
+ accumulation[5] += pFramesIn[iFrame*2 + 1] * weights[5][1];
+ accumulation[6] += pFramesIn[iFrame*2 + 1] * weights[6][1];
+ accumulation[7] += pFramesIn[iFrame*2 + 1] * weights[7][1];
+
+ pFramesOut[iFrame*8 + 0] = accumulation[0];
+ pFramesOut[iFrame*8 + 1] = accumulation[1];
+ pFramesOut[iFrame*8 + 2] = accumulation[2];
+ pFramesOut[iFrame*8 + 3] = accumulation[3];
+ pFramesOut[iFrame*8 + 4] = accumulation[4];
+ pFramesOut[iFrame*8 + 5] = accumulation[5];
+ pFramesOut[iFrame*8 + 6] = accumulation[6];
+ pFramesOut[iFrame*8 + 7] = accumulation[7];
+ }
+ } else {
+ /* When outputting to 8 channels, we can do everything in groups of two 4x SIMD operations. */
+ for (; iFrame < frameCount; iFrame += 1) {
+ float accumulation[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+
+ for (iChannelIn = 0; iChannelIn < channelsIn; iChannelIn += 1) {
+ accumulation[0] += pFramesIn[iFrame*channelsIn + iChannelIn] * weights[0][iChannelIn];
+ accumulation[1] += pFramesIn[iFrame*channelsIn + iChannelIn] * weights[1][iChannelIn];
+ accumulation[2] += pFramesIn[iFrame*channelsIn + iChannelIn] * weights[2][iChannelIn];
+ accumulation[3] += pFramesIn[iFrame*channelsIn + iChannelIn] * weights[3][iChannelIn];
+ accumulation[4] += pFramesIn[iFrame*channelsIn + iChannelIn] * weights[4][iChannelIn];
+ accumulation[5] += pFramesIn[iFrame*channelsIn + iChannelIn] * weights[5][iChannelIn];
+ accumulation[6] += pFramesIn[iFrame*channelsIn + iChannelIn] * weights[6][iChannelIn];
+ accumulation[7] += pFramesIn[iFrame*channelsIn + iChannelIn] * weights[7][iChannelIn];
+ }
+
+ pFramesOut[iFrame*8 + 0] = accumulation[0];
+ pFramesOut[iFrame*8 + 1] = accumulation[1];
+ pFramesOut[iFrame*8 + 2] = accumulation[2];
+ pFramesOut[iFrame*8 + 3] = accumulation[3];
+ pFramesOut[iFrame*8 + 4] = accumulation[4];
+ pFramesOut[iFrame*8 + 5] = accumulation[5];
+ pFramesOut[iFrame*8 + 6] = accumulation[6];
+ pFramesOut[iFrame*8 + 7] = accumulation[7];
+ }
+ }
+ } else if (channelsOut == 6) {
+ /*
+ When outputting to 6 channels we unfortunately don't have a nice multiple of 4 to do 4x SIMD operations. Instead we'll
+ expand our weights and do two frames at a time.
+ */
+ for (; iFrame < frameCount; iFrame += 1) {
+ float accumulation[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+
+ for (iChannelIn = 0; iChannelIn < channelsIn; iChannelIn += 1) {
+ accumulation[0] += pFramesIn[iFrame*channelsIn + iChannelIn] * weights[0][iChannelIn];
+ accumulation[1] += pFramesIn[iFrame*channelsIn + iChannelIn] * weights[1][iChannelIn];
+ accumulation[2] += pFramesIn[iFrame*channelsIn + iChannelIn] * weights[2][iChannelIn];
+ accumulation[3] += pFramesIn[iFrame*channelsIn + iChannelIn] * weights[3][iChannelIn];
+ accumulation[4] += pFramesIn[iFrame*channelsIn + iChannelIn] * weights[4][iChannelIn];
+ accumulation[5] += pFramesIn[iFrame*channelsIn + iChannelIn] * weights[5][iChannelIn];
+ }
+
+ pFramesOut[iFrame*6 + 0] = accumulation[0];
+ pFramesOut[iFrame*6 + 1] = accumulation[1];
+ pFramesOut[iFrame*6 + 2] = accumulation[2];
+ pFramesOut[iFrame*6 + 3] = accumulation[3];
+ pFramesOut[iFrame*6 + 4] = accumulation[4];
+ pFramesOut[iFrame*6 + 5] = accumulation[5];
+ }
+ }
+
+ /* Leftover frames. */
+ for (; iFrame < frameCount; iFrame += 1) {
for (iChannelOut = 0; iChannelOut < channelsOut; iChannelOut += 1) {
float accumulation = 0;
for (iChannelIn = 0; iChannelIn < channelsIn; iChannelIn += 1) {
- accumulation += pFramesIn[iChannelIn] * weights[iChannelOut][iChannelIn];
+ accumulation += pFramesIn[iFrame*channelsIn + iChannelIn] * weights[iChannelOut][iChannelIn];
}
- pFramesOut[iChannelOut] = accumulation;
+ pFramesOut[iFrame*channelsOut + iChannelOut] = accumulation;
}
-
- pFramesOut += channelsOut;
- pFramesIn += channelsIn;
}
} else {
/* Cannot pre-compute weights because not enough room in stack-allocated buffer. */
@@ -51449,14 +52727,11 @@ static void ma_channel_map_apply_f32(float* pFramesOut, const ma_channel* pChann
for (iChannelIn = 0; iChannelIn < channelsIn; iChannelIn += 1) {
ma_channel channelIn = ma_channel_map_get_channel(pChannelMapIn, channelsIn, iChannelIn);
- accumulation += pFramesIn[iChannelIn] * ma_calculate_channel_position_rectangular_weight(channelOut, channelIn);
+ accumulation += pFramesIn[iFrame*channelsIn + iChannelIn] * ma_calculate_channel_position_rectangular_weight(channelOut, channelIn);
}
- pFramesOut[iChannelOut] = accumulation;
+ pFramesOut[iFrame*channelsOut + iChannelOut] = accumulation;
}
-
- pFramesOut += channelsOut;
- pFramesIn += channelsIn;
}
}
}
@@ -51638,7 +52913,7 @@ MA_API ma_result ma_channel_converter_init_preallocated(const ma_channel_convert
/*
We now need to fill out our weights table. This is determined by the mixing mode.
*/
-
+
/* In all cases we need to make sure all channels that are present in both channel maps have a 1:1 mapping. */
for (iChannelIn = 0; iChannelIn < pConverter->channelsIn; ++iChannelIn) {
ma_channel channelPosIn = ma_channel_map_get_channel(pConverter->pChannelMapIn, pConverter->channelsIn, iChannelIn);
@@ -55284,6 +56559,11 @@ MA_API ma_uint32 ma_get_bytes_per_sample(ma_format format)
+#define MA_DATA_SOURCE_DEFAULT_RANGE_BEG 0
+#define MA_DATA_SOURCE_DEFAULT_RANGE_END ~((ma_uint64)0)
+#define MA_DATA_SOURCE_DEFAULT_LOOP_POINT_BEG 0
+#define MA_DATA_SOURCE_DEFAULT_LOOP_POINT_END ~((ma_uint64)0)
+
MA_API ma_data_source_config ma_data_source_config_init(void)
{
ma_data_source_config config;
@@ -55309,10 +56589,10 @@ MA_API ma_result ma_data_source_init(const ma_data_source_config* pConfig, ma_da
}
pDataSourceBase->vtable = pConfig->vtable;
- pDataSourceBase->rangeBegInFrames = 0;
- pDataSourceBase->rangeEndInFrames = ~((ma_uint64)0);
- pDataSourceBase->loopBegInFrames = 0;
- pDataSourceBase->loopEndInFrames = ~((ma_uint64)0);
+ pDataSourceBase->rangeBegInFrames = MA_DATA_SOURCE_DEFAULT_RANGE_BEG;
+ pDataSourceBase->rangeEndInFrames = MA_DATA_SOURCE_DEFAULT_RANGE_END;
+ pDataSourceBase->loopBegInFrames = MA_DATA_SOURCE_DEFAULT_LOOP_POINT_BEG;
+ pDataSourceBase->loopEndInFrames = MA_DATA_SOURCE_DEFAULT_LOOP_POINT_END;
pDataSourceBase->pCurrent = pDataSource; /* Always read from ourself by default. */
pDataSourceBase->pNext = NULL;
pDataSourceBase->onGetNext = NULL;
@@ -55378,18 +56658,23 @@ static ma_result ma_data_source_read_pcm_frames_within_range(ma_data_source* pDa
result = pDataSourceBase->vtable->onRead(pDataSourceBase, pFramesOut, frameCount, &framesRead);
} else {
/* Need to clamp to within the range. */
- ma_uint64 cursor;
+ ma_uint64 relativeCursor;
+ ma_uint64 absoluteCursor;
- result = ma_data_source_get_cursor_in_pcm_frames(pDataSourceBase, &cursor);
+ result = ma_data_source_get_cursor_in_pcm_frames(pDataSourceBase, &relativeCursor);
if (result != MA_SUCCESS) {
/* Failed to retrieve the cursor. Cannot read within a range or loop points. Just read like normal - this may happen for things like noise data sources where it doesn't really matter. */
result = pDataSourceBase->vtable->onRead(pDataSourceBase, pFramesOut, frameCount, &framesRead);
} else {
+ ma_uint64 rangeBeg;
ma_uint64 rangeEnd;
/* We have the cursor. We need to make sure we don't read beyond our range. */
+ rangeBeg = pDataSourceBase->rangeBegInFrames;
rangeEnd = pDataSourceBase->rangeEndInFrames;
+ absoluteCursor = rangeBeg + relativeCursor;
+
/* If looping, make sure we're within range. */
if (loop) {
if (pDataSourceBase->loopEndInFrames != ~((ma_uint64)0)) {
@@ -55397,8 +56682,8 @@ static ma_result ma_data_source_read_pcm_frames_within_range(ma_data_source* pDa
}
}
- if (frameCount > (rangeEnd - cursor) && rangeEnd != ~((ma_uint64)0)) {
- frameCount = (rangeEnd - cursor);
+ if (frameCount > (rangeEnd - absoluteCursor) && rangeEnd != ~((ma_uint64)0)) {
+ frameCount = (rangeEnd - absoluteCursor);
}
/*
@@ -55803,9 +57088,9 @@ MA_API ma_result ma_data_source_set_range_in_pcm_frames(ma_data_source* pDataSou
{
ma_data_source_base* pDataSourceBase = (ma_data_source_base*)pDataSource;
ma_result result;
- ma_uint64 cursor;
- ma_uint64 loopBegAbsolute;
- ma_uint64 loopEndAbsolute;
+ ma_uint64 relativeCursor;
+ ma_uint64 absoluteCursor;
+ ma_bool32 doSeekAdjustment = MA_FALSE;
if (pDataSource == NULL) {
return MA_INVALID_ARGS;
@@ -55816,51 +57101,51 @@ MA_API ma_result ma_data_source_set_range_in_pcm_frames(ma_data_source* pDataSou
}
/*
- The loop points need to be updated. We'll be storing the loop points relative to the range. We'll update
- these so that they maintain their absolute positioning. The loop points will then be clamped to the range.
+ We may need to adjust the position of the cursor to ensure it's clamped to the range. Grab it now
+ so we can calculate it's absolute position before we change the range.
*/
- loopBegAbsolute = pDataSourceBase->loopBegInFrames + pDataSourceBase->rangeBegInFrames;
- loopEndAbsolute = pDataSourceBase->loopEndInFrames + ((pDataSourceBase->loopEndInFrames != ~((ma_uint64)0)) ? pDataSourceBase->rangeBegInFrames : 0);
+ result = ma_data_source_get_cursor_in_pcm_frames(pDataSource, &relativeCursor);
+ if (result == MA_SUCCESS) {
+ doSeekAdjustment = MA_TRUE;
+ absoluteCursor = relativeCursor + pDataSourceBase->rangeBegInFrames;
+ } else {
+ /*
+ We couldn't get the position of the cursor. It probably means the data source has no notion
+ of a cursor. We'll just leave it at position 0. Don't treat this as an error.
+ */
+ doSeekAdjustment = MA_FALSE;
+ relativeCursor = 0;
+ absoluteCursor = 0;
+ }
pDataSourceBase->rangeBegInFrames = rangeBegInFrames;
pDataSourceBase->rangeEndInFrames = rangeEndInFrames;
- /* Make the loop points relative again, and make sure they're clamped to within the range. */
- if (loopBegAbsolute > pDataSourceBase->rangeBegInFrames) {
- pDataSourceBase->loopBegInFrames = loopBegAbsolute - pDataSourceBase->rangeBegInFrames;
- } else {
- pDataSourceBase->loopBegInFrames = 0;
- }
+ /*
+ The commented out logic below was intended to maintain loop points in response to a change in the
+ range. However, this is not useful because it results in the sound breaking when you move the range
+ outside of the old loop points. I'm simplifying this by simply resetting the loop points. The
+ caller is expected to update their loop points if they change the range.
- if (pDataSourceBase->loopBegInFrames > pDataSourceBase->rangeEndInFrames) {
- pDataSourceBase->loopBegInFrames = pDataSourceBase->rangeEndInFrames;
- }
+ In practice this should be mostly a non-issue because the majority of the time the range will be
+ set once right after initialization.
+ */
+ pDataSourceBase->loopBegInFrames = 0;
+ pDataSourceBase->loopEndInFrames = ~((ma_uint64)0);
- /* Only need to update the loop end point if it's not -1. */
- if (loopEndAbsolute != ~((ma_uint64)0)) {
- if (loopEndAbsolute > pDataSourceBase->rangeBegInFrames) {
- pDataSourceBase->loopEndInFrames = loopEndAbsolute - pDataSourceBase->rangeBegInFrames;
- } else {
- pDataSourceBase->loopEndInFrames = 0;
- }
-
- if (pDataSourceBase->loopEndInFrames > pDataSourceBase->rangeEndInFrames && pDataSourceBase->loopEndInFrames) {
- pDataSourceBase->loopEndInFrames = pDataSourceBase->rangeEndInFrames;
- }
- }
-
-
- /* If the new range is past the current cursor position we need to seek to it. */
- result = ma_data_source_get_cursor_in_pcm_frames(pDataSource, &cursor);
- if (result == MA_SUCCESS) {
- /* Seek to within range. Note that our seek positions here are relative to the new range. */
- if (cursor < rangeBegInFrames) {
+
+ /*
+ Seek to within range. Note that our seek positions here are relative to the new range. We don't want
+ do do this if we failed to retrieve the cursor earlier on because it probably means the data source
+ has no notion of a cursor. In practice the seek would probably fail (which we silently ignore), but
+ I'm just not even going to attempt it.
+ */
+ if (doSeekAdjustment) {
+ if (absoluteCursor < rangeBegInFrames) {
ma_data_source_seek_to_pcm_frame(pDataSource, 0);
- } else if (cursor > rangeEndInFrames) {
+ } else if (absoluteCursor > rangeEndInFrames) {
ma_data_source_seek_to_pcm_frame(pDataSource, rangeEndInFrames - rangeBegInFrames);
}
- } else {
- /* We failed to get the cursor position. Probably means the data source has no notion of a cursor such a noise data source. Just pretend the seeking worked. */
}
return MA_SUCCESS;
@@ -57870,7 +59155,7 @@ extern "C" {
#define DRWAV_XSTRINGIFY(x) DRWAV_STRINGIFY(x)
#define DRWAV_VERSION_MAJOR 0
#define DRWAV_VERSION_MINOR 13
-#define DRWAV_VERSION_REVISION 7
+#define DRWAV_VERSION_REVISION 8
#define DRWAV_VERSION_STRING DRWAV_XSTRINGIFY(DRWAV_VERSION_MAJOR) "." DRWAV_XSTRINGIFY(DRWAV_VERSION_MINOR) "." DRWAV_XSTRINGIFY(DRWAV_VERSION_REVISION)
#include
typedef signed char drwav_int8;
@@ -61292,6 +62577,7 @@ typedef struct
ma_uint8* pData;
size_t dataSize;
size_t dataCapacity;
+ size_t audioStartOffsetInBytes;
ma_uint32 framesConsumed; /* The number of frames consumed in ppPacketData. */
ma_uint32 framesRemaining; /* The number of frames remaining in ppPacketData. */
float** ppPacketData;
@@ -61458,6 +62744,13 @@ MA_API ma_result ma_stbvorbis_init(ma_read_proc onRead, ma_seek_proc onSeek, ma_
*/
dataSize -= (size_t)consumedDataSize; /* Consume the data. */
MA_MOVE_MEMORY(pData, ma_offset_ptr(pData, consumedDataSize), dataSize);
+
+ /*
+ We need to track the start point so we can seek back to the start of the audio
+ data when seeking.
+ */
+ pVorbis->push.audioStartOffsetInBytes = consumedDataSize;
+
break;
} else {
/* Failed to open the decoder. */
@@ -61791,13 +63084,14 @@ MA_API ma_result ma_stbvorbis_seek_to_pcm_frame(ma_stbvorbis* pVorbis, ma_uint64
TODO: Use seeking logic documented for stb_vorbis_flush_pushdata().
*/
- /* Seek to the start of the file to begin with. */
- result = pVorbis->onSeek(pVorbis->pReadSeekTellUserData, 0, ma_seek_origin_start);
+ /* Seek to the start of the audio data in the file to begin with. */
+ result = pVorbis->onSeek(pVorbis->pReadSeekTellUserData, pVorbis->push.audioStartOffsetInBytes, ma_seek_origin_start);
if (result != MA_SUCCESS) {
return result;
}
stb_vorbis_flush_pushdata(pVorbis->stb);
+ pVorbis->push.framesConsumed = 0;
pVorbis->push.framesRemaining = 0;
pVorbis->push.dataSize = 0;
@@ -64360,8 +65654,15 @@ MA_API ma_result ma_noise_set_type(ma_noise* pNoise, ma_noise_type type)
return MA_INVALID_ARGS;
}
- pNoise->config.type = type;
- return MA_SUCCESS;
+ /*
+ This function should never have been implemented in the first place. Changing the type dynamically is not
+ supported. Instead you need to uninitialize and reinitiailize a fresh `ma_noise` object. This function
+ will be removed in version 0.12.
+ */
+ MA_ASSERT(MA_FALSE);
+ (void)type;
+
+ return MA_INVALID_OPERATION;
}
static MA_INLINE float ma_noise_f32_white(ma_noise* pNoise)
@@ -65573,8 +66874,11 @@ MA_API ma_resource_manager_data_source_config ma_resource_manager_data_source_co
ma_resource_manager_data_source_config config;
MA_ZERO_OBJECT(&config);
- config.rangeEndInPCMFrames = ~((ma_uint64)0);
- config.loopPointEndInPCMFrames = ~((ma_uint64)0);
+ config.rangeBegInPCMFrames = MA_DATA_SOURCE_DEFAULT_RANGE_BEG;
+ config.rangeEndInPCMFrames = MA_DATA_SOURCE_DEFAULT_RANGE_END;
+ config.loopPointBegInPCMFrames = MA_DATA_SOURCE_DEFAULT_LOOP_POINT_BEG;
+ config.loopPointEndInPCMFrames = MA_DATA_SOURCE_DEFAULT_LOOP_POINT_END;
+ config.isLooping = MA_FALSE;
return config;
}
@@ -65623,8 +66927,17 @@ static ma_result ma_resource_manager__init_decoder(ma_resource_manager* pResourc
return MA_SUCCESS;
}
+static ma_bool32 ma_resource_manager_data_buffer_has_connector(ma_resource_manager_data_buffer* pDataBuffer)
+{
+ return ma_atomic_bool32_get(&pDataBuffer->isConnectorInitialized);
+}
+
static ma_data_source* ma_resource_manager_data_buffer_get_connector(ma_resource_manager_data_buffer* pDataBuffer)
{
+ if (ma_resource_manager_data_buffer_has_connector(pDataBuffer) == MA_FALSE) {
+ return NULL; /* Connector not yet initialized. */
+ }
+
switch (pDataBuffer->pNode->data.type)
{
case ma_resource_manager_data_supply_type_encoded: return &pDataBuffer->connector.decoder;
@@ -65646,7 +66959,7 @@ static ma_result ma_resource_manager_data_buffer_init_connector(ma_resource_mana
MA_ASSERT(pDataBuffer != NULL);
MA_ASSERT(pConfig != NULL);
- MA_ASSERT(pDataBuffer->isConnectorInitialized == MA_FALSE);
+ MA_ASSERT(ma_resource_manager_data_buffer_has_connector(pDataBuffer) == MA_FALSE);
/* The underlying data buffer must be initialized before we'll be able to know how to initialize the backend. */
result = ma_resource_manager_data_buffer_node_result(pDataBuffer->pNode);
@@ -65696,14 +67009,30 @@ static ma_result ma_resource_manager_data_buffer_init_connector(ma_resource_mana
*/
if (result == MA_SUCCESS) {
/*
- Make sure the looping state is set before returning in order to handle the case where the
- loop state was set on the data buffer before the connector was initialized.
- */
- ma_data_source_set_range_in_pcm_frames(pDataBuffer, pConfig->rangeBegInPCMFrames, pConfig->rangeEndInPCMFrames);
- ma_data_source_set_loop_point_in_pcm_frames(pDataBuffer, pConfig->loopPointBegInPCMFrames, pConfig->loopPointEndInPCMFrames);
- ma_data_source_set_looping(pDataBuffer, pConfig->isLooping);
+ The resource manager supports the ability to set the range and loop settings via a config at
+ initialization time. This results in an case where the ranges could be set explicitly via
+ ma_data_source_set_*() before we get to this point here. If this happens, we'll end up
+ hitting a case where we just override those settings which results in what feels like a bug.
- pDataBuffer->isConnectorInitialized = MA_TRUE;
+ To address this we only change the relevant properties if they're not equal to defaults. If
+ they're equal to defaults there's no need to change them anyway. If they're *not* set to the
+ default values, we can assume the user has set the range and loop settings via the config. If
+ they're doing their own calls to ma_data_source_set_*() in addition to setting them via the
+ config, that's entirely on the caller and any synchronization issue becomes their problem.
+ */
+ if (pConfig->rangeBegInPCMFrames != MA_DATA_SOURCE_DEFAULT_RANGE_BEG || pConfig->rangeEndInPCMFrames != MA_DATA_SOURCE_DEFAULT_RANGE_END) {
+ ma_data_source_set_range_in_pcm_frames(pDataBuffer, pConfig->rangeBegInPCMFrames, pConfig->rangeEndInPCMFrames);
+ }
+
+ if (pConfig->loopPointBegInPCMFrames != MA_DATA_SOURCE_DEFAULT_LOOP_POINT_BEG || pConfig->loopPointEndInPCMFrames != MA_DATA_SOURCE_DEFAULT_LOOP_POINT_END) {
+ ma_data_source_set_loop_point_in_pcm_frames(pDataBuffer, pConfig->loopPointBegInPCMFrames, pConfig->loopPointEndInPCMFrames);
+ }
+
+ if (pConfig->isLooping != MA_FALSE) {
+ ma_data_source_set_looping(pDataBuffer, pConfig->isLooping);
+ }
+
+ ma_atomic_bool32_set(&pDataBuffer->isConnectorInitialized, MA_TRUE);
if (pInitNotification != NULL) {
ma_async_notification_signal(pInitNotification);
@@ -65723,6 +67052,8 @@ static ma_result ma_resource_manager_data_buffer_uninit_connector(ma_resource_ma
MA_ASSERT(pResourceManager != NULL);
MA_ASSERT(pDataBuffer != NULL);
+ (void)pResourceManager;
+
switch (ma_resource_manager_data_buffer_node_get_data_supply_type(pDataBuffer->pNode))
{
case ma_resource_manager_data_supply_type_encoded: /* Connector is a decoder. */
@@ -66708,15 +68039,25 @@ MA_API ma_result ma_resource_manager_data_buffer_read_pcm_frames(ma_resource_man
MA_ASSERT(ma_resource_manager_data_buffer_node_result(pDataBuffer->pNode) != MA_UNAVAILABLE);
/* If the node is not initialized we need to abort with a busy code. */
- if (ma_resource_manager_data_buffer_node_get_data_supply_type(pDataBuffer->pNode) == ma_resource_manager_data_supply_type_unknown) {
+ if (ma_resource_manager_data_buffer_has_connector(pDataBuffer) == MA_FALSE) {
return MA_BUSY; /* Still loading. */
}
+ /*
+ If we've got a seek scheduled we'll want to do that before reading. However, for paged buffers, there's
+ a chance that the sound hasn't yet been decoded up to the seek point will result in the seek failing. If
+ this happens, we need to keep the seek scheduled and return MA_BUSY.
+ */
if (pDataBuffer->seekToCursorOnNextRead) {
pDataBuffer->seekToCursorOnNextRead = MA_FALSE;
result = ma_data_source_seek_to_pcm_frame(ma_resource_manager_data_buffer_get_connector(pDataBuffer), pDataBuffer->seekTargetInPCMFrames);
if (result != MA_SUCCESS) {
+ if (result == MA_BAD_SEEK && ma_resource_manager_data_buffer_node_get_data_supply_type(pDataBuffer->pNode) == ma_resource_manager_data_supply_type_decoded_paged) {
+ pDataBuffer->seekToCursorOnNextRead = MA_TRUE; /* Keep the seek scheduled. We just haven't loaded enough data yet to do the seek properly. */
+ return MA_BUSY;
+ }
+
return result;
}
}
@@ -66789,7 +68130,7 @@ MA_API ma_result ma_resource_manager_data_buffer_seek_to_pcm_frame(ma_resource_m
MA_ASSERT(ma_resource_manager_data_buffer_node_result(pDataBuffer->pNode) != MA_UNAVAILABLE);
/* If we haven't yet got a connector we need to abort. */
- if (ma_resource_manager_data_buffer_node_get_data_supply_type(pDataBuffer->pNode) == ma_resource_manager_data_supply_type_unknown) {
+ if (ma_resource_manager_data_buffer_has_connector(pDataBuffer) == MA_FALSE) {
pDataBuffer->seekTargetInPCMFrames = frameIndex;
pDataBuffer->seekToCursorOnNextRead = MA_TRUE;
return MA_BUSY; /* Still loading. */
@@ -67248,6 +68589,14 @@ MA_API ma_result ma_resource_manager_data_stream_init_ex(ma_resource_manager* pR
ma_async_notification_signal(notifications.init.pNotification);
}
+ /*
+ If there was an error during initialization make sure we return that result here. We don't want to do this
+ if we're not waiting because it will most likely be in a busy state.
+ */
+ if (pDataStream->result != MA_SUCCESS) {
+ return pDataStream->result;
+ }
+
/* NOTE: Do not release pInitFence here. That will be done by the job. */
}
@@ -67262,7 +68611,7 @@ MA_API ma_result ma_resource_manager_data_stream_init(ma_resource_manager* pReso
config.pFilePath = pFilePath;
config.flags = flags;
config.pNotifications = pNotifications;
-
+
return ma_resource_manager_data_stream_init_ex(pResourceManager, &config, pDataStream);
}
@@ -67274,7 +68623,7 @@ MA_API ma_result ma_resource_manager_data_stream_init_w(ma_resource_manager* pRe
config.pFilePathW = pFilePath;
config.flags = flags;
config.pNotifications = pNotifications;
-
+
return ma_resource_manager_data_stream_init_ex(pResourceManager, &config, pDataStream);
}
@@ -68354,7 +69703,7 @@ static ma_result ma_job_process__resource_manager__load_data_buffer(ma_job* pJob
}
/* Try initializing the connector if we haven't already. */
- isConnectorInitialized = pDataBuffer->isConnectorInitialized;
+ isConnectorInitialized = ma_resource_manager_data_buffer_has_connector(pDataBuffer);
if (isConnectorInitialized == MA_FALSE) {
dataSupplyType = ma_resource_manager_data_buffer_node_get_data_supply_type(pDataBuffer->pNode);
@@ -68387,7 +69736,7 @@ static ma_result ma_job_process__resource_manager__load_data_buffer(ma_job* pJob
There is a hole between here and the where the data connector is initialized where the data
buffer node may have finished initializing. We need to check for this by checking the result of
the data buffer node and whether or not we had an unknown data supply type at the time of
- trying to initialize the data connector.
+ trying to initialize the data connector.
*/
result = ma_resource_manager_data_buffer_node_result(pDataBuffer->pNode);
if (result == MA_BUSY || (result == MA_SUCCESS && isConnectorInitialized == MA_FALSE && dataSupplyType == ma_resource_manager_data_supply_type_unknown)) {
@@ -68410,7 +69759,7 @@ done:
If at this point the data buffer has not had it's connector initialized, it means the
notification event was never signalled which means we need to signal it here.
*/
- if (pDataBuffer->isConnectorInitialized == MA_FALSE && result != MA_SUCCESS) {
+ if (ma_resource_manager_data_buffer_has_connector(pDataBuffer) == MA_FALSE && result != MA_SUCCESS) {
if (pJob->data.resourceManager.loadDataBuffer.pInitNotification != NULL) {
ma_async_notification_signal(pJob->data.resourceManager.loadDataBuffer.pInitNotification);
}
@@ -68736,35 +70085,6 @@ MA_API void ma_debug_fill_pcm_frames_with_sine_wave(float* pFramesOut, ma_uint32
-static ma_result ma_mix_pcm_frames_f32(float* pDst, const float* pSrc, ma_uint64 frameCount, ma_uint32 channels, float volume)
-{
- ma_uint64 iSample;
- ma_uint64 sampleCount;
-
- if (pDst == NULL || pSrc == NULL || channels == 0) {
- return MA_INVALID_ARGS;
- }
-
- if (volume == 0) {
- return MA_SUCCESS; /* No changes if the volume is 0. */
- }
-
- sampleCount = frameCount * channels;
-
- if (volume == 1) {
- for (iSample = 0; iSample < sampleCount; iSample += 1) {
- pDst[iSample] += pSrc[iSample];
- }
- } else {
- for (iSample = 0; iSample < sampleCount; iSample += 1) {
- pDst[iSample] += ma_apply_volume_unclipped_f32(pSrc[iSample], volume);
- }
- }
-
- return MA_SUCCESS;
-}
-
-
MA_API ma_node_graph_config ma_node_graph_config_init(ma_uint32 channels)
{
ma_node_graph_config config;
@@ -69238,7 +70558,7 @@ static void ma_node_input_bus_attach(ma_node_input_bus* pInputBus, ma_node_outpu
old input bus has been updated so that pOutputBus will not get iterated again.
*/
pOutputBus->pInputNode = pNewInputNode; /* No need for an atomic assignment here because modification of this variable always happens within a lock. */
- pOutputBus->inputNodeInputBusIndex = (ma_uint8)inputNodeInputBusIndex; /* As above. */
+ pOutputBus->inputNodeInputBusIndex = (ma_uint8)inputNodeInputBusIndex;
/*
Now we need to attach the output bus to the linked list. This involves updating two pointers on
@@ -69336,6 +70656,8 @@ static ma_result ma_node_input_bus_read_pcm_frames(ma_node* pInputNode, ma_node_
ma_uint32 inputChannels;
ma_bool32 doesOutputBufferHaveContent = MA_FALSE;
+ (void)pInputNode; /* Not currently used. */
+
/*
This will be called from the audio thread which means we can't be doing any locking. Basically,
this function will not perfom any locking, whereas attaching and detaching will, but crafted in
@@ -69378,6 +70700,7 @@ static ma_result ma_node_input_bus_read_pcm_frames(ma_node* pInputNode, ma_node_
ma_bool32 isSilentOutput = MA_FALSE;
MA_ASSERT(pOutputBus->pNode != NULL);
+ MA_ASSERT(((ma_node_base*)pOutputBus->pNode)->vtable != NULL);
isSilentOutput = (((ma_node_base*)pOutputBus->pNode)->vtable->flags & MA_NODE_FLAG_SILENT_OUTPUT) != 0;
@@ -69560,8 +70883,8 @@ static ma_result ma_node_translate_bus_counts(const ma_node_config* pConfig, ma_
/* Some special rules for passthrough nodes. */
if ((pConfig->vtable->flags & MA_NODE_FLAG_PASSTHROUGH) != 0) {
- if (pConfig->vtable->inputBusCount != 1 || pConfig->vtable->outputBusCount != 1) {
- return MA_INVALID_ARGS; /* Passthrough nodes must have exactly 1 input bus and 1 output bus. */
+ if ((pConfig->vtable->inputBusCount != 0 && pConfig->vtable->inputBusCount != 1) || pConfig->vtable->outputBusCount != 1) {
+ return MA_INVALID_ARGS; /* Passthrough nodes must have exactly 1 output bus and either 0 or 1 input bus. */
}
if (pConfig->pInputChannels[0] != pConfig->pOutputChannels[0]) {
@@ -70250,6 +71573,15 @@ static ma_result ma_node_read_pcm_frames(ma_node* pNode, ma_uint32 outputBusInde
frameCountOut = frameCount; /* Just read as much as we can. The callback will return what was actually read. */
ppFramesOut[0] = pFramesOut;
+
+ /*
+ If it's a passthrough we won't be expecting the callback to output anything, so we'll
+ need to pre-silence the output buffer.
+ */
+ if ((pNodeBase->vtable->flags & MA_NODE_FLAG_PASSTHROUGH) != 0) {
+ ma_silence_pcm_frames(pFramesOut, frameCount, ma_format_f32, ma_node_get_output_channels(pNode, outputBusIndex));
+ }
+
ma_node_process_pcm_frames_internal(pNode, NULL, &frameCountIn, ppFramesOut, &frameCountOut);
totalFramesRead = frameCountOut;
} else {
@@ -70502,7 +71834,7 @@ static ma_result ma_node_read_pcm_frames(ma_node* pNode, ma_uint32 outputBusInde
ma_node_output_bus_set_has_read(&pNodeBase->pOutputBuses[outputBusIndex], MA_TRUE);
}
}
-
+
/* Apply volume, if necessary. */
ma_apply_volume_factor_f32(pFramesOut, totalFramesRead * ma_node_get_output_channels(pNodeBase, outputBusIndex), ma_node_output_bus_get_volume(&pNodeBase->pOutputBuses[outputBusIndex]));
@@ -70671,8 +72003,7 @@ static void ma_splitter_node_process_pcm_frames(ma_node* pNode, const float** pp
ma_uint32 channels;
MA_ASSERT(pNodeBase != NULL);
- MA_ASSERT(ma_node_get_input_bus_count(pNodeBase) == 1);
- MA_ASSERT(ma_node_get_output_bus_count(pNodeBase) >= 2);
+ MA_ASSERT(ma_node_get_input_bus_count(pNodeBase) == 1);
/* We don't need to consider the input frame count - it'll be the same as the output frame count and we process everything. */
(void)pFrameCountIn;
@@ -71702,6 +73033,33 @@ static ma_uint64 ma_engine_node_get_required_input_frame_count(const ma_engine_n
return inputFrameCount;
}
+static ma_result ma_engine_node_set_volume(ma_engine_node* pEngineNode, float volume)
+{
+ if (pEngineNode == NULL) {
+ return MA_INVALID_ARGS;
+ }
+
+ /* We should always have an active spatializer because it can be enabled and disabled dynamically. We can just use that for hodling our volume. */
+ ma_spatializer_set_master_volume(&pEngineNode->spatializer, volume);
+
+ return MA_SUCCESS;
+}
+
+static ma_result ma_engine_node_get_volume(const ma_engine_node* pEngineNode, float* pVolume)
+{
+ if (pVolume == NULL) {
+ return MA_INVALID_ARGS;
+ }
+
+ *pVolume = 0.0f;
+
+ if (pEngineNode == NULL) {
+ return MA_INVALID_ARGS;
+ }
+
+ return ma_spatializer_get_master_volume(&pEngineNode->spatializer, pVolume);
+}
+
static void ma_engine_node_process_pcm_frames__general(ma_engine_node* pEngineNode, const float** ppFramesIn, ma_uint32* pFrameCountIn, float** ppFramesOut, ma_uint32* pFrameCountOut)
{
ma_uint32 frameCountIn;
@@ -71822,18 +73180,23 @@ static void ma_engine_node_process_pcm_frames__general(ma_engine_node* pEngineNo
if (pEngineNode->pinnedListenerIndex != MA_LISTENER_INDEX_CLOSEST && pEngineNode->pinnedListenerIndex < ma_engine_get_listener_count(pEngineNode->pEngine)) {
iListener = pEngineNode->pinnedListenerIndex;
} else {
- iListener = ma_engine_find_closest_listener(pEngineNode->pEngine, pEngineNode->spatializer.position.x, pEngineNode->spatializer.position.y, pEngineNode->spatializer.position.z);
+ ma_vec3f spatializerPosition = ma_spatializer_get_position(&pEngineNode->spatializer);
+ iListener = ma_engine_find_closest_listener(pEngineNode->pEngine, spatializerPosition.x, spatializerPosition.y, spatializerPosition.z);
}
ma_spatializer_process_pcm_frames(&pEngineNode->spatializer, &pEngineNode->pEngine->listeners[iListener], pRunningFramesOut, pWorkingBuffer, framesJustProcessedOut);
} else {
- /* No spatialization, but we still need to do channel conversion. */
+ /* No spatialization, but we still need to do channel conversion and master volume. */
+ float volume;
+ ma_engine_node_get_volume(pEngineNode, &volume); /* Should never fail. */
+
if (channelsIn == channelsOut) {
/* No channel conversion required. Just copy straight to the output buffer. */
- ma_copy_pcm_frames(pRunningFramesOut, pWorkingBuffer, framesJustProcessedOut, ma_format_f32, channelsOut);
+ ma_copy_and_apply_volume_factor_f32(pRunningFramesOut, pWorkingBuffer, framesJustProcessedOut * channelsOut, volume);
} else {
/* Channel conversion required. TODO: Add support for channel maps here. */
ma_channel_map_apply_f32(pRunningFramesOut, NULL, channelsOut, pWorkingBuffer, NULL, channelsIn, framesJustProcessedOut, ma_channel_mix_mode_simple, pEngineNode->monoExpansionMode);
+ ma_apply_volume_factor_f32(pRunningFramesOut, framesJustProcessedOut * channelsOut, volume);
}
}
@@ -72068,6 +73431,7 @@ static ma_result ma_engine_node_get_heap_layout(const ma_engine_node_config* pCo
ma_spatializer_config spatializerConfig;
ma_uint32 channelsIn;
ma_uint32 channelsOut;
+ ma_channel defaultStereoChannelMap[2] = {MA_CHANNEL_SIDE_LEFT, MA_CHANNEL_SIDE_RIGHT}; /* <-- Consistent with the default channel map of a stereo listener. Means channel conversion can run on a fast path. */
MA_ASSERT(pHeapLayout);
@@ -72104,7 +73468,7 @@ static ma_result ma_engine_node_get_heap_layout(const ma_engine_node_config* pCo
/* Resmapler. */
resamplerConfig = ma_linear_resampler_config_init(ma_format_f32, channelsIn, 1, 1); /* Input and output sample rates don't affect the calculation of the heap size. */
resamplerConfig.lpfOrder = 0;
-
+
result = ma_linear_resampler_get_heap_size(&resamplerConfig, &tempHeapSize);
if (result != MA_SUCCESS) {
return result; /* Failed to retrieve the size of the heap for the resampler. */
@@ -72117,6 +73481,10 @@ static ma_result ma_engine_node_get_heap_layout(const ma_engine_node_config* pCo
/* Spatializer. */
spatializerConfig = ma_engine_node_spatializer_config_init(&baseNodeConfig);
+ if (spatializerConfig.channelsIn == 2) {
+ spatializerConfig.pChannelMapIn = defaultStereoChannelMap;
+ }
+
result = ma_spatializer_get_heap_size(&spatializerConfig, &tempHeapSize);
if (result != MA_SUCCESS) {
return result; /* Failed to retrieve the size of the heap for the spatializer. */
@@ -72161,6 +73529,7 @@ MA_API ma_result ma_engine_node_init_preallocated(const ma_engine_node_config* p
ma_panner_config pannerConfig;
ma_uint32 channelsIn;
ma_uint32 channelsOut;
+ ma_channel defaultStereoChannelMap[2] = {MA_CHANNEL_SIDE_LEFT, MA_CHANNEL_SIDE_RIGHT}; /* <-- Consistent with the default channel map of a stereo listener. Means channel conversion can run on a fast path. */
if (pEngineNode == NULL) {
return MA_INVALID_ARGS;
@@ -72190,10 +73559,17 @@ MA_API ma_result ma_engine_node_init_preallocated(const ma_engine_node_config* p
pEngineNode->isSpatializationDisabled = pConfig->isSpatializationDisabled;
pEngineNode->pinnedListenerIndex = pConfig->pinnedListenerIndex;
-
channelsIn = (pConfig->channelsIn != 0) ? pConfig->channelsIn : ma_engine_get_channels(pConfig->pEngine);
channelsOut = (pConfig->channelsOut != 0) ? pConfig->channelsOut : ma_engine_get_channels(pConfig->pEngine);
+ /*
+ If the sample rate of the sound is different to the engine, make sure pitching is enabled so that the resampler
+ is activated. Not doing this will result in the sound not being resampled if MA_SOUND_FLAG_NO_PITCH is used.
+ */
+ if (pEngineNode->sampleRate != ma_engine_get_sample_rate(pEngineNode->pEngine)) {
+ pEngineNode->isPitchDisabled = MA_FALSE;
+ }
+
/* Base node. */
baseNodeConfig = ma_engine_node_base_node_config_init(pConfig);
@@ -72240,6 +73616,10 @@ MA_API ma_result ma_engine_node_init_preallocated(const ma_engine_node_config* p
spatializerConfig = ma_engine_node_spatializer_config_init(&baseNodeConfig);
spatializerConfig.gainSmoothTimeInFrames = pEngineNode->pEngine->gainSmoothTimeInFrames;
+ if (spatializerConfig.channelsIn == 2) {
+ spatializerConfig.pChannelMapIn = defaultStereoChannelMap;
+ }
+
result = ma_spatializer_init_preallocated(&spatializerConfig, ma_offset_ptr(pHeap, heapLayout.spatializerOffset), &pEngineNode->spatializer);
if (result != MA_SUCCESS) {
goto error2;
@@ -72331,7 +73711,7 @@ MA_API ma_sound_config ma_sound_config_init_2(ma_engine* pEngine)
} else {
config.monoExpansionMode = ma_mono_expansion_mode_default;
}
-
+
config.rangeEndInPCMFrames = ~((ma_uint64)0);
config.loopPointEndInPCMFrames = ~((ma_uint64)0);
@@ -72439,7 +73819,7 @@ MA_API ma_result ma_engine_init(const ma_engine_config* pConfig, ma_engine* pEng
#if !defined(MA_NO_DEVICE_IO)
{
pEngine->pDevice = engineConfig.pDevice;
-
+
/* If we don't have a device, we need one. */
if (pEngine->pDevice == NULL && engineConfig.noDevice == MA_FALSE) {
ma_device_config deviceConfig;
@@ -72554,7 +73934,7 @@ MA_API ma_result ma_engine_init(const ma_engine_config* pConfig, ma_engine* pEng
Temporarily disabled. There is a subtle bug here where front-left and front-right
will be used by the device's channel map, but this is not what we want to use for
spatialization. Instead we want to use side-left and side-right. I need to figure
- out a better solution for this. For now, disabling the user of device channel maps.
+ out a better solution for this. For now, disabling the use of device channel maps.
*/
/*listenerConfig.pChannelMapOut = pEngine->pDevice->playback.channelMap;*/
}
@@ -72924,7 +74304,7 @@ MA_API ma_uint32 ma_engine_find_closest_listener(const ma_engine* pEngine, float
iListenerClosest = 0;
for (iListener = 0; iListener < pEngine->listenerCount; iListener += 1) {
if (ma_engine_listener_is_enabled(pEngine, iListener)) {
- float len2 = ma_vec3f_len2(ma_vec3f_sub(pEngine->listeners[iListener].position, ma_vec3f_init_3f(absolutePosX, absolutePosY, absolutePosZ)));
+ float len2 = ma_vec3f_len2(ma_vec3f_sub(ma_spatializer_listener_get_position(&pEngine->listeners[iListener]), ma_vec3f_init_3f(absolutePosX, absolutePosY, absolutePosZ)));
if (closestLen2 > len2) {
closestLen2 = len2;
iListenerClosest = iListener;
@@ -73306,8 +74686,11 @@ MA_API ma_result ma_sound_init_from_file_internal(ma_engine* pEngine, const ma_s
return MA_OUT_OF_MEMORY;
}
- notifications = ma_resource_manager_pipeline_notifications_init();
- notifications.done.pFence = pConfig->pDoneFence;
+ /* Removed in 0.12. Set pDoneFence on the notifications. */
+ notifications = pConfig->initNotifications;
+ if (pConfig->pDoneFence != NULL && notifications.done.pFence == NULL) {
+ notifications.done.pFence = pConfig->pDoneFence;
+ }
/*
We must wrap everything around the fence if one was specified. This ensures ma_fence_wait() does
@@ -73355,21 +74738,35 @@ done:
MA_API ma_result ma_sound_init_from_file(ma_engine* pEngine, const char* pFilePath, ma_uint32 flags, ma_sound_group* pGroup, ma_fence* pDoneFence, ma_sound* pSound)
{
- ma_sound_config config = ma_sound_config_init_2(pEngine);
+ ma_sound_config config;
+
+ if (pFilePath == NULL) {
+ return MA_INVALID_ARGS;
+ }
+
+ config = ma_sound_config_init_2(pEngine);
config.pFilePath = pFilePath;
config.flags = flags;
config.pInitialAttachment = pGroup;
config.pDoneFence = pDoneFence;
+
return ma_sound_init_ex(pEngine, &config, pSound);
}
MA_API ma_result ma_sound_init_from_file_w(ma_engine* pEngine, const wchar_t* pFilePath, ma_uint32 flags, ma_sound_group* pGroup, ma_fence* pDoneFence, ma_sound* pSound)
{
- ma_sound_config config = ma_sound_config_init_2(pEngine);
+ ma_sound_config config;
+
+ if (pFilePath == NULL) {
+ return MA_INVALID_ARGS;
+ }
+
+ config = ma_sound_config_init_2(pEngine);
config.pFilePathW = pFilePath;
config.flags = flags;
config.pInitialAttachment = pGroup;
config.pDoneFence = pDoneFence;
+
return ma_sound_init_ex(pEngine, &config, pSound);
}
@@ -73552,17 +74949,20 @@ MA_API void ma_sound_set_volume(ma_sound* pSound, float volume)
return;
}
- /* The volume is controlled via the output bus. */
- ma_node_set_output_bus_volume(pSound, 0, volume);
+ ma_engine_node_set_volume(&pSound->engineNode, volume);
}
MA_API float ma_sound_get_volume(const ma_sound* pSound)
{
+ float volume = 0;
+
if (pSound == NULL) {
return 0;
}
- return ma_node_get_output_bus_volume(pSound, 0);
+ ma_engine_node_get_volume(&pSound->engineNode, &volume);
+
+ return volume;
}
MA_API void ma_sound_set_pan(ma_sound* pSound, float pan)
@@ -73956,7 +75356,7 @@ MA_API void ma_sound_set_fade_in_milliseconds(ma_sound* pSound, float volumeBeg,
ma_sound_set_fade_in_pcm_frames(pSound, volumeBeg, volumeEnd, (fadeLengthInMilliseconds * pSound->engineNode.fader.config.sampleRate) / 1000);
}
-MA_API float ma_sound_get_current_fade_volume(ma_sound* pSound)
+MA_API float ma_sound_get_current_fade_volume(const ma_sound* pSound)
{
if (pSound == NULL) {
return MA_INVALID_ARGS;
@@ -76318,7 +77718,7 @@ DRWAV_PRIVATE size_t drwav__write_or_count_metadata(drwav* pWav, drwav_metadata*
bytesWritten += drwav__write_or_count_u32ne_to_le(pWav, pMetadata->data.smpl.pLoops[iLoop].playCount);
}
if (pMetadata->data.smpl.samplerSpecificDataSizeInBytes > 0) {
- bytesWritten += drwav__write(pWav, pMetadata->data.smpl.pSamplerSpecificData, pMetadata->data.smpl.samplerSpecificDataSizeInBytes);
+ bytesWritten += drwav__write_or_count(pWav, pMetadata->data.smpl.pSamplerSpecificData, pMetadata->data.smpl.samplerSpecificDataSizeInBytes);
}
} break;
case drwav_metadata_type_inst:
@@ -77235,10 +78635,10 @@ DRWAV_PRIVATE drwav_result drwav_wfopen(FILE** ppFile, const wchar_t* pFilePath,
(void)pAllocationCallbacks;
}
#else
- #if defined(__DJGPP__)
- {
- }
- #else
+ #if defined(__DJGPP__)
+ {
+ }
+ #else
{
mbstate_t mbs;
size_t lenMB;
@@ -77271,7 +78671,7 @@ DRWAV_PRIVATE drwav_result drwav_wfopen(FILE** ppFile, const wchar_t* pFilePath,
*ppFile = fopen(pFilePathMB, pOpenModeMB);
drwav__free_from_callbacks(pFilePathMB, pAllocationCallbacks);
}
- #endif
+ #endif
if (*ppFile == NULL) {
return DRWAV_ERROR;
}
@@ -85196,10 +86596,10 @@ static drflac_result drflac_wfopen(FILE** ppFile, const wchar_t* pFilePath, cons
(void)pAllocationCallbacks;
}
#else
- #if defined(__DJGPP__)
- {
- }
- #else
+ #if defined(__DJGPP__)
+ {
+ }
+ #else
{
mbstate_t mbs;
size_t lenMB;
@@ -85232,7 +86632,7 @@ static drflac_result drflac_wfopen(FILE** ppFile, const wchar_t* pFilePath, cons
*ppFile = fopen(pFilePathMB, pOpenModeMB);
drflac__free_from_callbacks(pFilePathMB, pAllocationCallbacks);
}
- #endif
+ #endif
if (*ppFile == NULL) {
return DRFLAC_ERROR;
}
@@ -90532,10 +91932,10 @@ static drmp3_result drmp3_wfopen(FILE** ppFile, const wchar_t* pFilePath, const
(void)pAllocationCallbacks;
}
#else
- #if defined(__DJGPP__)
- {
- }
- #else
+ #if defined(__DJGPP__)
+ {
+ }
+ #else
{
mbstate_t mbs;
size_t lenMB;
@@ -90568,7 +91968,7 @@ static drmp3_result drmp3_wfopen(FILE** ppFile, const wchar_t* pFilePath, const
*ppFile = fopen(pFilePathMB, pOpenModeMB);
drmp3__free_from_callbacks(pFilePathMB, pAllocationCallbacks);
}
- #endif
+ #endif
if (*ppFile == NULL) {
return DRMP3_ERROR;
}
diff --git a/src/external/qoaplay.c b/src/external/qoaplay.c
index 549e9f778..7f937f4fa 100644
--- a/src/external/qoaplay.c
+++ b/src/external/qoaplay.c
@@ -62,7 +62,7 @@ typedef struct {
extern "C" { // Prevents name mangling of functions
#endif
-qoaplay_desc *qoaplay_open(char *path);
+qoaplay_desc *qoaplay_open(const char *path);
qoaplay_desc *qoaplay_open_memory(const unsigned char *data, int data_size);
void qoaplay_close(qoaplay_desc *qoa_ctx);
@@ -83,7 +83,7 @@ int qoaplay_get_frame(qoaplay_desc *qoa_ctx);
//----------------------------------------------------------------------------------
// Open QOA file, keep FILE pointer to keep reading from file
-qoaplay_desc *qoaplay_open(char *path)
+qoaplay_desc *qoaplay_open(const char *path)
{
FILE *file = fopen(path, "rb");
if (!file) return NULL;
diff --git a/src/raudio.c b/src/raudio.c
index 8bd9052c2..d7ee183a8 100644
--- a/src/raudio.c
+++ b/src/raudio.c
@@ -377,11 +377,6 @@ typedef struct AudioData {
int defaultSize; // Default audio buffer size for audio streams
} Buffer;
rAudioProcessor *mixedProcessor;
- struct {
- unsigned int poolCounter; // AudioBuffer pointers pool counter
- AudioBuffer *pool[MAX_AUDIO_BUFFER_POOL_CHANNELS]; // Multichannel AudioBuffer pointers pool
- unsigned int channels[MAX_AUDIO_BUFFER_POOL_CHANNELS]; // AudioBuffer pool channels
- } MultiChannel;
} AudioData;
//----------------------------------------------------------------------------------
@@ -490,13 +485,6 @@ void InitAudioDevice(void)
return;
}
- // Init dummy audio buffers pool for multichannel sound playing
- for (int i = 0; i < MAX_AUDIO_BUFFER_POOL_CHANNELS; i++)
- {
- // WARNING: An empty audio buffer is created (data = 0) and added to list, AudioBuffer data is filled on PlaySoundMulti()
- AUDIO.MultiChannel.pool[i] = LoadAudioBuffer(AUDIO_DEVICE_FORMAT, AUDIO_DEVICE_CHANNELS, AUDIO.System.device.sampleRate, 0, AUDIO_BUFFER_USAGE_STATIC);
- }
-
TRACELOG(LOG_INFO, "AUDIO: Device initialized successfully");
TRACELOG(LOG_INFO, " > Backend: miniaudio / %s", ma_get_backend_name(AUDIO.System.context.backend));
TRACELOG(LOG_INFO, " > Format: %s -> %s", ma_get_format_name(AUDIO.System.device.playback.format), ma_get_format_name(AUDIO.System.device.playback.internalFormat));
@@ -512,20 +500,6 @@ void CloseAudioDevice(void)
{
if (AUDIO.System.isReady)
{
- // Unload dummy audio buffers pool
- // WARNING: They can be pointing to already unloaded data
- for (int i = 0; i < MAX_AUDIO_BUFFER_POOL_CHANNELS; i++)
- {
- //UnloadAudioBuffer(AUDIO.MultiChannel.pool[i]);
- if (AUDIO.MultiChannel.pool[i] != NULL)
- {
- ma_data_converter_uninit(&AUDIO.MultiChannel.pool[i]->converter, NULL);
- UntrackAudioBuffer(AUDIO.MultiChannel.pool[i]);
- //RL_FREE(buffer->data); // Already unloaded by UnloadSound()
- RL_FREE(AUDIO.MultiChannel.pool[i]);
- }
- }
-
ma_mutex_uninit(&AUDIO.System.lock);
ma_device_uninit(&AUDIO.System.device);
ma_context_uninit(&AUDIO.System.context);
@@ -938,11 +912,11 @@ Sound LoadSoundFromWave(Wave wave)
// Checks if a sound is ready
bool IsSoundReady(Sound sound)
{
- return ((sound.frameCount > 0) && // Validate frame count
- (sound.stream.buffer != NULL) && // Validate stream buffer
- (sound.stream.sampleRate > 0) && // Validate sample rate is supported
- (sound.stream.sampleSize > 0) && // Validate sample size is supported
- (sound.stream.channels > 0)); // Validate number of channels supported
+ return ((sound.frameCount > 0) && // Validate frame count
+ (sound.stream.buffer != NULL) && // Validate stream buffer
+ (sound.stream.sampleRate > 0) && // Validate sample rate is supported
+ (sound.stream.sampleSize > 0) && // Validate sample size is supported
+ (sound.stream.channels > 0)); // Validate number of channels supported
}
// Unload wave data
@@ -1100,88 +1074,6 @@ void PlaySound(Sound sound)
PlayAudioBuffer(sound.stream.buffer);
}
-// Play a sound in the multichannel buffer pool
-void PlaySoundMulti(Sound sound)
-{
- int index = -1;
- unsigned int oldAge = 0;
- int oldIndex = -1;
-
- // find the first non-playing pool entry
- for (int i = 0; i < MAX_AUDIO_BUFFER_POOL_CHANNELS; i++)
- {
- if (AUDIO.MultiChannel.channels[i] > oldAge)
- {
- oldAge = AUDIO.MultiChannel.channels[i];
- oldIndex = i;
- }
-
- if (!IsAudioBufferPlaying(AUDIO.MultiChannel.pool[i]))
- {
- index = i;
- break;
- }
- }
-
- // If no none playing pool members can be indexed choose the oldest
- if (index == -1)
- {
- TRACELOG(LOG_WARNING, "SOUND: Buffer pool is already full, count: %i", AUDIO.MultiChannel.poolCounter);
-
- if (oldIndex == -1)
- {
- // Shouldn't be able to get here... but just in case something odd happens!
- TRACELOG(LOG_WARNING, "SOUND: Buffer pool could not determine the oldest buffer not playing sound");
- return;
- }
-
- index = oldIndex;
-
- // Just in case...
- StopAudioBuffer(AUDIO.MultiChannel.pool[index]);
- }
-
- // Experimentally mutex lock doesn't seem to be needed this makes sense
- // as pool[index] isn't playing and the only stuff we're copying
- // shouldn't be changing...
-
- AUDIO.MultiChannel.channels[index] = AUDIO.MultiChannel.poolCounter;
- AUDIO.MultiChannel.poolCounter++;
-
- SetAudioBufferVolume(AUDIO.MultiChannel.pool[index], sound.stream.buffer->volume);
- SetAudioBufferPitch(AUDIO.MultiChannel.pool[index], sound.stream.buffer->pitch);
- SetAudioBufferPan(AUDIO.MultiChannel.pool[index], sound.stream.buffer->pan);
-
- AUDIO.MultiChannel.pool[index]->looping = sound.stream.buffer->looping;
- AUDIO.MultiChannel.pool[index]->usage = sound.stream.buffer->usage;
- AUDIO.MultiChannel.pool[index]->isSubBufferProcessed[0] = false;
- AUDIO.MultiChannel.pool[index]->isSubBufferProcessed[1] = false;
- AUDIO.MultiChannel.pool[index]->sizeInFrames = sound.stream.buffer->sizeInFrames;
-
- AUDIO.MultiChannel.pool[index]->data = sound.stream.buffer->data; // Fill dummy track with data for playing
-
- PlayAudioBuffer(AUDIO.MultiChannel.pool[index]);
-}
-
-// Stop any sound played with PlaySoundMulti()
-void StopSoundMulti(void)
-{
- for (int i = 0; i < MAX_AUDIO_BUFFER_POOL_CHANNELS; i++) StopAudioBuffer(AUDIO.MultiChannel.pool[i]);
-}
-
-// Get number of sounds playing in the multichannel buffer pool
-int GetSoundsPlaying(void)
-{
- int counter = 0;
-
- for (int i = 0; i < MAX_AUDIO_BUFFER_POOL_CHANNELS; i++)
- {
- if (IsAudioBufferPlaying(AUDIO.MultiChannel.pool[i])) counter++;
- }
-
- return counter;
-}
-
// Pause a sound
void PauseSound(Sound sound)
{
@@ -1898,9 +1790,9 @@ void UpdateMusicStream(Music music)
{
while (true)
{
- int frameCountRed = (int)drwav_read_pcm_frames_s16((drwav *)music.ctxData, frameCountStillNeeded, (short *)((char *)AUDIO.System.pcmBuffer + frameCountReadTotal*frameSize));
- frameCountReadTotal += frameCountRed;
- frameCountStillNeeded -= frameCountRed;
+ int frameCountRead = (int)drwav_read_pcm_frames_s16((drwav *)music.ctxData, frameCountStillNeeded, (short *)((char *)AUDIO.System.pcmBuffer + frameCountReadTotal*frameSize));
+ frameCountReadTotal += frameCountRead;
+ frameCountStillNeeded -= frameCountRead;
if (frameCountStillNeeded == 0) break;
else drwav_seek_to_first_pcm_frame((drwav *)music.ctxData);
}
@@ -1909,9 +1801,9 @@ void UpdateMusicStream(Music music)
{
while (true)
{
- int frameCountRed = (int)drwav_read_pcm_frames_f32((drwav *)music.ctxData, frameCountStillNeeded, (float *)((char *)AUDIO.System.pcmBuffer + frameCountReadTotal*frameSize));
- frameCountReadTotal += frameCountRed;
- frameCountStillNeeded -= frameCountRed;
+ int frameCountRead = (int)drwav_read_pcm_frames_f32((drwav *)music.ctxData, frameCountStillNeeded, (float *)((char *)AUDIO.System.pcmBuffer + frameCountReadTotal*frameSize));
+ frameCountReadTotal += frameCountRead;
+ frameCountStillNeeded -= frameCountRead;
if (frameCountStillNeeded == 0) break;
else drwav_seek_to_first_pcm_frame((drwav *)music.ctxData);
}
@@ -1923,9 +1815,9 @@ void UpdateMusicStream(Music music)
{
while (true)
{
- int frameCountRed = stb_vorbis_get_samples_short_interleaved((stb_vorbis *)music.ctxData, music.stream.channels, (short *)((char *)AUDIO.System.pcmBuffer + frameCountReadTotal*frameSize), frameCountStillNeeded*music.stream.channels);
- frameCountReadTotal += frameCountRed;
- frameCountStillNeeded -= frameCountRed;
+ int frameCountRead = stb_vorbis_get_samples_short_interleaved((stb_vorbis *)music.ctxData, music.stream.channels, (short *)((char *)AUDIO.System.pcmBuffer + frameCountReadTotal*frameSize), frameCountStillNeeded*music.stream.channels);
+ frameCountReadTotal += frameCountRead;
+ frameCountStillNeeded -= frameCountRead;
if (frameCountStillNeeded == 0) break;
else stb_vorbis_seek_start((stb_vorbis *)music.ctxData);
}
diff --git a/src/raylib.dll.rc.data b/src/raylib.dll.rc.data
index 729c45ddf..d506b8d28 100644
Binary files a/src/raylib.dll.rc.data and b/src/raylib.dll.rc.data differ
diff --git a/src/raylib.h b/src/raylib.h
index 9365f1367..06cadc708 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -1,6 +1,6 @@
/**********************************************************************************************
*
-* raylib v4.5-dev - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com)
+* raylib v4.5 - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com)
*
* FEATURES:
* - NO external dependencies, all required libraries included with raylib
@@ -84,7 +84,7 @@
#define RAYLIB_VERSION_MAJOR 4
#define RAYLIB_VERSION_MINOR 5
#define RAYLIB_VERSION_PATCH 0
-#define RAYLIB_VERSION "4.5-dev"
+#define RAYLIB_VERSION "4.5"
// Function specifiers in case library is build/used as a shared library (Windows)
// NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll
@@ -1158,6 +1158,7 @@ RLAPI float GetGesturePinchAngle(void); // Get gesture pinch ang
// Camera System Functions (Module: rcamera)
//------------------------------------------------------------------------------------
RLAPI void UpdateCamera(Camera *camera, int mode); // Update camera position for selected mode
+RLAPI void UpdateCameraPro(Camera *camera, Vector3 movement, Vector3 rotation, float zoom); // Update camera movement/rotation
//------------------------------------------------------------------------------------
// Basic Shapes Drawing Functions (Module: shapes)
@@ -1440,7 +1441,6 @@ RLAPI Model LoadModel(const char *fileName);
RLAPI Model LoadModelFromMesh(Mesh mesh); // Load model from generated mesh (default material)
RLAPI bool IsModelReady(Model model); // Check if a model is ready
RLAPI void UnloadModel(Model model); // Unload model (including meshes) from memory (RAM and/or VRAM)
-RLAPI void UnloadModelKeepMeshes(Model model); // Unload model (but not meshes) from memory (RAM and/or VRAM)
RLAPI BoundingBox GetModelBoundingBox(Model model); // Compute model bounding box limits (considers all meshes)
// Model drawing functions
@@ -1530,9 +1530,6 @@ RLAPI void PlaySound(Sound sound); // Play a
RLAPI void StopSound(Sound sound); // Stop playing a sound
RLAPI void PauseSound(Sound sound); // Pause a sound
RLAPI void ResumeSound(Sound sound); // Resume a paused sound
-RLAPI void PlaySoundMulti(Sound sound); // Play a sound (using multichannel buffer pool)
-RLAPI void StopSoundMulti(void); // Stop any sound playing (using multichannel buffer pool)
-RLAPI int GetSoundsPlaying(void); // Get number of sounds playing in the multichannel
RLAPI bool IsSoundPlaying(Sound sound); // Check if a sound is currently playing
RLAPI void SetSoundVolume(Sound sound, float volume); // Set volume for a sound (1.0 is max level)
RLAPI void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level)
diff --git a/src/raylib.rc.data b/src/raylib.rc.data
index e44f566d4..7a86e26ba 100644
Binary files a/src/raylib.rc.data and b/src/raylib.rc.data differ
diff --git a/src/rcamera.h b/src/rcamera.h
index c3a101f0b..8b37ff7ba 100644
--- a/src/rcamera.h
+++ b/src/rcamera.h
@@ -46,32 +46,35 @@
//----------------------------------------------------------------------------------
// Defines and Macros
//----------------------------------------------------------------------------------
-//...
+// Function specifiers definition
+#ifndef RLAPI
+ #define RLAPI // Functions defined as 'extern' by default (implicit specifiers)
+#endif
+
#if defined(CAMERA_STANDALONE)
-#define CAMERA_CULL_DISTANCE_NEAR 0.01
-#define CAMERA_CULL_DISTANCE_FAR 1000.0
+ #define CAMERA_CULL_DISTANCE_NEAR 0.01
+ #define CAMERA_CULL_DISTANCE_FAR 1000.0
#else
-#define CAMERA_CULL_DISTANCE_NEAR RL_CULL_DISTANCE_NEAR
-#define CAMERA_CULL_DISTANCE_FAR RL_CULL_DISTANCE_FAR
+ #define CAMERA_CULL_DISTANCE_NEAR RL_CULL_DISTANCE_NEAR
+ #define CAMERA_CULL_DISTANCE_FAR RL_CULL_DISTANCE_FAR
#endif
//----------------------------------------------------------------------------------
// Types and Structures Definition
// NOTE: Below types are required for CAMERA_STANDALONE usage
//----------------------------------------------------------------------------------
-// TODO review
#if defined(CAMERA_STANDALONE)
- // Vector2 type
+ // Vector2, 2 components
typedef struct Vector2 {
- float x;
- float y;
+ float x; // Vector x component
+ float y; // Vector y component
} Vector2;
- // Vector3 type
+ // Vector3, 3 components
typedef struct Vector3 {
- float x;
- float y;
- float z;
+ float x; // Vector x component
+ float y; // Vector y component
+ float z; // Vector z component
} Vector3;
// Camera type, defines a camera position/orientation in 3d space
@@ -80,31 +83,31 @@
Vector3 target; // Camera target it looks-at
Vector3 up; // Camera up vector (rotation over its axis)
float fovy; // Camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic
- int projection; // Camera type, defines projection type: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC
+ int projection; // Camera projection type: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC
} Camera3D;
typedef Camera3D Camera; // Camera type fallback, defaults to Camera3D
+ // Camera projection
+ typedef enum {
+ CAMERA_PERSPECTIVE = 0, // Perspective projection
+ CAMERA_ORTHOGRAPHIC // Orthographic projection
+ } CameraProjection;
+
// Camera system modes
typedef enum {
- CAMERA_CUSTOM = 0,
- CAMERA_FREE,
- CAMERA_ORBITAL,
- CAMERA_FIRST_PERSON,
- CAMERA_THIRD_PERSON
+ CAMERA_CUSTOM = 0, // Camera custom, controlled by user (UpdateCamera() does nothing)
+ CAMERA_FREE, // Camera free mode
+ CAMERA_ORBITAL, // Camera orbital, around target, zoom supported
+ CAMERA_FIRST_PERSON, // Camera first person
+ CAMERA_THIRD_PERSON // Camera third person
} CameraMode;
-
- // Camera projection modes
- typedef enum {
- CAMERA_PERSPECTIVE = 0,
- CAMERA_ORTHOGRAPHIC
- } CameraProjection;
#endif
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
-
+//...
//----------------------------------------------------------------------------------
// Module Functions Declaration
@@ -114,21 +117,23 @@
extern "C" { // Prevents name mangling of functions
#endif
-Vector3 GetCameraForward(Camera *camera);
-Vector3 GetCameraUp(Camera *camera);
-Vector3 GetCameraRight(Camera *camera);
+RLAPI Vector3 GetCameraForward(Camera *camera);
+RLAPI Vector3 GetCameraUp(Camera *camera);
+RLAPI Vector3 GetCameraRight(Camera *camera);
-void CameraMoveForward(Camera *camera, float distance, bool moveInWorldPlane);
-void CameraMoveUp(Camera *camera, float distance);
-void CameraMoveRight(Camera *camera, float distance, bool moveInWorldPlane);
-void CameraMoveToTarget(Camera *camera, float delta);
+// Camera movement
+RLAPI void CameraMoveForward(Camera *camera, float distance, bool moveInWorldPlane);
+RLAPI void CameraMoveUp(Camera *camera, float distance);
+RLAPI void CameraMoveRight(Camera *camera, float distance, bool moveInWorldPlane);
+RLAPI void CameraMoveToTarget(Camera *camera, float delta);
-void CameraYaw(Camera *camera, float angle, bool rotateAroundTarget);
-void CameraPitch(Camera *camera, float angle, bool lockView, bool rotateAroundTarget, bool rotateUp);
-void CameraRoll(Camera *camera, float angle);
+// Camera rotation
+RLAPI void CameraYaw(Camera *camera, float angle, bool rotateAroundTarget);
+RLAPI void CameraPitch(Camera *camera, float angle, bool lockView, bool rotateAroundTarget, bool rotateUp);
+RLAPI void CameraRoll(Camera *camera, float angle);
-Matrix GetCameraViewMatrix(Camera *camera);
-Matrix GetCameraProjectionMatrix(Camera* camera, float aspect);
+RLAPI Matrix GetCameraViewMatrix(Camera *camera);
+RLAPI Matrix GetCameraProjectionMatrix(Camera* camera, float aspect);
#if defined(__cplusplus)
}
@@ -306,36 +311,35 @@ void CameraYaw(Camera *camera, float angle, bool rotateAroundTarget)
Vector3 up = GetCameraUp(camera);
// View vector
- Vector3 target_position = Vector3Subtract(camera->target, camera->position);
+ Vector3 targetPosition = Vector3Subtract(camera->target, camera->position);
// Rotate view vector around up axis
- target_position = Vector3RotateByAxisAngle(target_position, up, angle);
+ targetPosition = Vector3RotateByAxisAngle(targetPosition, up, angle);
if (rotateAroundTarget)
{
// Move position relative to target
- camera->position = Vector3Subtract(camera->target, target_position);
+ camera->position = Vector3Subtract(camera->target, targetPosition);
}
else // rotate around camera.position
{
// Move target relative to position
- camera->target = Vector3Add(camera->position, target_position);
+ camera->target = Vector3Add(camera->position, targetPosition);
}
}
-// Rotates the camera around its right vector
-// Pitch is "looking up and down"
-// lockView prevents camera overrotation (aka "somersaults")
-// If rotateAroundTarget is false, the camera rotates around its position
-// rotateUp rotates the up direction as well (typically only usefull in CAMERA_FREE)
-// Note: angle must be provided in radians
+// Rotates the camera around its right vector, pitch is "looking up and down"
+// - lockView prevents camera overrotation (aka "somersaults")
+// - rotateAroundTarget defines if rotation is around target or around its position
+// - rotateUp rotates the up direction as well (typically only usefull in CAMERA_FREE)
+// NOTE: angle must be provided in radians
void CameraPitch(Camera *camera, float angle, bool lockView, bool rotateAroundTarget, bool rotateUp)
{
// Up direction
Vector3 up = GetCameraUp(camera);
// View vector
- Vector3 target_position = Vector3Subtract(camera->target, camera->position);
+ Vector3 targetPosition = Vector3Subtract(camera->target, camera->position);
if (lockView)
{
@@ -343,32 +347,32 @@ void CameraPitch(Camera *camera, float angle, bool lockView, bool rotateAroundTa
// to allow only viewing straight up or down.
// Clamp view up
- float max_angle_up = Vector3Angle(up, target_position);
- max_angle_up -= 0.001f; // avoid numerical errors
- if (angle > max_angle_up) angle = max_angle_up;
+ float maxAngleUp = Vector3Angle(up, targetPosition);
+ maxAngleUp -= 0.001f; // avoid numerical errors
+ if (angle > maxAngleUp) angle = maxAngleUp;
// Clamp view down
- float max_angle_down = Vector3Angle(Vector3Negate(up), target_position);
- max_angle_down *= -1.0f; // downwards angle is negative
- max_angle_down += 0.001f; // avoid numerical errors
- if (angle < max_angle_down) angle = max_angle_down;
+ float maxAngleDown = Vector3Angle(Vector3Negate(up), targetPosition);
+ maxAngleDown *= -1.0f; // downwards angle is negative
+ maxAngleDown += 0.001f; // avoid numerical errors
+ if (angle < maxAngleDown) angle = maxAngleDown;
}
// Rotation axis
Vector3 right = GetCameraRight(camera);
// Rotate view vector around right axis
- target_position = Vector3RotateByAxisAngle(target_position, right, angle);
+ targetPosition = Vector3RotateByAxisAngle(targetPosition, right, angle);
if (rotateAroundTarget)
{
// Move position relative to target
- camera->position = Vector3Subtract(camera->target, target_position);
+ camera->position = Vector3Subtract(camera->target, targetPosition);
}
else // rotate around camera.position
{
// Move target relative to position
- camera->target = Vector3Add(camera->position, target_position);
+ camera->target = Vector3Add(camera->position, targetPosition);
}
if (rotateUp)
@@ -466,4 +470,35 @@ void UpdateCamera(Camera *camera, int mode)
}
#endif // !CAMERA_STANDALONE
+// Update camera movement, movement/rotation values should be provided by user
+void UpdateCameraPro(Camera *camera, Vector3 movement, Vector3 rotation, float zoom)
+{
+ // Required values
+ // movement.x - Move forward/backward
+ // movement.y - Move right/left
+ // movement.z - Move up/down
+ // rotation.x - yaw
+ // rotation.y - pitch
+ // rotation.z - roll
+ // zoom - Move towards target
+
+ bool lockView = true;
+ bool rotateAroundTarget = false;
+ bool rotateUp = false;
+ bool moveInWorldPlane = true;
+
+ // Camera rotation
+ CameraPitch(camera, -rotation.y*DEG2RAD, lockView, rotateAroundTarget, rotateUp);
+ CameraYaw(camera, -rotation.x*DEG2RAD, rotateAroundTarget);
+ CameraRoll(camera, rotation.z*DEG2RAD);
+
+ // Camera movement
+ CameraMoveForward(camera, movement.x, moveInWorldPlane);
+ CameraMoveRight(camera, movement.y, moveInWorldPlane);
+ CameraMoveUp(camera, movement.z);
+
+ // Zoom target distance
+ CameraMoveToTarget(camera, zoom);
+}
+
#endif // CAMERA_IMPLEMENTATION
diff --git a/src/rcamera.old.h b/src/rcamera.old.h
deleted file mode 100644
index 08c376690..000000000
--- a/src/rcamera.old.h
+++ /dev/null
@@ -1,567 +0,0 @@
-/*******************************************************************************************
-*
-* rcamera - Basic camera system for multiple camera modes
-*
-* NOTE: Memory footprint of this library is aproximately 52 bytes (global variables)
-*
-* CONFIGURATION:
-*
-* #define CAMERA_IMPLEMENTATION
-* Generates the implementation of the library into the included file.
-* If not defined, the library is in header only mode and can be included in other headers
-* or source files without problems. But only ONE file should hold the implementation.
-*
-* #define CAMERA_STANDALONE
-* If defined, the library can be used as standalone as a camera system but some
-* functions must be redefined to manage inputs accordingly.
-*
-* CONTRIBUTORS:
-* Ramon Santamaria: Supervision, review, update and maintenance
-* Marc Palau: Initial implementation (2014)
-*
-*
-* LICENSE: zlib/libpng
-*
-* Copyright (c) 2015-2022 Ramon Santamaria (@raysan5)
-*
-* This software is provided "as-is", without any express or implied warranty. In no event
-* will the authors be held liable for any damages arising from the use of this software.
-*
-* Permission is granted to anyone to use this software for any purpose, including commercial
-* applications, and to alter it and redistribute it freely, subject to the following restrictions:
-*
-* 1. The origin of this software must not be misrepresented; you must not claim that you
-* wrote the original software. If you use this software in a product, an acknowledgment
-* in the product documentation would be appreciated but is not required.
-*
-* 2. Altered source versions must be plainly marked as such, and must not be misrepresented
-* as being the original software.
-*
-* 3. This notice may not be removed or altered from any source distribution.
-*
-**********************************************************************************************/
-
-#ifndef RCAMERA_H
-#define RCAMERA_H
-
-//----------------------------------------------------------------------------------
-// Defines and Macros
-//----------------------------------------------------------------------------------
-//...
-
-//----------------------------------------------------------------------------------
-// Types and Structures Definition
-// NOTE: Below types are required for CAMERA_STANDALONE usage
-//----------------------------------------------------------------------------------
-#if defined(CAMERA_STANDALONE)
- // Vector2 type
- typedef struct Vector2 {
- float x;
- float y;
- } Vector2;
-
- // Vector3 type
- typedef struct Vector3 {
- float x;
- float y;
- float z;
- } Vector3;
-
- // Camera type, defines a camera position/orientation in 3d space
- typedef struct Camera3D {
- Vector3 position; // Camera position
- Vector3 target; // Camera target it looks-at
- Vector3 up; // Camera up vector (rotation over its axis)
- float fovy; // Camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic
- int type; // Camera type, defines projection type: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC
- } Camera3D;
-
- typedef Camera3D Camera; // Camera type fallback, defaults to Camera3D
-
- // Camera system modes
- typedef enum {
- CAMERA_CUSTOM = 0,
- CAMERA_FREE,
- CAMERA_ORBITAL,
- CAMERA_FIRST_PERSON,
- CAMERA_THIRD_PERSON
- } CameraMode;
-
- // Camera projection modes
- typedef enum {
- CAMERA_PERSPECTIVE = 0,
- CAMERA_ORTHOGRAPHIC
- } CameraProjection;
-#endif
-
-//----------------------------------------------------------------------------------
-// Global Variables Definition
-//----------------------------------------------------------------------------------
-//...
-
-//----------------------------------------------------------------------------------
-// Module Functions Declaration
-//----------------------------------------------------------------------------------
-
-#ifdef __cplusplus
-extern "C" { // Prevents name mangling of functions
-#endif
-
-#if defined(CAMERA_STANDALONE)
-void SetCameraMode(Camera camera, int mode); // Set camera mode (multiple camera modes available)
-void UpdateCamera(Camera *camera); // Update camera position for selected mode
-
-void SetCameraPanControl(int keyPan); // Set camera pan key to combine with mouse movement (free camera)
-void SetCameraAltControl(int keyAlt); // Set camera alt key to combine with mouse movement (free camera)
-void SetCameraSmoothZoomControl(int szoomKey); // Set camera smooth zoom key to combine with mouse (free camera)
-void SetCameraMoveControls(int keyFront, int keyBack,
- int keyRight, int keyLeft,
- int keyUp, int keyDown); // Set camera move controls (1st person and 3rd person cameras)
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // CAMERA_H
-
-
-/***********************************************************************************
-*
-* CAMERA IMPLEMENTATION
-*
-************************************************************************************/
-
-#if defined(CAMERA_IMPLEMENTATION)
-
-#include // Required for: sinf(), cosf(), sqrtf()
-
-//----------------------------------------------------------------------------------
-// Defines and Macros
-//----------------------------------------------------------------------------------
-#ifndef PI
- #define PI 3.14159265358979323846
-#endif
-#ifndef DEG2RAD
- #define DEG2RAD (PI/180.0f)
-#endif
-#ifndef RAD2DEG
- #define RAD2DEG (180.0f/PI)
-#endif
-
-// Camera mouse movement sensitivity
-#define CAMERA_MOUSE_MOVE_SENSITIVITY 0.003f
-#define CAMERA_MOUSE_SCROLL_SENSITIVITY 1.5f
-
-// FREE_CAMERA
-#define CAMERA_FREE_MOUSE_SENSITIVITY 0.01f
-#define CAMERA_FREE_DISTANCE_MIN_CLAMP 0.3f
-#define CAMERA_FREE_DISTANCE_MAX_CLAMP 120.0f
-#define CAMERA_FREE_MIN_CLAMP 85.0f
-#define CAMERA_FREE_MAX_CLAMP -85.0f
-#define CAMERA_FREE_SMOOTH_ZOOM_SENSITIVITY 0.05f
-#define CAMERA_FREE_PANNING_DIVIDER 5.1f
-
-// ORBITAL_CAMERA
-#define CAMERA_ORBITAL_SPEED 0.01f // Radians per frame
-
-// FIRST_PERSON
-//#define CAMERA_FIRST_PERSON_MOUSE_SENSITIVITY 0.003f
-#define CAMERA_FIRST_PERSON_FOCUS_DISTANCE 25.0f
-#define CAMERA_FIRST_PERSON_MIN_CLAMP 89.0f
-#define CAMERA_FIRST_PERSON_MAX_CLAMP -89.0f
-
-#define CAMERA_FIRST_PERSON_STEP_TRIGONOMETRIC_DIVIDER 8.0f
-#define CAMERA_FIRST_PERSON_STEP_DIVIDER 30.0f
-#define CAMERA_FIRST_PERSON_WAVING_DIVIDER 200.0f
-
-// THIRD_PERSON
-//#define CAMERA_THIRD_PERSON_MOUSE_SENSITIVITY 0.003f
-#define CAMERA_THIRD_PERSON_DISTANCE_CLAMP 1.2f
-#define CAMERA_THIRD_PERSON_MIN_CLAMP 5.0f
-#define CAMERA_THIRD_PERSON_MAX_CLAMP -85.0f
-#define CAMERA_THIRD_PERSON_OFFSET (Vector3){ 0.4f, 0.0f, 0.0f }
-
-// PLAYER (used by camera)
-#define PLAYER_MOVEMENT_SENSITIVITY 20.0f
-
-//----------------------------------------------------------------------------------
-// Types and Structures Definition
-//----------------------------------------------------------------------------------
-// Camera move modes (first person and third person cameras)
-typedef enum {
- MOVE_FRONT = 0,
- MOVE_BACK,
- MOVE_RIGHT,
- MOVE_LEFT,
- MOVE_UP,
- MOVE_DOWN
-} CameraMove;
-
-// Camera global state context data [56 bytes]
-typedef struct {
- unsigned int mode; // Current camera mode
- float targetDistance; // Camera distance from position to target
- float playerEyesPosition; // Player eyes position from ground (in meters)
- Vector2 angle; // Camera angle in plane XZ
- Vector2 previousMousePosition; // Previous mouse position
-
- // Camera movement control keys
- int moveControl[6]; // Move controls (CAMERA_FIRST_PERSON)
- int smoothZoomControl; // Smooth zoom control key
- int altControl; // Alternative control key
- int panControl; // Pan view control key
-} CameraData;
-
-//----------------------------------------------------------------------------------
-// Global Variables Definition
-//----------------------------------------------------------------------------------
-static CameraData CAMERA = { // Global CAMERA state context
- .mode = 0,
- .targetDistance = 0,
- .playerEyesPosition = 1.85f,
- .angle = { 0 },
- .previousMousePosition = { 0 },
- .moveControl = { 'W', 'S', 'D', 'A', 'E', 'Q' },
- .smoothZoomControl = 341, // raylib: KEY_LEFT_CONTROL
- .altControl = 342, // raylib: KEY_LEFT_ALT
- .panControl = 2 // raylib: MOUSE_BUTTON_MIDDLE
-};
-
-//----------------------------------------------------------------------------------
-// Module specific Functions Declaration
-//----------------------------------------------------------------------------------
-#if defined(CAMERA_STANDALONE)
-// NOTE: Camera controls depend on some raylib input functions
-static void EnableCursor() {} // Unlock cursor
-static void DisableCursor() {} // Lock cursor
-
-static int IsKeyDown(int key) { return 0; }
-
-static int IsMouseButtonDown(int button) { return 0;}
-static float GetMouseWheelMove() { return 0.0f; }
-static Vector2 GetMousePosition() { return (Vector2){ 0.0f, 0.0f }; }
-#endif
-
-//----------------------------------------------------------------------------------
-// Module Functions Definition
-//----------------------------------------------------------------------------------
-
-// Select camera mode (multiple camera modes available)
-void SetCameraMode(Camera camera, int mode)
-{
- Vector3 v1 = camera.position;
- Vector3 v2 = camera.target;
-
- float dx = v2.x - v1.x;
- float dy = v2.y - v1.y;
- float dz = v2.z - v1.z;
-
- CAMERA.targetDistance = sqrtf(dx*dx + dy*dy + dz*dz); // Distance to target
-
- // Camera angle calculation
- CAMERA.angle.x = atan2f(dx, dz); // Camera angle in plane XZ (0 aligned with Z, move positive CCW)
- CAMERA.angle.y = atan2f(dy, sqrtf(dx*dx + dz*dz)); // Camera angle in plane XY (0 aligned with X, move positive CW)
-
- CAMERA.playerEyesPosition = camera.position.y; // Init player eyes position to camera Y position
-
- CAMERA.previousMousePosition = GetMousePosition(); // Init mouse position
-
- // Lock cursor for first person and third person cameras
- if ((mode == CAMERA_FIRST_PERSON) || (mode == CAMERA_THIRD_PERSON)) DisableCursor();
- else EnableCursor();
-
- CAMERA.mode = mode;
-}
-
-// Update camera depending on selected mode
-// NOTE: Camera controls depend on some raylib functions:
-// System: EnableCursor(), DisableCursor()
-// Mouse: IsMouseButtonDown(), GetMousePosition(), GetMouseWheelMove()
-// Keys: IsKeyDown()
-void UpdateCamera(Camera *camera)
-{
- static int swingCounter = 0; // Used for 1st person swinging movement
-
- // TODO: Compute CAMERA.targetDistance and CAMERA.angle here (?)
-
- // Mouse movement detection
- Vector2 mousePositionDelta = { 0.0f, 0.0f };
- Vector2 mousePosition = GetMousePosition();
- float mouseWheelMove = GetMouseWheelMove();
-
- // Keys input detection
- // TODO: Input detection is raylib-dependant, it could be moved outside the module
- bool keyPan = IsMouseButtonDown(CAMERA.panControl);
- bool keyAlt = IsKeyDown(CAMERA.altControl);
- bool szoomKey = IsKeyDown(CAMERA.smoothZoomControl);
- bool direction[6] = { IsKeyDown(CAMERA.moveControl[MOVE_FRONT]),
- IsKeyDown(CAMERA.moveControl[MOVE_BACK]),
- IsKeyDown(CAMERA.moveControl[MOVE_RIGHT]),
- IsKeyDown(CAMERA.moveControl[MOVE_LEFT]),
- IsKeyDown(CAMERA.moveControl[MOVE_UP]),
- IsKeyDown(CAMERA.moveControl[MOVE_DOWN]) };
-
- if (CAMERA.mode != CAMERA_CUSTOM)
- {
- mousePositionDelta.x = mousePosition.x - CAMERA.previousMousePosition.x;
- mousePositionDelta.y = mousePosition.y - CAMERA.previousMousePosition.y;
-
- CAMERA.previousMousePosition = mousePosition;
- }
-
- // Support for multiple automatic camera modes
- // NOTE: In case of CAMERA_CUSTOM nothing happens here, user must update it manually
- switch (CAMERA.mode)
- {
- case CAMERA_FREE: // Camera free controls, using standard 3d-content-creation scheme
- {
- // Camera zoom
- if ((CAMERA.targetDistance < CAMERA_FREE_DISTANCE_MAX_CLAMP) && (mouseWheelMove < 0))
- {
- CAMERA.targetDistance -= (mouseWheelMove*CAMERA_MOUSE_SCROLL_SENSITIVITY);
- if (CAMERA.targetDistance > CAMERA_FREE_DISTANCE_MAX_CLAMP) CAMERA.targetDistance = CAMERA_FREE_DISTANCE_MAX_CLAMP;
- }
-
- // Camera looking down
- else if ((camera->position.y > camera->target.y) && (CAMERA.targetDistance == CAMERA_FREE_DISTANCE_MAX_CLAMP) && (mouseWheelMove < 0))
- {
- camera->target.x += mouseWheelMove*(camera->target.x - camera->position.x)*CAMERA_MOUSE_SCROLL_SENSITIVITY/CAMERA.targetDistance;
- camera->target.y += mouseWheelMove*(camera->target.y - camera->position.y)*CAMERA_MOUSE_SCROLL_SENSITIVITY/CAMERA.targetDistance;
- camera->target.z += mouseWheelMove*(camera->target.z - camera->position.z)*CAMERA_MOUSE_SCROLL_SENSITIVITY/CAMERA.targetDistance;
- }
- else if ((camera->position.y > camera->target.y) && (camera->target.y >= 0))
- {
- camera->target.x += mouseWheelMove*(camera->target.x - camera->position.x)*CAMERA_MOUSE_SCROLL_SENSITIVITY/CAMERA.targetDistance;
- camera->target.y += mouseWheelMove*(camera->target.y - camera->position.y)*CAMERA_MOUSE_SCROLL_SENSITIVITY/CAMERA.targetDistance;
- camera->target.z += mouseWheelMove*(camera->target.z - camera->position.z)*CAMERA_MOUSE_SCROLL_SENSITIVITY/CAMERA.targetDistance;
-
- // if (camera->target.y < 0) camera->target.y = -0.001;
- }
- else if ((camera->position.y > camera->target.y) && (camera->target.y < 0) && (mouseWheelMove > 0))
- {
- CAMERA.targetDistance -= (mouseWheelMove*CAMERA_MOUSE_SCROLL_SENSITIVITY);
- if (CAMERA.targetDistance < CAMERA_FREE_DISTANCE_MIN_CLAMP) CAMERA.targetDistance = CAMERA_FREE_DISTANCE_MIN_CLAMP;
- }
- // Camera looking up
- else if ((camera->position.y < camera->target.y) && (CAMERA.targetDistance == CAMERA_FREE_DISTANCE_MAX_CLAMP) && (mouseWheelMove < 0))
- {
- camera->target.x += mouseWheelMove*(camera->target.x - camera->position.x)*CAMERA_MOUSE_SCROLL_SENSITIVITY/CAMERA.targetDistance;
- camera->target.y += mouseWheelMove*(camera->target.y - camera->position.y)*CAMERA_MOUSE_SCROLL_SENSITIVITY/CAMERA.targetDistance;
- camera->target.z += mouseWheelMove*(camera->target.z - camera->position.z)*CAMERA_MOUSE_SCROLL_SENSITIVITY/CAMERA.targetDistance;
- }
- else if ((camera->position.y < camera->target.y) && (camera->target.y <= 0))
- {
- camera->target.x += mouseWheelMove*(camera->target.x - camera->position.x)*CAMERA_MOUSE_SCROLL_SENSITIVITY/CAMERA.targetDistance;
- camera->target.y += mouseWheelMove*(camera->target.y - camera->position.y)*CAMERA_MOUSE_SCROLL_SENSITIVITY/CAMERA.targetDistance;
- camera->target.z += mouseWheelMove*(camera->target.z - camera->position.z)*CAMERA_MOUSE_SCROLL_SENSITIVITY/CAMERA.targetDistance;
-
- // if (camera->target.y > 0) camera->target.y = 0.001;
- }
- else if ((camera->position.y < camera->target.y) && (camera->target.y > 0) && (mouseWheelMove > 0))
- {
- CAMERA.targetDistance -= (mouseWheelMove*CAMERA_MOUSE_SCROLL_SENSITIVITY);
- if (CAMERA.targetDistance < CAMERA_FREE_DISTANCE_MIN_CLAMP) CAMERA.targetDistance = CAMERA_FREE_DISTANCE_MIN_CLAMP;
- }
-
- // Input keys checks
- if (keyPan)
- {
- if (keyAlt) // Alternative key behaviour
- {
- if (szoomKey)
- {
- // Camera smooth zoom
- CAMERA.targetDistance += (mousePositionDelta.y*CAMERA_FREE_SMOOTH_ZOOM_SENSITIVITY);
- }
- else
- {
- // Camera rotation
- CAMERA.angle.x += mousePositionDelta.x*-CAMERA_FREE_MOUSE_SENSITIVITY;
- CAMERA.angle.y += mousePositionDelta.y*-CAMERA_FREE_MOUSE_SENSITIVITY;
-
- // Angle clamp
- if (CAMERA.angle.y > CAMERA_FREE_MIN_CLAMP*DEG2RAD) CAMERA.angle.y = CAMERA_FREE_MIN_CLAMP*DEG2RAD;
- else if (CAMERA.angle.y < CAMERA_FREE_MAX_CLAMP*DEG2RAD) CAMERA.angle.y = CAMERA_FREE_MAX_CLAMP*DEG2RAD;
- }
- }
- else
- {
- // Camera panning
- camera->target.x += ((mousePositionDelta.x*CAMERA_FREE_MOUSE_SENSITIVITY)*cosf(CAMERA.angle.x) + (mousePositionDelta.y*-CAMERA_FREE_MOUSE_SENSITIVITY)*sinf(CAMERA.angle.x)*sinf(CAMERA.angle.y))*(CAMERA.targetDistance/CAMERA_FREE_PANNING_DIVIDER);
- camera->target.y += ((mousePositionDelta.y*CAMERA_FREE_MOUSE_SENSITIVITY)*cosf(CAMERA.angle.y))*(CAMERA.targetDistance/CAMERA_FREE_PANNING_DIVIDER);
- camera->target.z += ((mousePositionDelta.x*-CAMERA_FREE_MOUSE_SENSITIVITY)*sinf(CAMERA.angle.x) + (mousePositionDelta.y*-CAMERA_FREE_MOUSE_SENSITIVITY)*cosf(CAMERA.angle.x)*sinf(CAMERA.angle.y))*(CAMERA.targetDistance/CAMERA_FREE_PANNING_DIVIDER);
- }
- }
-
- // Update camera position with changes
- camera->position.x = -sinf(CAMERA.angle.x)*CAMERA.targetDistance*cosf(CAMERA.angle.y) + camera->target.x;
- camera->position.y = -sinf(CAMERA.angle.y)*CAMERA.targetDistance + camera->target.y;
- camera->position.z = -cosf(CAMERA.angle.x)*CAMERA.targetDistance*cosf(CAMERA.angle.y) + camera->target.z;
-
- } break;
- case CAMERA_ORBITAL: // Camera just orbits around target, only zoom allowed
- {
- CAMERA.angle.x += CAMERA_ORBITAL_SPEED; // Camera orbit angle
- CAMERA.targetDistance -= (mouseWheelMove*CAMERA_MOUSE_SCROLL_SENSITIVITY); // Camera zoom
-
- // Camera distance clamp
- if (CAMERA.targetDistance < CAMERA_THIRD_PERSON_DISTANCE_CLAMP) CAMERA.targetDistance = CAMERA_THIRD_PERSON_DISTANCE_CLAMP;
-
- // Update camera position with changes
- camera->position.x = sinf(CAMERA.angle.x)*CAMERA.targetDistance*cosf(CAMERA.angle.y) + camera->target.x;
- camera->position.y = ((CAMERA.angle.y <= 0.0f)? 1 : -1)*sinf(CAMERA.angle.y)*CAMERA.targetDistance*sinf(CAMERA.angle.y) + camera->target.y;
- camera->position.z = cosf(CAMERA.angle.x)*CAMERA.targetDistance*cosf(CAMERA.angle.y) + camera->target.z;
-
- } break;
- case CAMERA_FIRST_PERSON: // Camera moves as in a first-person game, controls are configurable
- {
- camera->position.x += (sinf(CAMERA.angle.x)*direction[MOVE_BACK] -
- sinf(CAMERA.angle.x)*direction[MOVE_FRONT] -
- cosf(CAMERA.angle.x)*direction[MOVE_LEFT] +
- cosf(CAMERA.angle.x)*direction[MOVE_RIGHT])/PLAYER_MOVEMENT_SENSITIVITY;
-
- camera->position.y += (sinf(CAMERA.angle.y)*direction[MOVE_FRONT] -
- sinf(CAMERA.angle.y)*direction[MOVE_BACK] +
- 1.0f*direction[MOVE_UP] - 1.0f*direction[MOVE_DOWN])/PLAYER_MOVEMENT_SENSITIVITY;
-
- camera->position.z += (cosf(CAMERA.angle.x)*direction[MOVE_BACK] -
- cosf(CAMERA.angle.x)*direction[MOVE_FRONT] +
- sinf(CAMERA.angle.x)*direction[MOVE_LEFT] -
- sinf(CAMERA.angle.x)*direction[MOVE_RIGHT])/PLAYER_MOVEMENT_SENSITIVITY;
-
- // Camera orientation calculation
- CAMERA.angle.x += (mousePositionDelta.x*-CAMERA_MOUSE_MOVE_SENSITIVITY);
- CAMERA.angle.y += (mousePositionDelta.y*-CAMERA_MOUSE_MOVE_SENSITIVITY);
-
- // Angle clamp
- if (CAMERA.angle.y > CAMERA_FIRST_PERSON_MIN_CLAMP*DEG2RAD) CAMERA.angle.y = CAMERA_FIRST_PERSON_MIN_CLAMP*DEG2RAD;
- else if (CAMERA.angle.y < CAMERA_FIRST_PERSON_MAX_CLAMP*DEG2RAD) CAMERA.angle.y = CAMERA_FIRST_PERSON_MAX_CLAMP*DEG2RAD;
-
- // Calculate translation matrix
- Matrix matTranslation = { 1.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 1.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 1.0f, (CAMERA.targetDistance/CAMERA_FREE_PANNING_DIVIDER),
- 0.0f, 0.0f, 0.0f, 1.0f };
-
- // Calculate rotation matrix
- Matrix matRotation = { 1.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 1.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 1.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 1.0f };
-
- float cosz = cosf(0.0f);
- float sinz = sinf(0.0f);
- float cosy = cosf(-(PI*2 - CAMERA.angle.x));
- float siny = sinf(-(PI*2 - CAMERA.angle.x));
- float cosx = cosf(-(PI*2 - CAMERA.angle.y));
- float sinx = sinf(-(PI*2 - CAMERA.angle.y));
-
- matRotation.m0 = cosz*cosy;
- matRotation.m4 = (cosz*siny*sinx) - (sinz*cosx);
- matRotation.m8 = (cosz*siny*cosx) + (sinz*sinx);
- matRotation.m1 = sinz*cosy;
- matRotation.m5 = (sinz*siny*sinx) + (cosz*cosx);
- matRotation.m9 = (sinz*siny*cosx) - (cosz*sinx);
- matRotation.m2 = -siny;
- matRotation.m6 = cosy*sinx;
- matRotation.m10= cosy*cosx;
-
- // Multiply translation and rotation matrices
- Matrix matTransform = { 0 };
- matTransform.m0 = matTranslation.m0*matRotation.m0 + matTranslation.m1*matRotation.m4 + matTranslation.m2*matRotation.m8 + matTranslation.m3*matRotation.m12;
- matTransform.m1 = matTranslation.m0*matRotation.m1 + matTranslation.m1*matRotation.m5 + matTranslation.m2*matRotation.m9 + matTranslation.m3*matRotation.m13;
- matTransform.m2 = matTranslation.m0*matRotation.m2 + matTranslation.m1*matRotation.m6 + matTranslation.m2*matRotation.m10 + matTranslation.m3*matRotation.m14;
- matTransform.m3 = matTranslation.m0*matRotation.m3 + matTranslation.m1*matRotation.m7 + matTranslation.m2*matRotation.m11 + matTranslation.m3*matRotation.m15;
- matTransform.m4 = matTranslation.m4*matRotation.m0 + matTranslation.m5*matRotation.m4 + matTranslation.m6*matRotation.m8 + matTranslation.m7*matRotation.m12;
- matTransform.m5 = matTranslation.m4*matRotation.m1 + matTranslation.m5*matRotation.m5 + matTranslation.m6*matRotation.m9 + matTranslation.m7*matRotation.m13;
- matTransform.m6 = matTranslation.m4*matRotation.m2 + matTranslation.m5*matRotation.m6 + matTranslation.m6*matRotation.m10 + matTranslation.m7*matRotation.m14;
- matTransform.m7 = matTranslation.m4*matRotation.m3 + matTranslation.m5*matRotation.m7 + matTranslation.m6*matRotation.m11 + matTranslation.m7*matRotation.m15;
- matTransform.m8 = matTranslation.m8*matRotation.m0 + matTranslation.m9*matRotation.m4 + matTranslation.m10*matRotation.m8 + matTranslation.m11*matRotation.m12;
- matTransform.m9 = matTranslation.m8*matRotation.m1 + matTranslation.m9*matRotation.m5 + matTranslation.m10*matRotation.m9 + matTranslation.m11*matRotation.m13;
- matTransform.m10 = matTranslation.m8*matRotation.m2 + matTranslation.m9*matRotation.m6 + matTranslation.m10*matRotation.m10 + matTranslation.m11*matRotation.m14;
- matTransform.m11 = matTranslation.m8*matRotation.m3 + matTranslation.m9*matRotation.m7 + matTranslation.m10*matRotation.m11 + matTranslation.m11*matRotation.m15;
- matTransform.m12 = matTranslation.m12*matRotation.m0 + matTranslation.m13*matRotation.m4 + matTranslation.m14*matRotation.m8 + matTranslation.m15*matRotation.m12;
- matTransform.m13 = matTranslation.m12*matRotation.m1 + matTranslation.m13*matRotation.m5 + matTranslation.m14*matRotation.m9 + matTranslation.m15*matRotation.m13;
- matTransform.m14 = matTranslation.m12*matRotation.m2 + matTranslation.m13*matRotation.m6 + matTranslation.m14*matRotation.m10 + matTranslation.m15*matRotation.m14;
- matTransform.m15 = matTranslation.m12*matRotation.m3 + matTranslation.m13*matRotation.m7 + matTranslation.m14*matRotation.m11 + matTranslation.m15*matRotation.m15;
-
- camera->target.x = camera->position.x - matTransform.m12;
- camera->target.y = camera->position.y - matTransform.m13;
- camera->target.z = camera->position.z - matTransform.m14;
-
- // If movement detected (some key pressed), increase swinging
- for (int i = 0; i < 6; i++) if (direction[i]) { swingCounter++; break; }
-
- // Camera position update
- // NOTE: On CAMERA_FIRST_PERSON player Y-movement is limited to player 'eyes position'
- camera->position.y = CAMERA.playerEyesPosition - sinf(swingCounter/CAMERA_FIRST_PERSON_STEP_TRIGONOMETRIC_DIVIDER)/CAMERA_FIRST_PERSON_STEP_DIVIDER;
-
- camera->up.x = sinf(swingCounter/(CAMERA_FIRST_PERSON_STEP_TRIGONOMETRIC_DIVIDER*2))/CAMERA_FIRST_PERSON_WAVING_DIVIDER;
- camera->up.z = -sinf(swingCounter/(CAMERA_FIRST_PERSON_STEP_TRIGONOMETRIC_DIVIDER*2))/CAMERA_FIRST_PERSON_WAVING_DIVIDER;
-
- } break;
- case CAMERA_THIRD_PERSON: // Camera moves as in a third-person game, following target at a distance, controls are configurable
- {
- camera->position.x += (sinf(CAMERA.angle.x)*direction[MOVE_BACK] -
- sinf(CAMERA.angle.x)*direction[MOVE_FRONT] -
- cosf(CAMERA.angle.x)*direction[MOVE_LEFT] +
- cosf(CAMERA.angle.x)*direction[MOVE_RIGHT])/PLAYER_MOVEMENT_SENSITIVITY;
-
- camera->position.y += (sinf(CAMERA.angle.y)*direction[MOVE_FRONT] -
- sinf(CAMERA.angle.y)*direction[MOVE_BACK] +
- 1.0f*direction[MOVE_UP] - 1.0f*direction[MOVE_DOWN])/PLAYER_MOVEMENT_SENSITIVITY;
-
- camera->position.z += (cosf(CAMERA.angle.x)*direction[MOVE_BACK] -
- cosf(CAMERA.angle.x)*direction[MOVE_FRONT] +
- sinf(CAMERA.angle.x)*direction[MOVE_LEFT] -
- sinf(CAMERA.angle.x)*direction[MOVE_RIGHT])/PLAYER_MOVEMENT_SENSITIVITY;
-
- // Camera orientation calculation
- CAMERA.angle.x += (mousePositionDelta.x*-CAMERA_MOUSE_MOVE_SENSITIVITY);
- CAMERA.angle.y += (mousePositionDelta.y*-CAMERA_MOUSE_MOVE_SENSITIVITY);
-
- // Angle clamp
- if (CAMERA.angle.y > CAMERA_THIRD_PERSON_MIN_CLAMP*DEG2RAD) CAMERA.angle.y = CAMERA_THIRD_PERSON_MIN_CLAMP*DEG2RAD;
- else if (CAMERA.angle.y < CAMERA_THIRD_PERSON_MAX_CLAMP*DEG2RAD) CAMERA.angle.y = CAMERA_THIRD_PERSON_MAX_CLAMP*DEG2RAD;
-
- // Camera zoom
- CAMERA.targetDistance -= (mouseWheelMove*CAMERA_MOUSE_SCROLL_SENSITIVITY);
-
- // Camera distance clamp
- if (CAMERA.targetDistance < CAMERA_THIRD_PERSON_DISTANCE_CLAMP) CAMERA.targetDistance = CAMERA_THIRD_PERSON_DISTANCE_CLAMP;
-
- camera->position.x = sinf(CAMERA.angle.x)*CAMERA.targetDistance*cosf(CAMERA.angle.y) + camera->target.x;
-
- if (CAMERA.angle.y <= 0.0f) camera->position.y = sinf(CAMERA.angle.y)*CAMERA.targetDistance*sinf(CAMERA.angle.y) + camera->target.y;
- else camera->position.y = -sinf(CAMERA.angle.y)*CAMERA.targetDistance*sinf(CAMERA.angle.y) + camera->target.y;
-
- camera->position.z = cosf(CAMERA.angle.x)*CAMERA.targetDistance*cosf(CAMERA.angle.y) + camera->target.z;
-
- } break;
- case CAMERA_CUSTOM: break;
- default: break;
- }
-}
-
-// Set camera pan key to combine with mouse movement (free camera)
-void SetCameraPanControl(int keyPan) { CAMERA.panControl = keyPan; }
-
-// Set camera alt key to combine with mouse movement (free camera)
-void SetCameraAltControl(int keyAlt) { CAMERA.altControl = keyAlt; }
-
-// Set camera smooth zoom key to combine with mouse (free camera)
-void SetCameraSmoothZoomControl(int szoomKey) { CAMERA.smoothZoomControl = szoomKey; }
-
-// Set camera move controls (1st person and 3rd person cameras)
-void SetCameraMoveControls(int keyFront, int keyBack, int keyRight, int keyLeft, int keyUp, int keyDown)
-{
- CAMERA.moveControl[MOVE_FRONT] = keyFront;
- CAMERA.moveControl[MOVE_BACK] = keyBack;
- CAMERA.moveControl[MOVE_RIGHT] = keyRight;
- CAMERA.moveControl[MOVE_LEFT] = keyLeft;
- CAMERA.moveControl[MOVE_UP] = keyUp;
- CAMERA.moveControl[MOVE_DOWN] = keyDown;
-}
-
-#endif // CAMERA_IMPLEMENTATION
diff --git a/src/rcore.c b/src/rcore.c
index 84ff72878..3f85b41ed 100644
--- a/src/rcore.c
+++ b/src/rcore.c
@@ -1720,7 +1720,7 @@ void *GetWindowHandle(void)
// NOTE: Returned handle is: unsigned long Window (X.h)
// typedef unsigned long XID;
// typedef XID Window;
- //unsigned long id = (unsigned long)glfwGetX11Window(window);
+ //unsigned long id = (unsigned long)glfwGetX11Window(CORE.Window.handle);
//return NULL; // TODO: Find a way to return value... cast to void *?
return (void *)CORE.Window.handle;
#endif
@@ -1997,7 +1997,9 @@ void SetClipboardText(const char *text)
glfwSetClipboardString(CORE.Window.handle, text);
#endif
#if defined(PLATFORM_WEB)
- emscripten_run_script(TextFormat("navigator.clipboard.writeText('%s')", text));
+ // Security check to (partially) avoid malicious code
+ if (strchr(text, '\'') != NULL) TRACELOG(LOG_WARNING, "SYSTEM: Provided Clipboard could be potentially malicious, avoid [\'] character");
+ else emscripten_run_script(TextFormat("navigator.clipboard.writeText('%s')", text));
#endif
}
@@ -2009,6 +2011,7 @@ const char *GetClipboardText(void)
return glfwGetClipboardString(CORE.Window.handle);
#endif
#if defined(PLATFORM_WEB)
+/*
// Accessing clipboard data from browser is tricky due to security reasons
// The method to use is navigator.clipboard.readText() but this is an asynchronous method
// that will return at some moment after the function is called with the required data
@@ -2022,7 +2025,7 @@ const char *GetClipboardText(void)
// Another approach could be just copy the data in a HTML text field and try to retrieve it
// later on if available... and clean it for future accesses
-
+*/
return NULL;
#endif
return NULL;
@@ -2946,6 +2949,9 @@ void SetConfigFlags(unsigned int flags)
void TakeScreenshot(const char *fileName)
{
#if defined(SUPPORT_MODULE_RTEXTURES)
+ // Security check to (partially) avoid malicious code on PLATFORM_WEB
+ if (strchr(fileName, '\'') != NULL) { TRACELOG(LOG_WARNING, "SYSTEM: Provided fileName could be potentially malicious, avoid [\'] character"); return; }
+
Vector2 scale = GetWindowScaleDPI();
unsigned char *imgData = rlReadScreenPixels((int)((float)CORE.Window.render.width*scale.x), (int)((float)CORE.Window.render.height*scale.y));
Image image = { imgData, (int)((float)CORE.Window.render.width*scale.x), (int)((float)CORE.Window.render.height*scale.y), 1, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 };
@@ -3572,12 +3578,8 @@ unsigned char *DecodeDataBase64(const unsigned char *data, int *outputSize)
// Ref: https://github.com/raysan5/raylib/issues/686
void OpenURL(const char *url)
{
- // Small security check trying to avoid (partially) malicious code...
- // sorry for the inconvenience when you hit this point...
- if (strchr(url, '\'') != NULL)
- {
- TRACELOG(LOG_WARNING, "SYSTEM: Provided URL is not valid");
- }
+ // Security check to (aprtially) avoid malicious code on PLATFORM_WEB
+ if (strchr(url, '\'') != NULL) TRACELOG(LOG_WARNING, "SYSTEM: Provided URL could be potentially malicious, avoid [\'] character");
else
{
#if defined(PLATFORM_DESKTOP)
diff --git a/src/rglfw.c b/src/rglfw.c
index 794e0d2e4..59f5ad2f8 100644
--- a/src/rglfw.c
+++ b/src/rglfw.c
@@ -108,6 +108,7 @@
#include "external/glfw/src/posix_module.c"
#include "external/glfw/src/posix_thread.c"
#include "external/glfw/src/posix_time.c"
+ #include "external/glfw/src/posix_poll.c"
#include "external/glfw/src/null_joystick.c"
#include "external/glfw/src/xkb_unicode.c"
diff --git a/src/rlgl.h b/src/rlgl.h
index 66a349645..86208de4c 100644
--- a/src/rlgl.h
+++ b/src/rlgl.h
@@ -1,6 +1,6 @@
/**********************************************************************************************
*
-* rlgl v4.2 - A multi-OpenGL abstraction layer with an immediate-mode style API
+* rlgl v4.5 - A multi-OpenGL abstraction layer with an immediate-mode style API
*
* An abstraction layer for multiple OpenGL versions (1.1, 2.1, 3.3 Core, 4.3 Core, ES 2.0)
* that provides a pseudo-OpenGL 1.1 immediate-mode style API (rlVertex, rlTranslate, rlRotate...)
@@ -106,7 +106,7 @@
#ifndef RLGL_H
#define RLGL_H
-#define RLGL_VERSION "4.2"
+#define RLGL_VERSION "4.5"
// Function specifiers in case library is build/used as a shared library (Windows)
// NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll
diff --git a/src/rmodels.c b/src/rmodels.c
index b28e14dc1..2b1d0f936 100644
--- a/src/rmodels.c
+++ b/src/rmodels.c
@@ -1112,7 +1112,13 @@ Model LoadModelFromMesh(Mesh mesh)
// Check if a model is ready
bool IsModelReady(Model model)
{
- return model.meshes != NULL && model.materials != NULL && model.meshMaterial != NULL && model.meshCount > 0 && model.materialCount > 0;
+ return ((model.meshes != NULL) && // Validate model contains some mesh
+ (model.materials != NULL) && // Validate model contains some material (at least default one)
+ (model.meshMaterial != NULL) && // Validate mesh-material linkage
+ (model.meshCount > 0) && // Validate mesh count
+ (model.materialCount > 0)); // Validate material count
+
+ // NOTE: This is a very general model validation, many elements could be validated from a model...
}
// Unload model (meshes/materials) from memory (RAM and/or VRAM)
@@ -1141,27 +1147,6 @@ void UnloadModel(Model model)
TRACELOG(LOG_INFO, "MODEL: Unloaded model (and meshes) from RAM and VRAM");
}
-// Unload model (but not meshes) from memory (RAM and/or VRAM)
-void UnloadModelKeepMeshes(Model model)
-{
- // Unload materials maps
- // NOTE: As the user could be sharing shaders and textures between models,
- // we don't unload the material but just free its maps,
- // the user is responsible for freeing models shaders and textures
- for (int i = 0; i < model.materialCount; i++) RL_FREE(model.materials[i].maps);
-
- // Unload arrays
- RL_FREE(model.meshes);
- RL_FREE(model.materials);
- RL_FREE(model.meshMaterial);
-
- // Unload animation data
- RL_FREE(model.bones);
- RL_FREE(model.bindPose);
-
- TRACELOG(LOG_INFO, "MODEL: Unloaded model (but not meshes) from RAM and VRAM");
-}
-
// Compute model bounding box limits (considers all meshes)
BoundingBox GetModelBoundingBox(Model model)
{
@@ -1959,7 +1944,8 @@ Material LoadMaterialDefault(void)
// Check if a material is ready
bool IsMaterialReady(Material material)
{
- return material.maps != NULL;
+ return ((material.maps != NULL) && // Validate material contain some map
+ (material.shader.id > 0)); // Validate material shader is valid
}
// Unload material from memory
diff --git a/src/rtext.c b/src/rtext.c
index f07261121..9eec0059f 100644
--- a/src/rtext.c
+++ b/src/rtext.c
@@ -538,7 +538,14 @@ Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int
// Check if a font is ready
bool IsFontReady(Font font)
{
- return font.glyphs != NULL;
+ return ((font.texture.id > 0) && // Validate OpenGL id fot font texture atlas
+ (font.baseSize > 0) && // Validate font size
+ (font.glyphCount > 0) && // Validate font contains some glyph
+ (font.recs != NULL) && // Validate font recs defining glyphs on texture atlas
+ (font.glyphs != NULL)); // Validate glyph data is loaded
+
+ // NOTE: Further validations could be done to verify if recs count and glyphs count
+ // match glyphCount and to verify that data contained is valid (glyphs values, metrics...)
}
// Load font data for further use
diff --git a/src/rtextures.c b/src/rtextures.c
index 56b200ce8..b5f9998a9 100644
--- a/src/rtextures.c
+++ b/src/rtextures.c
@@ -3362,7 +3362,9 @@ void UnloadTexture(Texture2D texture)
// Check if a render texture is ready
bool IsRenderTextureReady(RenderTexture2D target)
{
- return target.id > 0 && IsTextureReady(target.depth) && IsTextureReady(target.texture);
+ return ((target.id > 0) && // Validate OpenGL id
+ IsTextureReady(target.depth) && // Validate FBO depth texture/renderbuffer
+ IsTextureReady(target.texture)); // Validate FBO texture
}
// Unload render texture from GPU memory (VRAM)
diff --git a/src/utils.c b/src/utils.c
index 6843bd946..771271d35 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -54,7 +54,7 @@
// Defines and Macros
//----------------------------------------------------------------------------------
#ifndef MAX_TRACELOG_MSG_LENGTH
- #define MAX_TRACELOG_MSG_LENGTH 128 // Max length of one trace-log message
+ #define MAX_TRACELOG_MSG_LENGTH 256 // Max length of one trace-log message
#endif
//----------------------------------------------------------------------------------
@@ -145,7 +145,8 @@ void TraceLog(int logType, const char *text, ...)
default: break;
}
- strcat(buffer, text);
+ unsigned int textSize = strlen(text);
+ memcpy(buffer + strlen(buffer), text, (textSize < (MAX_TRACELOG_MSG_LENGTH - 12))? textSize : (MAX_TRACELOG_MSG_LENGTH - 12));
strcat(buffer, "\n");
vprintf(buffer, args);
fflush(stdout);