API CHANGE: Update ma_node_graph_uninit().

This removes the allocation callbacks parameter. These are now managed
internally. This is in preparation for some future changes to data
source management.
This commit is contained in:
David Reid
2026-04-28 17:20:31 +10:00
parent 44323c9cae
commit 52f22d6597
7 changed files with 15 additions and 13 deletions
+1 -1
View File
@@ -146,7 +146,7 @@ int main(int argc, char** argv)
/*done4:*/ ma_data_source_node_uninit(&g_exciteNode, NULL); /*done4:*/ ma_data_source_node_uninit(&g_exciteNode, NULL);
done3: ma_data_source_node_uninit(&g_sourceNode, NULL); done3: ma_data_source_node_uninit(&g_sourceNode, NULL);
done2: ma_vocoder_node_uninit(&g_vocoderNode, NULL); done2: ma_vocoder_node_uninit(&g_vocoderNode, NULL);
done1: ma_node_graph_uninit(&g_nodeGraph, NULL); done1: ma_node_graph_uninit(&g_nodeGraph);
done0: ma_device_uninit(&device); done0: ma_device_uninit(&device);
(void)argc; (void)argc;
+1 -1
View File
@@ -241,7 +241,7 @@ cleanup_graph:
ma_lpf_node_uninit(&g_lpfNode, NULL); ma_lpf_node_uninit(&g_lpfNode, NULL);
/* Node Graph */ /* Node Graph */
ma_node_graph_uninit(&g_nodeGraph, NULL); ma_node_graph_uninit(&g_nodeGraph);
} }
return 0; return 0;
@@ -138,7 +138,7 @@ int main(int argc, char** argv)
/*done4:*/ ma_data_source_node_uninit(&g_dataSupplyNode, NULL); /*done4:*/ ma_data_source_node_uninit(&g_dataSupplyNode, NULL);
done3: ma_channel_separator_node_uninit(&g_separatorNode, NULL); done3: ma_channel_separator_node_uninit(&g_separatorNode, NULL);
done2: ma_channel_combiner_node_uninit(&g_combinerNode, NULL); done2: ma_channel_combiner_node_uninit(&g_combinerNode, NULL);
done1: ma_node_graph_uninit(&g_nodeGraph, NULL); done1: ma_node_graph_uninit(&g_nodeGraph);
done0: ma_device_uninit(&device); done0: ma_device_uninit(&device);
(void)argc; (void)argc;
@@ -107,7 +107,7 @@ int main(int argc, char** argv)
/*done3:*/ ma_data_source_node_uninit(&g_dataSupplyNode, NULL); /*done3:*/ ma_data_source_node_uninit(&g_dataSupplyNode, NULL);
done2: ma_ltrim_node_uninit(&g_trimNode, NULL); done2: ma_ltrim_node_uninit(&g_trimNode, NULL);
done1: ma_node_graph_uninit(&g_nodeGraph, NULL); done1: ma_node_graph_uninit(&g_nodeGraph);
done0: ma_device_uninit(&device); done0: ma_device_uninit(&device);
return 0; return 0;
@@ -112,7 +112,7 @@ int main(int argc, char** argv)
/*done3:*/ ma_data_source_node_uninit(&g_dataSupplyNode, NULL); /*done3:*/ ma_data_source_node_uninit(&g_dataSupplyNode, NULL);
done2: ma_reverb_node_uninit(&g_reverbNode, NULL); done2: ma_reverb_node_uninit(&g_reverbNode, NULL);
done1: ma_node_graph_uninit(&g_nodeGraph, NULL); done1: ma_node_graph_uninit(&g_nodeGraph);
done0: ma_device_uninit(&device); done0: ma_device_uninit(&device);
(void)argc; (void)argc;
@@ -143,7 +143,7 @@ int main(int argc, char** argv)
/*done4:*/ ma_data_source_node_uninit(&g_exciteNode, NULL); /*done4:*/ ma_data_source_node_uninit(&g_exciteNode, NULL);
done3: ma_data_source_node_uninit(&g_sourceNode, NULL); done3: ma_data_source_node_uninit(&g_sourceNode, NULL);
done2: ma_vocoder_node_uninit(&g_vocoderNode, NULL); done2: ma_vocoder_node_uninit(&g_vocoderNode, NULL);
done1: ma_node_graph_uninit(&g_nodeGraph, NULL); done1: ma_node_graph_uninit(&g_nodeGraph);
done0: ma_device_uninit(&device); done0: ma_device_uninit(&device);
(void)argc; (void)argc;
+9 -7
View File
@@ -11352,6 +11352,7 @@ MA_API ma_node_graph_config ma_node_graph_config_init(ma_uint32 channels);
struct ma_node_graph struct ma_node_graph
{ {
ma_data_source_base ds; ma_data_source_base ds;
ma_allocation_callbacks allocationCallbacks;
/* Immutable. */ /* Immutable. */
ma_node_base endpoint; /* Special node that all nodes eventually connect to. Data is read from this node in ma_node_graph_read_pcm_frames(). */ ma_node_base endpoint; /* Special node that all nodes eventually connect to. Data is read from this node in ma_node_graph_read_pcm_frames(). */
@@ -11367,7 +11368,7 @@ struct ma_node_graph
}; };
MA_API ma_result ma_node_graph_init(const ma_node_graph_config* pConfig, const ma_allocation_callbacks* pAllocationCallbacks, ma_node_graph* pNodeGraph); MA_API ma_result ma_node_graph_init(const ma_node_graph_config* pConfig, const ma_allocation_callbacks* pAllocationCallbacks, ma_node_graph* pNodeGraph);
MA_API void ma_node_graph_uninit(ma_node_graph* pNodeGraph, const ma_allocation_callbacks* pAllocationCallbacks); MA_API void ma_node_graph_uninit(ma_node_graph* pNodeGraph);
MA_API ma_node* ma_node_graph_get_endpoint(ma_node_graph* pNodeGraph); MA_API ma_node* ma_node_graph_get_endpoint(ma_node_graph* pNodeGraph);
MA_API ma_result ma_node_graph_read_pcm_frames(ma_node_graph* pNodeGraph, void* pFramesOut, ma_uint64 frameCount, ma_uint64* pFramesRead); MA_API ma_result ma_node_graph_read_pcm_frames(ma_node_graph* pNodeGraph, void* pFramesOut, ma_uint64 frameCount, ma_uint64* pFramesRead);
MA_API ma_uint32 ma_node_graph_get_channels(const ma_node_graph* pNodeGraph); MA_API ma_uint32 ma_node_graph_get_channels(const ma_node_graph* pNodeGraph);
@@ -82959,6 +82960,7 @@ MA_API ma_result ma_node_graph_init(const ma_node_graph_config* pConfig, const m
} }
MA_ZERO_OBJECT(pNodeGraph); MA_ZERO_OBJECT(pNodeGraph);
ma_allocation_callbacks_init_copy(&pNodeGraph->allocationCallbacks, pAllocationCallbacks);
if (pConfig == NULL) { if (pConfig == NULL) {
return MA_INVALID_ARGS; return MA_INVALID_ARGS;
@@ -83023,22 +83025,22 @@ MA_API ma_result ma_node_graph_init(const ma_node_graph_config* pConfig, const m
return MA_SUCCESS; return MA_SUCCESS;
} }
MA_API void ma_node_graph_uninit(ma_node_graph* pNodeGraph, const ma_allocation_callbacks* pAllocationCallbacks) MA_API void ma_node_graph_uninit(ma_node_graph* pNodeGraph)
{ {
if (pNodeGraph == NULL) { if (pNodeGraph == NULL) {
return; return;
} }
ma_node_uninit(&pNodeGraph->endpoint, pAllocationCallbacks); ma_node_uninit(&pNodeGraph->endpoint, &pNodeGraph->allocationCallbacks);
ma_data_source_base_uninit(&pNodeGraph->ds); ma_data_source_base_uninit(&pNodeGraph->ds);
if (pNodeGraph->pProcessingCache != NULL) { if (pNodeGraph->pProcessingCache != NULL) {
ma_free(pNodeGraph->pProcessingCache, pAllocationCallbacks); ma_free(pNodeGraph->pProcessingCache, &pNodeGraph->allocationCallbacks);
pNodeGraph->pProcessingCache = NULL; pNodeGraph->pProcessingCache = NULL;
} }
if (pNodeGraph->pPreMixStack != NULL) { if (pNodeGraph->pPreMixStack != NULL) {
ma_stack_uninit(pNodeGraph->pPreMixStack, pAllocationCallbacks); ma_stack_uninit(pNodeGraph->pPreMixStack, &pNodeGraph->allocationCallbacks);
pNodeGraph->pPreMixStack = NULL; pNodeGraph->pPreMixStack = NULL;
} }
} }
@@ -87089,7 +87091,7 @@ on_error_2:
ma_spatializer_listener_uninit(&pEngine->listeners[iListener], &pEngine->allocationCallbacks); ma_spatializer_listener_uninit(&pEngine->listeners[iListener], &pEngine->allocationCallbacks);
} }
ma_node_graph_uninit(&pEngine->nodeGraph, &pEngine->allocationCallbacks); ma_node_graph_uninit(&pEngine->nodeGraph);
on_error_1: on_error_1:
#if !defined(MA_NO_DEVICE_IO) #if !defined(MA_NO_DEVICE_IO)
{ {
@@ -87150,7 +87152,7 @@ MA_API void ma_engine_uninit(ma_engine* pEngine)
} }
/* Make sure the node graph is uninitialized after the audio thread has been shutdown to prevent accessing of the node graph after being uninitialized. */ /* Make sure the node graph is uninitialized after the audio thread has been shutdown to prevent accessing of the node graph after being uninitialized. */
ma_node_graph_uninit(&pEngine->nodeGraph, &pEngine->allocationCallbacks); ma_node_graph_uninit(&pEngine->nodeGraph);
/* Uninitialize the resource manager last to ensure we don't have a thread still trying to access it. */ /* Uninitialize the resource manager last to ensure we don't have a thread still trying to access it. */
#ifndef MA_NO_RESOURCE_MANAGER #ifndef MA_NO_RESOURCE_MANAGER