@@ -1072,22 +1072,6 @@ The flags below are used for controlling how the resource manager should handle
#define MA_DATA_SOURCE_FLAG_WAIT_INIT 0x00000008 /* When set, waits for initialization of the underlying data source before returning from ma_resource_manager_data_source_init(). */
typedefenum
{
ma_resource_manager_data_buffer_encoding_encoded,
ma_resource_manager_data_buffer_encoding_decoded
}ma_resource_manager_data_buffer_encoding;
/* The type of object that's used to connect a data buffer to a data source. */
ma_uint32executionCounter;/* For allocating execution orders for jobs. */
ma_uint32executionPointer;/* For managing the order of execution for asynchronous jobs relating to this object. Incremented as jobs complete processing. */
ma_bool32isDataOwnedByResourceManager;/* Set to true when the underlying data buffer was allocated the resource manager. Set to false if it is owned by the application (via ma_resource_manager_register_*()). */
returnresult;/* The data buffer is in an erroneous state. */
}
/*
We need to initialize either a ma_decoder or an ma_audio_buffer depending on whether or not the backing data is encoded or decoded. These act as the
"instance" to the data and are used to form the connection between underlying data buffer and the data source. If the data buffer is decoded, we can use
an ma_audio_buffer. This enables us to use memory mapping when mixing which saves us a bit of data movement overhead.
result=ma_decoder_init_memory_raw(pDataBuffer->pNode->data.decoded.pData,(size_t)sizeInBytes,&configIn,&configOut,&pDataBuffer->connector.decoder);/* Safe cast thanks to the check above. */
}
casema_resource_manager_data_supply_type_decoded_paged:/* Connector is a paged audio buffer. */
Here is where we determine whether or not we need to return MA_BUSY from a data source callback. If we don't have enough data loaded to output all requiredFrameCount frames
we will abort with MA_BUSY. We could also choose to do a partial read (only reading as many frames are available), but it's just easier to abort early and I don't think it
really makes much practical difference. This only applies to decoded buffers.
returnma_resource_manager_post_job(pResourceManager,pJob);/* Attempting to execute out of order. Probably interleaved with a MA_JOB_FREE_DATA_BUFFER job. */
pageDataBufferJob.pageDataBuffer.pInitNotification=NULL;/* <-- Clear this notification to NULL to ensure it's not signalled a second time at the end of decoding, which will be done for sounds of unknown length. */