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
3735ecac
Commit
3735ecac
authored
Sep 27, 2011
by
Andrew Eikum
Committed by
Alexandre Julliard
Sep 27, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dsound: Reimplement capturing devices on mmdevapi.
parent
e786998d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
271 additions
and
261 deletions
+271
-261
capture.c
dlls/dsound/capture.c
+249
-196
dsound.c
dlls/dsound/dsound.c
+2
-2
dsound_main.c
dlls/dsound/dsound_main.c
+6
-54
dsound_private.h
dlls/dsound/dsound_private.h
+14
-9
No files found.
dlls/dsound/capture.c
View file @
3735ecac
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include <stdarg.h>
#include <stdarg.h>
#define COBJMACROS
#define NONAMELESSSTRUCT
#define NONAMELESSSTRUCT
#define NONAMELESSUNION
#define NONAMELESSUNION
#include "windef.h"
#include "windef.h"
...
@@ -249,12 +250,14 @@ IDirectSoundCaptureBufferImpl_Release( LPDIRECTSOUNDCAPTUREBUFFER8 iface )
...
@@ -249,12 +250,14 @@ IDirectSoundCaptureBufferImpl_Release( LPDIRECTSOUNDCAPTUREBUFFER8 iface )
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pdscbd
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pdscbd
);
if
(
This
->
device
->
hwi
)
{
if
(
This
->
device
->
client
)
{
waveInReset
(
This
->
device
->
hwi
);
IAudioClient_Release
(
This
->
device
->
client
);
waveInClose
(
This
->
device
->
hwi
);
This
->
device
->
client
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
This
->
device
->
pwave
);
}
This
->
device
->
pwave
=
0
;
This
->
device
->
hwi
=
0
;
if
(
This
->
device
->
capture
)
{
IAudioCaptureClient_Release
(
This
->
device
->
capture
);
This
->
device
->
capture
=
NULL
;
}
}
/* remove from DirectSoundCaptureDevice */
/* remove from DirectSoundCaptureDevice */
...
@@ -309,7 +312,6 @@ IDirectSoundCaptureBufferImpl_GetCurrentPosition(
...
@@ -309,7 +312,6 @@ IDirectSoundCaptureBufferImpl_GetCurrentPosition(
LPDWORD
lpdwReadPosition
)
LPDWORD
lpdwReadPosition
)
{
{
IDirectSoundCaptureBufferImpl
*
This
=
(
IDirectSoundCaptureBufferImpl
*
)
iface
;
IDirectSoundCaptureBufferImpl
*
This
=
(
IDirectSoundCaptureBufferImpl
*
)
iface
;
HRESULT
hres
=
DS_OK
;
TRACE
(
"(%p,%p,%p)
\n
"
,
This
,
lpdwCapturePosition
,
lpdwReadPosition
);
TRACE
(
"(%p,%p,%p)
\n
"
,
This
,
lpdwCapturePosition
,
lpdwReadPosition
);
if
(
This
->
device
==
NULL
)
{
if
(
This
->
device
==
NULL
)
{
...
@@ -317,25 +319,26 @@ IDirectSoundCaptureBufferImpl_GetCurrentPosition(
...
@@ -317,25 +319,26 @@ IDirectSoundCaptureBufferImpl_GetCurrentPosition(
return
DSERR_INVALIDPARAM
;
return
DSERR_INVALIDPARAM
;
}
}
if
(
This
->
device
->
hwi
)
{
DWORD
pos
;
EnterCriticalSection
(
&
This
->
device
->
lock
);
EnterCriticalSection
(
&
This
->
device
->
lock
);
pos
=
(
DWORD_PTR
)
This
->
device
->
pwave
[
This
->
device
->
index
].
lpData
-
(
DWORD_PTR
)
This
->
device
->
buffer
;
if
(
lpdwCapturePosition
)
*
lpdwCapturePosition
=
(
This
->
device
->
pwave
[
This
->
device
->
index
].
dwBufferLength
+
pos
)
%
This
->
device
->
buflen
;
if
(
lpdwReadPosition
)
*
lpdwReadPosition
=
pos
;
LeaveCriticalSection
(
&
This
->
device
->
lock
);
}
else
{
if
(
!
This
->
device
->
client
)
{
LeaveCriticalSection
(
&
This
->
device
->
lock
);
WARN
(
"no driver
\n
"
);
WARN
(
"no driver
\n
"
);
hres
=
DSERR_NODRIVER
;
return
DSERR_NODRIVER
;
}
}
if
(
lpdwCapturePosition
)
*
lpdwCapturePosition
=
This
->
device
->
write_pos_bytes
;
if
(
lpdwReadPosition
)
*
lpdwReadPosition
=
This
->
device
->
write_pos_bytes
;
LeaveCriticalSection
(
&
This
->
device
->
lock
);
TRACE
(
"cappos=%d readpos=%d
\n
"
,
(
lpdwCapturePosition
?*
lpdwCapturePosition
:-
1
),
(
lpdwReadPosition
?*
lpdwReadPosition
:-
1
));
TRACE
(
"cappos=%d readpos=%d
\n
"
,
(
lpdwCapturePosition
?*
lpdwCapturePosition
:-
1
),
(
lpdwReadPosition
?*
lpdwReadPosition
:-
1
));
TRACE
(
"returning %08x
\n
"
,
hres
);
TRACE
(
"returning DS_OK
\n
"
);
return
hres
;
return
DS_OK
;
}
}
static
HRESULT
WINAPI
static
HRESULT
WINAPI
...
@@ -460,7 +463,7 @@ IDirectSoundCaptureBufferImpl_Lock(
...
@@ -460,7 +463,7 @@ IDirectSoundCaptureBufferImpl_Lock(
EnterCriticalSection
(
&
(
This
->
device
->
lock
));
EnterCriticalSection
(
&
(
This
->
device
->
lock
));
if
(
This
->
device
->
hwi
)
{
if
(
This
->
device
->
client
)
{
*
lplpvAudioPtr1
=
This
->
device
->
buffer
+
dwReadCusor
;
*
lplpvAudioPtr1
=
This
->
device
->
buffer
+
dwReadCusor
;
if
(
(
dwReadCusor
+
dwReadBytes
)
>
This
->
device
->
buflen
)
{
if
(
(
dwReadCusor
+
dwReadBytes
)
>
This
->
device
->
buflen
)
{
*
lpdwAudioBytes1
=
This
->
device
->
buflen
-
dwReadCusor
;
*
lpdwAudioBytes1
=
This
->
device
->
buflen
-
dwReadCusor
;
...
@@ -491,8 +494,9 @@ IDirectSoundCaptureBufferImpl_Start(
...
@@ -491,8 +494,9 @@ IDirectSoundCaptureBufferImpl_Start(
LPDIRECTSOUNDCAPTUREBUFFER8
iface
,
LPDIRECTSOUNDCAPTUREBUFFER8
iface
,
DWORD
dwFlags
)
DWORD
dwFlags
)
{
{
HRESULT
hres
=
DS_OK
;
HRESULT
hres
;
IDirectSoundCaptureBufferImpl
*
This
=
(
IDirectSoundCaptureBufferImpl
*
)
iface
;
IDirectSoundCaptureBufferImpl
*
This
=
(
IDirectSoundCaptureBufferImpl
*
)
iface
;
TRACE
(
"(%p,0x%08x)
\n
"
,
This
,
dwFlags
);
TRACE
(
"(%p,0x%08x)
\n
"
,
This
,
dwFlags
);
if
(
This
->
device
==
NULL
)
{
if
(
This
->
device
==
NULL
)
{
...
@@ -500,7 +504,7 @@ IDirectSoundCaptureBufferImpl_Start(
...
@@ -500,7 +504,7 @@ IDirectSoundCaptureBufferImpl_Start(
return
DSERR_INVALIDPARAM
;
return
DSERR_INVALIDPARAM
;
}
}
if
(
This
->
device
->
hwi
==
0
)
{
if
(
!
This
->
device
->
client
)
{
WARN
(
"no driver
\n
"
);
WARN
(
"no driver
\n
"
);
return
DSERR_NODRIVER
;
return
DSERR_NODRIVER
;
}
}
...
@@ -508,87 +512,33 @@ IDirectSoundCaptureBufferImpl_Start(
...
@@ -508,87 +512,33 @@ IDirectSoundCaptureBufferImpl_Start(
EnterCriticalSection
(
&
(
This
->
device
->
lock
));
EnterCriticalSection
(
&
(
This
->
device
->
lock
));
This
->
flags
=
dwFlags
;
This
->
flags
=
dwFlags
;
TRACE
(
"old This->state=%s
\n
"
,
captureStateString
[
This
->
device
->
state
]);
TRACE
(
"old This->
device->
state=%s
\n
"
,
captureStateString
[
This
->
device
->
state
]);
if
(
This
->
device
->
state
==
STATE_STOPPED
)
if
(
This
->
device
->
state
==
STATE_STOPPED
)
This
->
device
->
state
=
STATE_STARTING
;
This
->
device
->
state
=
STATE_STARTING
;
else
if
(
This
->
device
->
state
==
STATE_STOPPING
)
else
if
(
This
->
device
->
state
==
STATE_STOPPING
)
This
->
device
->
state
=
STATE_CAPTURING
;
This
->
device
->
state
=
STATE_CAPTURING
;
TRACE
(
"new This->device->state=%s
\n
"
,
captureStateString
[
This
->
device
->
state
]);
TRACE
(
"new This->device->state=%s
\n
"
,
captureStateString
[
This
->
device
->
state
]);
LeaveCriticalSection
(
&
(
This
->
device
->
lock
));
if
(
This
->
device
->
buffer
)
FillMemory
(
This
->
device
->
buffer
,
This
->
device
->
buflen
,
(
This
->
device
->
pwfx
->
wBitsPerSample
==
8
)
?
128
:
0
);
if
(
This
->
device
->
hwi
)
{
DirectSoundCaptureDevice
*
device
=
This
->
device
;
if
(
device
->
buffer
)
{
int
c
;
DWORD
blocksize
=
DSOUND_fraglen
(
device
->
pwfx
->
nSamplesPerSec
,
device
->
pwfx
->
nBlockAlign
);
device
->
nrofpwaves
=
device
->
buflen
/
blocksize
+
!!
(
device
->
buflen
%
blocksize
);
TRACE
(
"nrofpwaves=%d
\n
"
,
device
->
nrofpwaves
);
/* prepare headers */
if
(
device
->
pwave
)
device
->
pwave
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
device
->
pwave
,
device
->
nrofpwaves
*
sizeof
(
WAVEHDR
));
else
device
->
pwave
=
HeapAlloc
(
GetProcessHeap
(),
0
,
device
->
nrofpwaves
*
sizeof
(
WAVEHDR
));
for
(
c
=
0
;
c
<
device
->
nrofpwaves
;
++
c
)
{
hres
=
IAudioClient_Start
(
This
->
device
->
client
);
device
->
pwave
[
c
].
lpData
=
(
char
*
)
device
->
buffer
+
c
*
blocksize
;
if
(
FAILED
(
hres
)){
if
(
c
+
1
==
device
->
nrofpwaves
)
WARN
(
"Start failed: %08x
\n
"
,
hres
);
device
->
pwave
[
c
].
dwBufferLength
=
device
->
buflen
-
c
*
blocksize
;
LeaveCriticalSection
(
&
This
->
device
->
lock
);
else
return
hres
;
device
->
pwave
[
c
].
dwBufferLength
=
blocksize
;
device
->
pwave
[
c
].
dwBytesRecorded
=
0
;
device
->
pwave
[
c
].
dwUser
=
(
DWORD_PTR
)
device
;
device
->
pwave
[
c
].
dwFlags
=
0
;
device
->
pwave
[
c
].
dwLoops
=
0
;
hres
=
mmErr
(
waveInPrepareHeader
(
device
->
hwi
,
&
(
device
->
pwave
[
c
]),
sizeof
(
WAVEHDR
)));
if
(
hres
!=
DS_OK
)
{
WARN
(
"waveInPrepareHeader failed
\n
"
);
while
(
c
--
)
waveInUnprepareHeader
(
device
->
hwi
,
&
(
device
->
pwave
[
c
]),
sizeof
(
WAVEHDR
));
break
;
}
hres
=
mmErr
(
waveInAddBuffer
(
device
->
hwi
,
&
(
device
->
pwave
[
c
]),
sizeof
(
WAVEHDR
)));
if
(
hres
!=
DS_OK
)
{
WARN
(
"waveInAddBuffer failed
\n
"
);
while
(
c
--
)
waveInUnprepareHeader
(
device
->
hwi
,
&
(
device
->
pwave
[
c
]),
sizeof
(
WAVEHDR
));
break
;
}
}
FillMemory
(
device
->
buffer
,
device
->
buflen
,
(
device
->
pwfx
->
wBitsPerSample
==
8
)
?
128
:
0
);
}
device
->
index
=
0
;
if
(
hres
==
DS_OK
)
{
/* start filling the first buffer */
hres
=
mmErr
(
waveInStart
(
device
->
hwi
));
if
(
hres
!=
DS_OK
)
WARN
(
"waveInStart failed
\n
"
);
}
}
if
(
hres
!=
DS_OK
)
{
LeaveCriticalSection
(
&
This
->
device
->
lock
);
WARN
(
"calling waveInClose because of error
\n
"
);
waveInClose
(
device
->
hwi
);
device
->
hwi
=
0
;
}
}
else
{
WARN
(
"no driver
\n
"
);
hres
=
DSERR_NODRIVER
;
}
TRACE
(
"returning
%08x
\n
"
,
hres
);
TRACE
(
"returning
DS_OK
\n
"
);
return
hres
;
return
DS_OK
;
}
}
static
HRESULT
WINAPI
static
HRESULT
WINAPI
IDirectSoundCaptureBufferImpl_Stop
(
LPDIRECTSOUNDCAPTUREBUFFER8
iface
)
IDirectSoundCaptureBufferImpl_Stop
(
LPDIRECTSOUNDCAPTUREBUFFER8
iface
)
{
{
HRESULT
hres
=
DS_OK
;
HRESULT
hres
;
IDirectSoundCaptureBufferImpl
*
This
=
(
IDirectSoundCaptureBufferImpl
*
)
iface
;
IDirectSoundCaptureBufferImpl
*
This
=
(
IDirectSoundCaptureBufferImpl
*
)
iface
;
TRACE
(
"(%p)
\n
"
,
This
);
TRACE
(
"(%p)
\n
"
,
This
);
...
@@ -606,19 +556,18 @@ IDirectSoundCaptureBufferImpl_Stop( LPDIRECTSOUNDCAPTUREBUFFER8 iface )
...
@@ -606,19 +556,18 @@ IDirectSoundCaptureBufferImpl_Stop( LPDIRECTSOUNDCAPTUREBUFFER8 iface )
This
->
device
->
state
=
STATE_STOPPED
;
This
->
device
->
state
=
STATE_STOPPED
;
TRACE
(
"new This->device->state=%s
\n
"
,
captureStateString
[
This
->
device
->
state
]);
TRACE
(
"new This->device->state=%s
\n
"
,
captureStateString
[
This
->
device
->
state
]);
LeaveCriticalSection
(
&
(
This
->
device
->
lock
));
if
(
This
->
device
->
client
){
hres
=
IAudioClient_Stop
(
This
->
device
->
client
);
if
(
This
->
device
->
hwi
)
{
if
(
FAILED
(
hres
)){
hres
=
mmErr
(
waveInReset
(
This
->
device
->
hwi
));
LeaveCriticalSection
(
&
This
->
device
->
lock
);
if
(
hres
!=
DS_OK
)
return
hres
;
WARN
(
"waveInReset() failed
\n
"
);
}
}
else
{
WARN
(
"no driver
\n
"
);
hres
=
DSERR_NODRIVER
;
}
}
TRACE
(
"returning %08x
\n
"
,
hres
);
LeaveCriticalSection
(
&
(
This
->
device
->
lock
));
return
hres
;
TRACE
(
"returning DS_OK
\n
"
);
return
DS_OK
;
}
}
static
HRESULT
WINAPI
static
HRESULT
WINAPI
...
@@ -639,7 +588,7 @@ IDirectSoundCaptureBufferImpl_Unlock(
...
@@ -639,7 +588,7 @@ IDirectSoundCaptureBufferImpl_Unlock(
return
DSERR_INVALIDPARAM
;
return
DSERR_INVALIDPARAM
;
}
}
if
(
!
This
->
device
->
hwi
)
{
if
(
!
This
->
device
->
client
)
{
WARN
(
"invalid call
\n
"
);
WARN
(
"invalid call
\n
"
);
hres
=
DSERR_INVALIDCALL
;
hres
=
DSERR_INVALIDCALL
;
}
}
...
@@ -725,49 +674,6 @@ static void capture_CheckNotify(IDirectSoundCaptureBufferImpl *This, DWORD from,
...
@@ -725,49 +674,6 @@ static void capture_CheckNotify(IDirectSoundCaptureBufferImpl *This, DWORD from,
}
}
}
}
static
void
CALLBACK
DSOUND_capture_callback
(
HWAVEIN
hwi
,
UINT
msg
,
DWORD_PTR
dwUser
,
DWORD_PTR
dw1
,
DWORD_PTR
dw2
)
{
DirectSoundCaptureDevice
*
This
=
(
DirectSoundCaptureDevice
*
)
dwUser
;
IDirectSoundCaptureBufferImpl
*
Moi
=
This
->
capture_buffer
;
TRACE
(
"(%p,%08x(%s),%08lx,%08lx,%08lx) entering at %d
\n
"
,
hwi
,
msg
,
msg
==
MM_WIM_OPEN
?
"MM_WIM_OPEN"
:
msg
==
MM_WIM_CLOSE
?
"MM_WIM_CLOSE"
:
msg
==
MM_WIM_DATA
?
"MM_WIM_DATA"
:
"UNKNOWN"
,
dwUser
,
dw1
,
dw2
,
GetTickCount
());
if
(
msg
==
MM_WIM_DATA
)
{
EnterCriticalSection
(
&
(
This
->
lock
)
);
TRACE
(
"DirectSoundCapture msg=MM_WIM_DATA, old This->state=%s, old This->index=%d
\n
"
,
captureStateString
[
This
->
state
],
This
->
index
);
if
(
This
->
state
!=
STATE_STOPPED
)
{
int
index
=
This
->
index
;
if
(
This
->
state
==
STATE_STARTING
)
This
->
state
=
STATE_CAPTURING
;
capture_CheckNotify
(
Moi
,
(
DWORD_PTR
)
This
->
pwave
[
index
].
lpData
-
(
DWORD_PTR
)
This
->
buffer
,
This
->
pwave
[
index
].
dwBufferLength
);
This
->
index
=
(
This
->
index
+
1
)
%
This
->
nrofpwaves
;
if
(
(
This
->
index
==
0
)
&&
!
(
This
->
capture_buffer
->
flags
&
DSCBSTART_LOOPING
)
)
{
TRACE
(
"end of buffer
\n
"
);
This
->
state
=
STATE_STOPPED
;
capture_CheckNotify
(
Moi
,
0
,
0
);
}
else
{
if
(
This
->
state
==
STATE_CAPTURING
)
{
waveInUnprepareHeader
(
hwi
,
&
(
This
->
pwave
[
index
]),
sizeof
(
WAVEHDR
));
waveInPrepareHeader
(
hwi
,
&
(
This
->
pwave
[
index
]),
sizeof
(
WAVEHDR
));
waveInAddBuffer
(
hwi
,
&
(
This
->
pwave
[
index
]),
sizeof
(
WAVEHDR
));
}
else
if
(
This
->
state
==
STATE_STOPPING
)
{
TRACE
(
"stopping
\n
"
);
This
->
state
=
STATE_STOPPED
;
}
}
}
TRACE
(
"DirectSoundCapture new This->state=%s, new This->index=%d
\n
"
,
captureStateString
[
This
->
state
],
This
->
index
);
LeaveCriticalSection
(
&
(
This
->
lock
)
);
}
TRACE
(
"completed
\n
"
);
}
static
HRESULT
IDirectSoundCaptureBufferImpl_Create
(
static
HRESULT
IDirectSoundCaptureBufferImpl_Create
(
DirectSoundCaptureDevice
*
device
,
DirectSoundCaptureDevice
*
device
,
IDirectSoundCaptureBufferImpl
**
ppobj
,
IDirectSoundCaptureBufferImpl
**
ppobj
,
...
@@ -849,12 +755,38 @@ static HRESULT IDirectSoundCaptureBufferImpl_Create(
...
@@ -849,12 +755,38 @@ static HRESULT IDirectSoundCaptureBufferImpl_Create(
This
->
lpVtbl
=
&
dscbvt
;
This
->
lpVtbl
=
&
dscbvt
;
err
=
mmErr
(
waveInOpen
(
&
(
device
->
hwi
),
err
=
IMMDevice_Activate
(
device
->
mmdevice
,
&
IID_IAudioClient
,
device
->
drvdesc
.
dnDevNode
,
device
->
pwfx
,
CLSCTX_INPROC_SERVER
,
NULL
,
(
void
**
)
&
device
->
client
);
(
DWORD_PTR
)
DSOUND_capture_callback
,
(
DWORD_PTR
)
device
,
if
(
FAILED
(
err
)){
CALLBACK_FUNCTION
|
WAVE_MAPPED
));
WARN
(
"Activate failed: %08x
\n
"
,
err
);
if
(
err
!=
DS_OK
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pdscbd
);
WARN
(
"waveInOpen failed
\n
"
);
This
->
device
->
capture_buffer
=
0
;
HeapFree
(
GetProcessHeap
(),
0
,
This
);
*
ppobj
=
NULL
;
return
err
;
}
err
=
IAudioClient_Initialize
(
device
->
client
,
AUDCLNT_SHAREMODE_SHARED
,
AUDCLNT_STREAMFLAGS_NOPERSIST
,
200
*
100000
,
50000
,
device
->
pwfx
,
NULL
);
if
(
FAILED
(
err
)){
WARN
(
"Initialize failed: %08x
\n
"
,
err
);
IAudioClient_Release
(
device
->
client
);
device
->
client
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pdscbd
);
This
->
device
->
capture_buffer
=
0
;
HeapFree
(
GetProcessHeap
(),
0
,
This
);
*
ppobj
=
NULL
;
return
err
;
}
err
=
IAudioClient_GetService
(
device
->
client
,
&
IID_IAudioCaptureClient
,
(
void
**
)
&
device
->
capture
);
if
(
FAILED
(
err
)){
WARN
(
"GetService failed: %08x
\n
"
,
err
);
IAudioClient_Release
(
device
->
client
);
device
->
client
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pdscbd
);
This
->
device
->
capture_buffer
=
0
;
This
->
device
->
capture_buffer
=
0
;
HeapFree
(
GetProcessHeap
(),
0
,
This
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
*
ppobj
=
NULL
;
*
ppobj
=
NULL
;
...
@@ -868,14 +800,19 @@ static HRESULT IDirectSoundCaptureBufferImpl_Create(
...
@@ -868,14 +800,19 @@ static HRESULT IDirectSoundCaptureBufferImpl_Create(
else
else
newbuf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
buflen
);
newbuf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
buflen
);
if
(
newbuf
==
NULL
)
{
if
(
newbuf
==
NULL
)
{
WARN
(
"failed to allocate capture buffer
\n
"
);
IAudioClient_Release
(
device
->
client
);
err
=
DSERR_OUTOFMEMORY
;
device
->
client
=
NULL
;
/* but the old buffer might still exist and must be re-prepared */
IAudioCaptureClient_Release
(
device
->
capture
);
}
else
{
device
->
capture
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pdscbd
);
This
->
device
->
capture_buffer
=
0
;
HeapFree
(
GetProcessHeap
(),
0
,
This
);
*
ppobj
=
NULL
;
return
DSERR_OUTOFMEMORY
;
}
device
->
buffer
=
newbuf
;
device
->
buffer
=
newbuf
;
device
->
buflen
=
buflen
;
device
->
buflen
=
buflen
;
}
}
}
TRACE
(
"returning DS_OK
\n
"
);
TRACE
(
"returning DS_OK
\n
"
);
return
DS_OK
;
return
DS_OK
;
...
@@ -920,30 +857,137 @@ static ULONG DirectSoundCaptureDevice_Release(
...
@@ -920,30 +857,137 @@ static ULONG DirectSoundCaptureDevice_Release(
if
(
!
ref
)
{
if
(
!
ref
)
{
TRACE
(
"deleting object
\n
"
);
TRACE
(
"deleting object
\n
"
);
timeKillEvent
(
device
->
timerID
);
timeEndPeriod
(
DS_TIME_RES
);
EnterCriticalSection
(
&
DSOUND_capturers_lock
);
list_remove
(
&
device
->
entry
);
LeaveCriticalSection
(
&
DSOUND_capturers_lock
);
if
(
device
->
capture_buffer
)
if
(
device
->
capture_buffer
)
IDirectSoundCaptureBufferImpl_Release
(
IDirectSoundCaptureBufferImpl_Release
(
(
LPDIRECTSOUNDCAPTUREBUFFER8
)
device
->
capture_buffer
);
(
LPDIRECTSOUNDCAPTUREBUFFER8
)
device
->
capture_buffer
);
if
(
device
->
mmdevice
)
IMMDevice_Release
(
device
->
mmdevice
);
HeapFree
(
GetProcessHeap
(),
0
,
device
->
pwfx
);
HeapFree
(
GetProcessHeap
(),
0
,
device
->
pwfx
);
device
->
lock
.
DebugInfo
->
Spare
[
0
]
=
0
;
device
->
lock
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
(
device
->
lock
)
);
DeleteCriticalSection
(
&
(
device
->
lock
)
);
DSOUND_capture
[
device
->
drvdesc
.
dnDevNode
]
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
device
);
HeapFree
(
GetProcessHeap
(),
0
,
device
);
TRACE
(
"(%p) released
\n
"
,
device
);
TRACE
(
"(%p) released
\n
"
,
device
);
}
}
return
ref
;
return
ref
;
}
}
void
CALLBACK
DSOUND_capture_timer
(
UINT
timerID
,
UINT
msg
,
DWORD_PTR
user
,
DWORD_PTR
dw1
,
DWORD_PTR
dw2
)
{
DirectSoundCaptureDevice
*
device
=
(
DirectSoundCaptureDevice
*
)
user
;
UINT32
packet_frames
,
packet_bytes
,
avail_bytes
;
DWORD
flags
;
BYTE
*
buf
;
HRESULT
hr
;
if
(
!
device
->
ref
)
return
;
EnterCriticalSection
(
&
device
->
lock
);
if
(
!
device
->
capture_buffer
||
device
->
state
==
STATE_STOPPED
){
LeaveCriticalSection
(
&
device
->
lock
);
return
;
}
if
(
device
->
state
==
STATE_STOPPING
){
device
->
state
=
STATE_STOPPED
;
LeaveCriticalSection
(
&
device
->
lock
);
return
;
}
if
(
device
->
state
==
STATE_STARTING
)
device
->
state
=
STATE_CAPTURING
;
hr
=
IAudioCaptureClient_GetBuffer
(
device
->
capture
,
&
buf
,
&
packet_frames
,
&
flags
,
NULL
,
NULL
);
if
(
FAILED
(
hr
)){
LeaveCriticalSection
(
&
device
->
lock
);
WARN
(
"GetBuffer failed: %08x
\n
"
,
hr
);
return
;
}
packet_bytes
=
packet_frames
*
device
->
pwfx
->
nBlockAlign
;
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
,
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
+
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
;
hr
=
IAudioCaptureClient_ReleaseBuffer
(
device
->
capture
,
packet_frames
);
if
(
FAILED
(
hr
)){
LeaveCriticalSection
(
&
device
->
lock
);
WARN
(
"ReleaseBuffer failed: %08x
\n
"
,
hr
);
return
;
}
LeaveCriticalSection
(
&
device
->
lock
);
}
static
struct
_TestFormat
{
DWORD
flag
;
DWORD
rate
;
DWORD
depth
;
WORD
channels
;
}
formats_to_test
[]
=
{
{
WAVE_FORMAT_1M08
,
11025
,
8
,
1
},
{
WAVE_FORMAT_1M16
,
11025
,
16
,
1
},
{
WAVE_FORMAT_1S08
,
11025
,
8
,
2
},
{
WAVE_FORMAT_1S16
,
11025
,
16
,
2
},
{
WAVE_FORMAT_2M08
,
22050
,
8
,
1
},
{
WAVE_FORMAT_2M16
,
22050
,
16
,
1
},
{
WAVE_FORMAT_2S08
,
22050
,
8
,
2
},
{
WAVE_FORMAT_2S16
,
22050
,
16
,
2
},
{
WAVE_FORMAT_4M08
,
44100
,
8
,
1
},
{
WAVE_FORMAT_4M16
,
44100
,
16
,
1
},
{
WAVE_FORMAT_4S08
,
44100
,
8
,
2
},
{
WAVE_FORMAT_4S16
,
44100
,
16
,
2
},
{
WAVE_FORMAT_48M08
,
48000
,
8
,
1
},
{
WAVE_FORMAT_48M16
,
48000
,
16
,
1
},
{
WAVE_FORMAT_48S08
,
48000
,
8
,
2
},
{
WAVE_FORMAT_48S16
,
48000
,
16
,
2
},
{
WAVE_FORMAT_96M08
,
96000
,
8
,
1
},
{
WAVE_FORMAT_96M16
,
96000
,
16
,
1
},
{
WAVE_FORMAT_96S08
,
96000
,
8
,
2
},
{
WAVE_FORMAT_96S16
,
96000
,
16
,
2
},
{
0
}
};
static
HRESULT
DirectSoundCaptureDevice_Initialize
(
static
HRESULT
DirectSoundCaptureDevice_Initialize
(
DirectSoundCaptureDevice
**
ppDevice
,
DirectSoundCaptureDevice
**
ppDevice
,
LPCGUID
lpcGUID
)
LPCGUID
lpcGUID
)
{
{
HRESULT
err
=
DSERR_INVALIDPARAM
;
HRESULT
hr
;
unsigned
wid
,
widn
;
BOOLEAN
found
=
FALSE
;
GUID
devGUID
;
GUID
devGUID
;
DirectSoundCaptureDevice
*
device
=
*
ppDevice
;
IMMDevice
*
mmdevice
;
WAVEINCAPSA
wic
;
struct
_TestFormat
*
fmt
;
DirectSoundCaptureDevice
*
device
;
IAudioClient
*
client
;
TRACE
(
"(%p, %s)
\n
"
,
ppDevice
,
debugstr_guid
(
lpcGUID
));
TRACE
(
"(%p, %s)
\n
"
,
ppDevice
,
debugstr_guid
(
lpcGUID
));
...
@@ -951,63 +995,72 @@ static HRESULT DirectSoundCaptureDevice_Initialize(
...
@@ -951,63 +995,72 @@ static HRESULT DirectSoundCaptureDevice_Initialize(
if
(
!
lpcGUID
||
IsEqualGUID
(
lpcGUID
,
&
GUID_NULL
)
)
if
(
!
lpcGUID
||
IsEqualGUID
(
lpcGUID
,
&
GUID_NULL
)
)
lpcGUID
=
&
DSDEVID_DefaultCapture
;
lpcGUID
=
&
DSDEVID_DefaultCapture
;
if
(
IsEqualGUID
(
lpcGUID
,
&
DSDEVID_DefaultPlayback
)
||
IsEqualGUID
(
lpcGUID
,
&
DSDEVID_DefaultVoicePlayback
))
return
DSERR_NODRIVER
;
if
(
GetDeviceID
(
lpcGUID
,
&
devGUID
)
!=
DS_OK
)
{
if
(
GetDeviceID
(
lpcGUID
,
&
devGUID
)
!=
DS_OK
)
{
WARN
(
"invalid parameter: lpcGUID
\n
"
);
WARN
(
"invalid parameter: lpcGUID
\n
"
);
return
DSERR_INVALIDPARAM
;
return
DSERR_INVALIDPARAM
;
}
}
widn
=
waveInGetNumDevs
();
hr
=
get_mmdevice
(
eCapture
,
&
devGUID
,
&
mmdevice
);
if
(
!
widn
)
{
if
(
FAILED
(
hr
))
WARN
(
"no audio devices found
\n
"
);
return
hr
;
return
DSERR_NODRIVER
;
}
/* enumerate WINMM audio devices and find the one we want */
for
(
wid
=
0
;
wid
<
widn
;
wid
++
)
{
if
(
IsEqualGUID
(
&
devGUID
,
&
DSOUND_capture_guids
[
wid
])
)
{
found
=
TRUE
;
break
;
}
}
if
(
found
==
FALSE
)
{
EnterCriticalSection
(
&
DSOUND_capturers_lock
);
WARN
(
"No device found matching given ID!
\n
"
);
return
DSERR_NODRIVER
;
}
if
(
DSOUND_capture
[
wid
])
{
LIST_FOR_EACH_ENTRY
(
device
,
&
DSOUND_capturers
,
DirectSoundCaptureDevice
,
entry
){
WARN
(
"already in use
\n
"
);
if
(
IsEqualGUID
(
&
device
->
guid
,
&
devGUID
)){
IMMDevice_Release
(
mmdevice
);
LeaveCriticalSection
(
&
DSOUND_capturers_lock
);
return
DSERR_ALLOCATED
;
return
DSERR_ALLOCATED
;
}
}
}
err
=
DirectSoundCaptureDevice_Create
(
&
(
device
)
);
hr
=
DirectSoundCaptureDevice_Create
(
&
device
);
if
(
er
r
!=
DS_OK
)
{
if
(
h
r
!=
DS_OK
)
{
WARN
(
"DirectSoundCaptureDevice_Create failed
\n
"
);
WARN
(
"DirectSoundCaptureDevice_Create failed
\n
"
);
return
err
;
LeaveCriticalSection
(
&
DSOUND_capturers_lock
);
return
hr
;
}
}
*
ppDevice
=
device
;
device
->
guid
=
devGUID
;
device
->
guid
=
devGUID
;
device
->
mmdevice
=
mmdevice
;
device
->
drvdesc
.
dwFlags
=
0
;
device
->
drvdesc
.
dwFlags
=
0
;
device
->
drv
desc
.
dnDevNode
=
wid
;
device
->
drv
caps
.
dwFlags
=
0
;
*
ppDevice
=
device
;
device
->
drvcaps
.
dwFormats
=
0
;
device
->
drvcaps
.
dwChannels
=
0
;
hr
=
IMMDevice_Activate
(
mmdevice
,
&
IID_IAudioClient
,
CLSCTX_INPROC_SERVER
,
NULL
,
(
void
**
)
&
client
);
if
(
FAILED
(
hr
)){
DeleteCriticalSection
(
&
device
->
lock
);
HeapFree
(
GetProcessHeap
(),
0
,
device
);
return
DSERR_NODRIVER
;
}
err
=
mmErr
(
waveInGetDevCapsA
((
UINT
)
device
->
drvdesc
.
dnDevNode
,
&
wic
,
sizeof
(
wic
)));
for
(
fmt
=
formats_to_test
;
fmt
->
flag
;
++
fmt
){
if
(
DSOUND_check_supported
(
client
,
fmt
->
rate
,
fmt
->
depth
,
fmt
->
channels
)){
device
->
drvcaps
.
dwFormats
|=
fmt
->
flag
;
if
(
fmt
->
channels
>
device
->
drvcaps
.
dwChannels
)
device
->
drvcaps
.
dwChannels
=
fmt
->
channels
;
}
}
IAudioClient_Release
(
client
);
if
(
err
==
DS_OK
)
{
device
->
timerID
=
DSOUND_create_timer
(
&
DSOUND_capture_timer
,
(
DWORD_PTR
)
device
);
device
->
drvcaps
.
dwFlags
=
0
;
lstrcpynA
(
device
->
drvdesc
.
szDrvname
,
wic
.
szPname
,
sizeof
(
device
->
drvdesc
.
szDrvname
));
device
->
drvcaps
.
dwFlags
|=
DSCCAPS_EMULDRIVER
;
list_add_tail
(
&
DSOUND_capturers
,
&
device
->
entry
);
device
->
drvcaps
.
dwFormats
=
wic
.
dwFormats
;
device
->
drvcaps
.
dwChannels
=
wic
.
wChannels
;
}
return
err
;
*
ppDevice
=
device
;
LeaveCriticalSection
(
&
DSOUND_capturers_lock
);
return
S_OK
;
}
}
...
...
dlls/dsound/dsound.c
View file @
3735ecac
...
@@ -1343,7 +1343,7 @@ HRESULT DirectSoundDevice_GetCaps(
...
@@ -1343,7 +1343,7 @@ HRESULT DirectSoundDevice_GetCaps(
return
DS_OK
;
return
DS_OK
;
}
}
static
BOOL
DSOUND_check_supported
(
IAudioClient
*
client
,
DWORD
rate
,
BOOL
DSOUND_check_supported
(
IAudioClient
*
client
,
DWORD
rate
,
DWORD
depth
,
WORD
channels
)
DWORD
depth
,
WORD
channels
)
{
{
WAVEFORMATEX
fmt
,
*
junk
;
WAVEFORMATEX
fmt
,
*
junk
;
...
@@ -1364,7 +1364,7 @@ static BOOL DSOUND_check_supported(IAudioClient *client, DWORD rate,
...
@@ -1364,7 +1364,7 @@ static BOOL DSOUND_check_supported(IAudioClient *client, DWORD rate,
return
hr
==
S_OK
;
return
hr
==
S_OK
;
}
}
static
UINT
DSOUND_create_timer
(
LPTIMECALLBACK
cb
,
DWORD_PTR
user
)
UINT
DSOUND_create_timer
(
LPTIMECALLBACK
cb
,
DWORD_PTR
user
)
{
{
UINT
triggertime
=
DS_TIME_DEL
,
res
=
DS_TIME_RES
,
id
;
UINT
triggertime
=
DS_TIME_DEL
,
res
=
DS_TIME_RES
,
id
;
TIMECAPS
time
;
TIMECAPS
time
;
...
...
dlls/dsound/dsound_main.c
View file @
3735ecac
...
@@ -68,6 +68,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(dsound);
...
@@ -68,6 +68,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(dsound);
struct
list
DSOUND_renderers
=
LIST_INIT
(
DSOUND_renderers
);
struct
list
DSOUND_renderers
=
LIST_INIT
(
DSOUND_renderers
);
CRITICAL_SECTION
DSOUND_renderers_lock
;
CRITICAL_SECTION
DSOUND_renderers_lock
;
struct
list
DSOUND_capturers
=
LIST_INIT
(
DSOUND_capturers
);
CRITICAL_SECTION
DSOUND_capturers_lock
;
GUID
DSOUND_renderer_guids
[
MAXWAVEDRIVERS
];
GUID
DSOUND_renderer_guids
[
MAXWAVEDRIVERS
];
GUID
DSOUND_capture_guids
[
MAXWAVEDRIVERS
];
GUID
DSOUND_capture_guids
[
MAXWAVEDRIVERS
];
...
@@ -652,13 +655,6 @@ DirectSoundCaptureEnumerateW(
...
@@ -652,13 +655,6 @@ DirectSoundCaptureEnumerateW(
LPDSENUMCALLBACKW
lpDSEnumCallback
,
LPDSENUMCALLBACKW
lpDSEnumCallback
,
LPVOID
lpContext
)
LPVOID
lpContext
)
{
{
unsigned
devs
,
wid
;
DSDRIVERDESC
desc
;
GUID
guid
;
int
err
;
WCHAR
wDesc
[
MAXPNAMELEN
];
WCHAR
wName
[
MAXPNAMELEN
];
TRACE
(
"(%p,%p)
\n
"
,
lpDSEnumCallback
,
lpContext
);
TRACE
(
"(%p,%p)
\n
"
,
lpDSEnumCallback
,
lpContext
);
if
(
lpDSEnumCallback
==
NULL
)
{
if
(
lpDSEnumCallback
==
NULL
)
{
...
@@ -668,48 +664,8 @@ DirectSoundCaptureEnumerateW(
...
@@ -668,48 +664,8 @@ DirectSoundCaptureEnumerateW(
setup_dsound_options
();
setup_dsound_options
();
devs
=
waveInGetNumDevs
();
return
enumerate_mmdevices
(
eCapture
,
DSOUND_capture_guids
,
if
(
devs
>
0
)
{
lpDSEnumCallback
,
lpContext
);
if
(
GetDeviceID
(
&
DSDEVID_DefaultCapture
,
&
guid
)
==
DS_OK
)
{
for
(
wid
=
0
;
wid
<
devs
;
++
wid
)
{
if
(
IsEqualGUID
(
&
guid
,
&
DSOUND_capture_guids
[
wid
]
)
)
{
err
=
mmErr
(
waveInMessage
(
UlongToHandle
(
wid
),
DRV_QUERYDSOUNDDESC
,(
DWORD_PTR
)
&
desc
,
0
));
if
(
err
==
DS_OK
)
{
TRACE
(
"calling lpDSEnumCallback(NULL,
\"
%s
\"
,
\"
%s
\"
,%p)
\n
"
,
"Primary Sound Capture Driver"
,
desc
.
szDrvname
,
lpContext
);
MultiByteToWideChar
(
CP_ACP
,
0
,
"Primary Sound Capture Driver"
,
-
1
,
wDesc
,
sizeof
(
wDesc
)
/
sizeof
(
WCHAR
)
);
MultiByteToWideChar
(
CP_ACP
,
0
,
desc
.
szDrvname
,
-
1
,
wName
,
sizeof
(
wName
)
/
sizeof
(
WCHAR
)
);
wName
[(
sizeof
(
wName
)
/
sizeof
(
WCHAR
))
-
1
]
=
'\0'
;
if
(
lpDSEnumCallback
(
NULL
,
wDesc
,
wName
,
lpContext
)
==
FALSE
)
return
DS_OK
;
}
}
}
}
}
for
(
wid
=
0
;
wid
<
devs
;
++
wid
)
{
err
=
mmErr
(
waveInMessage
(
UlongToHandle
(
wid
),
DRV_QUERYDSOUNDDESC
,(
DWORD_PTR
)
&
desc
,
0
));
if
(
err
==
DS_OK
)
{
TRACE
(
"calling lpDSEnumCallback(%s,
\"
%s
\"
,
\"
%s
\"
,%p)
\n
"
,
debugstr_guid
(
&
DSOUND_capture_guids
[
wid
]),
desc
.
szDesc
,
desc
.
szDrvname
,
lpContext
);
MultiByteToWideChar
(
CP_ACP
,
0
,
desc
.
szDesc
,
-
1
,
wDesc
,
sizeof
(
wDesc
)
/
sizeof
(
WCHAR
)
);
wDesc
[(
sizeof
(
wDesc
)
/
sizeof
(
WCHAR
))
-
1
]
=
'\0'
;
MultiByteToWideChar
(
CP_ACP
,
0
,
desc
.
szDrvname
,
-
1
,
wName
,
sizeof
(
wName
)
/
sizeof
(
WCHAR
)
);
wName
[(
sizeof
(
wName
)
/
sizeof
(
WCHAR
))
-
1
]
=
'\0'
;
if
(
lpDSEnumCallback
(
&
DSOUND_capture_guids
[
wid
],
wDesc
,
wName
,
lpContext
)
==
FALSE
)
return
DS_OK
;
}
}
return
DS_OK
;
}
}
/*******************************************************************************
/*******************************************************************************
...
@@ -877,21 +833,17 @@ HRESULT WINAPI DllCanUnloadNow(void)
...
@@ -877,21 +833,17 @@ HRESULT WINAPI DllCanUnloadNow(void)
*/
*/
BOOL
WINAPI
DllMain
(
HINSTANCE
hInstDLL
,
DWORD
fdwReason
,
LPVOID
lpvReserved
)
BOOL
WINAPI
DllMain
(
HINSTANCE
hInstDLL
,
DWORD
fdwReason
,
LPVOID
lpvReserved
)
{
{
int
i
;
TRACE
(
"(%p %d %p)
\n
"
,
hInstDLL
,
fdwReason
,
lpvReserved
);
TRACE
(
"(%p %d %p)
\n
"
,
hInstDLL
,
fdwReason
,
lpvReserved
);
switch
(
fdwReason
)
{
switch
(
fdwReason
)
{
case
DLL_PROCESS_ATTACH
:
case
DLL_PROCESS_ATTACH
:
TRACE
(
"DLL_PROCESS_ATTACH
\n
"
);
TRACE
(
"DLL_PROCESS_ATTACH
\n
"
);
for
(
i
=
0
;
i
<
MAXWAVEDRIVERS
;
i
++
)
{
DSOUND_capture
[
i
]
=
NULL
;
INIT_GUID
(
DSOUND_capture_guids
[
i
],
0xbd6dd71b
,
0x3deb
,
0x11d1
,
0xb1
,
0x71
,
0x00
,
0xc0
,
0x4f
,
0xc2
,
0x00
,
0x00
+
i
);
}
instance
=
hInstDLL
;
instance
=
hInstDLL
;
DisableThreadLibraryCalls
(
hInstDLL
);
DisableThreadLibraryCalls
(
hInstDLL
);
/* Increase refcount on dsound by 1 */
/* Increase refcount on dsound by 1 */
GetModuleHandleExW
(
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
,
(
LPCWSTR
)
hInstDLL
,
&
hInstDLL
);
GetModuleHandleExW
(
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
,
(
LPCWSTR
)
hInstDLL
,
&
hInstDLL
);
InitializeCriticalSection
(
&
DSOUND_renderers_lock
);
InitializeCriticalSection
(
&
DSOUND_renderers_lock
);
InitializeCriticalSection
(
&
DSOUND_capturers_lock
);
InitializeCriticalSection
(
&
g_devenum_lock
);
InitializeCriticalSection
(
&
g_devenum_lock
);
break
;
break
;
case
DLL_PROCESS_DETACH
:
case
DLL_PROCESS_DETACH
:
...
...
dlls/dsound/dsound_private.h
View file @
3735ecac
...
@@ -280,21 +280,22 @@ struct DirectSoundCaptureDevice
...
@@ -280,21 +280,22 @@ struct DirectSoundCaptureDevice
DSDRIVERDESC
drvdesc
;
DSDRIVERDESC
drvdesc
;
DSCDRIVERCAPS
drvcaps
;
DSCDRIVERCAPS
drvcaps
;
/* wave driver info */
HWAVEIN
hwi
;
/* more stuff */
/* more stuff */
LPBYTE
buffer
;
LPBYTE
buffer
;
DWORD
buflen
;
DWORD
buflen
,
write_pos_bytes
;
PWAVEFORMATEX
pwfx
;
PWAVEFORMATEX
pwfx
;
IDirectSoundCaptureBufferImpl
*
capture_buffer
;
IDirectSoundCaptureBufferImpl
*
capture_buffer
;
DWORD
state
;
DWORD
state
;
LPWAVEHDR
pwave
;
UINT
timerID
;
int
nrofpwaves
;
int
index
;
CRITICAL_SECTION
lock
;
CRITICAL_SECTION
lock
;
IMMDevice
*
mmdevice
;
IAudioClient
*
client
;
IAudioCaptureClient
*
capture
;
struct
list
entry
;
};
};
/*****************************************************************************
/*****************************************************************************
...
@@ -428,10 +429,10 @@ HRESULT DSOUND_CaptureCreate8(REFIID riid, LPDIRECTSOUNDCAPTURE8 *ppDSC8) DECLSP
...
@@ -428,10 +429,10 @@ HRESULT DSOUND_CaptureCreate8(REFIID riid, LPDIRECTSOUNDCAPTURE8 *ppDSC8) DECLSP
#define DSOUND_FREQSHIFT (20)
#define DSOUND_FREQSHIFT (20)
extern
CRITICAL_SECTION
DSOUND_renderers_lock
DECLSPEC_HIDDEN
;
extern
CRITICAL_SECTION
DSOUND_renderers_lock
DECLSPEC_HIDDEN
;
extern
CRITICAL_SECTION
DSOUND_capturers_lock
DECLSPEC_HIDDEN
;
extern
struct
list
DSOUND_capturers
DECLSPEC_HIDDEN
;
extern
struct
list
DSOUND_renderers
DECLSPEC_HIDDEN
;
extern
struct
list
DSOUND_renderers
DECLSPEC_HIDDEN
;
extern
DirectSoundCaptureDevice
*
DSOUND_capture
[
MAXWAVEDRIVERS
]
DECLSPEC_HIDDEN
;
extern
GUID
DSOUND_renderer_guids
[
MAXWAVEDRIVERS
]
DECLSPEC_HIDDEN
;
extern
GUID
DSOUND_renderer_guids
[
MAXWAVEDRIVERS
]
DECLSPEC_HIDDEN
;
extern
GUID
DSOUND_capture_guids
[
MAXWAVEDRIVERS
]
DECLSPEC_HIDDEN
;
extern
GUID
DSOUND_capture_guids
[
MAXWAVEDRIVERS
]
DECLSPEC_HIDDEN
;
...
@@ -440,3 +441,7 @@ void setup_dsound_options(void) DECLSPEC_HIDDEN;
...
@@ -440,3 +441,7 @@ void setup_dsound_options(void) DECLSPEC_HIDDEN;
const
char
*
dumpCooperativeLevel
(
DWORD
level
)
DECLSPEC_HIDDEN
;
const
char
*
dumpCooperativeLevel
(
DWORD
level
)
DECLSPEC_HIDDEN
;
HRESULT
get_mmdevice
(
EDataFlow
flow
,
const
GUID
*
tgt
,
IMMDevice
**
device
)
DECLSPEC_HIDDEN
;
HRESULT
get_mmdevice
(
EDataFlow
flow
,
const
GUID
*
tgt
,
IMMDevice
**
device
)
DECLSPEC_HIDDEN
;
BOOL
DSOUND_check_supported
(
IAudioClient
*
client
,
DWORD
rate
,
DWORD
depth
,
WORD
channels
)
DECLSPEC_HIDDEN
;
UINT
DSOUND_create_timer
(
LPTIMECALLBACK
cb
,
DWORD_PTR
user
)
DECLSPEC_HIDDEN
;
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