You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
nativeDataFormats: [/*len(format_count) * standard_sample_rate.rate_count * MAX_CHANNELS*/64]struct { /* Not sure how big to make this. There can be *many* permutations for virtual devices which can support anything. */
367
-
format: format, /* Sample format. If set to ma_format_unknown, all sample formats are supported. */
368
-
channels: u32, /* If set to 0, all channels are supported. */
369
-
sampleRate: u32, /* If set to 0, all sample rates are supported. */
370
-
flags: u32, /* A combination of MA_DATA_FORMAT_FLAG_* flags. */
372
+
format: format, /* Sample format. If set to ma_format_unknown, all sample formats are supported. */
373
+
channels: u32, /* If set to 0, all channels are supported. */
374
+
sampleRate: u32, /* If set to 0, all sample rates are supported. */
375
+
flags: data_format_flags,/* A combination of MA_DATA_FORMAT_FLAG_* flags. */
pFilePath: cstring, /* Set this to load from the resource manager. */
100
-
pFilePathW: [^]c.wchar_t, /* Set this to load from the resource manager. */
101
-
pDataSource: ^data_source, /* Set this to load from an existing data source. */
102
-
pInitialAttachment: ^node, /* If set, the sound will be attached to an input of this node. This can be set to a ma_sound. If set to NULL, the sound will be attached directly to the endpoint unless MA_SOUND_FLAG_NO_DEFAULT_ATTACHMENT is set in `flags`. */
103
-
initialAttachmentInputBusIndex: u32, /* The index of the input bus of pInitialAttachment to attach the sound to. */
104
-
channelsIn: u32, /* Ignored if using a data source as input (the data source's channel count will be used always). Otherwise, setting to 0 will cause the engine's channel count to be used. */
105
-
channelsOut: u32, /* Set this to 0 (default) to use the engine's channel count. Set to MA_SOUND_SOURCE_CHANNEL_COUNT to use the data source's channel count (only used if using a data source as input). */
101
+
pFilePath: cstring, /* Set this to load from the resource manager. */
102
+
pFilePathW: [^]c.wchar_t, /* Set this to load from the resource manager. */
103
+
pDataSource: ^data_source, /* Set this to load from an existing data source. */
104
+
pInitialAttachment: ^node, /* If set, the sound will be attached to an input of this node. This can be set to a ma_sound. If set to NULL, the sound will be attached directly to the endpoint unless MA_SOUND_FLAG_NO_DEFAULT_ATTACHMENT is set in `flags`. */
105
+
initialAttachmentInputBusIndex: u32, /* The index of the input bus of pInitialAttachment to attach the sound to. */
106
+
channelsIn: u32, /* Ignored if using a data source as input (the data source's channel count will be used always). Otherwise, setting to 0 will cause the engine's channel count to be used. */
107
+
channelsOut: u32, /* Set this to 0 (default) to use the engine's channel count. Set to MA_SOUND_SOURCE_CHANNEL_COUNT to use the data source's channel count (only used if using a data source as input). */
106
108
monoExpansionMode: mono_expansion_mode, /* Controls how the mono channel should be expanded to other channels when spatialization is disabled on a sound. */
107
-
flags: u32, /* A combination of MA_SOUND_FLAG_* flags. */
108
-
volumeSmoothTimeInPCMFrames: u32, /* The number of frames to smooth over volume changes. Defaults to 0 in which case no smoothing is used. */
109
-
initialSeekPointInPCMFrames: u64, /* Initializes the sound such that it's seeked to this location by default. */
109
+
flags: sound_flags,/* A combination of MA_SOUND_FLAG_* flags. */
110
+
volumeSmoothTimeInPCMFrames: u32, /* The number of frames to smooth over volume changes. Defaults to 0 in which case no smoothing is used. */
111
+
initialSeekPointInPCMFrames: u64, /* Initializes the sound such that it's seeked to this location by default. */
110
112
rangeBegInPCMFrames: u64,
111
113
rangeEndInPCMFrames: u64,
112
114
loopPointBegInPCMFrames: u64,
@@ -152,10 +154,10 @@ foreign lib {
152
154
sound_config_init :: proc() -> sound_config ---
153
155
sound_config_init2 :: proc(pEngine: ^engine) -> sound_config ---/* Will be renamed to sound_config_init() in version 0.12. */
flags: u32, /* Resource manager data source flags that were used when initializing the data buffer. */
111
+
flags: resource_manager_data_source_flags,/* Resource manager data source flags that were used when initializing the data buffer. */
112
112
pInitNotification: ^async_notification, /* Signalled when the data buffer has been initialized and the format/channels/rate can be retrieved. */
113
113
pDoneNotification: ^async_notification, /* Signalled when the data buffer has been fully decoded. Will be passed through to MA_JOB_TYPE_RESOURCE_MANAGER_PAGE_DATA_BUFFER_NODE when decoding. */
114
114
pInitFence: ^fence, /* Released when initialization of the decoder is complete. */
@@ -194,19 +194,21 @@ ma_job_queue_post(). ma_job_queue_next() will return MA_NO_DATA_AVAILABLE if not
194
194
195
195
This flag should always be used for platforms that do not support multithreading.
196
196
*/
197
-
job_queue_flags :: enum c.int {
198
-
NON_BLOCKING = 0x00000001,
197
+
job_queue_flag :: enum c.int {
198
+
NON_BLOCKING = 0,
199
199
}
200
200
201
+
job_queue_flags :: bit_set[job_queue_flag; u32]
202
+
201
203
job_queue_config :: struct {
202
-
flags: u32,
204
+
flags: job_queue_flags,
203
205
capacity: u32, /* The maximum number of jobs that can fit in the queue at a time. */
204
206
}
205
207
206
208
USE_EXPERIMENTAL_LOCK_FREE_JOB_QUEUE :: false
207
209
208
210
job_queue :: struct {
209
-
flags: u32, /* Flags passed in at initialization time. */
211
+
flags: job_queue_flags,/* Flags passed in at initialization time. */
210
212
capacity: u32, /* The maximum number of jobs that can fit in the queue at a time. Set by the config. */
211
213
head: u64, /*atomic*//* The first item in the list. Required for removing from the top of the list. */
212
214
tail: u64, /*atomic*//* The last item in the list. Required for appending to the end of the list. */
Copy file name to clipboardExpand all lines: vendor/miniaudio/node_graph.odin
+16-8Lines changed: 16 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -22,14 +22,16 @@ NODE_BUS_COUNT_UNKNOWN :: 255
22
22
node :: struct {}
23
23
24
24
/* Node flags. */
25
-
node_flags :: enum c.int {
26
-
PASSTHROUGH = 0x00000001,
27
-
CONTINUOUS_PROCESSING = 0x00000002,
28
-
ALLOW_NULL_INPUT = 0x00000004,
29
-
DIFFERENT_PROCESSING_RATES = 0x00000008,
30
-
SILENT_OUTPUT = 0x00000010,
25
+
node_flag :: enum c.int {
26
+
PASSTHROUGH = 0,
27
+
CONTINUOUS_PROCESSING = 1,
28
+
ALLOW_NULL_INPUT = 2,
29
+
DIFFERENT_PROCESSING_RATES = 3,
30
+
SILENT_OUTPUT = 4,
31
31
}
32
32
33
+
node_flags :: bit_set[node_flag; u32]
34
+
33
35
/* The playback state of a node. Either started or stopped. */
34
36
node_state :: enum c.int {
35
37
started = 0,
@@ -75,7 +77,7 @@ node_vtable :: struct {
75
77
Flags describing characteristics of the node. This is currently just a placeholder for some
76
78
ideas for later on.
77
79
*/
78
-
flags: u32,
80
+
flags: node_flags,
79
81
}
80
82
81
83
node_config :: struct {
@@ -87,6 +89,12 @@ node_config :: struct {
87
89
pOutputChannels: ^u32, /* The number of elements are determined by the output bus count as determined by the vtable, or `outputBusCount` if the vtable specifies `MA_NODE_BUS_COUNT_UNKNOWN`. */
A node has multiple output buses. An output bus is attached to an input bus as an item in a linked
92
100
list. Think of the input bus as a linked list, with the output bus being an item in that list.
@@ -99,7 +107,7 @@ node_output_bus :: struct {
99
107
100
108
/* Mutable via multiple threads. Must be used atomically. The weird ordering here is for packing reasons. */
101
109
inputNodeInputBusIndex: u8, /* The index of the input bus on the input. Required for detaching. Will only be used in the spinlock so does not need to be atomic. */
102
-
flags: u32, /*atomic*//* Some state flags for tracking the read state of the output buffer. A combination of MA_NODE_OUTPUT_BUS_FLAG_*. */
110
+
flags: node_output_bus_flags, /*atomic*//* Some state flags for tracking the read state of the output buffer. A combination of MA_NODE_OUTPUT_BUS_FLAG_*. */
103
111
refCount: u32, /*atomic*//* Reference count for some thread-safety when detaching. */
104
112
isAttached: b32, /*atomic*//* This is used to prevent iteration of nodes that are in the middle of being detached. Used for thread safety. */
105
113
lock: spinlock, /*atomic*//* Unfortunate lock, but significantly simplifies the implementation. Required for thread-safe attaching and detaching. */
STREAM = 0x00000001, /* When set, does not load the entire data source in memory. Disk I/O will happen on job threads. */
15
-
DECODE = 0x00000002, /* Decode data before storing in memory. When set, decoding is done at the resource manager level rather than the mixing thread. Results in faster mixing, but higher memory usage. */
16
-
ASYNC = 0x00000004, /* When set, the resource manager will load the data source asynchronously. */
17
-
WAIT_INIT = 0x00000008, /* When set, waits for initialization of the underlying data source before returning from ma_resource_manager_data_source_init(). */
18
-
UNKNOWN_LENGTH = 0x00000010, /* Gives the resource manager a hint that the length of the data source is unknown and calling `ma_data_source_get_length_in_pcm_frames()` should be avoided. */
13
+
resource_manager_data_source_flag :: enum c.int {
14
+
STREAM = 0, /* When set, does not load the entire data source in memory. Disk I/O will happen on job threads. */
15
+
DECODE = 1, /* Decode data before storing in memory. When set, decoding is done at the resource manager level rather than the mixing thread. Results in faster mixing, but higher memory usage. */
16
+
ASYNC = 2, /* When set, the resource manager will load the data source asynchronously. */
17
+
WAIT_INIT = 3, /* When set, waits for initialization of the underlying data source before returning from ma_resource_manager_data_source_init(). */
18
+
UNKNOWN_LENGTH = 4, /* Gives the resource manager a hint that the length of the data source is unknown and calling `ma_data_source_get_length_in_pcm_frames()` should be avoided. */
/* Maximum job thread count will be restricted to this, but this may be removed later and replaced with a heap allocation thereby removing any limitation. */
59
61
RESOURCE_MANAGER_MAX_JOB_THREAD_COUNT :: 64
60
62
61
-
resource_manager_flags :: enum c.int {
63
+
resource_manager_flag :: enum c.int {
62
64
/* Indicates ma_resource_manager_next_job() should not block. Only valid when the job thread count is 0. */
63
65
NON_BLOCKING = 0x00000001,
64
66
65
67
/* Disables any kind of multithreading. Implicitly enables MA_RESOURCE_MANAGER_FLAG_NON_BLOCKING. */
ds: data_source_base, /* Base data source. A data buffer is a data source. */
127
131
pResourceManager: ^resource_manager, /* A pointer to the resource manager that owns this buffer. */
128
132
pNode: ^resource_manager_data_buffer_node, /* The data node. This is reference counted and is what supplies the data. */
129
-
flags: u32, /* The flags that were passed used to initialize the buffer. */
133
+
flags: resource_manager_flags,/* The flags that were passed used to initialize the buffer. */
130
134
executionCounter: u32, /*atomic*//* For allocating execution orders for jobs. */
131
135
executionPointer: u32, /*atomic*//* For managing the order of execution for asynchronous jobs relating to this object. Incremented as jobs complete processing. */
132
136
seekTargetInPCMFrames: u64, /* Only updated by the public API. Never written nor read from the job thread. */
0 commit comments