Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
7dce1418
Commit
7dce1418
authored
May 14, 2012
by
Andrew Eikum
Committed by
Alexandre Julliard
May 14, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dsound: Base fragment size off of the MMDevice's period.
parent
1053bfb4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
29 deletions
+16
-29
dsound_private.h
dlls/dsound/dsound_private.h
+0
-1
primary.c
dlls/dsound/primary.c
+16
-28
No files found.
dlls/dsound/dsound_private.h
View file @
7dce1418
...
...
@@ -276,7 +276,6 @@ HRESULT DSOUND_Create8(REFIID riid, LPDIRECTSOUND8 *ppDS) DECLSPEC_HIDDEN;
/* primary.c */
DWORD
DSOUND_fraglen
(
DWORD
nSamplesPerSec
,
DWORD
nBlockAlign
)
DECLSPEC_HIDDEN
;
HRESULT
DSOUND_PrimaryCreate
(
DirectSoundDevice
*
device
)
DECLSPEC_HIDDEN
;
HRESULT
DSOUND_PrimaryDestroy
(
DirectSoundDevice
*
device
)
DECLSPEC_HIDDEN
;
HRESULT
DSOUND_PrimaryPlay
(
DirectSoundDevice
*
device
)
DECLSPEC_HIDDEN
;
...
...
dlls/dsound/primary.c
View file @
7dce1418
...
...
@@ -40,41 +40,29 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
dsound
);
/** Calculate how long a fragment length of about 10 ms should be in frames
*
* nSamplesPerSec: Frequency rate in samples per second
* nBlockAlign: Size of a single blockalign
*
* Returns:
* Size in bytes of a single fragment
*/
DWORD
DSOUND_fraglen
(
DWORD
nSamplesPerSec
,
DWORD
nBlockAlign
)
static
DWORD
DSOUND_fraglen
(
DirectSoundDevice
*
device
)
{
/* Given a timer delay of 10ms, the fragment size is approximately:
* fraglen = (nSamplesPerSec * 10 / 1000) * nBlockAlign
* ==> fraglen = (nSamplesPerSec / 100) * nBlockSize
*
* ALSA uses buffers that are powers of 2. Because of this, fraglen
* is rounded up to the nearest power of 2:
*/
if
(
nSamplesPerSec
<=
12800
)
return
128
*
nBlockAlign
;
if
(
nSamplesPerSec
<=
25600
)
return
256
*
nBlockAlign
;
if
(
nSamplesPerSec
<=
51200
)
return
512
*
nBlockAlign
;
REFERENCE_TIME
period
;
HRESULT
hr
;
DWORD
ret
;
return
1024
*
nBlockAlign
;
hr
=
IAudioClient_GetDevicePeriod
(
device
->
client
,
&
period
,
NULL
);
if
(
FAILED
(
hr
)){
/* just guess at 10ms */
WARN
(
"GetDevicePeriod failed: %08x
\n
"
,
hr
);
ret
=
MulDiv
(
device
->
pwfx
->
nBlockAlign
,
device
->
pwfx
->
nSamplesPerSec
,
100
);
}
else
ret
=
MulDiv
(
device
->
pwfx
->
nSamplesPerSec
*
device
->
pwfx
->
nBlockAlign
,
period
,
10000000
);
ret
-=
ret
%
device
->
pwfx
->
nBlockAlign
;
return
ret
;
}
static
void
DSOUND_RecalcPrimary
(
DirectSoundDevice
*
device
)
{
TRACE
(
"(%p)
\n
"
,
device
);
device
->
fraglen
=
DSOUND_fraglen
(
device
->
pwfx
->
nSamplesPerSec
,
device
->
pwfx
->
nBlockAlign
);
device
->
fraglen
=
DSOUND_fraglen
(
device
);
device
->
helfrags
=
device
->
buflen
/
device
->
fraglen
;
TRACE
(
"fraglen=%d helfrags=%d
\n
"
,
device
->
fraglen
,
device
->
helfrags
);
...
...
@@ -114,7 +102,7 @@ HRESULT DSOUND_ReopenDevice(DirectSoundDevice *device, BOOL forcewave)
return
hres
;
}
prebuf_frames
=
device
->
prebuf
*
DSOUND_fraglen
(
device
->
pwfx
->
nSamplesPerSec
,
device
->
pwfx
->
nBlockAlign
)
/
device
->
pwfx
->
nBlockAlign
;
prebuf_frames
=
device
->
prebuf
*
DSOUND_fraglen
(
device
)
/
device
->
pwfx
->
nBlockAlign
;
prebuf_rt
=
(
10000000
*
(
UINT64
)
prebuf_frames
)
/
device
->
pwfx
->
nSamplesPerSec
;
hres
=
IAudioClient_Initialize
(
device
->
client
,
...
...
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