├── external
├── stb
│ ├── stb.c
│ ├── version_stb
│ └── CMakeLists.txt
├── soloud
│ ├── src
│ │ ├── audiosource
│ │ │ ├── wav
│ │ │ │ ├── stb_vorbis.h
│ │ │ │ └── dr_impl.cpp
│ │ │ ├── speech
│ │ │ │ ├── tts.h
│ │ │ │ ├── darray.h
│ │ │ │ ├── legal_readme.txt
│ │ │ │ ├── darray.cpp
│ │ │ │ ├── resonator.h
│ │ │ │ └── resonator.cpp
│ │ │ ├── tedsid
│ │ │ │ ├── readme.txt
│ │ │ │ └── ted.h
│ │ │ └── ay
│ │ │ │ ├── readme.txt
│ │ │ │ ├── chipplayer.h
│ │ │ │ ├── sndrender.h
│ │ │ │ ├── sndbuffer.cpp
│ │ │ │ └── sndbuffer.h
│ │ ├── tools
│ │ │ └── resamplerlab
│ │ │ │ └── stb_image_write.c
│ │ ├── backend
│ │ │ ├── null
│ │ │ │ └── soloud_null.cpp
│ │ │ ├── sdl_static
│ │ │ │ └── soloud_sdl_static.cpp
│ │ │ ├── sdl
│ │ │ │ ├── soloud_sdl1.cpp
│ │ │ │ └── soloud_sdl1_dll.c
│ │ │ ├── miniaudio
│ │ │ │ └── soloud_miniaudio.cpp
│ │ │ └── sdl2_static
│ │ │ │ └── soloud_sdl2_static.cpp
│ │ ├── filter
│ │ │ ├── soloud_bassboostfilter.cpp
│ │ │ ├── soloud_dcremovalfilter.cpp
│ │ │ ├── soloud_robotizefilter.cpp
│ │ │ └── soloud_waveshaperfilter.cpp
│ │ └── core
│ │ │ ├── soloud_fader.cpp
│ │ │ └── soloud_misc.cpp
│ ├── version
│ ├── soloud.png
│ ├── .gitmodules
│ ├── scripts
│ │ ├── compile_gamemaker_dll.bat
│ │ ├── makeglue.py
│ │ ├── make_gmez.bat
│ │ ├── readme.txt
│ │ ├── checkapidoc.py
│ │ ├── checksanity.py
│ │ ├── gen_autoit.py
│ │ └── gen_blitzmax.py
│ ├── contrib
│ │ ├── README.md
│ │ ├── cmake
│ │ │ ├── Install.cmake
│ │ │ ├── PrintOptionStatus.cmake
│ │ │ ├── InstallExport.cmake
│ │ │ └── OptionDependentOnPackage.cmake
│ │ ├── CMakeLists.txt
│ │ ├── demos.cmake
│ │ ├── Configure.cmake
│ │ └── gen_glue.cmake
│ ├── README.md
│ ├── issue_template.md
│ ├── .gitignore
│ ├── include
│ │ ├── soloud_file_hack_off.h
│ │ ├── soloud_misc.h
│ │ ├── soloud_error.h
│ │ ├── soloud_fft.h
│ │ ├── soloud_dcremovalfilter.h
│ │ ├── soloud_openmpt.h
│ │ ├── soloud_vizsn.h
│ │ ├── soloud_fader.h
│ │ ├── soloud_ay.h
│ │ ├── soloud_noise.h
│ │ ├── soloud_tedsid.h
│ │ ├── soloud_waveshaperfilter.h
│ │ ├── soloud_bassboostfilter.h
│ │ ├── soloud_flangerfilter.h
│ │ ├── soloud_echofilter.h
│ │ ├── soloud_robotizefilter.h
│ │ ├── soloud_duckfilter.h
│ │ ├── soloud_file_hack_on.h
│ │ ├── soloud_queue.h
│ │ ├── soloud_lofifilter.h
│ │ ├── soloud_eqfilter.h
│ │ ├── soloud_fftfilter.h
│ │ ├── soloud_speech.h
│ │ ├── soloud_freeverbfilter.h
│ │ ├── soloud_wav.h
│ │ ├── soloud_filter.h
│ │ ├── soloud_biquadresonantfilter.h
│ │ ├── soloud_file.h
│ │ ├── soloud_thread.h
│ │ ├── zx7decompress.h
│ │ ├── soloud_wavstream.h
│ │ ├── soloud_monotone.h
│ │ └── soloud_vic.h
│ ├── PULL_REQUEST_TEMPLATE.md
│ ├── LICENSE
│ ├── AUTHORS
│ └── CONTRIBUTING
├── sokol
│ ├── version_sokol
│ ├── sokol.c
│ └── CMakeLists.txt
├── CMakeLists.txt
└── cimgui
│ ├── CMakeLists.txt
│ ├── LICENSE
│ └── imgui
│ └── LICENSE.txt
├── media
├── showcase.jpg
└── custom-widget.jpg
├── .npmrc.example
├── .prettierrc
├── .gitignore
├── lib
├── imgui-unit
│ ├── js_externs.c
│ ├── gen_js_externs.sh
│ ├── CMakeLists.txt
│ └── main.js
├── CMakeLists.txt
├── imgui-runtime
│ ├── MappedFileBuffer.h
│ ├── CMakeLists.txt
│ ├── imgui-runtime.h
│ └── MappedFileBuffer.cpp
├── jslib-unit
│ └── CMakeLists.txt
└── react-imgui-reconciler
│ ├── tree-node.js
│ ├── perf-stats.js
│ ├── tree-printer.js
│ └── reconciler.js
├── examples
├── custom-widget
│ ├── CMakeLists.txt
│ ├── custom-widget.cpp
│ ├── index.jsx
│ └── app.jsx
├── hello
│ ├── hello.cpp
│ ├── app.jsx
│ ├── CMakeLists.txt
│ └── index.js
├── showcase
│ ├── showcase.cpp
│ ├── CMakeLists.txt
│ ├── index.js
│ └── ControlledWindow.jsx
├── dynamic-windows
│ ├── dynamic-windows.cpp
│ ├── CMakeLists.txt
│ ├── index.js
│ └── app.jsx
└── CMakeLists.txt
├── .babelrc.cjs
├── Dockerfile.fedora42
├── Dockerfile.ubuntu2404
├── package.json
├── LICENSE_sokol
├── LICENSE
├── LICENSE_soloud
├── doc
└── TODO.md
├── tools
└── xxd.py
├── CMakeLists.txt
└── LICENSE_stb
/external/stb/stb.c:
--------------------------------------------------------------------------------
1 | #define STB_IMAGE_IMPLEMENTATION
2 | #include "stb_image.h"
--------------------------------------------------------------------------------
/media/showcase.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tmikov/imgui-react-runtime/HEAD/media/showcase.jpg
--------------------------------------------------------------------------------
/external/soloud/src/audiosource/wav/stb_vorbis.h:
--------------------------------------------------------------------------------
1 | #define STB_VORBIS_HEADER_ONLY
2 | #include "stb_vorbis.c"
--------------------------------------------------------------------------------
/media/custom-widget.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tmikov/imgui-react-runtime/HEAD/media/custom-widget.jpg
--------------------------------------------------------------------------------
/external/sokol/version_sokol:
--------------------------------------------------------------------------------
1 | https://github.com/floooh/sokol
2 | 31f3dfc17931113cfa3d4f73b242730631f44cf5
3 |
--------------------------------------------------------------------------------
/external/soloud/version:
--------------------------------------------------------------------------------
1 | https://github.com/jarikomppa/soloud
2 | 1157475881da0d7f76102578255b937c7d4e8f57
3 |
--------------------------------------------------------------------------------
/external/stb/version_stb:
--------------------------------------------------------------------------------
1 | https://github.com/nothings/stb.git
2 | beebb24b945efdea3b9bba23affb8eb3ba8982e7
3 |
--------------------------------------------------------------------------------
/.npmrc.example:
--------------------------------------------------------------------------------
1 | # Copy this file to .npmrc and update the path to your Hermes binary
2 | hermes_bin=/path/to/hermes
3 |
--------------------------------------------------------------------------------
/external/soloud/soloud.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tmikov/imgui-react-runtime/HEAD/external/soloud/soloud.png
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "semi": true,
3 | "singleQuote": true,
4 | "tabWidth": 2,
5 | "trailingComma": "es5"
6 | }
7 |
--------------------------------------------------------------------------------
/external/soloud/src/audiosource/speech/tts.h:
--------------------------------------------------------------------------------
1 |
2 | extern int xlate_string (const char *string,darray *phone);
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/external/soloud/src/tools/resamplerlab/stb_image_write.c:
--------------------------------------------------------------------------------
1 | #define STB_IMAGE_WRITE_IMPLEMENTATION
2 | #include "stb_image_write.h"
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | dist/
3 | bundle/
4 | *.log
5 | .DS_Store
6 | .npmrc
7 | cmake-build-*/
8 | .claude/
9 | .idea/
10 |
--------------------------------------------------------------------------------
/lib/imgui-unit/js_externs.c:
--------------------------------------------------------------------------------
1 | #define CIMGUI_DEFINE_ENUMS_AND_STRUCTS
2 | #include "cimgui/cimgui.h"
3 | #include "sokol/sokol_imgui.h"
4 |
--------------------------------------------------------------------------------
/external/soloud/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "ext/libmodplug"]
2 | path = ext/libmodplug
3 | url = https://github.com/jarikomppa/libmodplug.git
4 |
--------------------------------------------------------------------------------
/external/stb/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library(stb stb.c stb_image.h)
2 | target_include_directories(stb INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
3 |
--------------------------------------------------------------------------------
/external/soloud/src/audiosource/tedsid/readme.txt:
--------------------------------------------------------------------------------
1 | The TED / SID support is based on tedplay (c) 2012 Attila Grosz, used under Unlicense http://unlicense.org/
2 |
--------------------------------------------------------------------------------
/external/soloud/scripts/compile_gamemaker_dll.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | call vcvars32.bat
3 | cl /LD /MT /Ox /nologo soloud_gamemaker_dll.c soloud_gamemaker_dll.def user32.lib
4 |
--------------------------------------------------------------------------------
/external/soloud/src/audiosource/ay/readme.txt:
--------------------------------------------------------------------------------
1 | The AY sound support is based on public domain zxssk library
2 | "created under public domain license by SMT, jan.2006"
3 |
--------------------------------------------------------------------------------
/external/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #add_subdirectory(soloud/contrib)
2 |
3 | # Third-party native libraries
4 | add_subdirectory(cimgui)
5 | add_subdirectory(sokol)
6 | add_subdirectory(stb)
7 |
--------------------------------------------------------------------------------
/examples/custom-widget/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Custom Widget Example
2 |
3 | add_react_imgui_app(
4 | TARGET custom-widget
5 | ENTRY_POINT index.jsx
6 | SOURCES custom-widget.cpp
7 | )
8 |
--------------------------------------------------------------------------------
/external/soloud/scripts/makeglue.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | import glob
3 | import subprocess
4 |
5 | for file in glob.glob("gen_*.py"):
6 | subprocess.call(["python",file])
7 |
8 |
--------------------------------------------------------------------------------
/external/soloud/scripts/make_gmez.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | del soloud.gmez
3 | cd gm_temp
4 | 7z a -r -y ../../glue/soloud.gmez *
5 | cd ..
6 | rd /s /q gm_temp
7 | del soloud_gamemaker_dll.*
8 | del soloud.extension.gmx
9 |
--------------------------------------------------------------------------------
/examples/hello/hello.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tzvetan Mikov and contributors
2 | // SPDX-License-Identifier: MIT
3 | // See LICENSE file for full license text
4 |
5 | #define PROVIDE_IMGUI_MAIN
6 | #include "imgui-runtime.h"
7 |
--------------------------------------------------------------------------------
/examples/showcase/showcase.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tzvetan Mikov and contributors
2 | // SPDX-License-Identifier: MIT
3 | // See LICENSE file for full license text
4 |
5 | #define PROVIDE_IMGUI_MAIN
6 | #include "imgui-runtime.h"
7 |
--------------------------------------------------------------------------------
/external/soloud/scripts/readme.txt:
--------------------------------------------------------------------------------
1 | The 'codegen' tool can be used to parse SoLoud headers and generate the
2 | soloud_codegen.py file.
3 |
4 | This file can then be used to generate various "glue" code for non-c
5 | environments.
6 |
--------------------------------------------------------------------------------
/examples/dynamic-windows/dynamic-windows.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tzvetan Mikov and contributors
2 | // SPDX-License-Identifier: MIT
3 | // See LICENSE file for full license text
4 |
5 | #define PROVIDE_IMGUI_MAIN
6 | #include "imgui-runtime.h"
7 |
--------------------------------------------------------------------------------
/examples/custom-widget/custom-widget.cpp:
--------------------------------------------------------------------------------
1 | // Custom Widget Example - Demonstrates custom ImGui widget creation
2 | // This example shows how to create custom widgets using ImGui's draw list API
3 |
4 | #define PROVIDE_IMGUI_MAIN
5 | #include "imgui-runtime.h"
6 |
--------------------------------------------------------------------------------
/.babelrc.cjs:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | ['@babel/preset-react', { runtime: 'automatic' }]
4 | ],
5 | plugins: [
6 | process.env.USE_REACT_COMPILER === 'true'
7 | ? 'babel-plugin-react-compiler'
8 | : null
9 | ].filter(Boolean)
10 | };
11 |
--------------------------------------------------------------------------------
/lib/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (c) Tzvetan Mikov and contributors
2 | # SPDX-License-Identifier: MIT
3 | # See LICENSE file for full license text
4 |
5 | # JavaScript library units compiled with Static Hermes
6 |
7 | add_subdirectory(jslib-unit)
8 | add_subdirectory(imgui-unit)
9 | add_subdirectory(imgui-runtime)
10 |
--------------------------------------------------------------------------------
/examples/hello/app.jsx:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tzvetan Mikov and contributors
2 | // SPDX-License-Identifier: MIT
3 | // See LICENSE file for full license text
4 |
5 | import React from 'react';
6 |
7 | export function App() {
8 | return (
9 |
10 | Hello World!
11 |
12 | );
13 | }
14 |
--------------------------------------------------------------------------------
/external/soloud/contrib/README.md:
--------------------------------------------------------------------------------
1 | The contrib folder contains files that may be of use to some people
2 | but are not maintained by the project itself. As such they may be
3 | out of date. Pull requests are welcome.
4 |
5 | Note that the licenses of the contrib files may also be out of line
6 | with the SoLoud proper. You have been warned.
--------------------------------------------------------------------------------
/external/soloud/README.md:
--------------------------------------------------------------------------------
1 | SoLoud
2 | ======
3 |
4 | SoLoud is an easy to use, free, portable c/c++ audio engine for games.
5 |
6 | 
7 |
8 | Zlib/LibPng licensed. Portable. Easy.
9 |
10 | Official site with documentation can be found at:
11 | http://soloud-audio.com
12 |
--------------------------------------------------------------------------------
/examples/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (c) Tzvetan Mikov and contributors
2 | # SPDX-License-Identifier: MIT
3 | # See LICENSE file for full license text
4 |
5 | # Examples directory - each subdirectory is an example application
6 | add_subdirectory(hello)
7 | add_subdirectory(dynamic-windows)
8 | add_subdirectory(showcase)
9 | add_subdirectory(custom-widget)
10 |
--------------------------------------------------------------------------------
/Dockerfile.fedora42:
--------------------------------------------------------------------------------
1 | FROM fedora:42
2 |
3 | # Install build dependencies for imgui-react-runtime
4 | RUN dnf install -y \
5 | git \
6 | nodejs npm \
7 | clang \
8 | cmake \
9 | ninja-build \
10 | libX11-devel \
11 | libXi-devel \
12 | libXcursor-devel \
13 | mesa-libGL-devel \
14 | libicu-devel \
15 | && dnf clean all
16 |
--------------------------------------------------------------------------------
/external/soloud/src/audiosource/wav/dr_impl.cpp:
--------------------------------------------------------------------------------
1 | #define DR_MP3_IMPLEMENTATION
2 | #define DR_MP3_NO_STDIO
3 | #define DR_MP3_FLOAT_OUTPUT
4 | #include "dr_mp3.h"
5 |
6 | #define DR_WAV_IMPLEMENTATION
7 | #define DR_WAV_NO_STDIO
8 | #include "dr_wav.h"
9 |
10 | #define DR_FLAC_IMPLEMENTATION
11 | #define DR_FLAC_NO_STDIO
12 | #define DR_FLAC_NO_CRC
13 | #include "dr_flac.h"
14 |
--------------------------------------------------------------------------------
/external/cimgui/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Dear ImGui C bindings
2 | add_library(cimgui STATIC
3 | cimgui.cpp
4 | cimgui.h
5 | imgui/imgui.cpp
6 | imgui/imgui.h
7 | imgui/imgui_widgets.cpp
8 | imgui/imgui_draw.cpp
9 | imgui/imgui_tables.cpp
10 | imgui/imgui_demo.cpp)
11 | target_include_directories(cimgui INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
12 |
--------------------------------------------------------------------------------
/lib/imgui-unit/gen_js_externs.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | ../tools/ffigen.py js js_externs.c sokol_imgui.h,cimgui.h > js_externs.js
4 | ../tools/ffigen.py cwrap js_externs.c sokol_imgui.h,cimgui.h > tmp-cwrap.c
5 |
6 | cat << "EOF" - tmp-cwrap.c > js_externs_cwrap.c
7 | #define CIMGUI_DEFINE_ENUMS_AND_STRUCTS
8 | #include "cimgui.h"
9 | #include "sokol_app.h"
10 | #include "sokol_gfx.h"
11 | #include "sokol_imgui.h"
12 | EOF
13 |
14 | rm tmp-cwrap.c
15 |
--------------------------------------------------------------------------------
/external/soloud/src/audiosource/speech/darray.h:
--------------------------------------------------------------------------------
1 | #if !defined(DARRAY_H)
2 | #define DARRAY_H
3 |
4 | class darray
5 | {
6 | protected:
7 | char *mData;
8 | int mUsed;
9 | int mAllocated;
10 | int mAllocChunk;
11 | public:
12 | darray();
13 | ~darray();
14 | void clear();
15 | char *getDataInPos(int aPosition);
16 | void put(int aData);
17 | int getSize() const { return mUsed; }
18 | char *getData() { return mData; }
19 | };
20 |
21 | #endif
22 |
23 |
--------------------------------------------------------------------------------
/examples/hello/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (c) Tzvetan Mikov and contributors
2 | # SPDX-License-Identifier: MIT
3 | # See LICENSE file for full license text
4 |
5 | # Note: Native libraries (cimgui, sokol, stb, soloud) are built in external/
6 | # Note: Hermes configuration is in root CMakeLists.txt
7 | # Note: jslib-unit and imgui-unit are built in lib/
8 |
9 | # Build the hello React+ImGui application
10 | add_react_imgui_app(
11 | TARGET hello
12 | ENTRY_POINT index.js
13 | SOURCES hello.cpp
14 | )
15 |
--------------------------------------------------------------------------------
/examples/showcase/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (c) Tzvetan Mikov and contributors
2 | # SPDX-License-Identifier: MIT
3 | # See LICENSE file for full license text
4 |
5 | # Note: Native libraries (cimgui, sokol, stb, soloud) are built in external/
6 | # Note: Hermes configuration is in root CMakeLists.txt
7 | # Note: jslib-unit and imgui-unit are built in lib/
8 |
9 | # Build the showcase React+ImGui application
10 | add_react_imgui_app(
11 | TARGET showcase
12 | ENTRY_POINT index.js
13 | SOURCES showcase.cpp
14 | )
15 |
--------------------------------------------------------------------------------
/examples/custom-widget/index.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { createRoot, render } from 'react-imgui-reconciler/reconciler.js';
3 | import { App } from './app.jsx';
4 |
5 | // Create React root with fiber root and container
6 | const root = createRoot();
7 |
8 | // Expose to typed unit via global
9 | globalThis.reactApp = {
10 | rootChildren: [],
11 |
12 | // Render the app
13 | render() {
14 | render(React.createElement(App), root);
15 | },
16 | };
17 |
18 | // Initial render
19 | globalThis.reactApp.render();
20 |
--------------------------------------------------------------------------------
/examples/dynamic-windows/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (c) Tzvetan Mikov and contributors
2 | # SPDX-License-Identifier: MIT
3 | # See LICENSE file for full license text
4 |
5 | # Note: Native libraries (cimgui, sokol, stb, soloud) are built in external/
6 | # Note: Hermes configuration is in root CMakeLists.txt
7 | # Note: jslib-unit and imgui-unit are built in lib/
8 |
9 | # Build the dynamic-windows React+ImGui application
10 | add_react_imgui_app(
11 | TARGET dynamic-windows
12 | ENTRY_POINT index.js
13 | SOURCES dynamic-windows.cpp
14 | )
15 |
--------------------------------------------------------------------------------
/external/soloud/issue_template.md:
--------------------------------------------------------------------------------
1 | > Expected behavior:
2 |
3 |
4 | > Actual behavior:
5 |
6 |
7 | > Steps to reproduce the problem:
8 |
9 |
10 | > SoLoud version, operating system, backend used, any other potentially useful information:
11 |
12 |
13 | [//]: # ( You don't need to follow the above template if you do not want to; feel free to start from scratch. )
14 | [//]: # ( Following the template leads to problem reports that are helpful to the developers. )
15 | [//]: # ( ...yes, this weird syntax is how one writes comments in a markdown file )
16 |
--------------------------------------------------------------------------------
/Dockerfile.ubuntu2404:
--------------------------------------------------------------------------------
1 | FROM ubuntu:24.04
2 |
3 | # Install build dependencies for imgui-react-runtime
4 | RUN apt-get update && apt-get install -y \
5 | git \
6 | curl \
7 | clang \
8 | cmake \
9 | ninja-build \
10 | libx11-dev \
11 | libxi-dev \
12 | libxcursor-dev \
13 | libgl1-mesa-dev \
14 | libicu-dev \
15 | && rm -rf /var/lib/apt/lists/*
16 |
17 | # Install Node.js 20 from NodeSource
18 | RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
19 | && apt-get install -y nodejs \
20 | && rm -rf /var/lib/apt/lists/*
21 |
--------------------------------------------------------------------------------
/external/soloud/.gitignore:
--------------------------------------------------------------------------------
1 | Debug/
2 | _UpgradeReport_Files/
3 | *.ipch
4 | *.opensdf
5 | *.sdf
6 | *.old
7 | *.filters
8 | build/
9 | *.aux
10 | *.out
11 | *.gz
12 | *.toc
13 | *.o
14 | incoming/
15 | experiments/
16 | scripts/*.log
17 | lib/*
18 | rel/*
19 | doc/*
20 | bin/audio/
21 | bin/
22 | lib/*.ilk
23 | lib/*.lib
24 | lib/*.dll
25 | out/
26 | *.pyc
27 | *.exp
28 | docsrc/xelatex_output.txt
29 | docsrc/kindlegen_output.txt
30 | *.idb
31 | *.pdb
32 | docsrc/20*
33 | glue/*
34 | scripts/soloud_codegen.py
35 | glue/rpgmaker_soloud.rb
36 | *.lastcodeanalysissucceeded
37 | *.bak
38 |
--------------------------------------------------------------------------------
/external/sokol/sokol.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) Tzvetan Mikov.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | #define SOKOL_IMPL
9 | #include "sokol_app.h"
10 | #include "sokol_gfx.h"
11 | #include "sokol_glue.h"
12 | #include "sokol_log.h"
13 | #include "sokol_time.h"
14 |
15 | #define CIMGUI_DEFINE_ENUMS_AND_STRUCTS
16 | #include "cimgui.h"
17 | #define SOKOL_IMGUI_IMPL
18 | #include "sokol_imgui.h"
19 |
20 | // Must be separate to avoid reordering.
21 | #include "sokol_debugtext.h"
22 |
--------------------------------------------------------------------------------
/lib/imgui-runtime/MappedFileBuffer.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tzvetan Mikov and contributors
2 | // SPDX-License-Identifier: MIT
3 | // See LICENSE file for full license text
4 |
5 | #pragma once
6 |
7 | #include
8 | #include
9 |
10 | /// Memory map a file.
11 | ///
12 | /// @param path the file path to map
13 | /// @param attemptTrailingZero if possible, add a trailing zero and increase the
14 | /// logical mapped size to include it.
15 | /// @return memory mapped buffer
16 | std::shared_ptr
17 | mapFileBuffer(const char *path, bool attemptTrailingZero = false);
18 |
--------------------------------------------------------------------------------
/external/soloud/contrib/cmake/Install.cmake:
--------------------------------------------------------------------------------
1 | # Required Vars:
2 | # ${TARGET_NAME}
3 |
4 | SET (INSTALL_BINDIR bin)
5 | IF(WIN32)
6 | SET(INSTALL_LIBDIR bin)
7 | SET(INSTALL_ARCHIVEDIR lib)
8 | ELSE(WIN32)
9 | SET(INSTALL_LIBDIR lib${LIB_POSTFIX})
10 | SET(INSTALL_ARCHIVEDIR lib${LIB_POSTFIX})
11 | ENDIF(WIN32)
12 |
13 | SET (PROJECT_NAME_LOWERCASE)
14 | STRING (TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWERCASE)
15 | INSTALL (
16 | TARGETS ${TARGET_NAME}
17 | EXPORT ${PROJECT_NAME_LOWERCASE}-config
18 | RUNTIME DESTINATION ${INSTALL_BINDIR}
19 | BUNDLE DESTINATION ${INSTALL_BINDIR}
20 | LIBRARY DESTINATION ${INSTALL_LIBDIR}
21 | ARCHIVE DESTINATION ${INSTALL_ARCHIVEDIR}
22 | )
23 |
--------------------------------------------------------------------------------
/lib/jslib-unit/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (c) Tzvetan Mikov and contributors
2 | # SPDX-License-Identifier: MIT
3 | # See LICENSE file for full license text
4 |
5 | # Jslib unit - Event loop library (untyped)
6 | # Provides setTimeout, setImmediate, and event loop functionality
7 |
8 | set(JSLIB_UNIT_O jslib-unit${CMAKE_C_OUTPUT_EXTENSION})
9 | hermes_compile_native(
10 | OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${JSLIB_UNIT_O}
11 | SOURCES jslib.js
12 | UNIT_NAME jslib
13 | )
14 |
15 | add_library(jslib-unit STATIC ${CMAKE_CURRENT_BINARY_DIR}/${JSLIB_UNIT_O})
16 | set_target_properties(jslib-unit PROPERTIES LINKER_LANGUAGE C)
17 |
18 | # Ensure Hermes is built before compiling this unit
19 | add_dependencies(jslib-unit hermes)
20 |
--------------------------------------------------------------------------------
/external/soloud/contrib/cmake/PrintOptionStatus.cmake:
--------------------------------------------------------------------------------
1 | # Parameters:
2 | # OPTION: boolean option.
3 | # TEXT - option meaning text, printed between "[+/-]" and "enabled/disabled".
4 | # PREPEND - optional parameter, count of spaces inserted before output.
5 | # Useful for indenting relative options.
6 |
7 | MACRO (PRINT_OPTION_STATUS OPTION TEXT)
8 | SET (PREPEND "")
9 | IF (${ARGC} GREATER 2)
10 | IF (${ARGV2} GREATER 0)
11 | FOREACH (A RANGE 1 ${ARGV2})
12 | SET (PREPEND "${PREPEND} ")
13 | ENDFOREACH (A)
14 | ENDIF (${ARGV2} GREATER 0)
15 | ENDIF (${ARGC} GREATER 2)
16 | IF (${OPTION})
17 | MESSAGE ("${PREPEND}[+] ${TEXT} enabled")
18 | ELSE (${OPTION})
19 | MESSAGE ("${PREPEND}[-] ${TEXT} disabled")
20 | ENDIF (${OPTION})
21 | ENDMACRO (PRINT_OPTION_STATUS)
22 |
--------------------------------------------------------------------------------
/lib/imgui-runtime/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (c) Tzvetan Mikov and contributors
2 | # SPDX-License-Identifier: MIT
3 | # See LICENSE file for full license text
4 |
5 | add_library(imgui-runtime imgui-runtime.cpp
6 | MappedFileBuffer.cpp
7 | MappedFileBuffer.h
8 | imgui-runtime.h
9 | )
10 | target_link_directories(imgui-runtime INTERFACE
11 | ${HERMES_BUILD}/lib
12 | ${HERMES_BUILD}/jsi
13 | ${HERMES_BUILD}/external/boost/boost_1_86_0/libs/context
14 | )
15 | target_link_libraries(imgui-runtime
16 | sokol stb cimgui imgui-unit jslib-unit
17 | $<$:hermesvm_a jsi boost_context>
18 | $<$:hermesvm>
19 | $<$:icuuc icui18n icudata>
20 | )
21 | target_include_directories(imgui-runtime INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
22 |
--------------------------------------------------------------------------------
/examples/dynamic-windows/index.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tzvetan Mikov and contributors
2 | // SPDX-License-Identifier: MIT
3 | // See LICENSE file for full license text
4 |
5 | import React from 'react';
6 | import { createRoot, render } from 'react-imgui-reconciler/reconciler.js';
7 | import { App } from './app.jsx';
8 |
9 | // Configure window
10 | globalThis.sappConfig.title = 'Dynamic Windows Demo';
11 |
12 | // Create React root with fiber root and container
13 | const root = createRoot();
14 |
15 | // Expose to typed unit via global
16 | globalThis.reactApp = {
17 | rootChildren: [],
18 |
19 | // Render the app
20 | // Note: resetAfterCommit in host-config.js will sync rootChildren after each render
21 | render() {
22 | render(React.createElement(App), root);
23 | },
24 | };
25 |
26 | // Initial render
27 | globalThis.reactApp.render();
28 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "guireact",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "directories": {
7 | "doc": "doc"
8 | },
9 | "scripts": {
10 | "format": "prettier --write \"examples/**/*.{js,jsx}\" \"lib/jslib-unit/**/*.js\" \"lib/react-imgui-reconciler/**/*.js\"",
11 | "test": "echo \"Error: no test specified\" && exit 1"
12 | },
13 | "keywords": [],
14 | "author": "",
15 | "license": "ISC",
16 | "type": "module",
17 | "dependencies": {
18 | "react": "19.2.0",
19 | "react-reconciler": "0.33.0"
20 | },
21 | "devDependencies": {
22 | "@babel/cli": "^7.28.3",
23 | "@babel/core": "^7.28.4",
24 | "@babel/preset-react": "^7.27.1",
25 | "babel-plugin-react-compiler": "^1.0.0",
26 | "esbuild": "^0.25.11",
27 | "glob": "^11.0.3",
28 | "prettier": "^3.6.2"
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/lib/imgui-unit/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright (c) Tzvetan Mikov and contributors
2 | # SPDX-License-Identifier: MIT
3 | # See LICENSE file for full license text
4 |
5 | # ImGui unit - FFI bindings and renderer (typed)
6 | # Provides ImGui rendering functionality using Static Hermes FFI
7 |
8 | set(IMGUI_UNIT_O imgui-unit${CMAKE_C_OUTPUT_EXTENSION})
9 | hermes_compile_native(
10 | OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${IMGUI_UNIT_O}
11 | SOURCES
12 | ffi_helpers.js
13 | asciiz.js
14 | sapp.js
15 | js_externs.js
16 | renderer.js
17 | main.js
18 | UNIT_NAME imgui
19 | FLAGS -typed -Wc,-I.
20 | )
21 |
22 | add_library(imgui-unit STATIC js_externs_cwrap.c ${CMAKE_CURRENT_BINARY_DIR}/${IMGUI_UNIT_O})
23 | set_target_properties(imgui-unit PROPERTIES LINKER_LANGUAGE C)
24 | target_link_libraries(imgui-unit cimgui sokol)
25 |
26 | # Ensure Hermes is built before compiling this unit
27 | add_dependencies(imgui-unit hermes)
28 |
--------------------------------------------------------------------------------
/LICENSE_sokol:
--------------------------------------------------------------------------------
1 | zlib/libpng license
2 |
3 | Copyright (c) 2018 Andre Weissflog
4 |
5 | This software is provided 'as-is', without any express or implied warranty.
6 | In no event will the authors be held liable for any damages arising from the
7 | use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software in a
15 | product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not
19 | be misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 |
--------------------------------------------------------------------------------
/external/soloud/contrib/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #cmake_minimum_required (VERSION 2.8)
2 |
3 | project (SoLoud)
4 |
5 | set (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}")
6 | set (CMAKE_POSITION_INDEPENDENT_CODE ON)
7 | #INCLUDE (StandartIncludes)
8 |
9 | include_directories (../include)
10 |
11 | include (Configure.cmake)
12 | #INCLUDE (InstallIncludes.cmake)
13 | #INCLUDE (InstallStaticData.cmake)
14 |
15 | if (UNIX AND NOT WIN32 AND NOT APPLE)
16 | if (CMAKE_SIZEOF_VOID_P MATCHES "8")
17 | set (LIB_POSTFIX "64" CACHE STRING "suffix for 32/64 dir placement")
18 | mark_as_advanced (LIB_POSTFIX)
19 | endif ()
20 | endif ()
21 | if (MSVC)
22 | add_definitions (-D_CRT_SECURE_NO_WARNINGS)
23 | endif()
24 | if (NOT DEFINED LIB_POSTFIX)
25 | set (LIB_POSTFIX "")
26 | endif ()
27 |
28 | include (src.cmake)
29 |
30 | # Demos
31 | IF (SOLOUD_BUILD_DEMOS)
32 | include (demos.cmake)
33 | endif ()
34 |
35 | IF (SOLOUD_GENERATE_GLUE)
36 | include (gen_glue.cmake)
37 | endif ()
38 |
39 | include (InstallExport)
40 |
--------------------------------------------------------------------------------
/examples/hello/index.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tzvetan Mikov and contributors
2 | // SPDX-License-Identifier: MIT
3 | // See LICENSE file for full license text
4 |
5 | import React from 'react';
6 | import { createRoot, render } from 'react-imgui-reconciler/reconciler.js';
7 | import { App } from './app.jsx';
8 |
9 | // Configure window (optional - defaults are provided)
10 | // globalThis.sappConfig is created by imgui-unit with { title: "imgui-react-runtime" }
11 | // Applications can override properties here before rendering
12 | globalThis.sappConfig.title = 'Hello World';
13 | globalThis.sappConfig.width = 320;
14 | globalThis.sappConfig.height = 200;
15 |
16 | // Create React root with fiber root and container
17 | const root = createRoot();
18 |
19 | // Expose to typed unit via global
20 | globalThis.reactApp = {
21 | rootChildren: [],
22 |
23 | // Render the app
24 | // Note: resetAfterCommit in host-config.js will sync rootChildren after each render
25 | render() {
26 | render(React.createElement(App), root);
27 | },
28 | };
29 |
30 | // Initial render
31 | globalThis.reactApp.render();
32 |
--------------------------------------------------------------------------------
/external/soloud/src/audiosource/ay/chipplayer.h:
--------------------------------------------------------------------------------
1 | #ifndef _CHIPPLAYER_H_INCLUDED
2 | #define _CHIPPLAYER_H_INCLUDED
3 |
4 | #include "sndchip.h"
5 |
6 | namespace SoLoud
7 | {
8 | class AyInstance;
9 | }
10 |
11 | class ChipPlayer
12 | {
13 | public:
14 |
15 | // play next song chunk to buffer
16 | unsigned play(float *dst, unsigned need_samples);
17 |
18 | // for internal use by ChipSong class
19 | void set_timings(unsigned system_clock_rate, unsigned chip_clock_rate, unsigned sample_rate);
20 | void set_volumes(SNDCHIP::CHIP_TYPE t, unsigned global_vol, const SNDCHIP_VOLTAB *vt, const SNDCHIP_PANTAB *pt);
21 |
22 | ChipPlayer(SoLoud::AyInstance *aInstance);
23 | ~ChipPlayer();
24 |
25 | //private:
26 | SoLoud::AyInstance *mInstance;
27 | SNDBUFFER buffer;
28 | SNDCHIP chip;
29 | SNDCHIP chip2;
30 |
31 |
32 | unsigned locate(unsigned tick);
33 | unsigned playtick;
34 | unsigned playpos;
35 | unsigned system_clock_rate;
36 | unsigned ticks_per_buffer;
37 |
38 | unsigned get_time(unsigned tick);
39 | };
40 |
41 | #endif // _CHIPPLAYER_H_INCLUDED
42 |
--------------------------------------------------------------------------------
/examples/showcase/index.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tzvetan Mikov and contributors
2 | // SPDX-License-Identifier: MIT
3 | // See LICENSE file for full license text
4 |
5 | import React from 'react';
6 | import { createRoot, render } from 'react-imgui-reconciler/reconciler.js';
7 | import { App } from './app.jsx';
8 |
9 | // Configure window (optional - defaults are provided)
10 | // globalThis.sappConfig is created by imgui-unit with { title: "imgui-react-runtime" }
11 | // Applications can override properties here before rendering
12 | globalThis.sappConfig.title = 'React + ImGui Showcase';
13 | globalThis.sappConfig.width = 1024;
14 | globalThis.sappConfig.height = 768;
15 |
16 | // Create React root with fiber root and container
17 | const root = createRoot();
18 |
19 | // Expose to typed unit via global
20 | globalThis.reactApp = {
21 | rootChildren: [],
22 |
23 | // Render the app
24 | // Note: resetAfterCommit in host-config.js will sync rootChildren after each render
25 | render() {
26 | render(React.createElement(App), root);
27 | },
28 | };
29 |
30 | // Initial render
31 | globalThis.reactApp.render();
32 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) Tzvetan Mikov and contributors
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/lib/imgui-unit/main.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tzvetan Mikov and contributors
2 | // SPDX-License-Identifier: MIT
3 | // See LICENSE file for full license text
4 |
5 | // Main entry point for typed ImGui unit
6 | // Provides on_init, on_frame, on_event callbacks for C++ bridge
7 | // Note: globalThis.sappConfig is created by C++ before units load
8 |
9 | globalThis.on_init = function on_init(): void {
10 | // Trigger initial React render
11 | const reactApp = globalThis.reactApp;
12 | if (reactApp && reactApp.render) {
13 | reactApp.render();
14 | }
15 | };
16 |
17 | globalThis.on_frame = function on_frame(width: number, height: number, curTime: number): void {
18 | // Flush temporary allocations from previous frame
19 | flushAllocTmp();
20 |
21 | // Render the React tree (callbacks are invoked directly during rendering)
22 | const imguiUnit = (globalThis as any).imguiUnit;
23 | if (imguiUnit && imguiUnit.renderTree) {
24 | imguiUnit.renderTree();
25 | }
26 | };
27 |
28 | globalThis.on_event = function on_event(type: number, key_code: number, modifiers: number): void {
29 | // Handle events if needed
30 | // For now, we'll just pass through
31 | };
32 |
--------------------------------------------------------------------------------
/external/cimgui/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Stephan Dilly
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/external/cimgui/imgui/LICENSE.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014-2020 Omar Cornut
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/external/soloud/include/soloud_file_hack_off.h:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2020 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | /*
26 | See soloud_file_hack_on.h
27 | */
28 |
29 | #undef FILE
30 | #undef fgetc
31 | #undef fread
32 | #undef fseek
33 | #undef ftell
34 | #undef fclose
35 | #undef fopen
36 | #undef fopen_s
37 |
--------------------------------------------------------------------------------
/external/soloud/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | > 1. Remove this template before submitting
2 | >
3 | > 2. SoLoud project requires extremely liberal licensing, i.e, no attribution is required for binary forms.
4 | > Patches should come under zlib, cc0, unlicense or wtfpl license, or if you wish to not retain any
5 | > rights, don't include a license and the rights of your patch are released to the project owner and
6 | > included under the SoLoud zlib/libpng licensing for anyone to (ab)use.
7 | >
8 | > 3. Code should generally follow the coding conventions in SoLoud, meaning formatting that's basically
9 | > the ANSI format in Artistic Style formatter (or just read some of the code and make yours look the
10 | > same).
11 | >
12 | > 4. Code should generally follow "Orthodox C++" rules, i.e, not "modern c++". This means minimal template
13 | > use and basically no "new" c++ features.
14 | >
15 | > 5. Platform-specific code (i.e, backends / sinks) are pretty much expected to break the 3. and 4. above.
16 | >
17 | > 6. To show that you understand and accept the rules above, add your name to the AUTHORS file.
18 | >
19 | > TL;DR: make code similar to what's in SoLoud, don't add new licensing requirements, sign the AUTHORS file, thanks.
20 |
--------------------------------------------------------------------------------
/external/soloud/contrib/cmake/InstallExport.cmake:
--------------------------------------------------------------------------------
1 | # Installs export targets (i.e. cmake config files) into location
2 | # specified for OS.
3 | # Installs ${PROJECT_NAME}-SetThirdParties.cmake too if such file
4 | # is found in ${PROJECT_SOURCE_DIR}.
5 |
6 | SET (EV_CMAKE_EXPORT_DIR share/${PROJECT_NAME}/cmake)
7 |
8 | IF (WIN32)
9 | SET (EV_CMAKE_EXPORT_DIR cmake)
10 | ENDIF ()
11 |
12 | SET (PROJECT_NAME_LOWERCASE)
13 | STRING (TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWERCASE)
14 | INSTALL (
15 | EXPORT ${PROJECT_NAME_LOWERCASE}-config
16 | DESTINATION ${EV_CMAKE_EXPORT_DIR}
17 | )
18 |
19 | SET (EV_STP_FILENAME ${PROJECT_SOURCE_DIR}/${PROJECT_NAME}-SetThirdParties.cmake)
20 | IF (EXISTS ${EV_STP_FILENAME})
21 | INSTALL (
22 | FILES ${EV_STP_FILENAME}
23 | DESTINATION ${EV_CMAKE_EXPORT_DIR}
24 | )
25 | ENDIF ()
26 |
27 | SET (EV_SETTINGS_FILENAME ${PROJECT_SOURCE_DIR}/${PROJECT_NAME}-Settings.cmake)
28 | IF (NOT EXISTS ${EV_SETTINGS_FILENAME})
29 | # This file may be configured => it placed in binary dir
30 | SET (EV_SETTINGS_FILENAME ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-Settings.cmake)
31 | ENDIF ()
32 |
33 | IF (EXISTS ${EV_SETTINGS_FILENAME})
34 | INSTALL (
35 | FILES ${EV_SETTINGS_FILENAME}
36 | DESTINATION ${EV_CMAKE_EXPORT_DIR}
37 | )
38 | ENDIF ()
39 |
--------------------------------------------------------------------------------
/LICENSE_soloud:
--------------------------------------------------------------------------------
1 | SoLoud contains various third party libraries which vary in licenses,
2 | but are all extremely liberal; no attribution in binary form is required.
3 | For more information, see SoLoud manual or http://soloud-audio.com/legal.html
4 |
5 | SoLoud proper is licensed under the zlib/libpng license:
6 |
7 | SoLoud audio engine
8 | Copyright (c) 2013-2018 Jari Komppa
9 |
10 | This software is provided 'as-is', without any express or implied
11 | warranty. In no event will the authors be held liable for any damages
12 | arising from the use of this software.
13 |
14 | Permission is granted to anyone to use this software for any purpose,
15 | including commercial applications, and to alter it and redistribute it
16 | freely, subject to the following restrictions:
17 |
18 | 1. The origin of this software must not be misrepresented; you must not
19 | claim that you wrote the original software. If you use this software
20 | in a product, an acknowledgment in the product documentation would be
21 | appreciated but is not required.
22 |
23 | 2. Altered source versions must be plainly marked as such, and must not be
24 | misrepresented as being the original software.
25 |
26 | 3. This notice may not be removed or altered from any source
27 | distribution.
28 |
--------------------------------------------------------------------------------
/external/soloud/LICENSE:
--------------------------------------------------------------------------------
1 | SoLoud contains various third party libraries which vary in licenses,
2 | but are all extremely liberal; no attribution in binary form is required.
3 | For more information, see SoLoud manual or http://soloud-audio.com/legal.html
4 |
5 | SoLoud proper is licensed under the zlib/libpng license:
6 |
7 | SoLoud audio engine
8 | Copyright (c) 2013-2018 Jari Komppa
9 |
10 | This software is provided 'as-is', without any express or implied
11 | warranty. In no event will the authors be held liable for any damages
12 | arising from the use of this software.
13 |
14 | Permission is granted to anyone to use this software for any purpose,
15 | including commercial applications, and to alter it and redistribute it
16 | freely, subject to the following restrictions:
17 |
18 | 1. The origin of this software must not be misrepresented; you must not
19 | claim that you wrote the original software. If you use this software
20 | in a product, an acknowledgment in the product documentation would be
21 | appreciated but is not required.
22 |
23 | 2. Altered source versions must be plainly marked as such, and must not be
24 | misrepresented as being the original software.
25 |
26 | 3. This notice may not be removed or altered from any source
27 | distribution.
28 |
--------------------------------------------------------------------------------
/external/soloud/src/audiosource/speech/legal_readme.txt:
--------------------------------------------------------------------------------
1 | The speech synth is based on rsynth by the late
2 | Nick Ing-Simmons (et al).
3 |
4 | He described the legal status as:
5 |
6 | This is a text to speech system produced by
7 | integrating various pieces of code and tables
8 | of data, which are all (I believe) in the
9 | public domain.
10 |
11 | Since then, the rsynth source code has passed legal
12 | checks by several open source organizations, so it
13 | "should" be pretty safe.
14 |
15 | The primary copyright claims seem to have to do
16 | with text-to-speech dictionary use, which I've
17 | removed completely.
18 |
19 | I've done some serious refactoring, clean-up and
20 | feature removal on the source, as all I need is
21 | "a" free, simple speech synth, not a "good"
22 | speech synth. Since I've removed a bunch of stuff,
23 | this is probably safer public domain release
24 | than the original.
25 |
26 | (I'm rather surprised there's no good public domain
27 | speech synths out there; after all, it's 2013..)
28 |
29 | I'm placing my changes in public domain as well,
30 | or if that's not acceptable for you, then CC0:
31 | http://creativecommons.org/publicdomain/zero/1.0/
32 |
33 | The SoLoud interface files (soloud_speech.*) are
34 | under ZLib/LibPNG license.
35 |
36 | -- Jari Komppa
37 | 2013
38 |
--------------------------------------------------------------------------------
/lib/react-imgui-reconciler/tree-node.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tzvetan Mikov and contributors
2 | // SPDX-License-Identifier: MIT
3 | // See LICENSE file for full license text
4 |
5 | /**
6 | * Global counter for assigning unique IDs to TreeNodes.
7 | * Each TreeNode gets a unique ID that persists for its lifetime,
8 | * which is used by ImGui's ID stack for widget identity.
9 | */
10 | let nextNodeId = 1;
11 |
12 | /**
13 | * TreeNode represents a component instance in our tree.
14 | * This is what React creates and manipulates through our host config.
15 | */
16 | export class TreeNode {
17 | constructor(type, props) {
18 | this.id = nextNodeId++; // Unique ID for ImGui ID stack
19 | this.type = type; // Component type like "Window", "Button", etc.
20 | this.props = props; // Props object passed to the component
21 | this.children = []; // Array of child TreeNodes or TextNodes
22 | this.parent = null; // Parent TreeNode (for debugging/traversal)
23 | }
24 | }
25 |
26 | /**
27 | * TextNode represents text content in our tree.
28 | * React treats text as a special type of child.
29 | */
30 | export class TextNode {
31 | constructor(text) {
32 | this.id = nextNodeId++; // Unique ID for ImGui ID stack
33 | this.text = text; // The text content
34 | this.parent = null; // Parent TreeNode
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/external/soloud/src/audiosource/speech/darray.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "darray.h"
4 |
5 | darray::darray()
6 | {
7 | mAllocChunk = 128;
8 | mAllocated = mUsed = 0;
9 | mData = NULL;
10 | }
11 |
12 | void darray::clear()
13 | {
14 | free(mData);
15 | mAllocChunk = 128;
16 | mAllocated = mUsed = 0;
17 | mData = NULL;
18 | }
19 |
20 | darray::~darray()
21 | {
22 | clear();
23 | }
24 |
25 | char * darray::getDataInPos(int aPosition)
26 | {
27 | if (aPosition < mAllocated && aPosition < mUsed)
28 | return mData + aPosition;
29 |
30 | if (aPosition >= mAllocated)
31 | {
32 | int newsize = mAllocated;
33 |
34 | while (newsize <= aPosition)
35 | {
36 | newsize += mAllocChunk;
37 | mAllocChunk *= 2;
38 | }
39 |
40 | char *newdata = (char*)realloc(mData, newsize);
41 | if (!newdata)
42 | {
43 | free(mData);
44 | mData = NULL;
45 | mAllocated = mUsed = 0;
46 | return NULL;
47 | }
48 | else
49 | {
50 | memset(newdata + mAllocated, 0, newsize - mAllocated);
51 | }
52 |
53 | mData = newdata;
54 | mAllocated = newsize;
55 | }
56 |
57 | if (aPosition >= mUsed)
58 | {
59 | mUsed = aPosition + 1;
60 | }
61 |
62 | return mData + aPosition;
63 | }
64 |
65 | void darray::put(int aData)
66 | {
67 | char *s = getDataInPos(mUsed);
68 |
69 | *s = (char)aData;
70 | }
71 |
--------------------------------------------------------------------------------
/external/soloud/src/audiosource/speech/resonator.h:
--------------------------------------------------------------------------------
1 | #ifndef RESONATOR_H
2 | #define RESONATOR_H
3 |
4 | class resonator
5 | {
6 | float mA, mB, mC, mP1, mP2;
7 | public:
8 |
9 | /* Convert formant freqencies and bandwidth into resonator difference equation coefficents
10 | */
11 | void initResonator(
12 | int aFrequency, /* Frequency of resonator in Hz */
13 | int aBandwidth, /* Bandwidth of resonator in Hz */
14 | int aSamplerate);
15 |
16 | /* Convert formant freqencies and bandwidth into anti-resonator difference equation constants
17 | */
18 | void initAntiresonator(
19 | int aFrequency, /* Frequency of resonator in Hz */
20 | int aBandwidth, /* Bandwidth of resonator in Hz */
21 | int aSamplerate);
22 |
23 | /* Set gain */
24 | void setGain(float aG);
25 |
26 | /* Generic resonator function */
27 | float resonate(float input);
28 |
29 | /* Generic anti-resonator function
30 | Same as resonator except that a,b,c need to be set with initAntiresonator()
31 | and we save inputs in p1/p2 rather than outputs.
32 | There is currently only one of these - "mNasalZero"
33 |
34 | Output = (mNasalZero.a * input) + (mNasalZero.b * oldin1) + (mNasalZero.c * oldin2)
35 | */
36 |
37 | float antiresonate(float input);
38 |
39 | resonator();
40 |
41 | ~resonator();
42 | };
43 |
44 | #endif
--------------------------------------------------------------------------------
/external/soloud/scripts/checkapidoc.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | """ Complains if some API call is not documented """
3 |
4 | import soloud_codegen
5 | import glob
6 | import os
7 |
8 | def checkfile(apifunc, fname):
9 | """ Checks whether the string can be found in a file """
10 | if apifunc in open(fname).read():
11 | #print("; " + apifunc + " found in " + fname)
12 | return True
13 | return False
14 |
15 | def checkfiles(apifunc):
16 | """ Goes through all multimarkdown files in doc dir and passes
17 | them to checkfile. If found, early out.
18 | """
19 | for file in glob.glob("../docsrc/*.mmd"):
20 | if checkfile(apifunc, file):
21 | return True
22 | return False
23 |
24 | print("Checking for undocumented APIs..")
25 | print()
26 |
27 | found = 0
28 | total = 0
29 |
30 | for func in soloud_codegen.soloud_func:
31 | apifunc = func[1].replace("_",".")
32 | if ((apifunc[-2::] != "Ex") and
33 | (apifunc[-7::] != "destroy") and
34 | (apifunc[-6::] != "create")):
35 | total += 1
36 | if not checkfiles(apifunc + "()"):
37 | print(apifunc)
38 | found += 1
39 |
40 | if found == 0:
41 | print("All good! (" + str(total) + ", not counting ctor/dtor/ex)")
42 | else:
43 | print()
44 | print(str(found) + " / " + str(total) + " APIs undocumented. Get to work!")
45 | print("(not counting ctor/dtor/ex variants)")
46 |
--------------------------------------------------------------------------------
/external/soloud/contrib/demos.cmake:
--------------------------------------------------------------------------------
1 | set (HEADER_PATH ../include)
2 | set (SOURCE_PATH ../demos)
3 |
4 | function (soloud_add_demo name sources)
5 | set (TARGET_NAME SoLoud_${name})
6 | add_executable (${TARGET_NAME} ${sources})
7 | target_link_libraries (${TARGET_NAME} soloud)
8 | include (Install)
9 | endfunction()
10 |
11 | include_directories (${SOURCE_PATH}/common)
12 | include_directories (${SOURCE_PATH}/common/imgui)
13 |
14 |
15 | # soloud_add_demo(c_test ${SOURCE_PATH}/c_test/main.c)
16 | soloud_add_demo(enumerate ${SOURCE_PATH}/enumerate/main.cpp)
17 | # soloud_add_demo(env ${SOURCE_PATH}/env/main.cpp)
18 | # soloud_add_demo(megademo
19 | # ${SOURCE_PATH}/megademo/3dtest.cpp
20 | # ${SOURCE_PATH}/megademo/main.cpp
21 | # ${SOURCE_PATH}/megademo/mixbusses.cpp
22 | # ${SOURCE_PATH}/megademo/monotone.cpp
23 | # ${SOURCE_PATH}/megademo/multimusic.cpp
24 | # ${SOURCE_PATH}/megademo/pewpew.cpp
25 | # ${SOURCE_PATH}/megademo/radiogaga.cpp
26 | # ${SOURCE_PATH}/megademo/space.cpp
27 | # ${SOURCE_PATH}/megademo/speechfilter.cpp
28 | # ${SOURCE_PATH}/megademo/tedsid.cpp
29 | # ${SOURCE_PATH}/megademo/virtualvoices.cpp
30 | # )
31 | soloud_add_demo(null ${SOURCE_PATH}/null/main.cpp)
32 | # soloud_add_demo(piano
33 | # ${SOURCE_PATH}/piano/main.cpp
34 | # ${SOURCE_PATH}/piano/soloud_basicwave.cpp
35 | # ${SOURCE_PATH}/piano/soloud_padsynth.cpp
36 | # )
37 | soloud_add_demo(simplest ${SOURCE_PATH}/simplest/main.cpp)
38 | soloud_add_demo(welcome ${SOURCE_PATH}/welcome/main.cpp)
39 |
--------------------------------------------------------------------------------
/external/soloud/include/soloud_misc.h:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2020 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #ifndef SOLOUD_MISC_H
26 | #define SOLOUD_MISC_H
27 |
28 | #include "soloud.h"
29 |
30 | namespace SoLoud
31 | {
32 | namespace Misc
33 | {
34 | // Generate a waveform.
35 | float generateWaveform(int aWaveform, float p);
36 |
37 | // WELL512 random
38 | class Prg
39 | {
40 | public:
41 | // random generator
42 | Prg();
43 | unsigned int mState[16];
44 | unsigned int mIndex;
45 | unsigned int rand();
46 | float rand_float();
47 | void srand(int aSeed);
48 | };
49 |
50 | };
51 | };
52 |
53 | #endif
--------------------------------------------------------------------------------
/external/soloud/include/soloud_error.h:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2014 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 | #ifndef SOLOUD_ERROR_H
25 | #define SOLOUD_ERROR_H
26 |
27 | namespace SoLoud
28 | {
29 | enum SOLOUD_ERRORS
30 | {
31 | SO_NO_ERROR = 0, // No error
32 | INVALID_PARAMETER = 1, // Some parameter is invalid
33 | FILE_NOT_FOUND = 2, // File not found
34 | FILE_LOAD_FAILED = 3, // File found, but could not be loaded
35 | DLL_NOT_FOUND = 4, // DLL not found, or wrong DLL
36 | OUT_OF_MEMORY = 5, // Out of memory
37 | NOT_IMPLEMENTED = 6, // Feature not implemented
38 | UNKNOWN_ERROR = 7 // Other error
39 | };
40 | };
41 | #endif
--------------------------------------------------------------------------------
/external/soloud/scripts/checksanity.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | """ Complains if some API call is not tested """
3 |
4 | import soloud_codegen
5 | import glob
6 | import os
7 |
8 | def checkfile(apifunc, fname):
9 | """ Checks whether the string can be found in a file """
10 | if apifunc in open(fname).read():
11 | # print(apifunc + " found in " + fname)
12 | return True
13 | return False
14 |
15 | def checkfiles(apifunc):
16 | """ Goes through all sources files in sanity dir and passes
17 | them to checkfile. If found, early out.
18 | """
19 | for file in glob.glob("../src/tools/sanity/*.cpp"):
20 | if checkfile(apifunc, file):
21 | return True
22 | for file in glob.glob("../src/tools/sanity/*.h"):
23 | if checkfile(apifunc, file):
24 | return True
25 | return False
26 |
27 | print("Checking for untested APIs..")
28 | print()
29 |
30 | found = 0
31 | total = 0
32 |
33 | for func in soloud_codegen.soloud_func:
34 | apifunc = func[1].replace("_",".")
35 | if ((apifunc[-2::] != "Ex") and
36 | (apifunc[-7::] != "destroy")):
37 | if (apifunc[-6::] == "create"):
38 | apifunc = "SoLoud::" + apifunc[:-7:]
39 | total += 1
40 | if not checkfiles(apifunc):
41 | print(apifunc)
42 | found += 1
43 |
44 | if found == 0:
45 | print("All good! (" + str(total) + ", not counting ctor/dtor/ex)")
46 | else:
47 | print()
48 | print(str(found) + " / " + str(total) + " APIs untested. Get to work!")
49 | print("(not counting ctor/dtor/ex variants)")
50 |
--------------------------------------------------------------------------------
/examples/custom-widget/app.jsx:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 |
3 | const ACTIONS = ['Cut', 'Copy', 'Paste', 'Delete', 'Save'];
4 |
5 | export function App() {
6 | const [menuOpen, setMenuOpen] = useState(false);
7 | const [selectedAction, setSelectedAction] = useState(null);
8 |
9 | const handleItemClick = (index) => {
10 | setSelectedAction(ACTIONS[index]);
11 | setMenuOpen(false);
12 | };
13 |
14 | return (
15 |
20 | This example demonstrates creating custom ImGui widgets.
21 |
22 | The RadialMenu is a custom widget built using ImGui's draw list API.
23 |
24 |
25 |
26 | Click the button to open the radial menu:
27 |
30 |
31 | {menuOpen && (
32 | <>
33 |
34 |
40 |
41 | >
42 | )}
43 |
44 | {selectedAction && (
45 | <>
46 | Selected action: {selectedAction}
47 |
48 | >
49 | )}
50 |
51 | Hover over menu sectors to highlight them.
52 | Click a sector to select an action.
53 |
54 | );
55 | }
56 |
--------------------------------------------------------------------------------
/external/sokol/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(SOKOL_HEADERS
2 | sokol_app.h
3 | sokol_debugtext.h
4 | sokol_gfx.h
5 | sokol_glue.h
6 | sokol_imgui.h
7 | sokol_log.h
8 | sokol_time.h)
9 | set(SOKOL_DEFINES)
10 |
11 | if (EMSCRIPTEN)
12 | add_definitions(-DSOKOL_GLES2)
13 | add_library(sokol STATIC sokol.c ${SOKOL_HEADERS})
14 | set(CMAKE_EXECUTABLE_SUFFIX ".html")
15 | elseif (CMAKE_SYSTEM_NAME STREQUAL Darwin)
16 | add_library(sokol STATIC sokol.c ${SOKOL_HEADERS})
17 | target_compile_options(sokol PRIVATE -x objective-c)
18 | if (1)
19 | set(SOKOL_DEFINES ${SOKOL_DEFINES} -DSOKOL_METAL)
20 | target_link_libraries(sokol PUBLIC
21 | "-framework QuartzCore"
22 | "-framework Cocoa"
23 | "-framework MetalKit"
24 | "-framework Metal")
25 | else ()
26 | set(SOKOL_DEFINES ${SOKOL_DEFINES} -DSOKOL_GLCORE33)
27 | target_link_libraries(sokol PUBLIC
28 | "-framework QuartzCore"
29 | "-framework Cocoa"
30 | "-framework OpenGL")
31 | endif ()
32 | else ()
33 | set(SOKOL_DEFINES ${SOKOL_DEFINES} -DSOKOL_GLCORE33)
34 | add_library(sokol STATIC sokol.c ${SOKOL_HEADERS})
35 | if (CMAKE_SYSTEM_NAME STREQUAL Linux)
36 | target_link_libraries(sokol INTERFACE X11 Xi Xcursor GL dl m)
37 | endif ()
38 | endif ()
39 |
40 | find_package(Threads REQUIRED)
41 | target_link_libraries(sokol PUBLIC Threads::Threads)
42 | target_link_libraries(sokol PUBLIC cimgui)
43 | target_include_directories(sokol INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
44 | target_compile_definitions(sokol PUBLIC ${SOKOL_DEFINES})
45 |
--------------------------------------------------------------------------------
/doc/TODO.md:
--------------------------------------------------------------------------------
1 | # TODO List
2 |
3 | ## Runtime Improvements
4 |
5 | ### Proper Timer Implementation
6 | Currently, timer implementation is tied to the Sokol frame callback, which means:
7 | - Timers are only checked and executed before each frame render
8 | - No true background timer events (limited to ~60Hz frame rate)
9 | - Timer precision is limited by the frame rate
10 |
11 | **Goal**: Implement proper timer support with:
12 | - Native timer events from the platform (separate from frame callbacks)
13 | - Better precision for setTimeout/setInterval
14 | - Ability to wake event loop independently of rendering
15 |
16 | ### Environment Variable Import on Startup
17 | Add ability to import system environment variables when the runtime starts.
18 |
19 | **Goal**:
20 | - Populate `process.env` with system environment variables
21 | - Allow configuration via environment (e.g., `DEBUG=1`, custom paths)
22 | - Match Node.js behavior more closely
23 |
24 | ### Node.js API Compatibility
25 |
26 | Provide Node.js-compatible APIs:
27 |
28 | **Priority modules**:
29 | - `fs` - File system operations (readFile, writeFile, stat, readdir, etc.)
30 | - `path` - Path manipulation utilities (join, resolve, dirname, etc.)
31 | - `os` - Operating system information (platform, tmpdir, etc.)
32 | - `buffer` - Buffer class for binary data handling
33 | - `stream` - Stream handling for file and data operations
34 |
35 | **Future modules**:
36 | - `http`/`https` - Network operations
37 | - `child_process` - Process spawning
38 | - `worker_threads` - Parallel execution
39 |
40 | ### Web Workers
41 |
42 | Multi-thread support will be nice.
43 |
44 | ### Misc
45 |
46 | Remove try/finally in rendering
47 | react compiler
48 | caching of component data
49 |
--------------------------------------------------------------------------------
/tools/xxd.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # Copyright (c) Meta Platforms, Inc. and affiliates.
3 | #
4 | # This source code is licensed under the MIT license found in the
5 | # LICENSE file in the root directory of this source tree.
6 |
7 | """
8 | This module exists so that a Windows build can have access to functionality
9 | like xxd -i.
10 | This script is intended to be compliant with both py2 and py3.
11 | """
12 |
13 | import argparse
14 | import sys
15 | from os import path
16 |
17 |
18 | # This is about 80 characters long (4 characters per byte + comma + space)
19 | BYTES_PER_LINE = 12
20 | IS_PY3 = sys.version_info > (3, 0)
21 |
22 |
23 | def main():
24 | parser = argparse.ArgumentParser()
25 | parser.add_argument("file")
26 | args = parser.parse_args()
27 |
28 | # Ensure the file exists before writing out anything
29 | if not path.exists(args.file):
30 | raise Exception('File "{}" doesn\'t exist'.format(args.file))
31 |
32 | with open(args.file, "rb") as f:
33 | # Could read in chunks instead for extra performance, but this script
34 | # isn't meant to be used on gigantic files.
35 | file_as_bytes = f.read()
36 |
37 | # Make groups of bytes that fit in a single line
38 | lines = [
39 | file_as_bytes[i : i + BYTES_PER_LINE]
40 | for i in range(0, len(file_as_bytes), BYTES_PER_LINE)
41 | ]
42 | # in python2, byte is same as str and interating it yield strs.
43 | # in python3, byte is distinct and interating it yield ints.
44 | print(
45 | ",\n".join(
46 | ", ".join("0x{:02x}".format(b if IS_PY3 else ord(b)) for b in l)
47 | for l in lines
48 | )
49 | )
50 |
51 |
52 | if __name__ == "__main__":
53 | main()
54 |
--------------------------------------------------------------------------------
/external/soloud/src/audiosource/tedsid/ted.h:
--------------------------------------------------------------------------------
1 |
2 | class TED
3 | {
4 | public:
5 | unsigned int masterVolume;
6 | int Volume;
7 | int Snd1Status;
8 | int Snd2Status;
9 | int SndNoiseStatus;
10 | int DAStatus;
11 | unsigned short Freq1;
12 | unsigned short Freq2;
13 | int NoiseCounter;
14 | int FlipFlop[2];
15 | int dcOutput[2];
16 | int oscCount[2];
17 | int OscReload[2];
18 | int waveForm[2];
19 | int oscStep;
20 | int sampleRate;
21 | unsigned char noise[256]; // 0-8
22 | unsigned int channelMask[3];
23 | int vol;
24 |
25 | TED();
26 | void enableChannel(unsigned int channel, bool enable);
27 | void setFreq(unsigned int channel, int freq);
28 | void oscillatorReset();
29 | void oscillatorInit();
30 | void writeSoundReg(unsigned int reg, unsigned char value);
31 | void storeToBuffer(short *buffer, unsigned int count);
32 | unsigned int waveSquare(unsigned int channel);
33 | unsigned int waveSawTooth(unsigned int channel);
34 | unsigned int waveTriangle(unsigned int channel);
35 | unsigned int getWaveSample(unsigned int channel, unsigned int wave);
36 | void renderSound(unsigned int nrsamples, short *buffer);
37 | void setMasterVolume(unsigned int shift);
38 | void selectWaveForm(unsigned int channel, unsigned int wave);
39 | void setplaybackSpeed(unsigned int speed);
40 | unsigned int getTimeSinceLastReset();
41 | void setSampleRate(unsigned int value);
42 | void setFilterOrder(unsigned int value);
43 | void initFilter(unsigned int sampleRate_, unsigned int filterOrder_);
44 | };
--------------------------------------------------------------------------------
/external/soloud/scripts/gen_autoit.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # AutoIt wrapper generator
3 |
4 | from soloud_codegen import *
5 |
6 | fo = open("soloud.au3", "w")
7 |
8 | """
9 | Global $dll = DllOpen(@ScriptDir & "\soloud.dll")
10 |
11 | Const $CONSTANT = 1234567890
12 |
13 |
14 |
15 | Func _SoLoud_method($param1, $param2, $paramN)
16 | Local $ret = DllCall($dll, "return type e.g. int", "function", "type1 if necessary", "param1 if necessary", "typeN if necessary", "paramN if necessary")
17 | If @error Then Return SetError(1, 1, 0)
18 | Return $ret[0]
19 | EndFunc
20 | """
21 |
22 | fo.write("; SoLoud wrapper for AutoIt\n")
23 | fo.write("; This file is autogenerated; any changes will be overwritten\n")
24 | fo.write('Global $dll = DllOpen(@ScriptDir & "\\soloud_x86.dll")\n')
25 | fo.write("\n")
26 | fo.write("; Enumerations\n")
27 | for x in soloud_enum:
28 | fo.write("Const $" + x + " = " + str(soloud_enum[x]) + "\n")
29 | fo.write("\n")
30 | fo.write("; Functions\n")
31 | for x in soloud_func:
32 | funcdef = "Func _" + x[1] + "("
33 | first = True;
34 | for p in x[2]:
35 | if len(p) > 0:
36 | if not first:
37 | funcdef += ", "
38 | else:
39 | first = False
40 | funcdef += "$" + p[1]
41 | funcdef += ")"
42 |
43 | calldef = "\tLocal $ret = DllCall($dll, "
44 | calldef += '"' + x[0] + '", ' # return type
45 | calldef += '"' + x[1] + '"'
46 |
47 | for p in x[2]:
48 | if len(p) > 0:
49 | calldef += ', "' + p[0] + '", "' + p[1] + '"'
50 | calldef += ')'
51 |
52 | fo.write(funcdef + "\n")
53 | fo.write(calldef + "\n")
54 | fo.write('\tIf @error Then Return SetError(1, 1, 0)\n')
55 | fo.write('\tReturn $ret[0]\n')
56 | fo.write('EndFunc\n')
57 | fo.write("\n")
58 |
59 | fo.close()
60 | print("soloud.au3 generated")
61 |
--------------------------------------------------------------------------------
/external/soloud/include/soloud_fft.h:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2015 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #ifndef SOLOUD_FFT_H
26 | #define SOLOUD_FFT_H
27 |
28 | #include "soloud.h"
29 |
30 | namespace SoLoud
31 | {
32 | namespace FFT
33 | {
34 | // Perform 1024 unit FFT. Buffer must have 1024 floats, and will be overwritten
35 | void fft1024(float *aBuffer);
36 |
37 | // Perform 256 unit FFT. Buffer must have 256 floats, and will be overwritten
38 | void fft256(float *aBuffer);
39 |
40 | // Perform 256 unit IFFT. Buffer must have 256 floats, and will be overwritten
41 | void ifft256(float *aBuffer);
42 |
43 | // Generic (slower) power of two FFT. Buffer is overwritten.
44 | void fft(float *aBuffer, unsigned int aBufferLength);
45 |
46 | // Generic (slower) power of two IFFT. Buffer is overwritten.
47 | void ifft(float *aBuffer, unsigned int aBufferLength);
48 | };
49 | };
50 |
51 | #endif
--------------------------------------------------------------------------------
/external/soloud/AUTHORS:
--------------------------------------------------------------------------------
1 | If you wish to contribute code to SoLoud, add your name to
2 | this list when sending a pull request. All code must be
3 | either public domain, CC0, wtfpl, zlib/libpng licensed, or
4 | similarly free to use (without attribution, or (l)gpl-like
5 | limitations.
6 |
7 | Jari Komppa http://iki.fi/sol/
8 | Tom V�h�-Salo tomvahasalo@gmail.com
9 | Trygve Vea trygve.vea@gmail.com
10 | dorgonman dorgonman@hotmail.com
11 | Gabriel Teles Bastos http://mundorpgmaker.com.br
12 | r-lyeh https://github.com/r-lyeh
13 | Colden Cullen https://github.com/ColdenCullen
14 | Cosku Bas cosku.bas@gmail.com
15 | Neil Richardson https://github.com/neilogd
16 | Petri Häkkinen
17 | Omar Cornut
18 | amir ramezani http://shaberoshan.ir
19 | Luke San Antonio Bialecki lukesanantonio@gmail.com
20 | Konstantin S. Matveyev kos@eligovision.ru
21 | Eduardo Doria Lima https://github.com/eduardodoria
22 | Ilya Zhuravlev https://github.com/xyzz
23 | Jussi Sammaltupa
24 | Tam Toucn https://github.com/TamToucan
25 | lamelizard
26 | Tapio Vierros https://github.com/tapio
27 | Danny Angelo Carminati Grein https://github.com/fungos
28 | Igor Ivanov https://github.com/laptabrok
29 | Matthew O'Connell https://github.com/matthew-oconnell
30 | Boris Carvajal https://github.com/BorisCarvajal
31 | Osman Turan https://osmanturan.com
32 | Samson Close https://github.com/qwertysam
33 | Bruce A Henderson https://github.com/woollybah
34 | Philip Bennefall https://github.com/blastbay/
35 | Sebastian Hartte https://github.com/shartte/
36 | Jean-Luc Mackail https://github.com/fuzzyquills
37 | HumanGamer https://github.com/HumanGamer/
38 | Ales Mlakar https://github.com/jazzbre
39 | lexander Yashin https://github.com/yashin-alexander
40 | Nils Duval https://github.com/nlsdvl
41 | JackRedstonia jackredstonia64@gmail.com
42 | David Bullock https://github.com/dwbullock
43 |
--------------------------------------------------------------------------------
/external/soloud/include/soloud_dcremovalfilter.h:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2015 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #ifndef SOLOUD_DCREMOVAL_H
26 | #define SOLOUD_DCREMOVAL_H
27 |
28 | #include "soloud.h"
29 |
30 | namespace SoLoud
31 | {
32 | class DCRemovalFilter;
33 |
34 | class DCRemovalFilterInstance : public FilterInstance
35 | {
36 | float *mBuffer;
37 | float *mTotals;
38 | int mBufferLength;
39 | DCRemovalFilter *mParent;
40 | int mOffset;
41 |
42 | public:
43 | virtual void filter(float *aBuffer, unsigned int aSamples, unsigned int aBufferSize, unsigned int aChannels, float aSamplerate, time aTime);
44 | virtual ~DCRemovalFilterInstance();
45 | DCRemovalFilterInstance(DCRemovalFilter *aParent);
46 | };
47 |
48 | class DCRemovalFilter : public Filter
49 | {
50 | public:
51 | float mLength;
52 | virtual FilterInstance *createInstance();
53 | DCRemovalFilter();
54 | result setParams(float aLength = 0.1f);
55 | };
56 | }
57 |
58 | #endif
--------------------------------------------------------------------------------
/external/soloud/CONTRIBUTING:
--------------------------------------------------------------------------------
1 | Here's some guidelines on contributing to the SoLoud project.
2 |
3 | - SoLoud is extremely liberally licensed. All submitted code
4 | must follow suit to keep it that way.
5 | (public domain, CC0, wtfpl, zlib/libpng, unlicense, or similar
6 | no-attribution and definitely no viral licenses).
7 |
8 | - When submitting the first time, add your name in AUTHORS.
9 |
10 | - Many small commits are better than few huge ones.
11 |
12 | - Try to follow the coding convention of the surrounding code.
13 | If stand alone (such as platform or output device specific),
14 | this isn't as important.
15 |
16 | - All optimized code (such as SSE or assembler) must be
17 | accompanied by plain 'c' version, because:
18 | a) optimizations come and go, porting 30 years from now
19 | can be really painful.
20 | b) plain 'c' version works as documentation of the
21 | optimized code.
22 |
23 | - When doing platform specific code or otherwise optionally
24 | compiled code, it's often better to have some duplicate
25 | code inside large ifdef block than to have tons of hard
26 | to follow small ifdef blocks.
27 |
28 | - Unless there's a really, really good reason, no templates,
29 | including funkycast. foo = (int)bar works fine.
30 |
31 | - Unless performance critical, always try to write for readability.
32 |
33 | Coding convention in brief:
34 |
35 | - On naming:
36 | aFunctionParameter
37 | mMemberVariable
38 | gGlobalVariable
39 | localVariable
40 | CONSTANT_VALUE
41 | ClassName
42 | functionName
43 |
44 | int ExampleClass::example(int aFoo)
45 | {
46 | if (aFoo)
47 | {
48 | int i;
49 | for (i = 0; i < mBarCycles; i++)
50 | {
51 | bar();
52 | }
53 | switch (gBah)
54 | {
55 | case BOO:
56 | return HISS;
57 | }
58 | }
59 | return 0;
60 | }
61 |
--------------------------------------------------------------------------------
/lib/react-imgui-reconciler/perf-stats.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tzvetan Mikov and contributors
2 | // SPDX-License-Identifier: MIT
3 | // See LICENSE file for full license text
4 |
5 | // Reconciliation timing statistics - module scope for efficiency
6 | const RECONCILIATION_SAMPLE_SIZE = 30;
7 | const MAX_WINDOW_SECONDS = 5;
8 |
9 | let reconciliationSamples = []; // Array of {time: timestamp, duration: ms}
10 | let reconciliationAverage = 0;
11 | let reconciliationMax = 0;
12 |
13 | /**
14 | * Update reconciliation timing statistics.
15 | * Maintains a moving average of the last N samples and a time-windowed max.
16 | */
17 | export function updateReconciliationStats(duration) {
18 | const now = performance.now();
19 |
20 | // Add new sample
21 | reconciliationSamples.push({ time: now, duration });
22 |
23 | // Keep only last N samples for average
24 | if (reconciliationSamples.length > RECONCILIATION_SAMPLE_SIZE) {
25 | reconciliationSamples.shift();
26 | }
27 |
28 | // Calculate average from all samples
29 | let sum = 0;
30 | for (let i = 0; i < reconciliationSamples.length; i++) {
31 | sum += reconciliationSamples[i].duration;
32 | }
33 | reconciliationAverage = sum / reconciliationSamples.length;
34 |
35 | // Calculate max from samples within time window
36 | const cutoffTime = now - MAX_WINDOW_SECONDS * 1000;
37 | reconciliationMax = 0;
38 | for (let i = 0; i < reconciliationSamples.length; i++) {
39 | if (reconciliationSamples[i].time >= cutoffTime) {
40 | if (reconciliationSamples[i].duration > reconciliationMax) {
41 | reconciliationMax = reconciliationSamples[i].duration;
42 | }
43 | }
44 | }
45 |
46 | // Expose to globalThis for C++ access
47 | if (!globalThis.perfMetrics) {
48 | globalThis.perfMetrics = {};
49 | }
50 | globalThis.perfMetrics.reconciliationAvg = reconciliationAverage;
51 | globalThis.perfMetrics.reconciliationMax = reconciliationMax;
52 | }
53 |
--------------------------------------------------------------------------------
/external/soloud/contrib/Configure.cmake:
--------------------------------------------------------------------------------
1 | include (OptionDependentOnPackage)
2 | include (PrintOptionStatus)
3 |
4 | option (SOLOUD_DYNAMIC "Set to ON to build dynamic SoLoud" OFF)
5 | print_option_status (SOLOUD_DYNAMIC "Build dynamic library")
6 |
7 | option (SOLOUD_STATIC "Set to ON to build static SoLoud" ON)
8 | print_option_status (SOLOUD_STATIC "Build static library")
9 |
10 | option (SOLOUD_C_API "Set to ON to include the C API" OFF)
11 | print_option_status (SOLOUD_C_API "Build C API")
12 |
13 | # TODO:
14 | option (SOLOUD_BUILD_DEMOS "Set to ON for building demos" OFF)
15 | print_option_status (SOLOUD_BUILD_DEMOS "Build demos")
16 |
17 | option (SOLOUD_BACKEND_NULL "Set to ON for building NULL backend" ON)
18 | print_option_status (SOLOUD_BACKEND_NULL "NULL backend")
19 |
20 | option (SOLOUD_BACKEND_SDL2 "Set to ON for building SDL2 backend" ON)
21 | print_option_status (SOLOUD_BACKEND_SDL2 "SDL2 backend")
22 |
23 | option (SOLOUD_BACKEND_ALSA "Set to ON for building ALSA backend" OFF)
24 | print_option_status (SOLOUD_BACKEND_ALSA "ALSA backend")
25 |
26 | option (SOLOUD_BACKEND_COREAUDIO "Set to ON for building CoreAudio backend" OFF)
27 | print_option_status (SOLOUD_BACKEND_COREAUDIO "CoreAudio backend")
28 |
29 | option (SOLOUD_BACKEND_OPENSLES "Set to ON for building OpenSLES backend" OFF)
30 | print_option_status (SOLOUD_BACKEND_OPENSLES "OpenSLES backend")
31 |
32 | option (SOLOUD_BACKEND_XAUDIO2 "Set to ON for building XAudio2 backend" OFF)
33 | print_option_status (SOLOUD_BACKEND_XAUDIO2 "XAudio2 backend")
34 |
35 | option (SOLOUD_BACKEND_WINMM "Set to ON for building WINMM backend" OFF)
36 | print_option_status (SOLOUD_BACKEND_WINMM "WINMM backend")
37 |
38 | option (SOLOUD_BACKEND_WASAPI "Set to ON for building WASAPI backend" OFF)
39 | print_option_status (SOLOUD_BACKEND_WASAPI "WASAPI backend")
40 |
41 | option (SOLOUD_GENERATE_GLUE "Set to ON for generating the Glue APIs" OFF)
42 | print_option_status (SOLOUD_GENERATE_GLUE "Generate Glue")
43 |
--------------------------------------------------------------------------------
/external/soloud/include/soloud_openmpt.h:
--------------------------------------------------------------------------------
1 | /*
2 | Openmpt module for SoLoud audio engine
3 | Copyright (c) 2016 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #ifndef OPENMPT_H
26 | #define OPENMPT_H
27 |
28 | #include "soloud.h"
29 |
30 | namespace SoLoud
31 | {
32 | class Openmpt;
33 | class File;
34 |
35 | class OpenmptInstance : public AudioSourceInstance
36 | {
37 | Openmpt *mParent;
38 | void *mModfile;
39 | int mPlaying;
40 |
41 | public:
42 | OpenmptInstance(Openmpt *aParent);
43 | virtual ~OpenmptInstance();
44 | virtual unsigned int getAudio(float *aBuffer, unsigned int aSamplesToRead, unsigned int aBufferSize);
45 | virtual bool hasEnded();
46 | };
47 |
48 | class Openmpt : public AudioSource
49 | {
50 | public:
51 | char *mData;
52 | unsigned int mDataLen;
53 | Openmpt();
54 | virtual ~Openmpt();
55 | result load(const char* aFilename);
56 | result loadMem(const unsigned char *aMem, unsigned int aLength, bool aCopy = false, bool aTakeOwnership = true);
57 | result loadFile(File *aFile);
58 | virtual AudioSourceInstance *createInstance();
59 | };
60 | };
61 |
62 | #endif
--------------------------------------------------------------------------------
/examples/dynamic-windows/app.jsx:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tzvetan Mikov and contributors
2 | // SPDX-License-Identifier: MIT
3 | // See LICENSE file for full license text
4 |
5 | import React, { useState } from 'react';
6 |
7 | export function App() {
8 | const [windows, setWindows] = useState([
9 | { id: 1, title: 'Window 1' },
10 | { id: 2, title: 'Window 2' },
11 | ]);
12 | const [nextId, setNextId] = useState(3);
13 |
14 | const addWindow = () => {
15 | setWindows([...windows, { id: nextId, title: `Window ${nextId}` }]);
16 | setNextId(nextId + 1);
17 | };
18 |
19 | const closeWindow = (windowId) => {
20 | setWindows(windows.filter((w) => w.id !== windowId));
21 | };
22 |
23 | return (
24 | <>
25 |
32 | Dynamic Window Manager
33 |
34 | Total windows: {windows.length}
35 |
36 |
37 |
38 | Click the X button on any window to close it
39 |
40 |
41 |
42 | {windows.map((w) => (
43 | closeWindow(w.id)}
51 | >
52 | This is {w.title}
53 |
54 | Window ID: {w.id}
55 | Click the X button in the title bar to close this window
56 |
57 | Each window can be closed independently
58 |
59 | ))}
60 | >
61 | );
62 | }
63 |
--------------------------------------------------------------------------------
/external/soloud/include/soloud_vizsn.h:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2018 Jari Komppa
4 |
5 | vizsn speech synthesizer (c) by Ville-Matias Heikkilä,
6 | released under WTFPL, http://www.wtfpl.net/txt/copying/
7 | (in short, "do whatever you want to")
8 |
9 | Integration and changes to work with SoLoud by Jari Komppa,
10 | released under same license.
11 | */
12 |
13 | #ifndef SOLOUD_VIZSN_H
14 | #define SOLOUD_VIZSN_H
15 |
16 | #include "soloud.h"
17 |
18 | namespace SoLoud
19 | {
20 | class Vizsn;
21 |
22 | struct VizsnResonator
23 | {
24 | public:
25 | float a, b, c, p1, p2;
26 |
27 | float resonate(float i);
28 | float antiresonate(float i);
29 | VizsnResonator();
30 | };
31 |
32 | struct VizsnBank
33 | {
34 | VizsnResonator r[10];
35 | float pitch;
36 | float frica, voice, aspir, bypas, breth;
37 | VizsnBank();
38 | };
39 |
40 | class VizsnInstance : public AudioSourceInstance
41 | {
42 | public:
43 | VizsnInstance(Vizsn *aParent);
44 | ~VizsnInstance();
45 |
46 | virtual unsigned int getAudio(float *aBuffer, unsigned int aSamplesToRead, unsigned int aBufferSize);
47 | virtual bool hasEnded();
48 |
49 | public:
50 | Vizsn *mParent;
51 | VizsnBank mBank0, mBank1, mBank0to1;
52 | int mNper, mNmod, mNopen;
53 | int mEchobuf[1024], mPtr;
54 | int mCurrentVoiceType;
55 | float mPitch;
56 | char *mS;
57 | float mBuf[2048];
58 | unsigned int mBufwrite;
59 | unsigned int mBufread;
60 | float vcsrc(int aPitch, int aVoicetype);
61 | float noisrc();
62 | float genwave();
63 | void setphone(VizsnBank *aB, char aP, float aPitch);
64 | void slidePrepare(int aNumtix);
65 | void slideTick();
66 | int mA;
67 | int mB;
68 | int mOrgv;
69 | float mGlotlast;
70 | };
71 |
72 | class Vizsn : public AudioSource
73 | {
74 | public:
75 | char *mText;
76 | Vizsn();
77 | virtual ~Vizsn();
78 | void setText(char *aText);
79 | public:
80 | virtual AudioSourceInstance *createInstance();
81 | };
82 | };
83 |
84 | #endif
85 |
--------------------------------------------------------------------------------
/external/soloud/include/soloud_fader.h:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2014 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #ifndef SOLOUD_FADER_H
26 | #define SOLOUD_FADER_H
27 |
28 | #include "soloud.h"
29 |
30 | namespace SoLoud
31 | {
32 | // Helper class to process faders
33 | class Fader
34 | {
35 | public:
36 | // Value to fade from
37 | float mFrom;
38 | // Value to fade to
39 | float mTo;
40 | // Delta between from and to
41 | float mDelta;
42 | // Total time to fade
43 | time mTime;
44 | // Time fading started
45 | time mStartTime;
46 | // Time fading will end
47 | time mEndTime;
48 | // Current value. Used in case time rolls over.
49 | float mCurrent;
50 | // Active flag; 0 means disabled, 1 is active, 2 is LFO, -1 means was active, but stopped
51 | int mActive;
52 | // Ctor
53 | Fader();
54 | // Set up LFO
55 | void setLFO(float aFrom, float aTo, time aTime, time aStartTime);
56 | // Set up fader
57 | void set(float aFrom, float aTo, time aTime, time aStartTime);
58 | // Get the current fading value
59 | float get(time aCurrentTime);
60 | };
61 | };
62 |
63 | #endif
--------------------------------------------------------------------------------
/external/soloud/contrib/cmake/OptionDependentOnPackage.cmake:
--------------------------------------------------------------------------------
1 | # Parameters:
2 | # OPTION_VAR_NAME is variable name which will be passed to OPTION call
3 | # OPTION_DESCRIPTION is text description which will be passed to OPTION call
4 | # PACKAGE_FOUND_VAR is boolean variable indicated is requiring package found or not
5 | MACRO (OPTION_DEPENDENT_ON_PACKAGE OPTION_VAR_NAME OPTION_DESCRIPTION PACKAGE_FOUND_VAR)
6 | IF (NOT DEFINED ${OPTION_VAR_NAME})
7 | OPTION (${OPTION_VAR_NAME} "${OPTION_DESCRIPTION}" ${${PACKAGE_FOUND_VAR}})
8 | ELSE (NOT DEFINED ${OPTION_VAR_NAME})
9 | IF (${OPTION_VAR_NAME} AND NOT ${PACKAGE_FOUND_VAR})
10 | MESSAGE (FATAL_ERROR "You have set using of ${OPTION_VAR_NAME} whereas ${PACKAGE_FOUND_VAR} is NO")
11 | ENDIF (${OPTION_VAR_NAME} AND NOT ${PACKAGE_FOUND_VAR})
12 | ENDIF (NOT DEFINED ${OPTION_VAR_NAME})
13 | ENDMACRO (OPTION_DEPENDENT_ON_PACKAGE)
14 |
15 | # Parameters:
16 | # OPTION_VAR_NAME is variable name which will be passed to OPTION call
17 | # OPTION_DESCRIPTION is text description which will be passed to OPTION call
18 | # PACKAGE_FOUND_VAR and after parameters are boolean variables indicated is requiring package found or not
19 | MACRO (OPTION_DEPENDENT_ON_ALL_PACKAGES OPTION_VAR_NAME OPTION_DESCRIPTION PACKAGE_FOUND_VAR)
20 | SET (ALL_PACKAGES_FOUND TRUE)
21 | FOREACH (cur_package ${PACKAGE_FOUND_VAR} ${ARGN})
22 | IF (NOT ${cur_package})
23 | SET (ALL_PACKAGES_FOUND FALSE)
24 | SET (NOTFOUND_PACKAGES ${NOTFOUND_PACKAGES} ${cur_package})
25 | ENDIF (NOT ${cur_package})
26 | ENDFOREACH (cur_package)
27 | IF (NOT DEFINED ${OPTION_VAR_NAME})
28 | OPTION (${OPTION_VAR_NAME} "${OPTION_DESCRIPTION}" ${ALL_PACKAGES_FOUND})
29 | ELSE (NOT DEFINED ${OPTION_VAR_NAME})
30 | IF (${OPTION_VAR_NAME} AND NOT ALL_PACKAGES_FOUND)
31 | MESSAGE (FATAL_ERROR "You have set using of ${OPTION_VAR_NAME} whereas ${NOTFOUND_PACKAGES} is NO")
32 | ENDIF (${OPTION_VAR_NAME} AND NOT ALL_PACKAGES_FOUND)
33 | ENDIF (NOT DEFINED ${OPTION_VAR_NAME})
34 | ENDMACRO (OPTION_DEPENDENT_ON_ALL_PACKAGES)
35 |
--------------------------------------------------------------------------------
/external/soloud/src/backend/null/soloud_null.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2015 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #include "soloud.h"
26 |
27 | #if !defined(WITH_NULL)
28 |
29 | namespace SoLoud
30 | {
31 | result null_init(Soloud *aSoloud, unsigned int aFlags, unsigned int aSamplerate, unsigned int aBuffer)
32 | {
33 | return NOT_IMPLEMENTED;
34 | }
35 | };
36 |
37 | #else
38 |
39 | namespace SoLoud
40 | {
41 | static void nullCleanup(Soloud * /*aSoloud*/)
42 | {
43 | }
44 |
45 | result null_init(Soloud *aSoloud, unsigned int aFlags, unsigned int aSamplerate, unsigned int aBuffer, unsigned int aChannels)
46 | {
47 | if (aChannels == 0 || aChannels == 3 || aChannels == 5 || aChannels == 7 || aChannels > MAX_CHANNELS || aBuffer < SAMPLE_GRANULARITY)
48 | return INVALID_PARAMETER;
49 | aSoloud->mBackendData = 0;
50 | aSoloud->mBackendCleanupFunc = nullCleanup;
51 |
52 | aSoloud->postinit_internal(aSamplerate, aBuffer, aFlags, aChannels);
53 | aSoloud->mBackendString = "null driver";
54 | return SO_NO_ERROR;
55 | }
56 | };
57 | #endif
58 |
--------------------------------------------------------------------------------
/external/soloud/src/audiosource/ay/sndrender.h:
--------------------------------------------------------------------------------
1 | /*
2 | sound resampling core for Unreal Speccy project
3 | created under public domain license by SMT, jan.2006
4 | */
5 |
6 | #pragma once
7 |
8 | #include "sndbuffer.h"
9 |
10 | struct SNDOUT;
11 |
12 | const unsigned SNDR_DEFAULT_SYSTICK_RATE = 3500000; // ZX-Spectrum Z80 clock
13 | const unsigned SNDR_DEFAULT_SAMPLE_RATE = 44100;
14 |
15 | class SNDRENDER
16 | {
17 | public:
18 | SNDRENDER(SNDBUFFER& sndbuffer);
19 |
20 | void set_timings(unsigned sys_clock_rate, unsigned sample_rate);
21 |
22 | // 'render' is a function that converts array of DAC inputs into PCM-buffer
23 | void render(SNDOUT *src, unsigned srclen, unsigned sys_ticks);
24 |
25 | // set of functions that fills buffer in emulation progress:
26 |
27 | // when called, we assume that sys_tick reset to 0
28 | void start_frame();
29 | // system writes to DAC at given sys_tick
30 | void update(unsigned sys_tick, unsigned l, unsigned r);
31 | // emulate non-changed DAC value until end of frame
32 | void end_frame(unsigned endframe_sys_tick);
33 |
34 | protected:
35 |
36 | friend class SNDBUFFER; // access to dstpos in count()
37 | SNDBUFFER& sndbuffer;
38 |
39 | unsigned mix_l, mix_r; // current L/R volume values
40 | bufptr_t dstpos; // write position
41 | bufptr_t dst_start; // write position at start of frame. used to track count of samples in frame
42 |
43 | private:
44 | // local copies of sndbuffer params (for speed)
45 | SNDSAMPLE* buffer;
46 | unsigned bufsize;
47 |
48 | unsigned tick, base_tick;
49 | unsigned s1_l, s1_r;
50 | unsigned s2_l, s2_r;
51 |
52 | unsigned sys_clock_rate, sample_rate;
53 | unsigned passed_sys_ticks, passed_snd_ticks;
54 | unsigned mult_const;
55 |
56 | void flush(unsigned endtick);
57 | };
58 |
59 | struct SNDOUT
60 | {
61 | unsigned timestamp; // in 'system clock' ticks
62 | SNDSAMPLE newvalue;
63 | };
64 |
--------------------------------------------------------------------------------
/external/soloud/scripts/gen_blitzmax.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # BlitzMax wrapper generator
3 | # Thanks to James Boyd for help with this!
4 |
5 | import soloud_codegen
6 |
7 | fo = open("../glue/soloud.bmx", "w")
8 |
9 | """
10 | Global SoloudLib:Int = LoadLibraryA ("soloud_x86.dll")
11 |
12 | If not SoloudLib Then Notify "soloud_x86.dll not found"; End
13 |
14 | Const SFXR_BLIP:Int = 6
15 |
16 | Global Soloud_destroy:Int (aSoloud:Byte Ptr) "win32" = GetProcAddress (SoloudLib, "Soloud_destroy")
17 |
18 | """
19 |
20 | C_TO_BMX_TYPES = {
21 | "int":"Int",
22 | "void":"Int",
23 | "const char *":"Byte Ptr",
24 | "const unsigned char *":"Byte Ptr",
25 | "unsigned int":"Int",
26 | "float":"Float",
27 | "double":"Double",
28 | "float *":"Float Ptr",
29 | "File *":"Byte Ptr",
30 | "unsigned char *":"Byte Ptr",
31 | "char *":"Byte Ptr",
32 | "unsigned char":"Byte",
33 | "short *":"Byte Ptr"
34 | }
35 |
36 | for soloud_type in soloud_codegen.soloud_type:
37 | C_TO_BMX_TYPES[soloud_type + " *"] = "Byte Ptr"
38 |
39 | fo.write("' SoLoud wrapper for BlitzMax\n")
40 | fo.write("' This file is autogenerated; any changes will be overwritten\n")
41 | fo.write("\n")
42 | fo.write('Global SoloudLib:Int = LoadLibraryA ("soloud_x86.dll")\n')
43 | fo.write('If not SoloudLib Then Notify "soloud_x86.dll not found"; End\n')
44 | fo.write("\n")
45 | fo.write("' Enumerations\n")
46 | for x in soloud_codegen.soloud_enum:
47 | fo.write("Const " + x + ":Int = " + str(soloud_codegen.soloud_enum[x]) + "\n")
48 | fo.write("\n")
49 | fo.write("' Functions\n")
50 | for x in soloud_codegen.soloud_func:
51 | funcdef = "Global " + x[1] + ":" + C_TO_BMX_TYPES[x[0]] + " ("
52 | first = True;
53 | for p in x[2]:
54 | if len(p) > 0:
55 | if not first:
56 | funcdef += ", "
57 | else:
58 | first = False
59 | funcdef += p[1] + ":" + C_TO_BMX_TYPES[p[0]]
60 | funcdef += ")"
61 | funcdef += ' "win32" = GetProcAddress (SoloudLib, "'+x[1]+'")'
62 | fo.write(funcdef + "\n")
63 |
64 | fo.close()
65 | print("soloud.bmx generated")
66 |
--------------------------------------------------------------------------------
/external/soloud/include/soloud_ay.h:
--------------------------------------------------------------------------------
1 | /*
2 | AY module for SoLoud audio engine
3 | Copyright (c) 2020 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #ifndef AY_H
26 | #define AY_H
27 |
28 | #include "soloud.h"
29 |
30 | class ChipPlayer;
31 |
32 | namespace SoLoud
33 | {
34 | class Ay;
35 | class File;
36 | class AyInstance : public AudioSourceInstance
37 | {
38 | public:
39 | Ay *mParent;
40 | ChipPlayer *mChip;
41 | int mPos;
42 |
43 | AyInstance(Ay *aParent);
44 | ~AyInstance();
45 | virtual unsigned int getAudio(float *aBuffer, unsigned int aSamplesToRead, unsigned int aBufferSize);
46 | virtual bool hasEnded();
47 | virtual result rewind();
48 | virtual float getInfo(unsigned int aInfoKey);
49 | };
50 |
51 | class Ay : public AudioSource
52 | {
53 | public:
54 | bool mYm;
55 | int mChipspeed;
56 | int mCpuspeed;
57 | int mLooppos;
58 | int mLength;
59 | unsigned short* mOps;
60 | public:
61 | Ay();
62 | ~Ay();
63 | result load(const char *aFilename);
64 | result loadFile(File *aFile);
65 | result loadMem(const unsigned char* aMem, unsigned int aLength, bool aCopy, bool aTakeOwnership);
66 | virtual AudioSourceInstance *createInstance();
67 | };
68 | };
69 |
70 | #endif
--------------------------------------------------------------------------------
/external/soloud/include/soloud_noise.h:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2020 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #ifndef SOLOUD_NOISE_H
26 | #define SOLOUD_NOISE_H
27 |
28 | #include "soloud.h"
29 | #include "soloud_misc.h"
30 |
31 | namespace SoLoud
32 | {
33 | class Noise;
34 |
35 | class NoiseInstance : public AudioSourceInstance
36 | {
37 | public:
38 | NoiseInstance(Noise *aParent);
39 | ~NoiseInstance();
40 |
41 | virtual unsigned int getAudio(float *aBuffer, unsigned int aSamplesToRead, unsigned int aBufferSize);
42 | virtual bool hasEnded();
43 |
44 | public:
45 | float mOctaveScale[10];
46 | Misc::Prg mPrg;
47 | };
48 |
49 | class Noise : public AudioSource
50 | {
51 | public:
52 |
53 | enum NOISETYPES
54 | {
55 | WHITE = 0,
56 | PINK,
57 | BROWNISH,
58 | BLUEISH
59 | };
60 |
61 | Noise();
62 |
63 | void setOctaveScale(float aOct0, float aOct1, float aOct2, float aOct3, float aOct4, float aOct5, float aOct6, float aOct7, float aOct8, float aOct9);
64 | void setType(int aType);
65 |
66 | virtual ~Noise();
67 |
68 | public:
69 | virtual AudioSourceInstance *createInstance();
70 | float mOctaveScale[10];
71 | };
72 | };
73 |
74 | #endif
75 |
--------------------------------------------------------------------------------
/external/soloud/src/audiosource/ay/sndbuffer.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include "sndbuffer.h"
3 | #include "sndrender.h"
4 | #include
5 |
6 | SNDBUFFER::SNDBUFFER(unsigned aSize) {
7 | read_position = 0;
8 | samples_ready = 0;
9 | // size must be power of 2 for faster calc cyclic position: pos = (pos+1) & (size-1)
10 | if (aSize & (aSize-1)) {
11 | unsigned i = 1;
12 | while (i < aSize) i *= 2;
13 | aSize = i;
14 | }
15 | SNDBUFFER::size = aSize;
16 | buffer = (SNDSAMPLE*)malloc(aSize * sizeof(SNDSAMPLE));
17 | reset();
18 | }
19 |
20 | SNDBUFFER::~SNDBUFFER()
21 | {
22 | free(buffer);
23 | }
24 |
25 | void SNDBUFFER::reset()
26 | {
27 | read_position = 0;
28 | memset(buffer, 0, size * sizeof(SNDSAMPLE));
29 | }
30 |
31 | void SNDBUFFER::get_buffers(bufptr_t& pos1, unsigned& size1, bufptr_t& pos2, unsigned& size2, unsigned count)
32 | {
33 | pos1 = read_position;
34 | pos2 = 0;
35 | size1 = size - read_position;
36 | if (count < size1) {
37 | size1 = count;
38 | size2 = 0;
39 | } else {
40 | size2 = count-size1;
41 | }
42 | }
43 |
44 | void SNDBUFFER::samples_read(unsigned count)
45 | {
46 | unsigned size1, size2, pos1, pos2;
47 | get_buffers(pos1, size1, pos2, size2, count);
48 | memset(buffer + pos1, 0, size1 * sizeof(SNDSAMPLE));
49 | if (size2) {
50 | memset(buffer + pos2, 0, size2 * sizeof(SNDSAMPLE));
51 | }
52 | read_position = (read_position + count) & (size-1);
53 | }
54 |
55 | void SNDBUFFER::count_start()
56 | {
57 | samples_ready = size;
58 | }
59 |
60 | unsigned SNDBUFFER::count_single(const SNDRENDER& render)
61 | {
62 | return (render.dstpos - read_position) & (size-1);
63 | }
64 |
65 | void SNDBUFFER::count(const SNDRENDER& render)
66 | {
67 | unsigned samples = count_single(render);
68 | if (samples < samples_ready) samples_ready = samples;
69 | }
70 |
71 | unsigned SNDBUFFER::count_end()
72 | {
73 | return samples_ready;
74 | }
75 |
--------------------------------------------------------------------------------
/external/soloud/include/soloud_tedsid.h:
--------------------------------------------------------------------------------
1 | /*
2 | TED/SID module for SoLoud audio engine
3 | Copyright (c) 2013-2015 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #ifndef TEDSID_H
26 | #define TEDSID_H
27 |
28 | #include "soloud.h"
29 |
30 | class SIDsound;
31 | class TED;
32 |
33 | namespace SoLoud
34 | {
35 | class TedSid;
36 | class File;
37 |
38 | class TedSidInstance : public AudioSourceInstance
39 | {
40 | TedSid *mParent;
41 | SIDsound *mSID;
42 | TED *mTED;
43 | int mPos;
44 | unsigned int mSampleCount;
45 | int mRegValues[128];
46 | public:
47 |
48 | TedSidInstance(TedSid *aParent);
49 | ~TedSidInstance();
50 | virtual unsigned int getAudio(float *aBuffer, unsigned int aSamplesToRead, unsigned int aBufferSize);
51 | virtual void tick();
52 | virtual bool hasEnded();
53 | virtual float getInfo(unsigned int aInfoKey);
54 | };
55 |
56 | class TedSid : public AudioSource
57 | {
58 | public:
59 | int mLooppos;
60 | int mLength;
61 | unsigned short* mOps;
62 | int mModel;
63 | TedSid();
64 | ~TedSid();
65 | result load(const char *aFilename);
66 | result loadMem(const unsigned char *aMem, unsigned int aLength, bool aCopy = false, bool aTakeOwnership = true);
67 | result loadFile(File *aFile);
68 | virtual AudioSourceInstance *createInstance();
69 | };
70 | };
71 |
72 | #endif
--------------------------------------------------------------------------------
/external/soloud/include/soloud_waveshaperfilter.h:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2018 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #ifndef SOLOUD_WAVESHAPERFILTER_H
26 | #define SOLOUD_WAVESHAPERFILTER_H
27 |
28 | #include "soloud.h"
29 |
30 | namespace SoLoud
31 | {
32 | class WaveShaperFilter;
33 |
34 | class WaveShaperFilterInstance : public FilterInstance
35 | {
36 | WaveShaperFilter *mParent;
37 | public:
38 | virtual void filterChannel(float *aBuffer, unsigned int aSamples, float aSamplerate, time aTime, unsigned int aChannel, unsigned int aChannels);
39 | virtual ~WaveShaperFilterInstance();
40 | WaveShaperFilterInstance(WaveShaperFilter *aParent);
41 | };
42 |
43 | class WaveShaperFilter : public Filter
44 | {
45 | public:
46 | enum FILTERPARAMS {
47 | WET = 0,
48 | AMOUNT
49 | };
50 | float mAmount;
51 | virtual WaveShaperFilterInstance *createInstance();
52 | result setParams(float aAmount);
53 | WaveShaperFilter();
54 | virtual ~WaveShaperFilter();
55 | virtual int getParamCount();
56 | virtual const char* getParamName(unsigned int aParamIndex);
57 | virtual unsigned int getParamType(unsigned int aParamIndex);
58 | virtual float getParamMax(unsigned int aParamIndex);
59 | virtual float getParamMin(unsigned int aParamIndex);
60 | };
61 | }
62 |
63 | #endif
--------------------------------------------------------------------------------
/external/soloud/include/soloud_bassboostfilter.h:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2015 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #ifndef SOLOUD_BASSBOOSTFILTER_H
26 | #define SOLOUD_BASSBOOSTFILTER_H
27 |
28 | #include "soloud.h"
29 | #include "soloud_fftfilter.h"
30 |
31 | namespace SoLoud
32 | {
33 | class BassboostFilter;
34 |
35 | class BassboostFilterInstance : public FFTFilterInstance
36 | {
37 | enum FILTERATTRIBUTE
38 | {
39 | WET = 0,
40 | BOOST = 1
41 | };
42 | BassboostFilter *mParent;
43 | public:
44 | virtual void fftFilterChannel(float *aFFTBuffer, unsigned int aSamples, float aSamplerate, time aTime, unsigned int aChannel, unsigned int aChannels);
45 | BassboostFilterInstance(BassboostFilter *aParent);
46 | };
47 |
48 | class BassboostFilter : public FFTFilter
49 | {
50 | public:
51 | enum FILTERATTRIBUTE
52 | {
53 | WET = 0,
54 | BOOST = 1
55 | };
56 | virtual int getParamCount();
57 | virtual const char* getParamName(unsigned int aParamIndex);
58 | virtual unsigned int getParamType(unsigned int aParamIndex);
59 | virtual float getParamMax(unsigned int aParamIndex);
60 | virtual float getParamMin(unsigned int aParamIndex);
61 | float mBoost;
62 | result setParams(float aBoost);
63 | virtual FilterInstance *createInstance();
64 | BassboostFilter();
65 | };
66 | }
67 |
68 | #endif
--------------------------------------------------------------------------------
/external/soloud/include/soloud_flangerfilter.h:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2020 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #ifndef SOLOUD_FLANGERFILTER_H
26 | #define SOLOUD_FLANGERFILTER_H
27 |
28 | #include "soloud.h"
29 |
30 | namespace SoLoud
31 | {
32 | class FlangerFilter;
33 |
34 | class FlangerFilterInstance : public FilterInstance
35 | {
36 | float *mBuffer;
37 | unsigned int mBufferLength;
38 | FlangerFilter *mParent;
39 | unsigned int mOffset;
40 | double mIndex;
41 |
42 | public:
43 | virtual void filter(float *aBuffer, unsigned int aSamples, unsigned int aBufferSize, unsigned int aChannels, float aSamplerate, time aTime);
44 | virtual ~FlangerFilterInstance();
45 | FlangerFilterInstance(FlangerFilter *aParent);
46 | };
47 |
48 | class FlangerFilter : public Filter
49 | {
50 | public:
51 | enum FILTERPARAMS
52 | {
53 | WET,
54 | DELAY,
55 | FREQ
56 | };
57 | float mDelay;
58 | float mFreq;
59 | virtual int getParamCount();
60 | virtual const char* getParamName(unsigned int aParamIndex);
61 | virtual unsigned int getParamType(unsigned int aParamIndex);
62 | virtual float getParamMax(unsigned int aParamIndex);
63 | virtual float getParamMin(unsigned int aParamIndex);
64 | virtual FilterInstance *createInstance();
65 | FlangerFilter();
66 | result setParams(float aDelay, float aFreq);
67 | };
68 | }
69 |
70 | #endif
--------------------------------------------------------------------------------
/external/soloud/include/soloud_echofilter.h:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2020 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #ifndef SOLOUD_ECHOFILTER_H
26 | #define SOLOUD_ECHOFILTER_H
27 |
28 | #include "soloud.h"
29 |
30 | namespace SoLoud
31 | {
32 | class EchoFilter;
33 |
34 | class EchoFilterInstance : public FilterInstance
35 | {
36 | float *mBuffer;
37 | int mBufferLength;
38 | int mBufferMaxLength;
39 | int mOffset;
40 |
41 | public:
42 | virtual void filter(float *aBuffer, unsigned int aSamples, unsigned int aBufferSize, unsigned int aChannels, float aSamplerate, time aTime);
43 | virtual ~EchoFilterInstance();
44 | EchoFilterInstance(EchoFilter *aParent);
45 | };
46 |
47 | class EchoFilter : public Filter
48 | {
49 | public:
50 | enum FILTERATTRIBUTE
51 | {
52 | WET = 0,
53 | DELAY,
54 | DECAY,
55 | FILTER
56 | };
57 | float mDelay;
58 | float mDecay;
59 | float mFilter;
60 | virtual int getParamCount();
61 | virtual const char* getParamName(unsigned int aParamIndex);
62 | virtual unsigned int getParamType(unsigned int aParamIndex);
63 | virtual float getParamMax(unsigned int aParamIndex);
64 | virtual float getParamMin(unsigned int aParamIndex);
65 | virtual FilterInstance *createInstance();
66 | EchoFilter();
67 | result setParams(float aDelay, float aDecay = 0.7f, float aFilter = 0.0f);
68 | };
69 | }
70 |
71 | #endif
--------------------------------------------------------------------------------
/external/soloud/include/soloud_robotizefilter.h:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2020 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #ifndef SOLOUD_ROBOTIZEFILTER_H
26 | #define SOLOUD_ROBOTIZEFILTER_H
27 |
28 | #include "soloud.h"
29 | #include "soloud_filter.h"
30 | #include "soloud_misc.h"
31 |
32 | namespace SoLoud
33 | {
34 | class RobotizeFilter;
35 |
36 | class RobotizeFilterInstance : public FilterInstance
37 | {
38 | enum FILTERATTRIBUTE
39 | {
40 | WET = 0,
41 | FREQ,
42 | WAVE
43 | };
44 | RobotizeFilter *mParent;
45 | public:
46 | virtual void filterChannel(float *aBuffer, unsigned int aSamples, float aSamplerate, time aTime, unsigned int aChannel, unsigned int aChannels);
47 | RobotizeFilterInstance(RobotizeFilter *aParent);
48 | };
49 |
50 | class RobotizeFilter : public Filter
51 | {
52 | public:
53 | enum FILTERATTRIBUTE
54 | {
55 | WET = 0,
56 | FREQ,
57 | WAVE
58 | };
59 | float mFreq;
60 | int mWave;
61 | virtual int getParamCount();
62 | virtual const char* getParamName(unsigned int aParamIndex);
63 | virtual unsigned int getParamType(unsigned int aParamIndex);
64 | virtual float getParamMax(unsigned int aParamIndex);
65 | virtual float getParamMin(unsigned int aParamIndex);
66 | void setParams(float aFreq, int aWaveform);
67 | virtual FilterInstance *createInstance();
68 | RobotizeFilter();
69 | };
70 | }
71 |
72 | #endif
--------------------------------------------------------------------------------
/external/soloud/src/audiosource/speech/resonator.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include "resonator.h"
3 |
4 | #ifndef PI
5 | #define PI 3.1415926535897932384626433832795f
6 | #endif
7 |
8 | /* Convert formant freqencies and bandwidth into resonator difference equation coefficents
9 | */
10 | void resonator::initResonator(
11 | int aFrequency, /* Frequency of resonator in Hz */
12 | int aBandwidth, /* Bandwidth of resonator in Hz */
13 | int aSamplerate)
14 | {
15 | float arg = (-PI / aSamplerate) * aBandwidth;
16 | float r = (float)exp(arg);
17 | mC = -(r * r);
18 | arg = (-2.0f * PI / aSamplerate) * aFrequency;
19 | mB = r * (float)cos(arg) * 2.0f;
20 | mA = 1.0f - mB - mC;
21 | }
22 |
23 | /* Convert formant freqencies and bandwidth into anti-resonator difference equation constants
24 | */
25 | void resonator::initAntiresonator(
26 | int aFrequency, /* Frequency of resonator in Hz */
27 | int aBandwidth, /* Bandwidth of resonator in Hz */
28 | int aSamplerate)
29 | {
30 | initResonator(aFrequency, aBandwidth, aSamplerate); /* First compute ordinary resonator coefficients */
31 | /* Now convert to antiresonator coefficients */
32 | mA = 1.0f / mA; /* a'= 1/a */
33 | mB *= -mA; /* b'= -b/a */
34 | mC *= -mA; /* c'= -c/a */
35 | }
36 |
37 | /* Generic resonator function */
38 | float resonator::resonate(float input)
39 | {
40 | float x = mA * input + mB * mP1 + mC * mP2;
41 | mP2 = mP1;
42 | mP1 = x;
43 | return x;
44 | }
45 |
46 | /* Generic anti-resonator function
47 | Same as resonator except that a,b,c need to be set with initAntiresonator()
48 | and we save inputs in p1/p2 rather than outputs.
49 | There is currently only one of these - "mNasalZero"
50 | */
51 | /* Output = (mNasalZero.a * input) + (mNasalZero.b * oldin1) + (mNasalZero.c * oldin2) */
52 |
53 | float resonator::antiresonate(float input)
54 | {
55 | float x = mA * input + mB * mP1 + mC * mP2;
56 | mP2 = mP1;
57 | mP1 = input;
58 | return x;
59 | }
60 |
61 | resonator::resonator()
62 | {
63 | mA = mB = mC = mP1 = mP2 = 0;
64 | }
65 |
66 | resonator::~resonator()
67 | {
68 | }
69 |
70 | void resonator::setGain(float aG)
71 | {
72 | mA *= aG;
73 | }
74 |
75 |
--------------------------------------------------------------------------------
/external/soloud/include/soloud_duckfilter.h:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2021 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #ifndef SOLOUD_DUCKFILTER_H
26 | #define SOLOUD_DUCKFILTER_H
27 |
28 | #include "soloud.h"
29 |
30 | namespace SoLoud
31 | {
32 | class DuckFilter;
33 |
34 | class DuckFilterInstance : public FilterInstance
35 | {
36 | handle mListenTo;
37 | Soloud* mSoloud;
38 | float mCurrentLevel;
39 | public:
40 | virtual void filter(float *aBuffer, unsigned int aSamples, unsigned int aBufferSize, unsigned int aChannels, float aSamplerate, time aTime);
41 | virtual ~DuckFilterInstance();
42 | DuckFilterInstance(DuckFilter *aParent);
43 | };
44 |
45 | class DuckFilter : public Filter
46 | {
47 | public:
48 | enum FILTERATTRIBUTE
49 | {
50 | WET = 0,
51 | ONRAMP,
52 | OFFRAMP,
53 | LEVEL
54 | };
55 | Soloud* mSoloud;
56 | float mOnRamp;
57 | float mOffRamp;
58 | float mLevel;
59 | handle mListenTo;
60 | virtual int getParamCount();
61 | virtual const char* getParamName(unsigned int aParamIndex);
62 | virtual unsigned int getParamType(unsigned int aParamIndex);
63 | virtual float getParamMax(unsigned int aParamIndex);
64 | virtual float getParamMin(unsigned int aParamIndex);
65 | virtual FilterInstance *createInstance();
66 | DuckFilter();
67 | result setParams(Soloud* aSoloud, handle aListenTo, float aOnRamp = 0.1f, float aOffRamp = 0.5f, float aLevel = 0.1f);
68 | };
69 | }
70 |
71 | #endif
--------------------------------------------------------------------------------
/external/soloud/include/soloud_file_hack_on.h:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2020 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | /*
26 | This is a "hack" header to fool third party code to use our File stuff instead
27 | of stdio FILE* stuff.
28 | You can use soloud_file_hack_off.h to undef the stuff defined here.
29 | */
30 |
31 | #ifndef SEEK_SET
32 | #error soloud_file_hack_on must be included after stdio, otherwise the #define hacks will break stdio.
33 | #endif
34 |
35 | typedef void* Soloud_Filehack;
36 |
37 | #ifdef __cplusplus
38 | extern "C" {
39 | #endif
40 |
41 | extern int Soloud_Filehack_fgetc(Soloud_Filehack *f);
42 | extern int Soloud_Filehack_fread(void *dst, int s, int c, Soloud_Filehack *f);
43 | extern int Soloud_Filehack_fseek(Soloud_Filehack *f, int idx, int base);
44 | extern int Soloud_Filehack_ftell(Soloud_Filehack *f);
45 | extern int Soloud_Filehack_fclose(Soloud_Filehack *f);
46 | extern Soloud_Filehack * Soloud_Filehack_fopen(const char *aFilename, char *aMode);
47 | extern int Soloud_Filehack_fopen_s(Soloud_Filehack **f, const char* aFilename, char* aMode);
48 |
49 | #ifdef __cplusplus
50 | }
51 | #endif
52 |
53 | #define FILE Soloud_Filehack
54 | #define fgetc Soloud_Filehack_fgetc
55 | #define fread Soloud_Filehack_fread
56 | #define fseek Soloud_Filehack_fseek
57 | #define ftell Soloud_Filehack_ftell
58 | #define fclose Soloud_Filehack_fclose
59 | #define fopen Soloud_Filehack_fopen
60 | #define fopen_s Soloud_Filehack_fopen_s
61 |
--------------------------------------------------------------------------------
/lib/react-imgui-reconciler/tree-printer.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tzvetan Mikov and contributors
2 | // SPDX-License-Identifier: MIT
3 | // See LICENSE file for full license text
4 |
5 | /**
6 | * Pretty-print the tree structure to console.
7 | * This lets us visualize what React built.
8 | */
9 |
10 | /**
11 | * Print the entire tree from a container.
12 | *
13 | * @param container - The container object from render()
14 | * @param indent - Starting indentation level (default 0)
15 | */
16 | export function printTree(container, indent = 0) {
17 | console.log('\n=== Tree Structure ===');
18 |
19 | if (!container.rootNode) {
20 | console.log('(empty tree)');
21 | return;
22 | }
23 |
24 | printNode(container.rootNode, indent);
25 | console.log('======================\n');
26 | }
27 |
28 | /**
29 | * Recursively print a node and its children.
30 | *
31 | * @param node - TreeNode or TextNode to print
32 | * @param indent - Current indentation level
33 | */
34 | function printNode(node, indent) {
35 | const spaces = ' '.repeat(indent);
36 |
37 | if (node.text !== undefined) {
38 | // Text node
39 | console.log(`${spaces}"${node.text}"`);
40 | } else {
41 | // Element node
42 | const propsStr = formatProps(node.props);
43 | console.log(`${spaces}<${node.type}${propsStr}>`);
44 |
45 | // Print children
46 | for (const child of node.children) {
47 | printNode(child, indent + 1);
48 | }
49 | }
50 | }
51 |
52 | /**
53 | * Format props object as a string for display.
54 | *
55 | * @param props - Props object
56 | * @returns Formatted string like ' title="Hello" count="5"'
57 | */
58 | function formatProps(props) {
59 | if (!props || Object.keys(props).length === 0) {
60 | return '';
61 | }
62 |
63 | const parts = [];
64 | for (const [key, value] of Object.entries(props)) {
65 | // Skip children prop - it's handled separately
66 | if (key === 'children') continue;
67 |
68 | // Format the value
69 | let valueStr;
70 | if (typeof value === 'function') {
71 | valueStr = '[Function]';
72 | } else if (typeof value === 'object') {
73 | valueStr = JSON.stringify(value);
74 | } else {
75 | valueStr = String(value);
76 | }
77 |
78 | parts.push(`${key}="${valueStr}"`);
79 | }
80 |
81 | return parts.length > 0 ? ' ' + parts.join(' ') : '';
82 | }
83 |
--------------------------------------------------------------------------------
/external/soloud/include/soloud_queue.h:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2018 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #ifndef SOLOUD_QUEUE_H
26 | #define SOLOUD_QUEUE_H
27 |
28 | #include "soloud.h"
29 |
30 | #define SOLOUD_QUEUE_MAX 32
31 |
32 | namespace SoLoud
33 | {
34 | class Queue;
35 |
36 | class QueueInstance : public AudioSourceInstance
37 | {
38 | Queue *mParent;
39 | public:
40 | QueueInstance(Queue *aParent);
41 | virtual unsigned int getAudio(float *aBuffer, unsigned int aSamplesToRead, unsigned int aBufferSize);
42 | virtual bool hasEnded();
43 | virtual ~QueueInstance();
44 | };
45 |
46 | class Queue : public AudioSource
47 | {
48 | public:
49 | Queue();
50 | virtual QueueInstance *createInstance();
51 | // Play sound through the queue
52 | result play(AudioSource &aSound);
53 | // Number of audio sources queued for replay
54 | unsigned int getQueueCount();
55 | // Is this audio source currently playing?
56 | bool isCurrentlyPlaying(AudioSource &aSound);
57 | // Set params by reading them from an audio source
58 | result setParamsFromAudioSource(AudioSource &aSound);
59 | // Set params manually
60 | result setParams(float aSamplerate, unsigned int aChannels = 2);
61 |
62 | public:
63 | unsigned int mReadIndex, mWriteIndex, mCount;
64 | AudioSourceInstance *mSource[SOLOUD_QUEUE_MAX];
65 | QueueInstance *mInstance;
66 | handle mQueueHandle;
67 | void findQueueHandle();
68 |
69 | };
70 | };
71 |
72 | #endif
--------------------------------------------------------------------------------
/external/soloud/src/audiosource/ay/sndbuffer.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | union SNDSAMPLE
4 | {
5 | unsigned sample; // left/right channels in low/high WORDs
6 | struct { unsigned short left, right; } ch; // or left/right separately
7 | };
8 |
9 | typedef unsigned bufptr_t;
10 | class SNDRENDER;
11 |
12 | class SNDBUFFER
13 | {
14 | public:
15 | SNDBUFFER(unsigned size);
16 | ~SNDBUFFER();
17 |
18 | void reset();
19 |
20 | SNDSAMPLE* buffer;
21 | bufptr_t size;
22 |
23 | void count_start();
24 | void count(const SNDRENDER& render);
25 | unsigned count_end();
26 |
27 | unsigned count_single(const SNDRENDER& render);
28 | void get_buffers(bufptr_t& pos1, unsigned& size1, bufptr_t& pos2, unsigned& size2, unsigned count);
29 |
30 | // can read some samples starting from here, use count_start(), count(), count_end() to detect count of samples ready
31 | bufptr_t read_position;
32 |
33 | // called when application read `counts` samples from `read_position`
34 | // SNDBUFFER needs to zero buffer under read samples to continue mixing
35 | void samples_read(unsigned count);
36 |
37 | private:
38 | unsigned samples_ready;
39 | };
40 |
41 |
42 |
43 |
44 | #if 0 // USAGE EXAMPLE
45 |
46 | #include "sndrender/*.h"
47 |
48 | SNDBUFFER buf(4096);
49 | SNDCHIP ay1(buf), ay2(buf);
50 | SNDRENDER beeper(buf);
51 |
52 | // global emulation loop
53 | for (;;) {
54 | ay1.start_frame();
55 | ay2.start_frame();
56 | beeper.start_frame();
57 |
58 | // Z80 emulation before INT
59 | for (int t = 0; t < 71680; t++) {
60 | ay1.select(0);
61 | ay1.write(t, t % 100);
62 | ay2.select(3);
63 | ay2.write(t, t % 100);
64 | beeper.update(t, t % 4000, t % 400);
65 | }
66 | ay1.end_frame(t);
67 | ay2.end_frame(t);
68 | beeper.end_frame(t);
69 |
70 | buf.count_start();
71 | buf.count(ay1);
72 | buf.count(ay2);
73 | buf.count(beeper);
74 | unsigned n_samples = buf.count_end();
75 |
76 | bufptr_t pos1, pos2;
77 | unsigned size1, size2;
78 | buf.get_buffers(pos1, size1, pos2, size2, n_samples);
79 |
80 | wav_play(buf.buffer+pos1, size1);
81 | wav_play(buf.buffer+pos2, size2);
82 | buf.samples_read(n_samples);
83 | }
84 |
85 | #endif
86 |
87 |
--------------------------------------------------------------------------------
/external/soloud/include/soloud_lofifilter.h:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2020 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #ifndef SOLOUD_LOFIFILTER_H
26 | #define SOLOUD_LOFIFILTER_H
27 |
28 | #include "soloud.h"
29 |
30 | namespace SoLoud
31 | {
32 | class LofiFilter;
33 |
34 | struct LofiChannelData
35 | {
36 | float mSample;
37 | float mSamplesToSkip;
38 | };
39 |
40 | class LofiFilterInstance : public FilterInstance
41 | {
42 | enum FILTERPARAMS
43 | {
44 | WET,
45 | SAMPLERATE,
46 | BITDEPTH
47 | };
48 | LofiChannelData mChannelData[2];
49 |
50 | LofiFilter *mParent;
51 | public:
52 | virtual void filterChannel(float *aBuffer, unsigned int aSamples, float aSamplerate, time aTime, unsigned int aChannel, unsigned int aChannels);
53 | virtual ~LofiFilterInstance();
54 | LofiFilterInstance(LofiFilter *aParent);
55 | };
56 |
57 | class LofiFilter : public Filter
58 | {
59 | public:
60 | enum FILTERPARAMS
61 | {
62 | WET,
63 | SAMPLERATE,
64 | BITDEPTH
65 | };
66 | float mSampleRate;
67 | float mBitdepth;
68 | virtual LofiFilterInstance *createInstance();
69 | virtual int getParamCount();
70 | virtual const char* getParamName(unsigned int aParamIndex);
71 | virtual unsigned int getParamType(unsigned int aParamIndex);
72 | virtual float getParamMax(unsigned int aParamIndex);
73 | virtual float getParamMin(unsigned int aParamIndex);
74 | LofiFilter();
75 | result setParams(float aSampleRate, float aBitdepth);
76 | virtual ~LofiFilter();
77 | };
78 | }
79 |
80 | #endif
--------------------------------------------------------------------------------
/external/soloud/include/soloud_eqfilter.h:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2020 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #ifndef SOLOUD_EQFILTER_H
26 | #define SOLOUD_EQFILTER_H
27 |
28 | #include "soloud.h"
29 | #include "soloud_fftfilter.h"
30 |
31 | namespace SoLoud
32 | {
33 | class EqFilter;
34 |
35 | class EqFilterInstance : public FFTFilterInstance
36 | {
37 | enum FILTERATTRIBUTE
38 | {
39 | WET = 0,
40 | BAND1 = 1,
41 | BAND2 = 2,
42 | BAND3 = 3,
43 | BAND4 = 4,
44 | BAND5 = 5,
45 | BAND6 = 6,
46 | BAND7 = 7,
47 | BAND8 = 8
48 | };
49 | EqFilter *mParent;
50 | public:
51 | virtual void fftFilterChannel(float *aFFTBuffer, unsigned int aSamples, float aSamplerate, time aTime, unsigned int aChannel, unsigned int aChannels);
52 | EqFilterInstance(EqFilter *aParent);
53 | };
54 |
55 | class EqFilter : public FFTFilter
56 | {
57 | public:
58 | enum FILTERATTRIBUTE
59 | {
60 | WET = 0,
61 | BAND1 = 1,
62 | BAND2 = 2,
63 | BAND3 = 3,
64 | BAND4 = 4,
65 | BAND5 = 5,
66 | BAND6 = 6,
67 | BAND7 = 7,
68 | BAND8 = 8
69 | };
70 | virtual int getParamCount();
71 | virtual const char* getParamName(unsigned int aParamIndex);
72 | virtual unsigned int getParamType(unsigned int aParamIndex);
73 | virtual float getParamMax(unsigned int aParamIndex);
74 | virtual float getParamMin(unsigned int aParamIndex);
75 | float mVolume[8];
76 | result setParam(unsigned int aBand, float aVolume);
77 | virtual FilterInstance *createInstance();
78 | EqFilter();
79 | };
80 | }
81 |
82 | #endif
--------------------------------------------------------------------------------
/external/soloud/include/soloud_fftfilter.h:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2015 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #ifndef SOLOUD_FFTFILTER_H
26 | #define SOLOUD_FFTFILTER_H
27 |
28 | #include "soloud.h"
29 |
30 | namespace SoLoud
31 | {
32 | class FFTFilter;
33 |
34 | class FFTFilterInstance : public FilterInstance
35 | {
36 | float *mTemp;
37 | float *mInputBuffer;
38 | float *mMixBuffer;
39 | float *mLastPhase;
40 | float *mSumPhase;
41 | unsigned int mInputOffset[MAX_CHANNELS];
42 | unsigned int mMixOffset[MAX_CHANNELS];
43 | unsigned int mReadOffset[MAX_CHANNELS];
44 | FFTFilter *mParent;
45 | public:
46 | virtual void fftFilterChannel(float *aFFTBuffer, unsigned int aSamples, float aSamplerate, time aTime, unsigned int aChannel, unsigned int aChannels);
47 | virtual void filterChannel(float *aBuffer, unsigned int aSamples, float aSamplerate, time aTime, unsigned int aChannel, unsigned int aChannels);
48 | virtual ~FFTFilterInstance();
49 | FFTFilterInstance(FFTFilter *aParent);
50 | FFTFilterInstance();
51 | void comp2MagPhase(float* aFFTBuffer, unsigned int aSamples);
52 | void magPhase2MagFreq(float* aFFTBuffer, unsigned int aSamples, float aSamplerate, unsigned int aChannel);
53 | void magFreq2MagPhase(float* aFFTBuffer, unsigned int aSamples, float aSamplerate, unsigned int aChannel);
54 | void magPhase2Comp(float* aFFTBuffer, unsigned int aSamples);
55 | void init();
56 | };
57 |
58 | class FFTFilter : public Filter
59 | {
60 | public:
61 | virtual FilterInstance *createInstance();
62 | FFTFilter();
63 | };
64 | }
65 |
66 | #endif
--------------------------------------------------------------------------------
/external/soloud/include/soloud_speech.h:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2015 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 | #ifndef SOLOUD_SPEECH_H
25 | #define SOLOUD_SPEECH_H
26 |
27 | #include "soloud.h"
28 | #include "../src/audiosource/speech/darray.h"
29 | #include "../src/audiosource/speech/klatt.h"
30 | #include "../src/audiosource/speech/tts.h"
31 |
32 | namespace SoLoud
33 | {
34 | class Speech;
35 |
36 | class Speech : public AudioSource
37 | {
38 | // copy of the enum in klatt.h for codegen purposes
39 | enum KLATT_WAVEFORM
40 | {
41 | KW_SAW,
42 | KW_TRIANGLE,
43 | KW_SIN,
44 | KW_SQUARE,
45 | KW_PULSE,
46 | KW_NOISE,
47 | KW_WARBLE
48 | };
49 | public:
50 | int mBaseFrequency;
51 | float mBaseSpeed;
52 | float mBaseDeclination;
53 | int mBaseWaveform;
54 | int mFrames;
55 | darray mElement;
56 | Speech();
57 | result setText(const char *aText);
58 | result setParams(unsigned int aBaseFrequency = 1330, float aBaseSpeed = 10.0f, float aBaseDeclination = 0.5f, int aBaseWaveform = KW_TRIANGLE);
59 | virtual ~Speech();
60 | virtual AudioSourceInstance *createInstance();
61 | };
62 |
63 | class SpeechInstance : public AudioSourceInstance
64 | {
65 | klatt mSynth;
66 | Speech *mParent;
67 | short *mSample;
68 | int mSampleCount;
69 | int mOffset;
70 | public:
71 | SpeechInstance(Speech *aParent);
72 | virtual ~SpeechInstance();
73 | virtual unsigned int getAudio(float *aBuffer, unsigned int aSamplesToRead, unsigned int aBufferSize);
74 | virtual result rewind();
75 | virtual bool hasEnded();
76 | };
77 | };
78 |
79 | #endif
80 |
--------------------------------------------------------------------------------
/external/soloud/include/soloud_freeverbfilter.h:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2020 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #ifndef SOLOUD_FREEVERBFILTER_H
26 | #define SOLOUD_FREEVERBFILTER_H
27 |
28 | #include "soloud.h"
29 |
30 | namespace SoLoud
31 | {
32 | class FreeverbFilter;
33 | namespace FreeverbImpl
34 | {
35 | class Revmodel;
36 | }
37 |
38 | class FreeverbFilterInstance : public FilterInstance
39 | {
40 | enum FILTERPARAM {
41 | WET = 0,
42 | FREEZE,
43 | ROOMSIZE,
44 | DAMP,
45 | WIDTH
46 | };
47 |
48 | FreeverbFilter *mParent;
49 | FreeverbImpl::Revmodel *mModel;
50 | public:
51 | virtual void filter(float* aBuffer, unsigned int aSamples, unsigned int aBufferSize, unsigned int aChannels, float aSamplerate, time aTime);
52 | virtual ~FreeverbFilterInstance();
53 | FreeverbFilterInstance(FreeverbFilter *aParent);
54 | };
55 |
56 | class FreeverbFilter : public Filter
57 | {
58 | public:
59 | enum FILTERPARAM {
60 | WET = 0,
61 | FREEZE,
62 | ROOMSIZE,
63 | DAMP,
64 | WIDTH
65 | };
66 | virtual int getParamCount();
67 | virtual const char* getParamName(unsigned int aParamIndex);
68 | virtual unsigned int getParamType(unsigned int aParamIndex);
69 | virtual float getParamMax(unsigned int aParamIndex);
70 | virtual float getParamMin(unsigned int aParamIndex);
71 |
72 | float mMode;
73 | float mRoomSize;
74 | float mDamp;
75 | float mWidth;
76 | virtual FreeverbFilterInstance *createInstance();
77 | FreeverbFilter();
78 | result setParams(float aMode, float aRoomSize, float aDamp, float aWidth);
79 | virtual ~FreeverbFilter();
80 | };
81 | }
82 |
83 | #endif
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.26)
2 | project(imgui-react-runtime)
3 |
4 | set(CMAKE_CXX_STANDARD 17)
5 |
6 | # Suppress C99 designator warnings for C++ files with GCC/Clang
7 | if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
8 | add_compile_options($<$:-Wno-c99-designator>)
9 | endif()
10 |
11 | # Validate required variables
12 | if(NOT CMAKE_BUILD_TYPE)
13 | message(FATAL_ERROR "CMAKE_BUILD_TYPE must be set (e.g., Debug or Release)")
14 | endif()
15 |
16 | # Build Hermes as an external project (always in Release mode)
17 | # This sets HERMES_BUILD, HERMES_SRC, SHERMES, and HERMES variables
18 | include(cmake/HermesExternal.cmake)
19 |
20 | # Include Hermes compilation helper functions
21 | include(cmake/hermes.cmake)
22 |
23 | # Include React+ImGui app helper functions
24 | include(cmake/react-imgui.cmake)
25 |
26 | # React bundle mode:
27 | # 0 = Native compilation with shermes (default for Release, slowest build, fastest runtime)
28 | # 1 = Bytecode compilation with hermes (medium build speed, medium runtime)
29 | # 2 = Source bundle only (default for Debug, fastest build, slowest runtime)
30 | if(NOT DEFINED REACT_BUNDLE_MODE)
31 | if(CMAKE_BUILD_TYPE STREQUAL "Release")
32 | set(REACT_BUNDLE_MODE 0)
33 | else()
34 | set(REACT_BUNDLE_MODE 2)
35 | endif()
36 | endif()
37 | set(REACT_BUNDLE_MODE ${REACT_BUNDLE_MODE} CACHE STRING "React bundle compilation mode (0=native, 1=bytecode, 2=source)")
38 |
39 | # React Compiler: Optional optimization feature (OFF by default)
40 | option(USE_REACT_COMPILER "Enable React Compiler for automatic memoization optimizations" OFF)
41 |
42 | message(STATUS "Hermes build: ${HERMES_BUILD}")
43 | message(STATUS "Hermes source: ${HERMES_SRC}")
44 | message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
45 | message(STATUS "React bundle mode: ${REACT_BUNDLE_MODE} (0=native, 1=bytecode, 2=source)")
46 | message(STATUS "React Compiler: ${USE_REACT_COMPILER}")
47 |
48 | # Collect reconciler library files for dependency tracking
49 | # This is defined at root level so it can be reused by multiple apps
50 | file(GLOB RECONCILER_FILES
51 | CONFIGURE_DEPENDS
52 | ${CMAKE_SOURCE_DIR}/lib/react-imgui-reconciler/*.js
53 | )
54 |
55 | # Hermes include directories
56 | include_directories(${HERMES_BUILD}/lib/config)
57 | include_directories(${HERMES_SRC}/include)
58 | include_directories(${HERMES_SRC}/public)
59 | include_directories(${HERMES_SRC}/API)
60 | include_directories(${HERMES_SRC}/API/jsi)
61 |
62 | add_subdirectory(external)
63 | add_subdirectory(lib)
64 | add_subdirectory(examples)
65 |
--------------------------------------------------------------------------------
/LICENSE_stb:
--------------------------------------------------------------------------------
1 | This software is available under 2 licenses -- choose whichever you prefer.
2 | ------------------------------------------------------------------------------
3 | ALTERNATIVE A - MIT License
4 | Copyright (c) 2017 Sean Barrett
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9 | of the Software, and to permit persons to whom the Software is furnished to do
10 | so, subject to the following conditions:
11 | The above copyright notice and this permission notice shall be included in all
12 | copies or substantial portions of the Software.
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | SOFTWARE.
20 | ------------------------------------------------------------------------------
21 | ALTERNATIVE B - Public Domain (www.unlicense.org)
22 | This is free and unencumbered software released into the public domain.
23 | Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
24 | software, either in source code form or as a compiled binary, for any purpose,
25 | commercial or non-commercial, and by any means.
26 | In jurisdictions that recognize copyright laws, the author or authors of this
27 | software dedicate any and all copyright interest in the software to the public
28 | domain. We make this dedication for the benefit of the public at large and to
29 | the detriment of our heirs and successors. We intend this dedication to be an
30 | overt act of relinquishment in perpetuity of all present and future rights to
31 | this software under copyright law.
32 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
33 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
34 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
35 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
36 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
37 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38 |
--------------------------------------------------------------------------------
/external/soloud/include/soloud_wav.h:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2018 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #ifndef SOLOUD_WAV_H
26 | #define SOLOUD_WAV_H
27 |
28 | #include "soloud.h"
29 |
30 | struct stb_vorbis;
31 |
32 | namespace SoLoud
33 | {
34 | class Wav;
35 | class File;
36 | class MemoryFile;
37 |
38 | class WavInstance : public AudioSourceInstance
39 | {
40 | Wav *mParent;
41 | unsigned int mOffset;
42 | public:
43 | WavInstance(Wav *aParent);
44 | virtual unsigned int getAudio(float *aBuffer, unsigned int aSamplesToRead, unsigned int aBufferSize);
45 | virtual result rewind();
46 | virtual bool hasEnded();
47 | };
48 |
49 | class Wav : public AudioSource
50 | {
51 | result loadwav(MemoryFile *aReader);
52 | result loadogg(MemoryFile *aReader);
53 | result loadmp3(MemoryFile *aReader);
54 | result loadflac(MemoryFile *aReader);
55 | result testAndLoadFile(MemoryFile *aReader);
56 | public:
57 | float *mData;
58 | unsigned int mSampleCount;
59 |
60 | Wav();
61 | virtual ~Wav();
62 | result load(const char *aFilename);
63 | result loadMem(const unsigned char *aMem, unsigned int aLength, bool aCopy = false, bool aTakeOwnership = true);
64 | result loadFile(File *aFile);
65 | result loadRawWave8(unsigned char *aMem, unsigned int aLength, float aSamplerate = 44100.0f, unsigned int aChannels = 1);
66 | result loadRawWave16(short *aMem, unsigned int aLength, float aSamplerate = 44100.0f, unsigned int aChannels = 1);
67 | result loadRawWave(float *aMem, unsigned int aLength, float aSamplerate = 44100.0f, unsigned int aChannels = 1, bool aCopy = false, bool aTakeOwnership = true);
68 |
69 | virtual AudioSourceInstance *createInstance();
70 | time getLength();
71 | };
72 | };
73 |
74 | #endif
75 |
--------------------------------------------------------------------------------
/lib/imgui-runtime/imgui-runtime.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tzvetan Mikov and contributors
2 | // SPDX-License-Identifier: MIT
3 | // See LICENSE file for full license text
4 |
5 | #pragma once
6 |
7 | #include "MappedFileBuffer.h"
8 |
9 | struct InternalImage {
10 | const char unsigned *data;
11 | unsigned size;
12 | const char *name;
13 | };
14 |
15 | #define IMPORT_IMAGE(name) \
16 | extern "C" const unsigned char img_##name##_png[]; \
17 | extern "C" const unsigned img_##name##_png_size; \
18 | static InternalImage s_img_##name = {img_##name##_png, \
19 | img_##name##_png_size, #name}
20 |
21 | /// Main function provided by the user. It has to initialize the React and user
22 | /// code.
23 | void imgui_main(int argc, char *argv[],
24 | facebook::hermes::HermesRuntime *hermes);
25 |
26 | /// imgui_main() usually just calls this function with the correct parameters.
27 | void imgui_load_unit(facebook::hermes::HermesRuntime *hermes,
28 | SHUnitCreator nativeUnit, bool bytecode,
29 | const char *jsPath, const char *sourceURL);
30 |
31 | /// A simple default implementation of imgui_main().
32 | template
33 | void imgui_main_default(facebook::hermes::HermesRuntime *hermes,
34 | SHUnitCreator sh_export_react, const char *bundlePath) {
35 | // Load react unit based on compilation mode
36 | if constexpr (BUNDLE_MODE == 0) {
37 | imgui_load_unit(hermes, sh_export_react, false, nullptr, nullptr);
38 | } else if constexpr (BUNDLE_MODE == 1) {
39 | // Mode 1: Bytecode - load .hbc file via evaluateJavaScript
40 | imgui_load_unit(hermes, nullptr, true, bundlePath, "react-unit-bundle.hbc");
41 | } else if constexpr (BUNDLE_MODE == 2) {
42 | // Mode 2: Source - load .js file with source map
43 | imgui_load_unit(hermes, nullptr, false, bundlePath, "react-unit-bundle.js");
44 | }
45 | }
46 |
47 | #ifdef PROVIDE_IMGUI_MAIN
48 |
49 | #if REACT_BUNDLE_MODE == 0
50 | extern "C" SHUnit *sh_export_react(void);
51 | #elif !(REACT_BUNDLE_MODE >= 0 && REACT_BUNDLE_MODE < 4)
52 | #error "Invalid REACT_BUNDLE_MODE"
53 | #endif
54 |
55 | void imgui_main(int argc, char *argv[],
56 | facebook::hermes::HermesRuntime *hermes) {
57 | #if REACT_BUNDLE_MODE != 0
58 | static constexpr SHUnit *(*sh_export_react)(void) = nullptr;
59 | #endif
60 | imgui_main_default(hermes, sh_export_react,
61 | REACT_BUNDLE_PATH);
62 | }
63 |
64 | #endif
65 |
--------------------------------------------------------------------------------
/external/soloud/src/backend/sdl_static/soloud_sdl_static.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2014 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 | #include
25 |
26 | #include "soloud.h"
27 |
28 | #if !defined(WITH_SDL_STATIC)
29 |
30 | namespace SoLoud
31 | {
32 | result sdlstatic_init(SoLoud::Soloud *aSoloud, unsigned int aFlags, unsigned int aSamplerate, unsigned int aBuffer)
33 | {
34 | return NOT_IMPLEMENTED;
35 | }
36 | }
37 |
38 | #else
39 |
40 | #include "SDL.h"
41 | #include
42 |
43 |
44 | namespace SoLoud
45 | {
46 | static SDL_AudioSpec gActiveAudioSpec;
47 | void soloud_sdlstatic_audiomixer(void *userdata, Uint8 *stream, int len)
48 | {
49 | short *buf = (short*)stream;
50 | SoLoud::Soloud *soloud = (SoLoud::Soloud *)userdata;
51 | int samples = len / (gActiveAudioSpec.channels * sizeof(short));
52 | soloud->mixSigned16(buf, samples);
53 | }
54 |
55 | static void soloud_sdlstatic_deinit(SoLoud::Soloud *aSoloud)
56 | {
57 | SDL_CloseAudio();
58 | }
59 |
60 | result sdlstatic_init(SoLoud::Soloud *aSoloud, unsigned int aFlags, unsigned int aSamplerate, unsigned int aBuffer, unsigned int aChannels)
61 | {
62 | SDL_AudioSpec as;
63 | as.freq = aSamplerate;
64 | as.format = AUDIO_S16;
65 | as.channels = aChannels;
66 | as.samples = aBuffer;
67 | as.callback = soloud_sdlstatic_audiomixer;
68 | as.userdata = (void*)aSoloud;
69 |
70 | if (SDL_OpenAudio(&as, &gActiveAudioSpec) < 0)
71 | {
72 | return UNKNOWN_ERROR;
73 | }
74 |
75 | aSoloud->postinit_internal(gActiveAudioSpec.freq, gActiveAudioSpec.samples, aFlags, gActiveAudioSpec.channels);
76 |
77 | aSoloud->mBackendCleanupFunc = soloud_sdlstatic_deinit;
78 |
79 | SDL_PauseAudio(0);
80 | aSoloud->mBackendString = "SDL1 (static)";
81 | return 0;
82 | }
83 |
84 | };
85 | #endif
--------------------------------------------------------------------------------
/lib/imgui-runtime/MappedFileBuffer.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tzvetan Mikov and contributors
2 | // SPDX-License-Identifier: MIT
3 | // See LICENSE file for full license text
4 |
5 | #include "MappedFileBuffer.h"
6 |
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | namespace {
13 |
14 | // Memory-mapped file buffer for loading bytecode/source
15 | class MappedFileBuffer : public facebook::jsi::Buffer {
16 | public:
17 | explicit MappedFileBuffer(const char *path, bool attemptTrailingZero) {
18 | assert(path && path[0]);
19 | fd_ = open(path, O_RDONLY);
20 | if (fd_ < 0) {
21 | throw std::runtime_error(std::string("Failed to open: ") +
22 | path);
23 | }
24 |
25 | struct stat st;
26 | if (fstat(fd_, &st) < 0) {
27 | close(fd_);
28 | throw std::runtime_error(std::string("Failed to stat: ") +
29 | path);
30 | }
31 |
32 | fileSize_ = st.st_size;
33 |
34 | // Calculate mmap size - round up to page size
35 | long pageSize = sysconf(_SC_PAGESIZE);
36 | mappedSize_ = ((fileSize_ + pageSize - 1) / pageSize) * pageSize;
37 |
38 | // For source files, if file size is not page-aligned and addTrailingZero is
39 | // true, report size with extra byte to ensure null termination (mmap fills
40 | // with zeros)
41 | if (attemptTrailingZero && fileSize_ % pageSize != 0) {
42 | size_ = fileSize_ + 1; // Include null terminator
43 | } else {
44 | size_ = fileSize_;
45 | }
46 |
47 | data_ = static_cast(
48 | mmap(nullptr, mappedSize_, PROT_READ, MAP_PRIVATE, fd_, 0));
49 |
50 | if (data_ == MAP_FAILED) {
51 | close(fd_);
52 | throw std::runtime_error(std::string("Failed to mmap React bundle: ") +
53 | path);
54 | }
55 | }
56 |
57 | ~MappedFileBuffer() override {
58 | if (data_ != MAP_FAILED) {
59 | munmap(const_cast(data_), mappedSize_);
60 | }
61 | if (fd_ >= 0) {
62 | close(fd_);
63 | }
64 | }
65 |
66 | size_t size() const override { return size_; }
67 | const uint8_t *data() const override { return data_; }
68 |
69 | private:
70 | int fd_ = -1;
71 | const uint8_t *data_ = nullptr;
72 | size_t fileSize_ = 0; // Actual file size
73 | size_t mappedSize_ = 0; // Rounded to page size
74 | size_t size_ = 0; // Size to report (may include null terminator)
75 | };
76 |
77 | }
78 |
79 | std::shared_ptr
80 | mapFileBuffer(const char *path, bool attemptTrailingZero) {
81 | return std::make_shared(path, attemptTrailingZero);
82 | }
83 |
--------------------------------------------------------------------------------
/external/soloud/include/soloud_filter.h:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2014 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #ifndef SOLOUD_FILTER_H
26 | #define SOLOUD_FILTER_H
27 |
28 | #include "soloud.h"
29 |
30 | namespace SoLoud
31 | {
32 | class Fader;
33 |
34 | class FilterInstance
35 | {
36 | public:
37 | unsigned int mNumParams;
38 | unsigned int mParamChanged;
39 | float *mParam;
40 | Fader *mParamFader;
41 |
42 |
43 | FilterInstance();
44 | virtual result initParams(int aNumParams);
45 | virtual void updateParams(time aTime);
46 | virtual void filter(float *aBuffer, unsigned int aSamples, unsigned int aBufferSize, unsigned int aChannels, float aSamplerate, time aTime);
47 | virtual void filterChannel(float *aBuffer, unsigned int aSamples, float aSamplerate, time aTime, unsigned int aChannel, unsigned int aChannels);
48 | virtual float getFilterParameter(unsigned int aAttributeId);
49 | virtual void setFilterParameter(unsigned int aAttributeId, float aValue);
50 | virtual void fadeFilterParameter(unsigned int aAttributeId, float aTo, time aTime, time aStartTime);
51 | virtual void oscillateFilterParameter(unsigned int aAttributeId, float aFrom, float aTo, time aTime, time aStartTime);
52 | virtual ~FilterInstance();
53 | };
54 |
55 | class Filter
56 | {
57 | public:
58 | enum PARAMTYPE
59 | {
60 | FLOAT_PARAM = 0,
61 | INT_PARAM,
62 | BOOL_PARAM
63 | };
64 | Filter();
65 | virtual int getParamCount();
66 | virtual const char* getParamName(unsigned int aParamIndex);
67 | virtual unsigned int getParamType(unsigned int aParamIndex);
68 | virtual float getParamMax(unsigned int aParamIndex);
69 | virtual float getParamMin(unsigned int aParamIndex);
70 |
71 | virtual FilterInstance *createInstance() = 0;
72 | virtual ~Filter();
73 | };
74 | };
75 |
76 | #endif
77 |
--------------------------------------------------------------------------------
/external/soloud/src/filter/soloud_bassboostfilter.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2020 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #include
26 | #include "soloud.h"
27 | #include "soloud_bassboostfilter.h"
28 |
29 |
30 | namespace SoLoud
31 | {
32 | BassboostFilterInstance::BassboostFilterInstance(BassboostFilter *aParent)
33 | {
34 | mParent = aParent;
35 | initParams(2);
36 | mParam[BOOST] = aParent->mBoost;
37 | }
38 |
39 | void BassboostFilterInstance::fftFilterChannel(float *aFFTBuffer, unsigned int /*aSamples*/, float /*aSamplerate*/, time /*aTime*/, unsigned int /*aChannel*/, unsigned int /*aChannels*/)
40 | {
41 | comp2MagPhase(aFFTBuffer, 2);
42 | unsigned int i;
43 | for (i = 0; i < 2; i++)
44 | {
45 | aFFTBuffer[i*2] *= mParam[BOOST];
46 | }
47 | magPhase2Comp(aFFTBuffer, 2);
48 | }
49 |
50 | result BassboostFilter::setParams(float aBoost)
51 | {
52 | if (aBoost < 0)
53 | return INVALID_PARAMETER;
54 | mBoost = aBoost;
55 | return SO_NO_ERROR;
56 | }
57 |
58 | int BassboostFilter::getParamCount()
59 | {
60 | return 2;
61 | }
62 |
63 | const char* BassboostFilter::getParamName(unsigned int aParamIndex)
64 | {
65 | if (aParamIndex == 1)
66 | return "Boost";
67 | return "Wet";
68 | }
69 |
70 | unsigned int BassboostFilter::getParamType(unsigned int aParamIndex)
71 | {
72 | return FLOAT_PARAM;
73 | }
74 |
75 | float BassboostFilter::getParamMax(unsigned int aParamIndex)
76 | {
77 | if (aParamIndex == 1)
78 | return 10;
79 | return 1;
80 | }
81 |
82 | float BassboostFilter::getParamMin(unsigned int aParamIndex)
83 | {
84 | return 0;
85 | }
86 |
87 | BassboostFilter::BassboostFilter()
88 | {
89 | mBoost = 2;
90 | }
91 |
92 | FilterInstance *BassboostFilter::createInstance()
93 | {
94 | return new BassboostFilterInstance(this);
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/external/soloud/src/core/soloud_fader.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2014 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #include "soloud.h"
26 |
27 | namespace SoLoud
28 | {
29 | Fader::Fader()
30 | {
31 | mCurrent = mFrom = mTo = mDelta = 0;
32 | mTime = mStartTime = mEndTime = 0;
33 | mActive = 0;
34 | }
35 |
36 | void Fader::set(float aFrom, float aTo, double aTime, double aStartTime)
37 | {
38 | mCurrent = mFrom;
39 | mFrom = aFrom;
40 | mTo = aTo;
41 | mTime = aTime;
42 | mStartTime = aStartTime;
43 | mDelta = aTo - aFrom;
44 | mEndTime = mStartTime + mTime;
45 | mActive = 1;
46 | }
47 |
48 | void Fader::setLFO(float aFrom, float aTo, double aTime, double aStartTime)
49 | {
50 | mActive = 2;
51 | mCurrent = 0;
52 | mFrom = aFrom;
53 | mTo = aTo;
54 | mTime = aTime;
55 | mDelta = (aTo - aFrom) / 2;
56 | if (mDelta < 0) mDelta = -mDelta;
57 | mStartTime = aStartTime;
58 | mEndTime = (float)M_PI * 2 / mTime;
59 | }
60 |
61 | float Fader::get(double aCurrentTime)
62 | {
63 | if (mActive == 2)
64 | {
65 | // LFO mode
66 | if (mStartTime > aCurrentTime)
67 | {
68 | // Time rolled over.
69 | mStartTime = aCurrentTime;
70 | }
71 | double t = aCurrentTime - mStartTime;
72 | return (float)(sin(t * mEndTime) * mDelta + (mFrom + mDelta));
73 |
74 | }
75 | if (mStartTime > aCurrentTime)
76 | {
77 | // Time rolled over.
78 | // Figure out where we were..
79 | float p = (mCurrent - mFrom) / mDelta; // 0..1
80 | mFrom = mCurrent;
81 | mStartTime = aCurrentTime;
82 | mTime = mTime * (1 - p); // time left
83 | mDelta = mTo - mFrom;
84 | mEndTime = mStartTime + mTime;
85 | }
86 | if (aCurrentTime > mEndTime)
87 | {
88 | mActive = -1;
89 | return mTo;
90 | }
91 | mCurrent = (float)(mFrom + mDelta * ((aCurrentTime - mStartTime) / mTime));
92 | return mCurrent;
93 | }
94 | };
95 |
--------------------------------------------------------------------------------
/external/soloud/include/soloud_biquadresonantfilter.h:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2014 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #ifndef SOLOUD_BQRFILTER_H
26 | #define SOLOUD_BQRFILTER_H
27 |
28 | #include "soloud.h"
29 |
30 | namespace SoLoud
31 | {
32 | class BiquadResonantFilter;
33 |
34 | struct BQRStateData
35 | {
36 | float mY1, mY2, mX1, mX2;
37 | };
38 |
39 | class BiquadResonantFilterInstance : public FilterInstance
40 | {
41 | enum FILTERATTRIBUTE
42 | {
43 | WET = 0,
44 | TYPE,
45 | FREQUENCY,
46 | RESONANCE
47 | };
48 |
49 | BQRStateData mState[8];
50 | float mA0, mA1, mA2, mB1, mB2;
51 | int mDirty;
52 | float mSamplerate;
53 |
54 | BiquadResonantFilter *mParent;
55 | void calcBQRParams();
56 | public:
57 | virtual void filterChannel(float *aBuffer, unsigned int aSamples, float aSamplerate, time aTime, unsigned int aChannel, unsigned int aChannels);
58 | virtual ~BiquadResonantFilterInstance();
59 | BiquadResonantFilterInstance(BiquadResonantFilter *aParent);
60 | };
61 |
62 | class BiquadResonantFilter : public Filter
63 | {
64 | public:
65 | enum FILTERTYPE
66 | {
67 | LOWPASS = 0,
68 | HIGHPASS = 1,
69 | BANDPASS = 2
70 | };
71 | enum FILTERATTRIBUTE
72 | {
73 | WET = 0,
74 | TYPE,
75 | FREQUENCY,
76 | RESONANCE
77 | };
78 | int mFilterType;
79 | float mFrequency;
80 | float mResonance;
81 | virtual int getParamCount();
82 | virtual const char* getParamName(unsigned int aParamIndex);
83 | virtual unsigned int getParamType(unsigned int aParamIndex);
84 | virtual float getParamMax(unsigned int aParamIndex);
85 | virtual float getParamMin(unsigned int aParamIndex);
86 |
87 | virtual BiquadResonantFilterInstance *createInstance();
88 | BiquadResonantFilter();
89 | result setParams(int aType, float aFrequency, float aResonance);
90 | virtual ~BiquadResonantFilter();
91 | };
92 | }
93 |
94 | #endif
--------------------------------------------------------------------------------
/external/soloud/contrib/gen_glue.cmake:
--------------------------------------------------------------------------------
1 |
2 | # We need python to run the glue-code generators
3 | find_package (Python3 COMPONENTS Interpreter REQUIRED)
4 |
5 | # Create the executable that generates soloud_codegen.py
6 | add_executable (codegen ../src/tools/codegen/main.cpp)
7 |
8 | # Add a command to run the executable to generate the python file
9 | add_custom_command (OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/soloud_codegen.py"
10 | COMMAND codegen ARGS go
11 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
12 |
13 | # Now we can run the actual Python code-generators, BUT we need to add a dependency on
14 | # soloud_codegen.py, or otherwise codegen.exe will not be run beforehand
15 |
16 | ###############################################################################
17 | # C# API
18 | ###############################################################################
19 | add_custom_command (OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/../glue/soloud.cs"
20 | COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/gen_cs.py"
21 | DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/soloud_codegen.py"
22 | DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/gen_cs.py"
23 | )
24 | add_custom_target (generate_glue_cs ALL DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/../glue/soloud.cs")
25 | install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../glue/soloud.cs" DESTINATION glue)
26 |
27 | ###############################################################################
28 | # Python API
29 | ###############################################################################
30 | add_custom_command (OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/../glue/soloud.rb"
31 | COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/gen_ruby.py"
32 | DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/soloud_codegen.py"
33 | DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/gen_ruby.py"
34 | )
35 | add_custom_target (generate_glue_ruby ALL DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/../glue/soloud.rb")
36 | install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../glue/soloud.rb" DESTINATION glue)
37 |
38 | ###############################################################################
39 | # Ruby API
40 | ###############################################################################
41 | add_custom_command (OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/../glue/soloud.py"
42 | COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/gen_python.py"
43 | DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/soloud_codegen.py"
44 | DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/gen_python.py"
45 | )
46 | add_custom_target(generate_glue_python ALL DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/../glue/soloud.py")
47 | install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../glue/soloud.py" DESTINATION glue)
48 |
--------------------------------------------------------------------------------
/lib/react-imgui-reconciler/reconciler.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tzvetan Mikov and contributors
2 | // SPDX-License-Identifier: MIT
3 | // See LICENSE file for full license text
4 |
5 | import Reconciler from 'react-reconciler';
6 | import hostConfig from './host-config.js';
7 |
8 | /**
9 | * Create the React reconciler instance by passing it our host config.
10 | * This gives us a reconciler that knows how to manipulate our tree structure.
11 | */
12 | const reconciler = Reconciler(hostConfig);
13 |
14 | /**
15 | * Create a root container for rendering.
16 | * This is the entry point - call this once to create a render target.
17 | *
18 | * @returns An object with:
19 | * - container: Our container object that will hold the tree
20 | * - fiberRoot: React's internal fiber root
21 | */
22 | export function createRoot() {
23 | // This is our container - it will hold the root of our tree
24 | const container = {
25 | rootChildren: [], // Will hold root TreeNode(s) when we render
26 | };
27 |
28 | // Create React's internal fiber root
29 | // This is React's internal data structure for tracking the component tree
30 | const fiberRoot = reconciler.createContainer(
31 | container, // Our container object
32 | 0, // Tag: 0 = LegacyRoot (doesn't matter much for us)
33 | null, // Hydration callbacks (for SSR, we don't use)
34 | false, // isStrictMode
35 | null, // concurrentUpdatesByDefaultOverride
36 | '', // identifierPrefix
37 | (error, errorInfo) => {
38 | // Custom error handler that logs full error details
39 | console.error('React Error:', error);
40 | if (errorInfo && errorInfo.componentStack) {
41 | console.error('Component Stack:', errorInfo.componentStack);
42 | }
43 | },
44 | null // transitionCallbacks
45 | );
46 |
47 | return { container, fiberRoot };
48 | }
49 |
50 | /**
51 | * Render a React element tree into a root.
52 | * This triggers React's reconciliation algorithm.
53 | * Returns a Promise that resolves when rendering is complete.
54 | *
55 | * @param element - The React element to render (usually from JSX)
56 | * @param root - The root object from createRoot()
57 | * @returns Promise that resolves to the container
58 | */
59 | export function render(element, root) {
60 | return new Promise((resolve) => {
61 | // Tell React to reconcile this element tree into our container
62 | reconciler.updateContainer(
63 | element, // The React element tree (from JSX)
64 | root.fiberRoot, // React's fiber root
65 | null, // Parent component (null for root render)
66 | () => {
67 | // This callback is called after rendering completes
68 | // Use setImmediate to ensure all work is flushed
69 | setImmediate(() => {
70 | resolve(root.container);
71 | });
72 | }
73 | );
74 | });
75 | }
76 |
--------------------------------------------------------------------------------
/external/soloud/include/soloud_file.h:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2015 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #ifndef SOLOUD_FILE_H
26 | #define SOLOUD_FILE_H
27 |
28 | #include
29 | #include "soloud.h"
30 |
31 | typedef void* Soloud_Filehack;
32 |
33 | namespace SoLoud
34 | {
35 | class File
36 | {
37 | public:
38 | virtual ~File() {}
39 | unsigned int read8();
40 | unsigned int read16();
41 | unsigned int read32();
42 | virtual int eof() = 0;
43 | virtual unsigned int read(unsigned char *aDst, unsigned int aBytes) = 0;
44 | virtual unsigned int length() = 0;
45 | virtual void seek(int aOffset) = 0;
46 | virtual unsigned int pos() = 0;
47 | virtual FILE * getFilePtr() { return 0; }
48 | virtual const unsigned char * getMemPtr() { return 0; }
49 | };
50 |
51 | class DiskFile : public File
52 | {
53 | public:
54 | FILE *mFileHandle;
55 |
56 | virtual int eof();
57 | virtual unsigned int read(unsigned char *aDst, unsigned int aBytes);
58 | virtual unsigned int length();
59 | virtual void seek(int aOffset);
60 | virtual unsigned int pos();
61 | virtual ~DiskFile();
62 | DiskFile();
63 | DiskFile(FILE *fp);
64 | result open(const char *aFilename);
65 | virtual FILE * getFilePtr();
66 | };
67 |
68 | class MemoryFile : public File
69 | {
70 | public:
71 | const unsigned char *mDataPtr;
72 | unsigned int mDataLength;
73 | unsigned int mOffset;
74 | bool mDataOwned;
75 |
76 | virtual int eof();
77 | virtual unsigned int read(unsigned char *aDst, unsigned int aBytes);
78 | virtual unsigned int length();
79 | virtual void seek(int aOffset);
80 | virtual unsigned int pos();
81 | virtual const unsigned char * getMemPtr();
82 | virtual ~MemoryFile();
83 | MemoryFile();
84 | result openMem(const unsigned char *aData, unsigned int aDataLength, bool aCopy=false, bool aTakeOwnership=true);
85 | result openToMem(const char *aFilename);
86 | result openFileToMem(File *aFile);
87 | };
88 | };
89 |
90 | #endif
91 |
--------------------------------------------------------------------------------
/external/soloud/include/soloud_thread.h:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2014 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #ifndef SOLOUD_THREAD_H
26 | #define SOLOUD_THREAD_H
27 |
28 | #include "soloud.h"
29 |
30 | namespace SoLoud
31 | {
32 | namespace Thread
33 | {
34 | typedef void (*threadFunction)(void *aParam);
35 |
36 | struct ThreadHandleData;
37 | typedef ThreadHandleData* ThreadHandle;
38 |
39 | void * createMutex();
40 | void destroyMutex(void *aHandle);
41 | void lockMutex(void *aHandle);
42 | void unlockMutex(void *aHandle);
43 |
44 | ThreadHandle createThread(threadFunction aThreadFunction, void *aParameter);
45 |
46 | void sleep(int aMSec);
47 | void wait(ThreadHandle aThreadHandle);
48 | void release(ThreadHandle aThreadHandle);
49 | int getTimeMillis();
50 |
51 | #define MAX_THREADPOOL_TASKS 1024
52 |
53 | class PoolTask
54 | {
55 | public:
56 | virtual void work() = 0;
57 | };
58 |
59 | class Pool
60 | {
61 | public:
62 | // Initialize and run thread pool. For thread count 0, work is done at addWork call.
63 | void init(int aThreadCount);
64 | // Ctor, sets known state
65 | Pool();
66 | // Dtor. Waits for the threads to finish. Work may be unfinished.
67 | ~Pool();
68 | // Add work to work list. Object is not automatically deleted when work is done.
69 | void addWork(PoolTask *aTask);
70 | // Called from worker thread to get a new task. Returns null if no work available.
71 | PoolTask *getWork();
72 | public:
73 | int mThreadCount; // number of threads
74 | ThreadHandle *mThread; // array of thread handles
75 | void *mWorkMutex; // mutex to protect task array/maxtask
76 | PoolTask *mTaskArray[MAX_THREADPOOL_TASKS]; // pointers to tasks
77 | int mMaxTask; // how many tasks are pending
78 | int mRobin; // cyclic counter, used to pick jobs for threads
79 | volatile int mRunning; // running flag, used to flag threads to stop
80 | };
81 | }
82 | }
83 |
84 | #endif
--------------------------------------------------------------------------------
/external/soloud/src/backend/sdl/soloud_sdl1.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2014 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 | #include
25 |
26 | #include "soloud.h"
27 |
28 | #if !defined(WITH_SDL1)
29 |
30 | namespace SoLoud
31 | {
32 | result sdl1_init(SoLoud::Soloud * /*aSoloud*/, unsigned int /*aFlags*/, unsigned int /*aSamplerate*/, unsigned int /*aBuffer*/)
33 | {
34 | return NOT_IMPLEMENTED;
35 | }
36 | }
37 |
38 | #else
39 |
40 | #include "SDL.h"
41 | #include
42 |
43 |
44 | extern "C"
45 | {
46 | int dll_SDL1_found();
47 | int dll_SDL1_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained);
48 | void dll_SDL1_CloseAudio();
49 | void dll_SDL1_PauseAudio(int pause_on);
50 | };
51 |
52 |
53 | namespace SoLoud
54 | {
55 | static SDL_AudioSpec gActiveAudioSpec;
56 |
57 | void soloud_sdl1_audiomixer(void *userdata, Uint8 *stream, int len)
58 | {
59 | short *buf = (short*)stream;
60 | SoLoud::Soloud *soloud = (SoLoud::Soloud *)userdata;
61 | int samples = len / (gActiveAudioSpec.channels * sizeof(short));
62 | soloud->mixSigned16(buf, samples);
63 | }
64 |
65 | static void soloud_sdl1_deinit(SoLoud::Soloud *aSoloud)
66 | {
67 | dll_SDL1_CloseAudio();
68 | }
69 |
70 | result sdl1_init(SoLoud::Soloud *aSoloud, unsigned int aFlags, unsigned int aSamplerate, unsigned int aBuffer, unsigned int aChannels)
71 | {
72 | if (!dll_SDL1_found())
73 | return DLL_NOT_FOUND;
74 |
75 | SDL_AudioSpec as;
76 | as.freq = aSamplerate;
77 | as.format = AUDIO_S16;
78 | as.channels = aChannels;
79 | as.samples = aBuffer;
80 | as.callback = soloud_sdl1_audiomixer;
81 | as.userdata = (void*)aSoloud;
82 |
83 | if (dll_SDL1_OpenAudio(&as, &gActiveAudioSpec) < 0)
84 | {
85 | return UNKNOWN_ERROR;
86 | }
87 |
88 | aSoloud->postinit_internal(gActiveAudioSpec.freq, gActiveAudioSpec.samples, aFlags, gActiveAudioSpec.channels);
89 |
90 | aSoloud->mBackendCleanupFunc = soloud_sdl1_deinit;
91 |
92 | dll_SDL1_PauseAudio(0);
93 | aSoloud->mBackendString = "SDL (dynamic)";
94 | return 0;
95 | }
96 |
97 | };
98 | #endif
--------------------------------------------------------------------------------
/examples/showcase/ControlledWindow.jsx:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tzvetan Mikov and contributors
2 | // SPDX-License-Identifier: MIT
3 | // See LICENSE file for full license text
4 |
5 | // Demonstration of controlled window position/size pattern
6 | import React, { useState } from 'react';
7 |
8 | export function ControlledWindow() {
9 | // Controlled window state
10 | const [windowState, setWindowState] = useState({
11 | x: 300,
12 | y: 300,
13 | width: 350,
14 | height: 250,
15 | });
16 |
17 | const snapToOrigin = () => {
18 | setWindowState((prev) => ({ ...prev, x: 20, y: 20 }));
19 | };
20 |
21 | const snapToCenter = () => {
22 | // Approximate screen center
23 | setWindowState((prev) => ({ ...prev, x: 400, y: 300 }));
24 | };
25 |
26 | const makeWide = () => {
27 | setWindowState((prev) => ({ ...prev, width: 600, height: 250 }));
28 | };
29 |
30 | const makeTall = () => {
31 | setWindowState((prev) => ({ ...prev, width: 350, height: 400 }));
32 | };
33 |
34 | return (
35 | {
42 | setWindowState({ x, y, width, height });
43 | }}
44 | >
45 | This window is CONTROLLED by React state
46 | Try moving or resizing it - state updates automatically!
47 |
48 |
49 |
50 | Current State:
51 |
52 |
53 | Position: ({Math.round(windowState.x)}, {Math.round(windowState.y)})
54 |
55 |
56 | Size: {Math.round(windowState.width)} x{' '}
57 | {Math.round(windowState.height)}
58 |
59 |
60 |
61 |
62 |
63 | Programmatic Control:
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 | This window uses x, y, width, and height props (not
79 | defaultX/defaultY). These props are enforced every frame using
80 | ImGuiCond_Always.
81 |
82 |
83 | When you move or resize the window, onWindowState fires with new
84 | values. We update React state, which updates the props, completing the
85 | cycle.
86 |
87 |
88 | The buttons demonstrate programmatic control: just update state!
89 |
90 |
91 |
92 | );
93 | }
94 |
--------------------------------------------------------------------------------
/external/soloud/include/zx7decompress.h:
--------------------------------------------------------------------------------
1 | /*
2 | * zx7 decompress by Jari Komppa, under public domain / unlicense
3 | *
4 | * Heavily based on zx7 decompressor by Einar Saukas.
5 | * Einar Saukas requests that you mention the use of dx7, but
6 | * this is not enforced by any way.
7 | *
8 | * Note that compressor has a different license!
9 | */
10 |
11 | #ifndef ZX7DECOMPRESS_H
12 | #define ZX7DECOMPRESS_H
13 |
14 | #ifdef __cplusplus
15 | extern "C" {
16 | #endif
17 |
18 | struct zx7_io
19 | {
20 | unsigned char* input_data;
21 | unsigned char* output_data;
22 | size_t input_index;
23 | size_t output_index;
24 | int bit_mask;
25 | int bit_value;
26 | };
27 |
28 | static int zx7_read_byte(struct zx7_io *io) {
29 | return io->input_data[io->input_index++];
30 | }
31 |
32 | static int zx7_read_bit(struct zx7_io *io) {
33 | io->bit_mask >>= 1;
34 | if (io->bit_mask == 0) {
35 | io->bit_mask = 128;
36 | io->bit_value = zx7_read_byte(io);
37 | }
38 | return io->bit_value & io->bit_mask ? 1 : 0;
39 | }
40 |
41 | static int zx7_read_elias_gamma(struct zx7_io *io) {
42 | int i = 0;
43 | int value = 0;
44 |
45 | while (!zx7_read_bit(io)) {
46 | i++;
47 | }
48 | if (i > 15) {
49 | return -1;
50 | }
51 | value = 1;
52 | while (i--) {
53 | value = value << 1 | zx7_read_bit(io);
54 | }
55 | return value;
56 | }
57 |
58 | static int zx7_read_offset(struct zx7_io *io) {
59 | int value = 0;
60 | int i = 0;
61 |
62 | value = zx7_read_byte(io);
63 | if (value < 128) {
64 | return value;
65 | } else {
66 | i = zx7_read_bit(io);
67 | i = i << 1 | zx7_read_bit(io);
68 | i = i << 1 | zx7_read_bit(io);
69 | i = i << 1 | zx7_read_bit(io);
70 | return (value & 127 | i << 7) + 128;
71 | }
72 | }
73 |
74 | static void zx7_write_byte(struct zx7_io *io, int value) {
75 | io->output_data[io->output_index++] = value;
76 | }
77 |
78 | static void zx7_write_bytes(struct zx7_io *io, int offset, int length) {
79 | int i;
80 | while (length-- > 0) {
81 | i = io->output_index - offset;
82 | zx7_write_byte(io, io->output_data[i]);
83 | }
84 | }
85 |
86 | static int zx7_decompress(unsigned char *input_data, unsigned char *output_data) {
87 | struct zx7_io io;
88 | int length;
89 |
90 | io.input_data = input_data;
91 | io.output_data = output_data;
92 | io.input_index = 0;
93 | io.output_index = 0;
94 | io.bit_mask = 0;
95 | io.bit_value = 0;
96 |
97 | zx7_write_byte(&io, zx7_read_byte(&io));
98 | while (1) {
99 | if (!zx7_read_bit(&io)) {
100 | zx7_write_byte(&io, zx7_read_byte(&io));
101 | } else {
102 | length = zx7_read_elias_gamma(&io) + 1;
103 | if (length == 0) {
104 | return io.input_index;
105 | }
106 | zx7_write_bytes(&io, zx7_read_offset(&io) + 1, length);
107 | }
108 | }
109 | }
110 |
111 | #ifdef __cplusplus
112 | }
113 | #endif
114 |
115 | #endif // ZX7DECOMPRESS_H
--------------------------------------------------------------------------------
/external/soloud/src/backend/miniaudio/soloud_miniaudio.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2020 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 | #include
25 |
26 | #include "soloud.h"
27 |
28 | #if !defined(WITH_MINIAUDIO)
29 |
30 | namespace SoLoud
31 | {
32 | result miniaudio_init(SoLoud::Soloud *aSoloud, unsigned int aFlags, unsigned int aSamplerate, unsigned int aBuffer)
33 | {
34 | return NOT_IMPLEMENTED;
35 | }
36 | }
37 |
38 | #else
39 |
40 | #define MINIAUDIO_IMPLEMENTATION
41 | #define MA_NO_NULL
42 | #define MA_NO_DECODING
43 | #define MA_NO_WAV
44 | #define MA_NO_FLAC
45 | #define MA_NO_MP3
46 | #include "miniaudio.h"
47 | #include
48 |
49 | namespace SoLoud
50 | {
51 | ma_device gDevice;
52 |
53 | void soloud_miniaudio_audiomixer(ma_device* pDevice, void* pOutput, const void* pInput, ma_uint32 frameCount)
54 | {
55 | SoLoud::Soloud *soloud = (SoLoud::Soloud *)pDevice->pUserData;
56 | soloud->mix((float *)pOutput, frameCount);
57 | }
58 |
59 | static void soloud_miniaudio_deinit(SoLoud::Soloud *aSoloud)
60 | {
61 | ma_device_uninit(&gDevice);
62 | }
63 |
64 | result miniaudio_init(SoLoud::Soloud *aSoloud, unsigned int aFlags, unsigned int aSamplerate, unsigned int aBuffer, unsigned int aChannels)
65 | {
66 | ma_device_config config = ma_device_config_init(ma_device_type_playback);
67 | //config.periodSizeInFrames = aBuffer; // setting to aBuffer (like 2048) causes miniaudio to crash; let's just use the default.
68 | config.playback.format = ma_format_f32;
69 | config.playback.channels = aChannels;
70 | config.sampleRate = aSamplerate;
71 | config.dataCallback = soloud_miniaudio_audiomixer;
72 | config.pUserData = (void *)aSoloud;
73 |
74 | if (ma_device_init(NULL, &config, &gDevice) != MA_SUCCESS)
75 | {
76 | return UNKNOWN_ERROR;
77 | }
78 |
79 | aSoloud->postinit_internal(gDevice.sampleRate, gDevice.playback.internalPeriodSizeInFrames, aFlags, gDevice.playback.channels);
80 |
81 | aSoloud->mBackendCleanupFunc = soloud_miniaudio_deinit;
82 |
83 | ma_device_start(&gDevice);
84 | aSoloud->mBackendString = "MiniAudio";
85 | return 0;
86 | }
87 | };
88 | #endif
89 |
--------------------------------------------------------------------------------
/external/soloud/include/soloud_wavstream.h:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2018 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #ifndef SOLOUD_WAVSTREAM_H
26 | #define SOLOUD_WAVSTREAM_H
27 |
28 | #include
29 | #include "soloud.h"
30 |
31 | struct stb_vorbis;
32 | #ifndef dr_flac_h
33 | struct drflac;
34 | #endif
35 | #ifndef dr_mp3_h
36 | struct drmp3;
37 | #endif
38 | #ifndef dr_wav_h
39 | struct drwav;
40 | #endif
41 |
42 | namespace SoLoud
43 | {
44 | class WavStream;
45 | class File;
46 |
47 | class WavStreamInstance : public AudioSourceInstance
48 | {
49 | WavStream *mParent;
50 | unsigned int mOffset;
51 | File *mFile;
52 | union codec
53 | {
54 | stb_vorbis *mOgg;
55 | drflac *mFlac;
56 | drmp3 *mMp3;
57 | drwav *mWav;
58 | } mCodec;
59 | unsigned int mOggFrameSize;
60 | unsigned int mOggFrameOffset;
61 | float **mOggOutputs;
62 | public:
63 | WavStreamInstance(WavStream *aParent);
64 | virtual unsigned int getAudio(float *aBuffer, unsigned int aSamplesToRead, unsigned int aBufferSize);
65 | virtual result seek(double aSeconds, float* mScratch, unsigned int mScratchSize);
66 | virtual result rewind();
67 | virtual bool hasEnded();
68 | virtual ~WavStreamInstance();
69 | };
70 |
71 | enum WAVSTREAM_FILETYPE
72 | {
73 | WAVSTREAM_WAV = 0,
74 | WAVSTREAM_OGG = 1,
75 | WAVSTREAM_FLAC = 2,
76 | WAVSTREAM_MP3 = 3
77 | };
78 |
79 | class WavStream : public AudioSource
80 | {
81 | result loadwav(File *fp);
82 | result loadogg(File *fp);
83 | result loadflac(File *fp);
84 | result loadmp3(File *fp);
85 | public:
86 | int mFiletype;
87 | char *mFilename;
88 | File *mMemFile;
89 | File *mStreamFile;
90 | unsigned int mSampleCount;
91 |
92 | WavStream();
93 | virtual ~WavStream();
94 | result load(const char *aFilename);
95 | result loadMem(const unsigned char *aData, unsigned int aDataLen, bool aCopy = false, bool aTakeOwnership = true);
96 | result loadToMem(const char *aFilename);
97 | result loadFile(File *aFile);
98 | result loadFileToMem(File *aFile);
99 | virtual AudioSourceInstance *createInstance();
100 | time getLength();
101 |
102 | public:
103 | result parse(File *aFile);
104 | };
105 | };
106 |
107 | #endif
--------------------------------------------------------------------------------
/external/soloud/src/filter/soloud_dcremovalfilter.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2015 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #include "soloud.h"
26 | #include "soloud_dcremovalfilter.h"
27 |
28 | namespace SoLoud
29 | {
30 | DCRemovalFilterInstance::DCRemovalFilterInstance(DCRemovalFilter *aParent)
31 | {
32 | mParent = aParent;
33 | mBuffer = 0;
34 | mBufferLength = 0;
35 | mTotals = 0;
36 | mOffset = 0;
37 | initParams(1);
38 |
39 | }
40 |
41 | void DCRemovalFilterInstance::filter(float *aBuffer, unsigned int aSamples, unsigned int aBufferSize, unsigned int aChannels, float aSamplerate, double aTime)
42 | {
43 | updateParams(aTime);
44 |
45 | if (mBuffer == 0)
46 | {
47 | mBufferLength = (int)ceil(mParent->mLength * aSamplerate);
48 | mBuffer = new float[mBufferLength * aChannels];
49 | mTotals = new float[aChannels];
50 | unsigned int i;
51 | for (i = 0; i < aChannels; i++)
52 | {
53 | mTotals[i] = 0;
54 | }
55 | for (i = 0; i < mBufferLength * aChannels; i++)
56 | {
57 | mBuffer[i] = 0;
58 | }
59 | }
60 |
61 | unsigned int i, j;
62 | int prevofs = (mOffset + mBufferLength - 1) % mBufferLength;
63 | for (i = 0; i < aSamples; i++)
64 | {
65 | for (j = 0; j < aChannels; j++)
66 | {
67 | int chofs = j * mBufferLength;
68 | int bchofs = j * aBufferSize;
69 |
70 | float n = aBuffer[i + bchofs];
71 | mTotals[j] -= mBuffer[mOffset + chofs];
72 | mTotals[j] += n;
73 | mBuffer[mOffset + chofs] = n;
74 |
75 | n -= mTotals[j] / mBufferLength;
76 |
77 | aBuffer[i + bchofs] += (n - aBuffer[i + bchofs]) * mParam[0];
78 | }
79 | prevofs = mOffset;
80 | mOffset = (mOffset + 1) % mBufferLength;
81 | }
82 | }
83 |
84 | DCRemovalFilterInstance::~DCRemovalFilterInstance()
85 | {
86 | delete[] mBuffer;
87 | delete[] mTotals;
88 | }
89 |
90 | DCRemovalFilter::DCRemovalFilter()
91 | {
92 | mLength = 0.1f;
93 | }
94 |
95 | result DCRemovalFilter::setParams(float aLength)
96 | {
97 | if (aLength <= 0)
98 | return INVALID_PARAMETER;
99 |
100 | mLength = aLength;
101 |
102 | return 0;
103 | }
104 |
105 |
106 | FilterInstance *DCRemovalFilter::createInstance()
107 | {
108 | return new DCRemovalFilterInstance(this);
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/external/soloud/include/soloud_monotone.h:
--------------------------------------------------------------------------------
1 | /*
2 | MONOTONE module for SoLoud audio engine
3 | Copyright (c) 2013-2020 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #ifndef MONOTONE_H
26 | #define MONOTONE_H
27 |
28 | #include "soloud.h"
29 | #include "soloud_misc.h"
30 |
31 | namespace SoLoud
32 | {
33 | class Monotone;
34 | class File;
35 |
36 | struct MonotoneSong
37 | {
38 | char *mTitle;
39 | char *mComment;
40 | unsigned char mVersion; // must be 1
41 | unsigned char mTotalPatterns;
42 | unsigned char mTotalTracks;
43 | unsigned char mCellSize; // must be 2 for version 1
44 | unsigned char mOrder[256];
45 | unsigned int *mPatternData; // 64 rows * mTotalPatterns * mTotalTracks
46 | };
47 |
48 | struct MonotoneChannel
49 | {
50 | int mEnabled;
51 | int mActive;
52 | int mFreq[3];
53 | int mPortamento;
54 | int mArpCounter;
55 | int mArp;
56 | int mLastNote;
57 | int mPortamentoToNote;
58 | int mVibrato;
59 | int mVibratoIndex;
60 | int mVibratoDepth;
61 | int mVibratoSpeed;
62 | };
63 |
64 | struct MonotoneHardwareChannel
65 | {
66 | int mEnabled;
67 | float mSamplePos;
68 | float mSamplePosInc;
69 | };
70 |
71 | class MonotoneInstance : public AudioSourceInstance
72 | {
73 | Monotone *mParent;
74 | public:
75 | MonotoneChannel mChannel[12];
76 | MonotoneHardwareChannel mOutput[12];
77 | int mNextChannel;
78 | int mTempo; // ticks / row. Tick = 60hz. Default 4.
79 | int mOrder;
80 | int mRow;
81 | int mSampleCount;
82 | int mRowTick;
83 |
84 | MonotoneInstance(Monotone *aParent);
85 | virtual unsigned int getAudio(float *aBuffer, unsigned int aSamples, unsigned int aBufferSize);
86 | virtual bool hasEnded();
87 | };
88 |
89 | class Monotone : public AudioSource
90 | {
91 | public:
92 |
93 | int mNotesHz[800];
94 | int mVibTable[32];
95 | int mHardwareChannels;
96 | int mWaveform;
97 | MonotoneSong mSong;
98 | Monotone();
99 | ~Monotone();
100 | result setParams(int aHardwareChannels, int aWaveform = Soloud::WAVE_SQUARE);
101 | result load(const char *aFilename);
102 | result loadMem(const unsigned char *aMem, unsigned int aLength, bool aCopy = false, bool aTakeOwnership = true);
103 | result loadFile(File *aFile);
104 | virtual AudioSourceInstance *createInstance();
105 | public:
106 | void clear();
107 | };
108 | };
109 |
110 | #endif
--------------------------------------------------------------------------------
/external/soloud/src/filter/soloud_robotizefilter.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2020 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #include
26 | #include "soloud.h"
27 | #include "soloud_misc.h"
28 | #include "soloud_robotizefilter.h"
29 |
30 | namespace SoLoud
31 | {
32 | RobotizeFilterInstance::RobotizeFilterInstance(RobotizeFilter *aParent)
33 | {
34 | mParent = aParent;
35 | initParams(3);
36 | mParam[FREQ] = aParent->mFreq;
37 | mParam[WAVE] = (float)aParent->mWave;
38 | }
39 |
40 | void RobotizeFilterInstance::filterChannel(float *aBuffer, unsigned int aSamples, float aSamplerate, time aTime, unsigned int aChannel, unsigned int aChannels)
41 | {
42 | unsigned int i;
43 | int period = (int)(aSamplerate / mParam[FREQ]);
44 | int start = (int)(aTime * aSamplerate) % period;
45 | for (i = 0; i < aSamples; i++)
46 | {
47 | float s = aBuffer[i];
48 | float wpos = ((start + i) % period) / (float)period;
49 | s *= SoLoud::Misc::generateWaveform((int)mParam[WAVE], wpos) + 0.5f;
50 | aBuffer[i] += (s - aBuffer[i]) * mParam[WET];
51 | }
52 | }
53 |
54 | RobotizeFilter::RobotizeFilter()
55 | {
56 | mFreq = 30;
57 | mWave = 0;
58 | }
59 |
60 | void RobotizeFilter::setParams(float aFreq, int aWaveform)
61 | {
62 | mFreq = aFreq;
63 | mWave = aWaveform;
64 | }
65 |
66 | int RobotizeFilter::getParamCount()
67 | {
68 | return 3;
69 | }
70 |
71 | const char* RobotizeFilter::getParamName(unsigned int aParamIndex)
72 | {
73 | if (aParamIndex > 2)
74 | return 0;
75 | const char* names[3] = {
76 | "Wet",
77 | "Frequency",
78 | "Waveform"
79 | };
80 | return names[aParamIndex];
81 | }
82 |
83 | unsigned int RobotizeFilter::getParamType(unsigned int aParamIndex)
84 | {
85 | if (aParamIndex == WAVE)
86 | return INT_PARAM;
87 | return FLOAT_PARAM;
88 | }
89 |
90 | float RobotizeFilter::getParamMax(unsigned int aParamIndex)
91 | {
92 | if (aParamIndex == WAVE)
93 | return 6;
94 | if (aParamIndex == FREQ)
95 | return 100;
96 | return 1;
97 | }
98 |
99 | float RobotizeFilter::getParamMin(unsigned int aParamIndex)
100 | {
101 | if (aParamIndex == FREQ)
102 | return 0.1f;
103 | return 0;
104 | }
105 |
106 | FilterInstance *RobotizeFilter::createInstance()
107 | {
108 | return new RobotizeFilterInstance(this);
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/external/soloud/include/soloud_vic.h:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2015 Jari Komppa
4 |
5 | VIC 6560/6561 sound chip emulator
6 | Copyright (c) 2015 Petri Hakkinen
7 |
8 | This software is provided 'as-is', without any express or implied
9 | warranty. In no event will the authors be held liable for any damages
10 | arising from the use of this software.
11 |
12 | Permission is granted to anyone to use this software for any purpose,
13 | including commercial applications, and to alter it and redistribute it
14 | freely, subject to the following restrictions:
15 |
16 | 1. The origin of this software must not be misrepresented; you must not
17 | claim that you wrote the original software. If you use this software
18 | in a product, an acknowledgment in the product documentation would be
19 | appreciated but is not required.
20 |
21 | 2. Altered source versions must be plainly marked as such, and must not be
22 | misrepresented as being the original software.
23 |
24 | 3. This notice may not be removed or altered from any source
25 | distribution.
26 | */
27 |
28 | #ifndef SOLOUD_VIC_H
29 | #define SOLOUD_VIC_H
30 |
31 | #include "soloud.h"
32 |
33 | /*
34 | A very bare bones emulator for Commodore VIC-20 sound chip. Supports both PAL and NTSC models.
35 | Bass, alto and soprano should be quite close to original vic, noise probably not so.
36 |
37 | The first three channels (bass, alto and soprano) are square waveform generators with 7-bit frequency.
38 | The highest bit of each oscillator register switches the oscillator on/off.
39 | The fourth oscillator generates a noise waveform.
40 |
41 | VIC-20 does not have per channel volume control, only global volume,
42 | which you can change by setting audio source's volume.
43 |
44 | To get that authentic moldy VIC-20 sound, the audio source should be coupled with a biquad resonant filter
45 | with the following params: type = LOWPASS, sample rate = 44100, frequency = 1500, resonance = 2.0.
46 | */
47 |
48 | namespace SoLoud
49 | {
50 | class Vic;
51 |
52 | class VicInstance : public AudioSourceInstance
53 | {
54 | public:
55 | VicInstance(Vic *aParent);
56 | ~VicInstance();
57 |
58 | virtual unsigned int getAudio(float *aBuffer, unsigned int aSamplesToRead, unsigned int aBufferSize);
59 | virtual bool hasEnded();
60 |
61 | public:
62 | Vic* m_parent;
63 | unsigned int m_phase[4];
64 | unsigned int m_noisePos;
65 | };
66 |
67 | class Vic : public AudioSource
68 | {
69 | public:
70 | // VIC model
71 | enum
72 | {
73 | PAL = 0,
74 | NTSC
75 | };
76 |
77 | // VIC sound registers
78 | enum
79 | {
80 | BASS = 0,
81 | ALTO,
82 | SOPRANO,
83 | NOISE,
84 | MAX_REGS
85 | };
86 |
87 | Vic();
88 |
89 | virtual ~Vic();
90 |
91 | void setModel(int model);
92 |
93 | int getModel() const;
94 |
95 | void setRegister(int reg, unsigned char value);
96 |
97 | unsigned char getRegister(int reg);
98 |
99 | public:
100 | virtual AudioSourceInstance *createInstance();
101 | int m_model;
102 | float m_clocks[4]; // base clock frequencies for oscillators, dependent on VIC model
103 | unsigned char m_regs[MAX_REGS];
104 | unsigned char m_noise[8192];
105 | };
106 | };
107 |
108 | #endif
109 |
--------------------------------------------------------------------------------
/external/soloud/src/filter/soloud_waveshaperfilter.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2020 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #include
26 | #include
27 | #include "soloud.h"
28 | #include "soloud_waveshaperfilter.h"
29 |
30 | namespace SoLoud
31 | {
32 |
33 | WaveShaperFilterInstance::WaveShaperFilterInstance(WaveShaperFilter *aParent)
34 | {
35 | mParent = aParent;
36 | initParams(2);
37 | mParam[WaveShaperFilter::AMOUNT] = mParent->mAmount;
38 | }
39 |
40 | void WaveShaperFilterInstance::filterChannel(float *aBuffer, unsigned int aSamples, float /*aSamplerate*/, double aTime, unsigned int /*aChannel*/, unsigned int /*aChannels*/)
41 | {
42 | updateParams(aTime);
43 |
44 | unsigned int i;
45 | float k = 0;
46 | if (mParam[1] == 1)
47 | k = 2 * mParam[WaveShaperFilter::AMOUNT] / 0.01f;
48 | else
49 | k = 2 * mParam[WaveShaperFilter::AMOUNT] / (1 - mParam[1]);
50 |
51 | for (i = 0; i < aSamples; i++)
52 | {
53 | float dry = aBuffer[i];
54 | float wet = (1 + k) * aBuffer[i] / (1 + k * (float)fabs(aBuffer[i]));
55 | aBuffer[i] += (wet - dry) * mParam[WaveShaperFilter::WET];
56 | }
57 | }
58 |
59 | WaveShaperFilterInstance::~WaveShaperFilterInstance()
60 | {
61 | }
62 |
63 | result WaveShaperFilter::setParams(float aAmount)
64 | {
65 | if (aAmount < -1 || aAmount > 1)
66 | return INVALID_PARAMETER;
67 | mAmount = aAmount;
68 | return 0;
69 | }
70 |
71 | WaveShaperFilter::WaveShaperFilter()
72 | {
73 | mAmount = 0.0f;
74 | }
75 |
76 | int WaveShaperFilter::getParamCount()
77 | {
78 | return 2;
79 | }
80 |
81 | const char* WaveShaperFilter::getParamName(unsigned int aParamIndex)
82 | {
83 | if (aParamIndex == 1)
84 | return "Amount";
85 | return "Wet";
86 | }
87 |
88 | unsigned int WaveShaperFilter::getParamType(unsigned int aParamIndex)
89 | {
90 | return FLOAT_PARAM;
91 | }
92 |
93 | float WaveShaperFilter::getParamMax(unsigned int aParamIndex)
94 | {
95 | return 1;
96 | }
97 |
98 | float WaveShaperFilter::getParamMin(unsigned int aParamIndex)
99 | {
100 | if (aParamIndex == AMOUNT)
101 | return -1;
102 | return 0;
103 | }
104 |
105 | WaveShaperFilter::~WaveShaperFilter()
106 | {
107 | }
108 |
109 | WaveShaperFilterInstance *WaveShaperFilter::createInstance()
110 | {
111 | return new WaveShaperFilterInstance(this);
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/external/soloud/src/core/soloud_misc.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2020 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #include "soloud_misc.h"
26 | #include
27 |
28 | namespace SoLoud
29 | {
30 | namespace Misc
31 | {
32 | float generateWaveform(int aWaveform, float p)
33 | {
34 | switch (aWaveform)
35 | {
36 | default:
37 | case Soloud::WAVE_SQUARE:
38 | return p > 0.5f ? 0.5f : -0.5f;
39 | case Soloud::WAVE_SAW:
40 | return p - 0.5f;
41 | case Soloud::WAVE_SIN:
42 | return (float)sin(p * M_PI * 2.0f) * 0.5f;
43 | case Soloud::WAVE_TRIANGLE:
44 | return (p > 0.5f ? (1.0f - (p - 0.5f) * 2) : p * 2.0f) - 0.5f;
45 | case Soloud::WAVE_BOUNCE:
46 | return (p < 0.5f ? (float)sin(p * M_PI * 2.0f) * 0.5f : -(float)sin(p * M_PI * 2.0f) * 0.5f) - 0.5f;
47 | case Soloud::WAVE_JAWS:
48 | return (p < 0.25f ? (float)sin(p * M_PI * 2.0f) * 0.5f : 0) - 0.5f;
49 | case Soloud::WAVE_HUMPS:
50 | return (p < 0.5f ? (float)sin(p * M_PI * 2.0f) * 0.5f : 0) - 0.5f;
51 | case Soloud::WAVE_FSQUARE:
52 | {
53 | float f = 0;
54 | for (int i = 1; i < 22; i += 2)
55 | {
56 | f += (float)(4.0f / (M_PI * i)) * (float)sin(2 * M_PI * i * p);
57 | }
58 | return f * 0.5f;
59 | }
60 | case Soloud::WAVE_FSAW:
61 | {
62 | float f = 0;
63 | for (int i = 1; i < 15; i++)
64 | {
65 | if (i & 1)
66 | f += (float)(1.0f / (M_PI * i)) * (float)sin(p * 2 * M_PI * i);
67 | else
68 | f -= (float)(1.0f / (M_PI * i)) * (float)sin(p * 2 * M_PI * i);
69 | }
70 | return f;
71 | }
72 | }
73 | }
74 |
75 | Prg::Prg()
76 | {
77 | srand(0);
78 | }
79 |
80 | void Prg::srand(int aSeed)
81 | {
82 | mIndex = 0;
83 | int i;
84 | for (i = 0; i < 16; i++)
85 | mState[i] = aSeed + i * aSeed + i;
86 | }
87 |
88 | // WELL512 implementation, public domain by Chris Lomont
89 | unsigned int Prg::rand()
90 | {
91 | unsigned int a, b, c, d;
92 | a = mState[mIndex];
93 | c = mState[(mIndex + 13) & 15];
94 | b = a ^ c ^ (a << 16) ^ (c << 15);
95 | c = mState[(mIndex + 9) & 15];
96 | c ^= (c >> 11);
97 | a = mState[mIndex] = b ^ c;
98 | d = a ^ ((a << 5) & 0xDA442D24UL);
99 | mIndex = (mIndex + 15) & 15;
100 | a = mState[mIndex];
101 | mState[mIndex] = a ^ b ^ d ^ (a << 2) ^ (b << 18) ^ (c << 28);
102 | return mState[mIndex];
103 | }
104 |
105 | float Prg::rand_float()
106 | {
107 | return (float)rand() * 2.3283064365386963e-10f;
108 | }
109 |
110 | }
111 | };
112 |
--------------------------------------------------------------------------------
/external/soloud/src/backend/sdl/soloud_sdl1_dll.c:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2014 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 | #if defined(WITH_SDL)
25 |
26 | #include
27 | #if defined(_MSC_VER)
28 | #define WINDOWS_VERSION
29 | #endif
30 | #include "SDL.h"
31 | #include
32 |
33 | typedef int (*SDLOpenAudio)(SDL_AudioSpec *desired, SDL_AudioSpec *obtained);
34 | typedef void (*SDLCloseAudio)();
35 | typedef void (*SDLPauseAudio)(int pause_on);
36 |
37 | static SDLOpenAudio dSDL1_OpenAudio = NULL;
38 | static SDLCloseAudio dSDL1_CloseAudio = NULL;
39 | static SDLPauseAudio dSDL1_PauseAudio = NULL;
40 |
41 | #ifdef WINDOWS_VERSION
42 | #include
43 |
44 | static HMODULE sdl1_openDll()
45 | {
46 | HMODULE res = LoadLibraryA("SDL.dll");
47 | return res;
48 | }
49 |
50 | static void* sdl1_getDllProc(HMODULE aDllHandle, const char *aProcName)
51 | {
52 | return GetProcAddress(aDllHandle, aProcName);
53 | }
54 |
55 | #else
56 | #include // dll functions
57 |
58 | static void * sdl1_openDll()
59 | {
60 | void * res;
61 | res = dlopen("/Library/Frameworks/SDL.framework/SDL", RTLD_LAZY);
62 | if (!res) res = dlopen("SDL.so", RTLD_LAZY);
63 | if (!res) res = dlopen("libSDL.so", RTLD_LAZY);
64 | return res;
65 | }
66 |
67 | static void* sdl1_getDllProc(void * aLibrary, const char *aProcName)
68 | {
69 | return dlsym(aLibrary, aProcName);
70 | }
71 |
72 | #endif
73 |
74 | static int sdl1_load_dll()
75 | {
76 | #ifdef WINDOWS_VERSION
77 | HMODULE dll = NULL;
78 | #else
79 | void * dll = NULL;
80 | #endif
81 |
82 | if (dSDL1_OpenAudio != NULL)
83 | {
84 | return 1;
85 | }
86 |
87 | dll = sdl1_openDll();
88 |
89 | if (dll)
90 | {
91 | dSDL1_OpenAudio = (SDLOpenAudio)sdl1_getDllProc(dll, "SDL_OpenAudio");
92 | dSDL1_CloseAudio = (SDLCloseAudio)sdl1_getDllProc(dll, "SDL_CloseAudio");
93 | dSDL1_PauseAudio = (SDLPauseAudio)sdl1_getDllProc(dll, "SDL_PauseAudio");
94 |
95 |
96 | if (dSDL1_OpenAudio &&
97 | dSDL1_CloseAudio &&
98 | dSDL1_PauseAudio)
99 | {
100 | return 1;
101 | }
102 | }
103 | dSDL1_OpenAudio = NULL;
104 | return 0;
105 | }
106 |
107 | int dll_SDL1_found()
108 | {
109 | return sdl1_load_dll();
110 | }
111 |
112 | int dll_SDL1_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained)
113 | {
114 | if (sdl1_load_dll())
115 | return dSDL1_OpenAudio(desired, obtained);
116 | return 0;
117 | }
118 |
119 | void dll_SDL1_CloseAudio()
120 | {
121 | if (sdl1_load_dll())
122 | dSDL1_CloseAudio();
123 | }
124 |
125 | void dll_SDL1_PauseAudio(int pause_on)
126 | {
127 | if (sdl1_load_dll())
128 | dSDL1_PauseAudio(pause_on);
129 | }
130 |
131 | #endif
--------------------------------------------------------------------------------
/external/soloud/src/backend/sdl2_static/soloud_sdl2_static.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | SoLoud audio engine
3 | Copyright (c) 2013-2015 Jari Komppa
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any damages
7 | arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any purpose,
10 | including commercial applications, and to alter it and redistribute it
11 | freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not
14 | claim that you wrote the original software. If you use this software
15 | in a product, an acknowledgment in the product documentation would be
16 | appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and must not be
19 | misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 | #include
25 |
26 | #include "soloud.h"
27 |
28 | #if !defined(WITH_SDL2_STATIC)
29 |
30 | namespace SoLoud
31 | {
32 | result sdl2static_init(SoLoud::Soloud *aSoloud, unsigned int aFlags, unsigned int aSamplerate, unsigned int aBuffer)
33 | {
34 | return NOT_IMPLEMENTED;
35 | }
36 | }
37 |
38 | #else
39 |
40 | #include "SDL.h"
41 | #include
42 |
43 | namespace SoLoud
44 | {
45 | static SDL_AudioSpec gActiveAudioSpec;
46 | static SDL_AudioDeviceID gAudioDeviceID;
47 |
48 | void soloud_sdl2static_audiomixer(void *userdata, Uint8 *stream, int len)
49 | {
50 | short *buf = (short*)stream;
51 | SoLoud::Soloud *soloud = (SoLoud::Soloud *)userdata;
52 | if (gActiveAudioSpec.format == AUDIO_F32)
53 | {
54 | int samples = len / (gActiveAudioSpec.channels * sizeof(float));
55 | soloud->mix((float *)buf, samples);
56 | }
57 | else // assume s16 if not float
58 | {
59 | int samples = len / (gActiveAudioSpec.channels * sizeof(short));
60 | soloud->mixSigned16(buf, samples);
61 | }
62 | }
63 |
64 | static void soloud_sdl2static_deinit(SoLoud::Soloud *aSoloud)
65 | {
66 | SDL_CloseAudioDevice(gAudioDeviceID);
67 | }
68 |
69 | result sdl2static_init(SoLoud::Soloud *aSoloud, unsigned int aFlags, unsigned int aSamplerate, unsigned int aBuffer, unsigned int aChannels)
70 | {
71 | if (!SDL_WasInit(SDL_INIT_AUDIO))
72 | {
73 | if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
74 | {
75 | return UNKNOWN_ERROR;
76 | }
77 | }
78 |
79 | SDL_AudioSpec as;
80 | as.freq = aSamplerate;
81 | as.format = AUDIO_F32;
82 | as.channels = aChannels;
83 | as.samples = aBuffer;
84 | as.callback = soloud_sdl2static_audiomixer;
85 | as.userdata = (void*)aSoloud;
86 |
87 | gAudioDeviceID = SDL_OpenAudioDevice(NULL, 0, &as, &gActiveAudioSpec, SDL_AUDIO_ALLOW_ANY_CHANGE & ~(SDL_AUDIO_ALLOW_FORMAT_CHANGE | SDL_AUDIO_ALLOW_CHANNELS_CHANGE));
88 | if (gAudioDeviceID == 0)
89 | {
90 | as.format = AUDIO_S16;
91 | gAudioDeviceID = SDL_OpenAudioDevice(NULL, 0, &as, &gActiveAudioSpec, SDL_AUDIO_ALLOW_ANY_CHANGE & ~(SDL_AUDIO_ALLOW_FORMAT_CHANGE | SDL_AUDIO_ALLOW_CHANNELS_CHANGE));
92 | if (gAudioDeviceID == 0)
93 | {
94 | return UNKNOWN_ERROR;
95 | }
96 | }
97 |
98 | aSoloud->postinit_internal(gActiveAudioSpec.freq, gActiveAudioSpec.samples, aFlags, gActiveAudioSpec.channels);
99 |
100 | aSoloud->mBackendCleanupFunc = soloud_sdl2static_deinit;
101 |
102 | SDL_PauseAudioDevice(gAudioDeviceID, 0);
103 | aSoloud->mBackendString = "SDL2 (static)";
104 | return 0;
105 | }
106 | };
107 | #endif
--------------------------------------------------------------------------------