Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
miniaudio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
miniaudio
Commits
50367053
Commit
50367053
authored
Jul 17, 2021
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly namespace some tokens.
parent
faf3381f
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
233 additions
and
231 deletions
+233
-231
research/_examples/resource_manager.c
research/_examples/resource_manager.c
+4
-4
research/_examples/resource_manager_advanced.c
research/_examples/resource_manager_advanced.c
+8
-8
research/miniaudio_engine.c
research/miniaudio_engine.c
+2
-2
research/miniaudio_engine.h
research/miniaudio_engine.h
+219
-217
No files found.
research/_examples/resource_manager.c
View file @
50367053
...
...
@@ -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,
specify a combination of the following options in `ma_resource_manager_data_source_init()`:
* MA_DATA_SOURCE_FLAG_ASYNC - Load asynchronously.
* MA_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_ASYNC - Load asynchronously.
* MA_
RESOURCE_MANAGER_
DATA_SOURCE_FLAG_DECODE - Store the sound in-memory in uncompressed/decoded format.
* 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
`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
(
&
resourceManager
,
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. */
&
dataSource
);
if
(
result
!=
MA_SUCCESS
)
{
...
...
research/_examples/resource_manager_advanced.c
View file @
50367053
...
...
@@ -160,15 +160,15 @@ static ma_thread_result MA_THREADCALL custom_job_thread(void* pUserData)
for
(;;)
{
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
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.
When the quit job is returned (MA_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
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_
RESOURCE_MANAGER_
JOB_QUIT and use that
instead.
*/
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
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
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
)
{
printf
(
"CUSTOM JOB THREAD TERMINATING VIA MA_JOB_QUIT... "
);
if
(
job
.
toc
.
breakup
.
code
==
MA_
RESOURCE_MANAGER_
JOB_QUIT
)
{
printf
(
"CUSTOM JOB THREAD TERMINATING VIA MA_
RESOURCE_MANAGER_
JOB_QUIT... "
);
break
;
}
...
...
@@ -274,7 +274,7 @@ int main(int argc, char** argv)
result
=
ma_resource_manager_data_source_init
(
&
resourceManager
,
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. */
&
g_dataSources
[
iFile
]);
...
...
research/miniaudio_engine.c
View file @
50367053
...
...
@@ -79,7 +79,7 @@ int main(int argc, char** argv)
loadNotification
.
cb
.
onSignal
=
on_sound_loaded
;
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
)
{
printf
(
"Failed to load sound: %s
\n
"
,
argv
[
1
]);
ma_engine_uninit
(
&
engine
);
...
...
@@ -93,7 +93,7 @@ int main(int argc, char** argv)
}*/
#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) {
printf("Failed to load sound: %s\n", argv[1]);
ma_engine_uninit(&engine);
...
...
research/miniaudio_engine.h
View file @
50367053
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment