mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-24 09:14:04 +02:00
Prep work for some future work.
This commit is contained in:
@@ -6749,9 +6749,7 @@ static ma_result ma_resource_manager_data_buffer_init_nolock(ma_resource_manager
|
|||||||
alternative to this could be to initialize the connector via the job queue when the data
|
alternative to this could be to initialize the connector via the job queue when the data
|
||||||
source is being loaded asynchronously.
|
source is being loaded asynchronously.
|
||||||
*/
|
*/
|
||||||
if (ma_resource_manager_data_buffer_node_result(pDataBuffer->pNode) == MA_BUSY) {
|
if (ma_resource_manager_data_buffer_node_result(pDataBuffer->pNode) == MA_BUSY && ma_resource_manager_is_threading_enabled(pResourceManager) && async) {
|
||||||
if (ma_resource_manager_is_threading_enabled(pResourceManager)) {
|
|
||||||
if (async) {
|
|
||||||
/* Loading asynchronously. */
|
/* Loading asynchronously. */
|
||||||
|
|
||||||
/* TODO: This needs to be improved so that when loading asynchronously we post a message to the job queue instead of just waiting. */
|
/* TODO: This needs to be improved so that when loading asynchronously we post a message to the job queue instead of just waiting. */
|
||||||
@@ -6766,18 +6764,17 @@ static ma_result ma_resource_manager_data_buffer_init_nolock(ma_resource_manager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Loading synchronously. Wait for the initial sound to be fully decoded. */
|
/* Not loading asychronously. We need to wait for the sound to be fully decoded so we can initialize a connector. */
|
||||||
while (ma_resource_manager_data_buffer_node_result(pDataBuffer->pNode) == MA_BUSY) {
|
|
||||||
ma_yield();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* Threading is not enabled. We need to spin and call ma_resource_manager_process_next_job(). */
|
|
||||||
while (ma_resource_manager_data_buffer_node_result(pDataBuffer->pNode) == MA_BUSY) {
|
while (ma_resource_manager_data_buffer_node_result(pDataBuffer->pNode) == MA_BUSY) {
|
||||||
|
if (ma_resource_manager_is_threading_enabled(pResourceManager)) {
|
||||||
|
/* We're not threading, so process the next job if there are any. */
|
||||||
result = ma_resource_manager_process_next_job(pResourceManager);
|
result = ma_resource_manager_process_next_job(pResourceManager);
|
||||||
if (result == MA_NO_DATA_AVAILABLE || result == MA_JOB_QUIT) {
|
if (result == MA_NO_DATA_AVAILABLE || result == MA_JOB_QUIT) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
/* We're threading, so just keep spinning until some other thread finishes decoding of the original sound. */
|
||||||
|
ma_yield();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user