vendor/miniaudio: update to 0.11.22

This commit is contained in:
Laytan
2025-05-16 15:58:27 +02:00
committed by laytan
parent d3159f74cd
commit 53a9ecb577
13 changed files with 1462 additions and 550 deletions
+23 -9
View File
@@ -19,6 +19,13 @@ MAX_NODE_LOCAL_BUS_COUNT :: 2
/* Use this when the bus count is determined by the node instance rather than the vtable. */
NODE_BUS_COUNT_UNKNOWN :: 255
/* For some internal memory management of ma_node_graph. */
stack :: struct {
offset: uint,
sizeInBytes: uint,
_data: [1]byte,
}
node :: struct {}
/* Node flags. */
@@ -53,7 +60,7 @@ node_vtable :: struct {
onProcess: proc "c" (pNode: ^node, ppFramesIn: ^[^]f32, pFrameCountIn: ^u32, ppFramesOut: ^[^]f32, pFrameCountOut: ^u32),
/*
A callback for retrieving the number of a input frames that are required to output the
A callback for retrieving the number of input frames that are required to output the
specified number of output frames. You would only want to implement this when the node performs
resampling. This is optional, even for nodes that perform resampling, but it does offer a
small reduction in latency as it allows miniaudio to calculate the exact number of input frames
@@ -134,8 +141,12 @@ node_input_bus :: struct {
node_base :: struct {
/* These variables are set once at startup. */
pNodeGraph: ^node_graph, /* The graph this node belongs to. */
pNodeGraph: ^node_graph, /* The graph this node belongs to. */
vtable: ^node_vtable,
inputBusCount: u32,
outputBusCount: u32,
pInputBuses: [^]node_input_bus `fmt:"v,inputBusCount"`,
pOutputBuses: [^]node_output_bus `fmt:"v,outputBusCount"`,
pCachedData: [^]f32, /* Allocated on the heap. Fixed size. Needs to be stored on the heap because reading from output buses is done in separate function calls. */
cachedDataCapInFramesPerBus: u16, /* The capacity of the input data cache in frames, per bus. */
@@ -148,10 +159,6 @@ node_base :: struct {
state: node_state, /*atomic*/ /* When set to stopped, nothing will be read, regardless of the times in stateTimes. */
stateTimes: [2]u64, /*atomic*/ /* Indexed by ma_node_state. Specifies the time based on the global clock that a node should be considered to be in the relevant state. */
localTime: u64, /*atomic*/ /* The node's local clock. This is just a running sum of the number of output frames that have been processed. Can be modified by any thread with `ma_node_set_time()`. */
inputBusCount: u32,
outputBusCount: u32,
pInputBuses: [^]node_input_bus,
pOutputBuses: [^]node_output_bus,
/* Memory management. */
_inputBuses: [MAX_NODE_LOCAL_BUS_COUNT]node_input_bus,
@@ -189,18 +196,25 @@ foreign lib {
}
node_graph_config :: struct {
channels: u32,
nodeCacheCapInFrames: u16,
channels: u32,
processingSizeInFrames: u32, /* This is the preferred processing size for node processing callbacks unless overridden by a node itself. Can be 0 in which case it will be based on the frame count passed into ma_node_graph_read_pcm_frames(), but will not be well defined. */
preMixStackSizeInBytes: uint, /* Defaults to 512KB per channel. Reducing this will save memory, but the depth of your node graph will be more restricted. */
}
node_graph :: struct {
/* Immutable. */
base: node_base, /* The node graph itself is a node so it can be connected as an input to different node graph. This has zero inputs and calls ma_node_graph_read_pcm_frames() to generate it's output. */
endpoint: node_base, /* Special node that all nodes eventually connect to. Data is read from this node in ma_node_graph_read_pcm_frames(). */
nodeCacheCapInFrames: u16,
pProcessingCache: [^]f32, /* This will be allocated when processingSizeInFrames is non-zero. This is needed because ma_node_graph_read_pcm_frames() can be called with a variable number of frames, and we may need to do some buffering in situations where the caller requests a frame count that's not a multiple of processingSizeInFrames. */
processingCacheFramesRemaining: u32,
processingSizeInFrames: u32,
/* Read and written by multiple threads. */
isReading: b32, /*atomic*/
/* Modified only by the audio thread. */
pPreMixStack: ^stack,
}
@(default_calling_convention="c", link_prefix="ma_")