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
d984e39e
Commit
d984e39e
authored
Oct 21, 2016
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve the main loop for DirectSound by making better use of periods.
parent
3180cadb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
mini_al.h
mini_al.h
+6
-1
No files found.
mini_al.h
View file @
d984e39e
...
...
@@ -1789,6 +1789,12 @@ static mal_uint32 mal_device__wait_for_frames__dsound(mal_device* pDevice)
{
mal_assert
(
pDevice
!=
NULL
);
// The timeout to use for putting the thread to sleep is based on the size of the buffer and the period count.
DWORD
timeoutInMilliseconds
=
(
pDevice
->
bufferSizeInFrames
/
(
pDevice
->
sampleRate
/
1000
))
/
pDevice
->
periods
;
if
(
timeoutInMilliseconds
<
1
)
{
timeoutInMilliseconds
=
1
;
}
while
(
!
pDevice
->
dsound
.
breakFromMainLoop
)
{
mal_uint32
framesAvailable
=
mal_device__get_available_frames__dsound
(
pDevice
);
if
(
framesAvailable
>
0
)
{
...
...
@@ -1796,7 +1802,6 @@ static mal_uint32 mal_device__wait_for_frames__dsound(mal_device* pDevice)
}
// If we get here it means we weren't able to find any frames. We'll just wait here for a bit.
const
DWORD
timeoutInMilliseconds
=
4
;
// <-- This affects latency. Should this be a property? Tie this to the period count?
DWORD
rc
=
WaitForMultipleObjects
(
1
,
&
pDevice
->
dsound
.
hStopEvent
,
FALSE
,
timeoutInMilliseconds
);
if
(
rc
==
WAIT_OBJECT_0
)
{
return
0
;
...
...
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