mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
Properly namespace some tokens.
This commit is contained in:
@@ -8,9 +8,9 @@ You can control whether or not you want to load the sound asynchronously and whe
|
|||||||
in-memory or stream it. When storing the sound in-memory you can also control whether or not it is decoded. To do this,
|
in-memory or stream it. When storing the sound in-memory you can also control whether or not it is decoded. To do this,
|
||||||
specify a combination of the following options in `ma_resource_manager_data_source_init()`:
|
specify a combination of the following options in `ma_resource_manager_data_source_init()`:
|
||||||
|
|
||||||
* MA_DATA_SOURCE_FLAG_ASYNC - Load asynchronously.
|
* MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_ASYNC - Load asynchronously.
|
||||||
* MA_DATA_SOURCE_FLAG_DECODE - Store the sound in-memory in uncompressed/decoded format.
|
* MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_DECODE - Store the sound in-memory in uncompressed/decoded format.
|
||||||
* MA_DATA_SOURCE_FLAG_STREAM - Stream the sound from disk rather than storing entirely in memory. Useful for music.
|
* MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_STREAM - Stream the sound from disk rather than storing entirely in memory. Useful for music.
|
||||||
|
|
||||||
The object returned by the resource manager is just a standard data source which means it can be plugged into any of
|
The object returned by the resource manager is just a standard data source which means it can be plugged into any of
|
||||||
`ma_data_source_*()` APIs just like any other data source and it should just work.
|
`ma_data_source_*()` APIs just like any other data source and it should just work.
|
||||||
@@ -107,7 +107,7 @@ int main(int argc, char** argv)
|
|||||||
result = ma_resource_manager_data_source_init(
|
result = ma_resource_manager_data_source_init(
|
||||||
&resourceManager,
|
&resourceManager,
|
||||||
argv[1],
|
argv[1],
|
||||||
MA_DATA_SOURCE_FLAG_DECODE | MA_DATA_SOURCE_FLAG_ASYNC | MA_DATA_SOURCE_FLAG_STREAM,
|
MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_DECODE | MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_ASYNC | MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_STREAM,
|
||||||
NULL, /* Async notification. */
|
NULL, /* Async notification. */
|
||||||
&dataSource);
|
&dataSource);
|
||||||
if (result != MA_SUCCESS) {
|
if (result != MA_SUCCESS) {
|
||||||
|
|||||||
@@ -160,15 +160,15 @@ static ma_thread_result MA_THREADCALL custom_job_thread(void* pUserData)
|
|||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ma_result result;
|
ma_result result;
|
||||||
ma_job job;
|
ma_resource_manager_job job;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Retrieve a job from the queue first. This defines what it is you're about to do. By default this will be
|
Retrieve a job from the queue first. This defines what it is you're about to do. By default this will be
|
||||||
blocking. You can initialize the resource manager with MA_RESOURCE_MANAGER_FLAG_NON_BLOCKING to not block in
|
blocking. You can initialize the resource manager with MA_RESOURCE_MANAGER_FLAG_NON_BLOCKING to not block in
|
||||||
which case MA_NO_DATA_AVAILABLE will be returned if no jobs are available.
|
which case MA_NO_DATA_AVAILABLE will be returned if no jobs are available.
|
||||||
|
|
||||||
When the quit job is returned (MA_JOB_QUIT), the return value will always be MA_CANCELLED. If you don't want
|
When the quit job is returned (MA_RESOURCE_MANAGER_JOB_QUIT), the return value will always be MA_CANCELLED. If you don't want
|
||||||
to check the return value (you should), you can instead check if the job code is MA_JOB_QUIT and use that
|
to check the return value (you should), you can instead check if the job code is MA_RESOURCE_MANAGER_JOB_QUIT and use that
|
||||||
instead.
|
instead.
|
||||||
*/
|
*/
|
||||||
result = ma_resource_manager_next_job(pResourceManager, &job);
|
result = ma_resource_manager_next_job(pResourceManager, &job);
|
||||||
@@ -188,12 +188,12 @@ static ma_thread_result MA_THREADCALL custom_job_thread(void* pUserData)
|
|||||||
remains in the queue and will continue to be returned by future calls to ma_resource_manager_next_job(). The
|
remains in the queue and will continue to be returned by future calls to ma_resource_manager_next_job(). The
|
||||||
reason for this is to give every job thread visibility to the quit job so they have a chance to exit.
|
reason for this is to give every job thread visibility to the quit job so they have a chance to exit.
|
||||||
|
|
||||||
We won't actually be hitting this code because the call above will return MA_CANCELLED when the MA_JOB_QUIT
|
We won't actually be hitting this code because the call above will return MA_CANCELLED when the MA_RESOURCE_MANAGER_JOB_QUIT
|
||||||
event is received which means the `result != MA_SUCCESS` logic above will catch it. If you do not check the
|
event is received which means the `result != MA_SUCCESS` logic above will catch it. If you do not check the
|
||||||
return value of ma_resource_manager_next_job() you will want to check for MA_JOB_QUIT like the code below.
|
return value of ma_resource_manager_next_job() you will want to check for MA_RESOURCE_MANAGER_JOB_QUIT like the code below.
|
||||||
*/
|
*/
|
||||||
if (job.toc.breakup.code == MA_JOB_QUIT) {
|
if (job.toc.breakup.code == MA_RESOURCE_MANAGER_JOB_QUIT) {
|
||||||
printf("CUSTOM JOB THREAD TERMINATING VIA MA_JOB_QUIT... ");
|
printf("CUSTOM JOB THREAD TERMINATING VIA MA_RESOURCE_MANAGER_JOB_QUIT... ");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,7 +274,7 @@ int main(int argc, char** argv)
|
|||||||
result = ma_resource_manager_data_source_init(
|
result = ma_resource_manager_data_source_init(
|
||||||
&resourceManager,
|
&resourceManager,
|
||||||
argv[iFile+1],
|
argv[iFile+1],
|
||||||
MA_DATA_SOURCE_FLAG_DECODE | MA_DATA_SOURCE_FLAG_ASYNC /*| MA_DATA_SOURCE_FLAG_STREAM*/,
|
MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_DECODE | MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_ASYNC /*| MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_STREAM*/,
|
||||||
NULL, /* Async notification. */
|
NULL, /* Async notification. */
|
||||||
&g_dataSources[iFile]);
|
&g_dataSources[iFile]);
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ int main(int argc, char** argv)
|
|||||||
loadNotification.cb.onSignal = on_sound_loaded;
|
loadNotification.cb.onSignal = on_sound_loaded;
|
||||||
loadNotification.pSound = &sound;
|
loadNotification.pSound = &sound;
|
||||||
|
|
||||||
result = ma_sound_init_from_file(&engine, argv[1], MA_DATA_SOURCE_FLAG_DECODE | MA_DATA_SOURCE_FLAG_ASYNC | MA_DATA_SOURCE_FLAG_STREAM, &group, NULL, &sound);
|
result = ma_sound_init_from_file(&engine, argv[1], MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_DECODE | MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_ASYNC | MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_STREAM, &group, NULL, &sound);
|
||||||
if (result != MA_SUCCESS) {
|
if (result != MA_SUCCESS) {
|
||||||
printf("Failed to load sound: %s\n", argv[1]);
|
printf("Failed to load sound: %s\n", argv[1]);
|
||||||
ma_engine_uninit(&engine);
|
ma_engine_uninit(&engine);
|
||||||
@@ -93,7 +93,7 @@ int main(int argc, char** argv)
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
result = ma_sound_init_from_file(&engine, argv[1], MA_DATA_SOURCE_FLAG_DECODE /*| MA_DATA_SOURCE_FLAG_ASYNC | MA_DATA_SOURCE_FLAG_STREAM*/, NULL, &sound2);
|
result = ma_sound_init_from_file(&engine, argv[1], MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_DECODE /*| MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_ASYNC | MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_STREAM*/, NULL, &sound2);
|
||||||
if (result != MA_SUCCESS) {
|
if (result != MA_SUCCESS) {
|
||||||
printf("Failed to load sound: %s\n", argv[1]);
|
printf("Failed to load sound: %s\n", argv[1]);
|
||||||
ma_engine_uninit(&engine);
|
ma_engine_uninit(&engine);
|
||||||
|
|||||||
+218
-216
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user