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
f2c22831
Commit
f2c22831
authored
Dec 08, 2021
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix an error when retrieving the cursor from a data stream.
parent
40d89f90
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
12 deletions
+23
-12
miniaudio.h
miniaudio.h
+23
-12
No files found.
miniaudio.h
View file @
f2c22831
...
...
@@ -64316,6 +64316,16 @@ static ma_data_source_vtable g_ma_resource_manager_data_stream_vtable =
MA_DATA_SOURCE_SELF_MANAGED_RANGE_AND_LOOP_POINT
};
static void ma_resource_manager_data_stream_set_absolute_cursor(ma_resource_manager_data_stream* pDataStream, ma_uint64 absoluteCursor)
{
/* Loop if possible. */
if (absoluteCursor > pDataStream->totalLengthInPCMFrames && pDataStream->totalLengthInPCMFrames > 0) {
absoluteCursor = absoluteCursor % pDataStream->totalLengthInPCMFrames;
}
c89atomic_exchange_64(&pDataStream->absoluteCursor, absoluteCursor);
}
MA_API ma_result ma_resource_manager_data_stream_init_ex(ma_resource_manager* pResourceManager, const ma_resource_manager_data_source_config* pConfig, ma_resource_manager_data_stream* pDataStream)
{
ma_result result;
...
...
@@ -64394,6 +64404,9 @@ MA_API ma_result ma_resource_manager_data_stream_init_ex(ma_resource_manager* pR
ma_resource_manager_pipeline_notifications_acquire_all_fences(¬ifications);
/* Set the absolute cursor to our initial seek position so retrieval of the cursor returns a good value. */
ma_resource_manager_data_stream_set_absolute_cursor(pDataStream, pConfig->initialSeekPointInPCMFrames);
/* We now have everything we need to post the job. This is the last thing we need to do from here. The rest will be done by the job thread. */
job = ma_resource_manager_job_init(MA_RESOURCE_MANAGER_JOB_LOAD_DATA_STREAM);
job.order = ma_resource_manager_data_stream_next_execution_order(pDataStream);
...
...
@@ -64615,16 +64628,6 @@ static ma_result ma_resource_manager_data_stream_map(ma_resource_manager_data_st
return MA_SUCCESS;
}
static void ma_resource_manager_data_stream_set_absolute_cursor(ma_resource_manager_data_stream* pDataStream, ma_uint64 absoluteCursor)
{
/* Loop if possible. */
if (absoluteCursor > pDataStream->totalLengthInPCMFrames && pDataStream->totalLengthInPCMFrames > 0) {
absoluteCursor = absoluteCursor % pDataStream->totalLengthInPCMFrames;
}
c89atomic_exchange_64(&pDataStream->absoluteCursor, absoluteCursor);
}
static ma_result ma_resource_manager_data_stream_unmap(ma_resource_manager_data_stream* pDataStream, ma_uint64 frameCount)
{
ma_uint32 newRelativeCursor;
...
...
@@ -64836,6 +64839,8 @@ MA_API ma_result ma_resource_manager_data_stream_get_data_format(ma_resource_man
MA_API ma_result ma_resource_manager_data_stream_get_cursor_in_pcm_frames(ma_resource_manager_data_stream* pDataStream, ma_uint64* pCursor)
{
ma_result result;
if (pCursor == NULL) {
return MA_INVALID_ARGS;
}
...
...
@@ -64849,11 +64854,17 @@ MA_API ma_result ma_resource_manager_data_stream_get_cursor_in_pcm_frames(ma_res
return MA_INVALID_ARGS;
}
if (ma_resource_manager_data_stream_result(pDataStream) != MA_SUCCESS) {
/*
If the stream is in an erroneous state we need to return an invalid operation. We can allow
this to be called when the data stream is in a busy state because the caller may have asked
for an initial seek position and it's convenient to return that as the cursor position.
*/
result = ma_resource_manager_data_stream_result(pDataStream);
if (result != MA_SUCCESS && result != MA_BUSY) {
return MA_INVALID_OPERATION;
}
*pCursor = pDataStream->absoluteCursor
;
c89atomic_exchange_64(pCursor, pDataStream->absoluteCursor)
;
return MA_SUCCESS;
}
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