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
bb4078cc
Commit
bb4078cc
authored
Nov 14, 2021
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a bug when reading from a looped data source with a range.
parent
efa95d99
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
miniaudio.h
miniaudio.h
+12
-3
No files found.
miniaudio.h
View file @
bb4078cc
...
...
@@ -52269,7 +52269,16 @@ static ma_result ma_data_source_read_pcm_frames_within_range(ma_data_source* pDa
frameCount = (rangeEnd - cursor);
}
result = pDataSourceBase->vtable->onRead(pDataSourceBase, pFramesOut, frameCount, &framesRead);
/*
If the cursor is sitting on the end of the range the frame count will be set to 0 which can
result in MA_INVALID_ARGS. In this case, we don't want to try reading, but instead return
MA_AT_END so the higher level function can know about it.
*/
if (frameCount > 0) {
result = pDataSourceBase->vtable->onRead(pDataSourceBase, pFramesOut, frameCount, &framesRead);
} else {
result = MA_AT_END; /* The cursor is sitting on the end of the range which means we're at the end. */
}
}
}
...
...
@@ -52356,8 +52365,8 @@ MA_API ma_result ma_data_source_read_pcm_frames(ma_data_source* pDataSource, voi
}
/*
We can determine if we've reached the end by checking
the return value of the onRead()
callback
. To loop back to the start, all we need to do is seek back to the first frame.
We can determine if we've reached the end by checking
if ma_data_source_read_pcm_frames_within_range() returned
MA_AT_END
. To loop back to the start, all we need to do is seek back to the first frame.
*/
if (result == MA_AT_END) {
/*
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