Merge pull request #6334 from laytan/miniaudio-0.11.24

Miniaudio 0.11.24
This commit is contained in:
Laytan
2026-02-25 20:17:44 +01:00
committed by GitHub
10 changed files with 4690 additions and 2290 deletions

1
.gitattributes vendored
View File

@@ -5,3 +5,4 @@ Makefile text eol=lf
*.sh text eol=lf
vendor/box2d/lib/box2d_windows_amd64_avx2.lib filter=lfs diff=lfs merge=lfs -text
vendor/box2d/lib/box2d_windows_amd64_sse2.lib filter=lfs diff=lfs merge=lfs -text
vendor/miniaudio/lib/miniaudio.lib filter=lfs diff=lfs merge=lfs -text

View File

@@ -20,9 +20,9 @@ foreign import lib { LIB }
BINDINGS_VERSION_MAJOR :: 0
BINDINGS_VERSION_MINOR :: 11
BINDINGS_VERSION_REVISION :: 22
BINDINGS_VERSION_REVISION :: 24
BINDINGS_VERSION :: [3]u32{BINDINGS_VERSION_MAJOR, BINDINGS_VERSION_MINOR, BINDINGS_VERSION_REVISION}
BINDINGS_VERSION_STRING :: "0.11.22"
BINDINGS_VERSION_STRING :: "0.11.24"
@(init)
version_check :: proc "contextless" () {
@@ -114,9 +114,9 @@ channel :: enum u8 {
AUX_29 = 49,
AUX_30 = 50,
AUX_31 = 51,
POSITION_COUNT,
LEFT = FRONT_LEFT,
RIGHT = FRONT_RIGHT,
POSITION_COUNT = AUX_31 + 1,
}
result :: enum c.int {
@@ -296,7 +296,7 @@ allocation_callbacks :: struct {
}
lcg :: struct {
state: i32,
state: u32,
}

View File

@@ -1606,7 +1606,7 @@ foreign lib {
----------
pBackends (out, optional)
A pointer to the buffer that will receive the enabled backends. Set to NULL to retrieve the backend count. Setting
the capacity of the buffer to `MA_BUFFER_COUNT` will guarantee it's large enough for all backends.
the capacity of the buffer to `MA_BACKEND_COUNT` will guarantee it's large enough for all backends.
backendCap (in)
The capacity of the `pBackends` buffer.

View File

@@ -698,6 +698,7 @@ context_type :: struct {
snd_pcm_hw_params_set_rate_resample: proc "system" (),
snd_pcm_hw_params_set_rate: proc "system" (),
snd_pcm_hw_params_set_rate_near: proc "system" (),
snd_pcm_hw_params_set_rate_minmax: proc "system" (),
snd_pcm_hw_params_set_buffer_size_near: proc "system" (),
snd_pcm_hw_params_set_periods_near: proc "system" (),
snd_pcm_hw_params_set_access: proc "system" (),
@@ -1202,6 +1203,7 @@ device :: struct {
/*AAudioStream**/ pStreamPlayback: rawptr,
/*AAudioStream**/ pStreamCapture: rawptr,
rerouteLock: mutex,
isTearingDown: b32,
usage: aaudio_usage,
contentType: aaudio_content_type,
inputPreset: aaudio_input_preset,

View File

@@ -2,7 +2,7 @@
Bindings for [[ miniaudio ; https://miniaud.io/docs ]] audio playback and capture library.
Choice of public domain or MIT-0. See license statements at the end of this file.
miniaudio - v0.11.21 - 2023-11-15
miniaudio - v0.11.24 - 2025-09-11
David Reid - mackron@gmail.com
@@ -300,7 +300,7 @@ The engine encapsulates both the resource manager and the node graph to create a
use high level API. The resource manager and node graph APIs are covered in more later sections of
this manual.
The code below shows how you can initialize an engine using it's default configuration.
The code below shows how you can initialize an engine using its default configuration.
```c
ma_result result;
@@ -388,7 +388,7 @@ Sounds are not started by default. Start a sound with `ma_sound_start()` and sto
`ma_sound_stop()`. When a sound is stopped, it is not rewound to the start. Use
`ma_sound_seek_to_pcm_frame(&sound, 0)` to seek back to the start of a sound. By default, starting
and stopping sounds happens immediately, but sometimes it might be convenient to schedule the sound
the be started and/or stopped at a specific time. This can be done with the following functions:
to be started and/or stopped at a specific time. This can be done with the following functions:
```c
ma_sound_set_start_time_in_pcm_frames()
@@ -460,6 +460,11 @@ is at the end, use `ma_sound_at_end()`. Looping of a sound can be controlled wit
miniaudio should work cleanly out of the box without the need to download or install any
dependencies. See below for platform-specific details.
This library has been designed to be added directly to your source tree which is the preferred way
of using it, but you can compile it as a normal library if that's your preference. Be careful if
compiling as a shared object because miniaudio is not ABI compatible between any release, including
bug fix releases. It's recommended you link statically
Note that GCC and Clang require `-msse2`, `-mavx2`, etc. for SIMD optimizations.
If you get errors about undefined references to `__sync_val_compare_and_swap_8`, `__atomic_load_8`,
@@ -529,7 +534,7 @@ you'll need to disable run-time linking with `MA_NO_RUNTIME_LINKING` and link wi
The Emscripten build emits Web Audio JavaScript directly and should compile cleanly out of the box.
You cannot use `-std=c*` compiler flags, nor `-ansi`.
You can enable the use of AudioWorkets by defining `MA_ENABLE_AUDIO_WORKLETS` and then compiling
You can enable the use of AudioWorklets by defining `MA_ENABLE_AUDIO_WORKLETS` and then compiling
with the following options:
-sAUDIO_WORKLET=1 -sWASM_WORKERS=1 -sASYNCIFY
@@ -878,7 +883,7 @@ read data within a certain range of the underlying data. To do this you can use
This is useful if you have a sound bank where many sounds are stored in the same file and you want
the data source to only play one of those sub-sounds. Note that once the range is set, everything
that takes a position, such as cursors and loop points, should always be relatvie to the start of
that takes a position, such as cursors and loop points, should always be relative to the start of
the range. When the range is set, any previously defined loop point will be reset.
Custom loop points can also be used with data sources. By default, data sources will loop after
@@ -886,7 +891,7 @@ they reach the end of the data source, but if you need to loop at a specific loc
the following:
```c
result = ma_data_set_loop_point_in_pcm_frames(pDataSource, loopBegInFrames, loopEndInFrames);
result = ma_data_source_set_loop_point_in_pcm_frames(pDataSource, loopBegInFrames, loopEndInFrames);
if (result != MA_SUCCESS) {
return result; // Failed to set the loop point.
}
@@ -3734,4 +3739,4 @@ See below for some tips on improving performance.
- When compiling with VC6 and earlier, decoding is restricted to files less than 2GB in size. This
is due to 64-bit file APIs not being available.
*/
package miniaudio
package miniaudio

View File

@@ -48,6 +48,7 @@ engine_node_config :: struct {
isPitchDisabled: b8, /* Pitching can be explicitly disable with MA_SOUND_FLAG_NO_PITCH to optimize processing. */
isSpatializationDisabled: b8, /* Spatialization can be explicitly disabled with MA_SOUND_FLAG_NO_SPATIALIZATION. */
pinnedListenerIndex: u8, /* The index of the listener this node should always use for spatialization. If set to MA_LISTENER_INDEX_CLOSEST the engine will use the closest listener. */
resampling: resampler_config,
}
/* Base node object for both ma_sound and ma_sound_group. */
@@ -58,7 +59,7 @@ engine_node :: struct {
volumeSmoothTimeInPCMFrames: u32,
monoExpansionMode: mono_expansion_mode,
fader: fader,
resampler: linear_resampler, /* For pitch shift. */
resampler: resampler, /* For pitch shift. */
spatializer: spatializer,
panner: panner,
volumeGainer: gainer, /* This will only be used if volumeSmoothTimeInPCMFrames is > 0. */
@@ -117,6 +118,7 @@ sound_config :: struct {
endCallback: sound_end_proc, /* Fired when the sound reaches the end. Will be fired from the audio thread. Do not restart, uninitialize or otherwise change the state of the sound from here. Instead fire an event or set a variable to indicate to a different thread to change the start of the sound. Will not be fired in response to a scheduled stop with ma_sound_set_stop_time_*(). */
pEndCallbackUserData: rawptr,
pitchResampling: resampler_config,
initNotifications: resource_manager_pipeline_notifications,
@@ -134,6 +136,10 @@ sound :: struct {
endCallback: sound_end_proc,
pEndCallbackUserData: rawptr,
pProcessingCache: ^f32,
processingCacheFramesRemaining: u32,
processingCacheMap: u32,
ownsDataSource: b8,
/*
@@ -166,8 +172,12 @@ foreign lib {
sound_get_data_source :: proc(pSound: ^sound) -> ^data_source ---
sound_start :: proc(pSound: ^sound) -> result ---
sound_stop :: proc(pSound: ^sound) -> result ---
sound_stop_with_fade_in_pcm_frames :: proc(pSound: ^sound, fadeLengthInFrames: u64) --- /* Will overwrite any scheduled stop and fade. */
sound_stop_with_fade_in_milliseconds :: proc(pSound: ^sound, fadeLengthInFrames: u64) --- /* Will overwrite any scheduled stop and fade. */
sound_stop_with_fade_in_pcm_frames :: proc(pSound: ^sound, fadeLengthInFrames: u64) --- /* Will overwrite any scheduled stop and fade. If you want to restart the sound, first reset it with `ma_sound_reset_stop_time_and_fade()`. There are plans to make this less awkward in the future. */
sound_stop_with_fade_in_milliseconds :: proc(pSound: ^sound, fadeLengthInFrames: u64) --- /* Will overwrite any scheduled stop and fade. If you want to restart the sound, first reset it with `ma_sound_reset_stop_time_and_fade()`. There are plans to make this less awkward in the future. */
sound_reset_start_time :: proc(pSound: ^sound) ---
sound_reset_stop_time :: proc(pSound: ^sound) ---
sound_reset_fade :: proc(pSound: ^sound) ---
sound_reset_stop_time_and_fade :: proc(pSound: ^sound) --- /* Resets fades and scheduled stop time. Does not seek back to the start. */
sound_set_volume :: proc(pSound: ^sound, volume: f32) ---
sound_get_volume :: proc(pSound: ^sound) -> f32 ---
sound_set_pan :: proc(pSound: ^sound, pan: f32) ---
@@ -319,7 +329,7 @@ engine_config :: struct {
pLog: ^log, /* When set to NULL, will use the context's log. */
listenerCount: u32, /* Must be between 1 and MA_ENGINE_MAX_LISTENERS. */
channels: u32, /* The number of channels to use when mixing and spatializing. When set to 0, will use the native channel count of the device. */
sampleRate: u32, /* The sample rate. When set to 0 will use the native channel count of the device. */
sampleRate: u32, /* The sample rate. When set to 0 will use the native sample rate of the device. */
periodSizeInFrames: u32, /* If set to something other than 0, updates will always be exactly this size. The underlying device may be a different size, but from the perspective of the mixer that won't matter.*/
periodSizeInMilliseconds: u32, /* Used if periodSizeInFrames is unset. */
gainSmoothTimeInFrames: u32, /* The number of frames to interpolate the gain of spatialized sounds across. If set to 0, will use gainSmoothTimeInMilliseconds. */
@@ -335,6 +345,8 @@ engine_config :: struct {
pResourceManagerVFS: ^vfs, /* A pointer to a pre-allocated VFS object to use with the resource manager. This is ignored if pResourceManager is not NULL. */
onProcess: engine_process_proc, /* Fired at the end of each call to ma_engine_read_pcm_frames(). For engine's that manage their own internal device (the default configuration), this will be fired from the audio thread, and you do not need to call ma_engine_read_pcm_frames() manually in order to trigger this. */
pProcessUserData: rawptr, /* User data that's passed into onProcess. */
resourceManagerResampling: resampler_config, /* The resampling config to use with the resource manager. */
pitchResampling: resampler_config, /* The resampling config for the pitch and Doppler effects. You will typically want this to be a fast resampler. For high quality stuff, it's recommended that you pre-sample. */
}
engine :: struct {
@@ -358,6 +370,8 @@ engine :: struct {
monoExpansionMode: mono_expansion_mode,
onProcess: engine_process_proc,
pProcessUserData: rawptr,
pitchResamplingConfig: resampler_config,
}
@(default_calling_convention="c", link_prefix="ma_")

Binary file not shown.

View File

@@ -221,13 +221,14 @@ node_graph :: struct {
foreign lib {
node_graph_config_init :: proc(channels: u32) -> node_graph_config ---
node_graph_init :: proc(pConfig: ^node_graph_config, pAllocationCallbacks: ^allocation_callbacks, pNodeGraph: ^node_graph) -> result ---
node_graph_uninit :: proc(pNodeGraph: ^node_graph, pAllocationCallbacks: ^allocation_callbacks) ---
node_graph_get_endpoint :: proc(pNodeGraph: ^node_graph) -> ^node ---
node_graph_read_pcm_frames :: proc(pNodeGraph: ^node_graph, pFramesOut: rawptr, frameCount: u64, pFramesRead: ^u64) -> result ---
node_graph_get_channels :: proc(pNodeGraph: ^node_graph) -> u32 ---
node_graph_get_time :: proc(pNodeGraph: ^node_graph) -> u64 ---
node_graph_set_time :: proc(pNodeGraph: ^node_graph, globalTime: u64) -> result ---
node_graph_init :: proc(pConfig: ^node_graph_config, pAllocationCallbacks: ^allocation_callbacks, pNodeGraph: ^node_graph) -> result ---
node_graph_uninit :: proc(pNodeGraph: ^node_graph, pAllocationCallbacks: ^allocation_callbacks) ---
node_graph_get_endpoint :: proc(pNodeGraph: ^node_graph) -> ^node ---
node_graph_read_pcm_frames :: proc(pNodeGraph: ^node_graph, pFramesOut: rawptr, frameCount: u64, pFramesRead: ^u64) -> result ---
node_graph_get_channels :: proc(pNodeGraph: ^node_graph) -> u32 ---
node_graph_get_time :: proc(pNodeGraph: ^node_graph) -> u64 ---
node_graph_set_time :: proc(pNodeGraph: ^node_graph, globalTime: u64) -> result ---
node_graph_get_processing_size_in_frames :: proc(pNodeGraph: ^node_graph) -> u32 ---
}

View File

@@ -198,6 +198,7 @@ resource_manager_config :: struct {
ppCustomDecodingBackendVTables: ^[^]decoding_backend_vtable,
customDecodingBackendCount: u32,
pCustomDecodingBackendUserData: rawptr,
resampling: resampler_config,
}
resource_manager :: struct {

File diff suppressed because it is too large Load Diff