From c54bb969641dd6aa47283992716067fa90857c85 Mon Sep 17 00:00:00 2001 From: David Reid Date: Thu, 1 Jul 2021 14:58:05 +1000 Subject: [PATCH] Rename some config variables. --- examples/custom_decoder.c | 6 +++--- miniaudio.h | 4 ++-- research/_examples/custom_decoder_engine.c | 6 +++--- research/miniaudio_engine.h | 18 +++++++++--------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/examples/custom_decoder.c b/examples/custom_decoder.c index 61d35dd2..4b3ac97a 100644 --- a/examples/custom_decoder.c +++ b/examples/custom_decoder.c @@ -221,9 +221,9 @@ int main(int argc, char** argv) /* Initialize the decoder. */ decoderConfig = ma_decoder_config_init_default(); - decoderConfig.pCustomBackendUserData = NULL; /* In this example our backend objects are contained within a ma_decoder_ex object to avoid a malloc. Our vtables need to know about this. */ - decoderConfig.ppCustomBackendVTables = pCustomBackendVTables; - decoderConfig.customBackendVTableCount = sizeof(pCustomBackendVTables) / sizeof(pCustomBackendVTables[0]); + decoderConfig.pCustomBackendUserData = NULL; /* In this example our backend objects are contained within a ma_decoder_ex object to avoid a malloc. Our vtables need to know about this. */ + decoderConfig.ppCustomBackendVTables = pCustomBackendVTables; + decoderConfig.customBackendCount = sizeof(pCustomBackendVTables) / sizeof(pCustomBackendVTables[0]); result = ma_decoder_init_file(argv[1], &decoderConfig, &decoder); if (result != MA_SUCCESS) { diff --git a/miniaudio.h b/miniaudio.h index 5a95a75d..5b5ca501 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -6141,7 +6141,7 @@ typedef struct } resampling; ma_allocation_callbacks allocationCallbacks; ma_decoding_backend_vtable** ppCustomBackendVTables; - ma_uint32 customBackendVTableCount; + ma_uint32 customBackendCount; void* pCustomBackendUserData; } ma_decoder_config; @@ -46698,7 +46698,7 @@ static ma_result ma_decoder_init_custom__internal(const ma_decoder_config* pConf backendConfig = ma_decoding_backend_config_init(pConfig->format); /* The order each backend is listed is what defines the priority. */ - for (ivtable = 0; ivtable < pConfig->customBackendVTableCount; ivtable += 1) { + for (ivtable = 0; ivtable < pConfig->customBackendCount; ivtable += 1) { const ma_decoding_backend_vtable* pVTable = pConfig->ppCustomBackendVTables[ivtable]; if (pVTable != NULL && pVTable->onInit != NULL) { result = pVTable->onInit(pConfig->pCustomBackendUserData, ma_decoder_internal_on_read__custom, ma_decoder_internal_on_seek__custom, ma_decoder_internal_on_tell__custom, pDecoder, &backendConfig, &pDecoder->allocationCallbacks, &pBackend); diff --git a/research/_examples/custom_decoder_engine.c b/research/_examples/custom_decoder_engine.c index 1b39ff16..15aef140 100644 --- a/research/_examples/custom_decoder_engine.c +++ b/research/_examples/custom_decoder_engine.c @@ -219,9 +219,9 @@ int main(int argc, char** argv) /* Using custom decoding backends requires a resource manager. */ resourceManagerConfig = ma_resource_manager_config_init(); - resourceManagerConfig.ppCustomDecodingBackendVTables = pCustomBackendVTables; - resourceManagerConfig.customDecodingBackendVTableCount = sizeof(pCustomBackendVTables) / sizeof(pCustomBackendVTables[0]); - resourceManagerConfig.pCustomDecodingBackendUserData = NULL; /* <-- This will be passed in to the pUserData parameter of each function in the decoding backend vtables. */ + resourceManagerConfig.ppCustomDecodingBackendVTables = pCustomBackendVTables; + resourceManagerConfig.customDecodingBackendCount = sizeof(pCustomBackendVTables) / sizeof(pCustomBackendVTables[0]); + resourceManagerConfig.pCustomDecodingBackendUserData = NULL; /* <-- This will be passed in to the pUserData parameter of each function in the decoding backend vtables. */ result = ma_resource_manager_init(&resourceManagerConfig, &resourceManager); if (result != MA_SUCCESS) { diff --git a/research/miniaudio_engine.h b/research/miniaudio_engine.h index c4db1d8d..bf6bca8a 100644 --- a/research/miniaudio_engine.h +++ b/research/miniaudio_engine.h @@ -1467,7 +1467,7 @@ typedef struct ma_uint32 flags; ma_vfs* pVFS; /* Can be NULL in which case defaults will be used. */ ma_decoding_backend_vtable** ppCustomDecodingBackendVTables; - ma_uint32 customDecodingBackendVTableCount; + ma_uint32 customDecodingBackendCount; void* pCustomDecodingBackendUserData; } ma_resource_manager_config; @@ -6909,8 +6909,8 @@ MA_API ma_result ma_resource_manager_init(const ma_resource_manager_config* pCon /* Custom decoding backends. */ - if (pConfig->ppCustomDecodingBackendVTables != NULL && pConfig->customDecodingBackendVTableCount > 0) { - size_t sizeInBytes = sizeof(*pResourceManager->config.ppCustomDecodingBackendVTables) * pConfig->customDecodingBackendVTableCount; + if (pConfig->ppCustomDecodingBackendVTables != NULL && pConfig->customDecodingBackendCount > 0) { + size_t sizeInBytes = sizeof(*pResourceManager->config.ppCustomDecodingBackendVTables) * pConfig->customDecodingBackendCount; pResourceManager->config.ppCustomDecodingBackendVTables = (ma_decoding_backend_vtable**)ma_malloc(sizeInBytes, &pResourceManager->config.allocationCallbacks); if (pResourceManager->config.ppCustomDecodingBackendVTables == NULL) { @@ -6920,8 +6920,8 @@ MA_API ma_result ma_resource_manager_init(const ma_resource_manager_config* pCon MA_COPY_MEMORY(pResourceManager->config.ppCustomDecodingBackendVTables, pConfig->ppCustomDecodingBackendVTables, sizeInBytes); - pResourceManager->config.customDecodingBackendVTableCount = pConfig->customDecodingBackendVTableCount; - pResourceManager->config.pCustomDecodingBackendUserData = pConfig->pCustomDecodingBackendUserData; + pResourceManager->config.customDecodingBackendCount = pConfig->customDecodingBackendCount; + pResourceManager->config.pCustomDecodingBackendUserData = pConfig->pCustomDecodingBackendUserData; } @@ -7005,10 +7005,10 @@ static ma_decoder_config ma_resource_manager__init_decoder_config(ma_resource_ma ma_decoder_config config; config = ma_decoder_config_init(pResourceManager->config.decodedFormat, pResourceManager->config.decodedChannels, pResourceManager->config.decodedSampleRate); - config.allocationCallbacks = pResourceManager->config.allocationCallbacks; - config.ppCustomBackendVTables = pResourceManager->config.ppCustomDecodingBackendVTables; - config.customBackendVTableCount = pResourceManager->config.customDecodingBackendVTableCount; - config.pCustomBackendUserData = pResourceManager->config.pCustomDecodingBackendUserData; + config.allocationCallbacks = pResourceManager->config.allocationCallbacks; + config.ppCustomBackendVTables = pResourceManager->config.ppCustomDecodingBackendVTables; + config.customBackendCount = pResourceManager->config.customDecodingBackendCount; + config.pCustomBackendUserData = pResourceManager->config.pCustomDecodingBackendUserData; return config; }