code wiki / (root) / nx_audio_mix.nx

nx_audio_mix.nx

buildroot/runtime/nx_audio_mix.nx

2066 B58 linesdepth 2pulls 2 transitivereach 32 importersview sourcekind librarytopic audio
docsdependenciesstructsconstsfunctions

about

nx_audio_mix.nx -- SOVEREIGN AUDIO ENGINE, rung R0: the PCM mixer atom. Direct answer to "no FMOD/Wwise -- build S-class from the hardware rung up." The core of ANY audio engine (FMOD included) is summing sample streams with per-source gain and clamping to the sample range. This is that, in raw integer PCM math -- no third party, deterministic, inspectable. Samples are i64 in the signed-16-bit range; gain is Q8 fixed point (256 = 1.0x). Later rungs: N-chan, resample, stereo pan, oscillators/ADSR, filters/reverb, 3D spatialization, codecs -- the ladder to EXCEED FMOD (sovereign + no licensing + deterministic). license_tier: ORIGINAL.

dependencies 1 imports · 19 importers

nx_syscalls.nx nx_audio_mix.nx nx_audio_demo_test.nx nx_audio_fx.nx nx_audio_fx_test.nx nx_audio_mix_test.nx nx_audio_pan.nx nx_audio_pan_test.nx nx_audio_resample.nx nx_audio_resample_test.nx nx_audio_sfx.nx nx_audio_sfx_test.nx

diagram shows first 10 each side; +0 more imports, +9 more importers in the complete lists below.

imports: nx_syscalls.nx

imported by: nx_audio_demo_test.nxnx_audio_fx.nxnx_audio_fx_test.nxnx_audio_mix_test.nxnx_audio_pan.nxnx_audio_pan_test.nxnx_audio_resample.nxnx_audio_resample_test.nxnx_audio_sfx.nxnx_audio_sfx_test.nxnx_audio_sfx_web.nxnx_audio_sfx_web_test.nxnx_audio_song_test.nxnx_audio_spatial.nxnx_audio_spatial_test.nxnx_audio_synth.nxnx_audio_synth_test.nxnx_audio_web.nxnx_audio_web_test.nx

structs

none

consts

14const AE_GAIN_UNIT: i64 = 256 // Q8 gain: 256 = 1.0x, 128 = 0.5x
15const AE_SMAX: i64 = 32767 // i16 max
16const AE_SMIN: i64 = 0 - 32768 // i16 min

functions

19func ae_clamp(x: i64) -> i64
26func ae_mix2(a: *i64, b: *i64, ga: i64, gb: i64, out: *i64, n: i64) -> i64
called by 1: main calls 1: ae_clamp
37func ae_mixn(srcs: *i64, gains: *i64, k: i64, out: *i64, n: i64) -> i64
called by 1: main calls 1: ae_clamp
54func ae_gain(buf: *i64, g: i64, n: i64) -> i64
calls 1: ae_clamp