Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
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
Aleksandr Isakov
wine-fonts
Commits
7300f1b7
Commit
7300f1b7
authored
Jun 15, 2016
by
Andrew Eikum
Committed by
Alexandre Julliard
Jun 16, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dsound: Capture all available data on each period callback.
Signed-off-by:
Andrew Eikum
<
aeikum@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
7cb3b725
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
39 deletions
+43
-39
capture.c
dlls/dsound/capture.c
+43
-39
No files found.
dlls/dsound/capture.c
View file @
7300f1b7
...
...
@@ -876,11 +876,6 @@ static ULONG DirectSoundCaptureDevice_Release(
static
HRESULT
DSOUND_capture_data
(
DirectSoundCaptureDevice
*
device
)
{
HRESULT
hr
;
UINT32
packet_frames
,
packet_bytes
,
avail_bytes
,
skip_bytes
=
0
;
DWORD
flags
;
BYTE
*
buf
;
if
(
!
device
->
capture_buffer
||
device
->
state
==
STATE_STOPPED
)
return
S_FALSE
;
...
...
@@ -892,45 +887,54 @@ static HRESULT DSOUND_capture_data(DirectSoundCaptureDevice *device)
if
(
device
->
state
==
STATE_STARTING
)
device
->
state
=
STATE_CAPTURING
;
hr
=
IAudioCaptureClient_GetBuffer
(
device
->
capture
,
&
buf
,
&
packet_frames
,
&
flags
,
NULL
,
NULL
);
if
(
FAILED
(
hr
)){
WARN
(
"GetBuffer failed: %08x
\n
"
,
hr
);
return
hr
;
}
while
(
1
){
HRESULT
hr
;
UINT32
packet_frames
,
packet_bytes
,
avail_bytes
,
skip_bytes
=
0
;
DWORD
flags
;
BYTE
*
buf
;
hr
=
IAudioCaptureClient_GetBuffer
(
device
->
capture
,
&
buf
,
&
packet_frames
,
&
flags
,
NULL
,
NULL
);
if
(
FAILED
(
hr
)){
WARN
(
"GetBuffer failed: %08x
\n
"
,
hr
);
return
hr
;
}
if
(
hr
==
AUDCLNT_S_BUFFER_EMPTY
)
break
;
packet_bytes
=
packet_frames
*
device
->
pwfx
->
nBlockAlign
;
if
(
packet_bytes
>
device
->
buflen
){
TRACE
(
"audio glitch: dsound buffer too small for data
\n
"
);
skip_bytes
=
packet_bytes
-
device
->
buflen
;
packet_bytes
=
device
->
buflen
;
}
packet_bytes
=
packet_frames
*
device
->
pwfx
->
nBlockAlign
;
if
(
packet_bytes
>
device
->
buflen
){
TRACE
(
"audio glitch: dsound buffer too small for data
\n
"
);
skip_bytes
=
packet_bytes
-
device
->
buflen
;
packet_bytes
=
device
->
buflen
;
}
avail_bytes
=
device
->
buflen
-
device
->
write_pos_bytes
;
if
(
avail_bytes
>
packet_bytes
)
avail_bytes
=
packet_bytes
;
memcpy
(
device
->
buffer
+
device
->
write_pos_bytes
,
buf
+
skip_bytes
,
avail_bytes
);
capture_CheckNotify
(
device
->
capture_buffer
,
device
->
write_pos_bytes
,
avail_bytes
);
packet_bytes
-=
avail_bytes
;
if
(
packet_bytes
>
0
){
if
(
device
->
capture_buffer
->
flags
&
DSCBSTART_LOOPING
){
memcpy
(
device
->
buffer
,
buf
+
skip_bytes
+
avail_bytes
,
packet_bytes
);
capture_CheckNotify
(
device
->
capture_buffer
,
0
,
packet_bytes
);
}
else
{
device
->
state
=
STATE_STOPPED
;
capture_CheckNotify
(
device
->
capture_buffer
,
0
,
0
);
avail_bytes
=
device
->
buflen
-
device
->
write_pos_bytes
;
if
(
avail_bytes
>
packet_bytes
)
avail_bytes
=
packet_bytes
;
memcpy
(
device
->
buffer
+
device
->
write_pos_bytes
,
buf
+
skip_bytes
,
avail_bytes
);
capture_CheckNotify
(
device
->
capture_buffer
,
device
->
write_pos_bytes
,
avail_bytes
);
packet_bytes
-=
avail_bytes
;
if
(
packet_bytes
>
0
){
if
(
device
->
capture_buffer
->
flags
&
DSCBSTART_LOOPING
){
memcpy
(
device
->
buffer
,
buf
+
skip_bytes
+
avail_bytes
,
packet_bytes
);
capture_CheckNotify
(
device
->
capture_buffer
,
0
,
packet_bytes
);
}
else
{
device
->
state
=
STATE_STOPPED
;
capture_CheckNotify
(
device
->
capture_buffer
,
0
,
0
);
}
}
}
device
->
write_pos_bytes
+=
avail_bytes
+
packet_bytes
;
device
->
write_pos_bytes
%=
device
->
buflen
;
device
->
write_pos_bytes
+=
avail_bytes
+
packet_bytes
;
device
->
write_pos_bytes
%=
device
->
buflen
;
hr
=
IAudioCaptureClient_ReleaseBuffer
(
device
->
capture
,
packet_frames
);
if
(
FAILED
(
hr
)){
WARN
(
"ReleaseBuffer failed: %08x
\n
"
,
hr
);
return
hr
;
hr
=
IAudioCaptureClient_ReleaseBuffer
(
device
->
capture
,
packet_frames
);
if
(
FAILED
(
hr
)){
WARN
(
"ReleaseBuffer failed: %08x
\n
"
,
hr
);
return
hr
;
}
}
return
S_OK
;
...
...
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