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
f27a330a
Commit
f27a330a
authored
Feb 07, 2021
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Experiment with improving async decoding on the Emscripten build.
parent
b8f00dc4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
1 deletion
+27
-1
research/miniaudio_engine.h
research/miniaudio_engine.h
+27
-1
No files found.
research/miniaudio_engine.h
View file @
f27a330a
...
@@ -10355,7 +10355,33 @@ MA_API ma_engine_config ma_engine_config_init_default(void)
...
@@ -10355,7 +10355,33 @@ MA_API ma_engine_config ma_engine_config_init_default(void)
static
void
ma_engine_data_callback_internal
(
ma_device
*
pDevice
,
void
*
pFramesOut
,
const
void
*
pFramesIn
,
ma_uint32
frameCount
)
static
void
ma_engine_data_callback_internal
(
ma_device
*
pDevice
,
void
*
pFramesOut
,
const
void
*
pFramesIn
,
ma_uint32
frameCount
)
{
{
ma_engine_data_callback
((
ma_engine
*
)
pDevice
->
pUserData
,
pFramesOut
,
pFramesIn
,
frameCount
);
ma_engine
*
pEngine
=
(
ma_engine
*
)
pDevice
->
pUserData
;
/*
Experiment: Try processing a resource manager job if we're on the Emscripten build.
This serves two purposes:
1) It ensures jobs are actually processed at some point since we cannot guarantee that the
caller is doing the right thing and calling ma_resource_manager_process_next_job(); and
2) It's an attempt at working around an issue where processing jobs on the Emscripten main
loop doesn't work as well as it should. When trying to load sounds without the `DECODE`
flag or with the `ASYNC` flag, the sound data is just not able to be loaded in time
before the callback is processed. I think it's got something to do with the single-
threaded nature of Web, but I'm not entirely sure.
*/
#if !defined(MA_NO_RESOURCE_MANAGER) && defined(MA_EMSCRIPTEN)
{
if
(
pEngine
->
pResourceManager
!=
NULL
)
{
if
((
pEngine
->
pResourceManager
->
config
.
flags
&
MA_RESOURCE_MANAGER_FLAG_NO_THREADING
)
!=
0
)
{
ma_resource_manager_process_next_job
(
pEngine
->
pResourceManager
);
}
}
}
#endif
ma_engine_data_callback
(
pEngine
,
pFramesOut
,
pFramesIn
,
frameCount
);
}
}
MA_API
ma_result
ma_engine_init
(
const
ma_engine_config
*
pConfig
,
ma_engine
*
pEngine
)
MA_API
ma_result
ma_engine_init
(
const
ma_engine_config
*
pConfig
,
ma_engine
*
pEngine
)
...
...
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