3 * Copyright 1998 Marcus Meissner
4 * Copyright 1998 Rob Riggs
5 * Copyright 2000-2001 TransGaming Technologies, Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 * Implement DirectSoundFullDuplex support.
24 * Implement FX support.
31 #include <sys/types.h>
32 #include <sys/fcntl.h>
49 #include "wine/debug.h"
52 #include "dsound_private.h"
54 WINE_DEFAULT_DEBUG_CHANNEL(dsound
);
56 static HRESULT WINAPI
IDirectSoundCaptureImpl_Initialize(
57 LPDIRECTSOUNDCAPTURE iface
,
59 static ULONG WINAPI
IDirectSoundCaptureImpl_Release(
60 LPDIRECTSOUNDCAPTURE iface
);
61 static ULONG WINAPI
IDirectSoundCaptureBufferImpl_Release(
62 LPDIRECTSOUNDCAPTUREBUFFER8 iface
);
63 static HRESULT
DSOUND_CreateDirectSoundCaptureBuffer(
64 IDirectSoundCaptureImpl
*ipDSC
,
65 LPCDSCBUFFERDESC lpcDSCBufferDesc
,
67 static HRESULT WINAPI
IDirectSoundFullDuplexImpl_Initialize(
68 LPDIRECTSOUNDFULLDUPLEX iface
,
70 LPCGUID pRendererGuid
,
71 LPCDSCBUFFERDESC lpDscBufferDesc
,
72 LPCDSBUFFERDESC lpDsBufferDesc
,
75 LPLPDIRECTSOUNDCAPTUREBUFFER8 lplpDirectSoundCaptureBuffer8
,
76 LPLPDIRECTSOUNDBUFFER8 lplpDirectSoundBuffer8
);
78 static IDirectSoundCaptureVtbl dscvt
;
79 static IDirectSoundCaptureBuffer8Vtbl dscbvt
;
80 static IDirectSoundFullDuplexVtbl dsfdvt
;
82 static IDirectSoundCaptureImpl
* dsound_capture
= NULL
;
83 static GUID capture_guids
[MAXWAVEDRIVERS
];
85 static const char * captureStateString
[] = {
92 /***************************************************************************
93 * DirectSoundCaptureCreate [DSOUND.6]
95 * Create and initialize a DirectSoundCapture interface.
98 * lpcGUID [I] Address of the GUID that identifies the sound capture device.
99 * lplpDSC [O] Address of a variable to receive the interface pointer.
100 * pUnkOuter [I] Must be NULL.
104 * Failure: DSERR_NOAGGREGATION, DSERR_ALLOCATED, DSERR_INVALIDPARAM,
108 * lpcGUID must be one of the values returned from DirectSoundCaptureEnumerate
109 * or NULL for the default device or DSDEVID_DefaultCapture or
110 * DSDEVID_DefaultVoiceCapture.
112 * DSERR_ALLOCATED is returned for sound devices that do not support full duplex.
115 DirectSoundCaptureCreate8(
117 LPDIRECTSOUNDCAPTURE
* lplpDSC
,
118 LPUNKNOWN pUnkOuter
)
120 IDirectSoundCaptureImpl
** ippDSC
=(IDirectSoundCaptureImpl
**)lplpDSC
;
121 TRACE("(%s,%p,%p)\n", debugstr_guid(lpcGUID
), lplpDSC
, pUnkOuter
);
124 WARN("invalid parameter: pUnkOuter != NULL\n");
125 return DSERR_NOAGGREGATION
;
129 WARN("invalid parameter: lplpDSC == NULL\n");
130 return DSERR_INVALIDPARAM
;
133 /* Default device? */
134 if ( !lpcGUID
|| IsEqualGUID(lpcGUID
, &GUID_NULL
) )
135 lpcGUID
= &DSDEVID_DefaultCapture
;
137 *ippDSC
= HeapAlloc(GetProcessHeap(),
138 HEAP_ZERO_MEMORY
, sizeof(IDirectSoundCaptureImpl
));
140 if (*ippDSC
== NULL
) {
141 WARN("out of memory\n");
142 return DSERR_OUTOFMEMORY
;
144 ICOM_THIS(IDirectSoundCaptureImpl
, *ippDSC
);
147 This
->state
= STATE_STOPPED
;
149 InitializeCriticalSection( &(This
->lock
) );
150 This
->lock
.DebugInfo
->Spare
[1] = (DWORD
)"DSCAPTURE_lock";
152 This
->lpVtbl
= &dscvt
;
153 dsound_capture
= This
;
155 if (GetDeviceID(lpcGUID
, &This
->guid
) == DS_OK
) {
157 hres
= IDirectSoundCaptureImpl_Initialize( (LPDIRECTSOUNDCAPTURE
)This
, &This
->guid
);
159 WARN("IDirectSoundCaptureImpl_Initialize failed\n");
163 WARN("invalid GUID: %s\n", debugstr_guid(lpcGUID
));
164 return DSERR_INVALIDPARAM
;
167 /***************************************************************************
168 * DirectSoundCaptureEnumerateA [DSOUND.7]
170 * Enumerate all DirectSound drivers installed in the system.
173 * lpDSEnumCallback [I] Address of callback function.
174 * lpContext [I] Address of user defined context passed to callback function.
178 * Failure: DSERR_INVALIDPARAM
181 DirectSoundCaptureEnumerateA(
182 LPDSENUMCALLBACKA lpDSEnumCallback
,
190 TRACE("(%p,%p)\n", lpDSEnumCallback
, lpContext
);
192 if (lpDSEnumCallback
== NULL
) {
193 WARN("invalid parameter: lpDSEnumCallback == NULL\n");
194 return DSERR_INVALIDPARAM
;
197 devs
= waveInGetNumDevs();
199 if (GetDeviceID(&DSDEVID_DefaultCapture
, &guid
) == DS_OK
) {
201 for (wid
= 0; wid
< devs
; ++wid
) {
202 err
= mmErr(waveInMessage((HWAVEIN
)wid
,DRV_QUERYDSOUNDGUID
,(DWORD
)&temp
,0));
204 if (IsEqualGUID( &guid
, &temp
) ) {
205 err
= mmErr(waveInMessage((HWAVEIN
)wid
,DRV_QUERYDSOUNDDESC
,(DWORD
)&desc
,0));
207 TRACE("calling lpDSEnumCallback(NULL,\"%s\",\"%s\",%p)\n",
208 "Primary Sound Capture Driver",desc
.szDrvName
,lpContext
);
209 if (lpDSEnumCallback(NULL
, "Primary Sound Capture Driver", desc
.szDrvName
, lpContext
) == FALSE
)
218 for (wid
= 0; wid
< devs
; ++wid
) {
219 err
= mmErr(waveInMessage((HWAVEIN
)wid
,DRV_QUERYDSOUNDDESC
,(DWORD
)&desc
,0));
221 err
= mmErr(waveInMessage((HWAVEIN
)wid
,DRV_QUERYDSOUNDGUID
,(DWORD
)&capture_guids
[wid
],0));
223 TRACE("calling lpDSEnumCallback(%s,\"%s\",\"%s\",%p)\n",
224 debugstr_guid(&capture_guids
[wid
]),desc
.szDesc
,desc
.szDrvName
,lpContext
);
225 if (lpDSEnumCallback(&capture_guids
[wid
], desc
.szDesc
, desc
.szDrvName
, lpContext
) == FALSE
)
234 /***************************************************************************
235 * DirectSoundCaptureEnumerateW [DSOUND.8]
237 * Enumerate all DirectSound drivers installed in the system.
240 * lpDSEnumCallback [I] Address of callback function.
241 * lpContext [I] Address of user defined context passed to callback function.
245 * Failure: DSERR_INVALIDPARAM
248 DirectSoundCaptureEnumerateW(
249 LPDSENUMCALLBACKW lpDSEnumCallback
,
256 WCHAR wDesc
[MAXPNAMELEN
];
257 WCHAR wName
[MAXPNAMELEN
];
259 TRACE("(%p,%p)\n", lpDSEnumCallback
, lpContext
);
261 if (lpDSEnumCallback
== NULL
) {
262 WARN("invalid parameter: lpDSEnumCallback == NULL\n");
263 return DSERR_INVALIDPARAM
;
266 devs
= waveInGetNumDevs();
268 if (GetDeviceID(&DSDEVID_DefaultCapture
, &guid
) == DS_OK
) {
270 for (wid
= 0; wid
< devs
; ++wid
) {
271 err
= mmErr(waveInMessage((HWAVEIN
)wid
,DRV_QUERYDSOUNDGUID
,(DWORD
)&temp
,0));
273 if (IsEqualGUID( &guid
, &temp
) ) {
274 err
= mmErr(waveInMessage((HWAVEIN
)wid
,DRV_QUERYDSOUNDDESC
,(DWORD
)&desc
,0));
276 TRACE("calling lpDSEnumCallback(NULL,\"%s\",\"%s\",%p)\n",
277 "Primary Sound Capture Driver",desc
.szDrvName
,lpContext
);
278 MultiByteToWideChar( CP_ACP
, 0, "Primary Sound Capture Driver", -1,
279 wDesc
, sizeof(wDesc
)/sizeof(WCHAR
) );
280 MultiByteToWideChar( CP_ACP
, 0, desc
.szDrvName
, -1,
281 wName
, sizeof(wName
)/sizeof(WCHAR
) );
282 if (lpDSEnumCallback(NULL
, wDesc
, wName
, lpContext
) == FALSE
)
291 for (wid
= 0; wid
< devs
; ++wid
) {
292 err
= mmErr(waveInMessage((HWAVEIN
)wid
,DRV_QUERYDSOUNDDESC
,(DWORD
)&desc
,0));
294 err
= mmErr(waveInMessage((HWAVEIN
)wid
,DRV_QUERYDSOUNDGUID
,(DWORD
)&capture_guids
[wid
],0));
296 TRACE("calling lpDSEnumCallback(%s,\"%s\",\"%s\",%p)\n",
297 debugstr_guid(&capture_guids
[wid
]),desc
.szDesc
,desc
.szDrvName
,lpContext
);
298 MultiByteToWideChar( CP_ACP
, 0, desc
.szDesc
, -1,
299 wDesc
, sizeof(wDesc
)/sizeof(WCHAR
) );
300 MultiByteToWideChar( CP_ACP
, 0, desc
.szDrvName
, -1,
301 wName
, sizeof(wName
)/sizeof(WCHAR
) );
302 if (lpDSEnumCallback((LPGUID
)&capture_guids
[wid
], wDesc
, wName
, lpContext
) == FALSE
)
312 DSOUND_capture_callback(
319 IDirectSoundCaptureImpl
* This
= (IDirectSoundCaptureImpl
*)dwUser
;
320 TRACE("(%p,%08x(%s),%08lx,%08lx,%08lx) entering at %ld\n",hwi
,msg
,
321 msg
== MM_WIM_OPEN
? "MM_WIM_OPEN" : msg
== MM_WIM_CLOSE
? "MM_WIM_CLOSE" :
322 msg
== MM_WIM_DATA
? "MM_WIM_DATA" : "UNKNOWN",dwUser
,dw1
,dw2
,GetTickCount());
324 if (msg
== MM_WIM_DATA
) {
325 LPWAVEHDR pHdr
= (LPWAVEHDR
)dw1
;
326 EnterCriticalSection( &(This
->lock
) );
327 TRACE("DirectSoundCapture msg=MM_WIM_DATA, old This->state=%s, old This->index=%d\n",
328 captureStateString
[This
->state
],This
->index
);
329 if (This
->state
!= STATE_STOPPED
) {
330 int index
= This
->index
;
331 if (This
->state
== STATE_STARTING
) {
332 This
->read_position
= pHdr
->dwBytesRecorded
;
333 This
->state
= STATE_CAPTURING
;
335 waveInUnprepareHeader(hwi
,&(This
->pwave
[This
->index
]),sizeof(WAVEHDR
));
336 if (This
->capture_buffer
->nrofnotifies
)
337 SetEvent(This
->capture_buffer
->notifies
[This
->index
].hEventNotify
);
338 This
->index
= (This
->index
+ 1) % This
->nrofpwaves
;
339 if ( (This
->index
== 0) && !(This
->capture_buffer
->flags
& DSCBSTART_LOOPING
) ) {
340 TRACE("end of buffer\n");
341 This
->state
= STATE_STOPPED
;
343 if (This
->state
== STATE_CAPTURING
) {
344 waveInPrepareHeader(hwi
,&(This
->pwave
[index
]),sizeof(WAVEHDR
));
345 waveInAddBuffer(hwi
, &(This
->pwave
[index
]), sizeof(WAVEHDR
));
346 } else if (This
->state
== STATE_STOPPING
) {
348 This
->state
= STATE_STOPPED
;
352 TRACE("DirectSoundCapture new This->state=%s, new This->index=%d\n",
353 captureStateString
[This
->state
],This
->index
);
354 LeaveCriticalSection( &(This
->lock
) );
357 TRACE("completed\n");
360 static HRESULT WINAPI
361 IDirectSoundCaptureImpl_QueryInterface(
362 LPDIRECTSOUNDCAPTURE iface
,
366 ICOM_THIS(IDirectSoundCaptureImpl
,iface
);
367 TRACE( "(%p,%s,%p)\n", This
, debugstr_guid(riid
), ppobj
);
370 WARN("invalid parameter\n");
378 hres
= IDsCaptureDriver_QueryInterface(This
->driver
, riid
, ppobj
);
380 WARN("IDsCaptureDriver_QueryInterface failed\n");
384 WARN("unsupported riid: %s\n", debugstr_guid(riid
));
389 IDirectSoundCaptureImpl_AddRef( LPDIRECTSOUNDCAPTURE iface
)
392 ICOM_THIS(IDirectSoundCaptureImpl
,iface
);
393 TRACE("(%p) ref was %ld, thread is %04lx\n",This
, This
->ref
, GetCurrentThreadId());
395 EnterCriticalSection( &(This
->lock
) );
396 uRef
= ++(This
->ref
);
399 IDsCaptureDriver_AddRef(This
->driver
);
401 LeaveCriticalSection( &(This
->lock
) );
407 IDirectSoundCaptureImpl_Release( LPDIRECTSOUNDCAPTURE iface
)
410 ICOM_THIS(IDirectSoundCaptureImpl
,iface
);
411 TRACE("(%p) ref was %ld, thread is %04lx\n",This
, This
->ref
, GetCurrentThreadId());
413 EnterCriticalSection( &(This
->lock
) );
415 uRef
= --(This
->ref
);
417 LeaveCriticalSection( &(This
->lock
) );
420 TRACE("deleting object\n");
421 if (This
->capture_buffer
)
422 IDirectSoundCaptureBufferImpl_Release(
423 (LPDIRECTSOUNDCAPTUREBUFFER8
) This
->capture_buffer
);
426 IDsCaptureDriver_Close(This
->driver
);
427 IDsCaptureDriver_Release(This
->driver
);
431 HeapFree(GetProcessHeap(), 0, This
->pwfx
);
433 DeleteCriticalSection( &(This
->lock
) );
434 HeapFree( GetProcessHeap(), 0, This
);
435 dsound_capture
= NULL
;
436 TRACE("(%p) released\n",This
);
442 static HRESULT WINAPI
443 IDirectSoundCaptureImpl_CreateCaptureBuffer(
444 LPDIRECTSOUNDCAPTURE iface
,
445 LPCDSCBUFFERDESC lpcDSCBufferDesc
,
446 LPDIRECTSOUNDCAPTUREBUFFER
* lplpDSCaptureBuffer
,
450 ICOM_THIS(IDirectSoundCaptureImpl
,iface
);
452 TRACE( "(%p,%p,%p,%p)\n",This
,lpcDSCBufferDesc
,lplpDSCaptureBuffer
,pUnk
);
455 WARN("invalid parameter: This == NULL\n");
456 return DSERR_INVALIDPARAM
;
459 if (lpcDSCBufferDesc
== NULL
) {
460 WARN("invalid parameter: lpcDSCBufferDesc == NULL)\n");
461 return DSERR_INVALIDPARAM
;
464 if (lplpDSCaptureBuffer
== NULL
) {
465 WARN("invalid parameter: lplpDSCaptureBuffer == NULL\n");
466 return DSERR_INVALIDPARAM
;
470 WARN("invalid parameter: pUnk != NULL\n");
471 return DSERR_INVALIDPARAM
;
474 /* FIXME: We can only have one buffer so what do we do here? */
475 if (This
->capture_buffer
) {
476 WARN("lnvalid parameter: already has buffer\n");
477 return DSERR_INVALIDPARAM
; /* DSERR_GENERIC ? */
480 hr
= DSOUND_CreateDirectSoundCaptureBuffer( This
, lpcDSCBufferDesc
,
481 (LPVOID
*)lplpDSCaptureBuffer
);
484 WARN("DSOUND_CreateDirectSoundCaptureBuffer failed\n");
489 static HRESULT WINAPI
490 IDirectSoundCaptureImpl_GetCaps(
491 LPDIRECTSOUNDCAPTURE iface
,
492 LPDSCCAPS lpDSCCaps
)
494 ICOM_THIS(IDirectSoundCaptureImpl
,iface
);
495 TRACE("(%p,%p)\n",This
,lpDSCCaps
);
497 if (lpDSCCaps
== NULL
) {
498 WARN("invalid parameter: lpDSCCaps== NULL\n");
499 return DSERR_INVALIDPARAM
;
502 if (lpDSCCaps
->dwSize
< sizeof(*lpDSCCaps
)) {
503 WARN("invalid parameter: lpDSCCaps->dwSize = %ld < %d\n",
504 lpDSCCaps
->dwSize
, sizeof(*lpDSCCaps
));
505 return DSERR_INVALIDPARAM
;
508 if ( !(This
->initialized
) ) {
509 WARN("not initialized\n");
510 return DSERR_UNINITIALIZED
;
513 lpDSCCaps
->dwFlags
= This
->drvcaps
.dwFlags
;
514 lpDSCCaps
->dwFormats
= This
->drvcaps
.dwFormats
;
515 lpDSCCaps
->dwChannels
= This
->drvcaps
.dwChannels
;
517 TRACE("(flags=0x%08lx,format=0x%08lx,channels=%ld)\n",lpDSCCaps
->dwFlags
,
518 lpDSCCaps
->dwFormats
, lpDSCCaps
->dwChannels
);
523 static HRESULT WINAPI
524 IDirectSoundCaptureImpl_Initialize(
525 LPDIRECTSOUNDCAPTURE iface
,
528 HRESULT err
= DSERR_INVALIDPARAM
;
530 ICOM_THIS(IDirectSoundCaptureImpl
,iface
);
531 TRACE("(%p)\n", This
);
534 WARN("invalid parameter: This == NULL\n");
535 return DSERR_INVALIDPARAM
;
538 if (This
->initialized
) {
539 WARN("already initialized\n");
540 return DSERR_ALREADYINITIALIZED
;
543 widn
= waveInGetNumDevs();
546 WARN("no audio devices found\n");
547 return DSERR_NODRIVER
;
550 /* Get dsound configuration */
551 setup_dsound_options();
553 /* enumerate WINMM audio devices and find the one we want */
554 for (wid
=0; wid
<widn
; wid
++) {
556 err
= mmErr(waveInMessage((HWAVEIN
)wid
,DRV_QUERYDSOUNDGUID
,(DWORD
)(&guid
),0));
558 WARN("waveInMessage failed; err=%lx\n",err
);
561 if (IsEqualGUID( lpcGUID
, &guid
) ) {
568 WARN("invalid parameter\n");
569 return DSERR_INVALIDPARAM
;
572 err
= mmErr(waveInMessage((HWAVEIN
)wid
,DRV_QUERYDSOUNDIFACE
,(DWORD
)&(This
->driver
),0));
573 if ( (err
!= DS_OK
) && (err
!= DSERR_UNSUPPORTED
) ) {
574 WARN("waveInMessage failed; err=%lx\n",err
);
579 /* Disable the direct sound driver to force emulation if requested. */
580 if (ds_hw_accel
== DS_HW_ACCEL_EMULATION
)
583 /* Get driver description */
585 TRACE("using DirectSound driver\n");
586 err
= IDsCaptureDriver_GetDriverDesc(This
->driver
, &(This
->drvdesc
));
588 WARN("IDsCaptureDriver_GetDriverDesc failed\n");
592 TRACE("using WINMM\n");
593 /* if no DirectSound interface available, use WINMM API instead */
594 This
->drvdesc
.dwFlags
= DSDDESC_DOMMSYSTEMOPEN
|
595 DSDDESC_DOMMSYSTEMSETFORMAT
;
598 This
->drvdesc
.dnDevNode
= wid
;
600 /* open the DirectSound driver if available */
601 if (This
->driver
&& (err
== DS_OK
))
602 err
= IDsCaptureDriver_Open(This
->driver
);
605 This
->initialized
= TRUE
;
607 /* the driver is now open, so it's now allowed to call GetCaps */
609 This
->drvcaps
.dwSize
= sizeof(This
->drvcaps
);
610 err
= IDsCaptureDriver_GetCaps(This
->driver
,&(This
->drvcaps
));
612 WARN("IDsCaptureDriver_GetCaps failed\n");
615 } else /*if (This->hwi)*/ {
617 err
= mmErr(waveInGetDevCapsA((UINT
)This
->drvdesc
.dnDevNode
, &wic
, sizeof(wic
)));
620 This
->drvcaps
.dwFlags
= 0;
621 strncpy(This
->drvdesc
.szDrvName
, wic
.szPname
,
622 sizeof(This
->drvdesc
.szDrvName
));
624 This
->drvcaps
.dwFlags
|= DSCCAPS_EMULDRIVER
;
625 This
->drvcaps
.dwFormats
= wic
.dwFormats
;
626 This
->drvcaps
.dwChannels
= wic
.wChannels
;
634 static IDirectSoundCaptureVtbl dscvt
=
636 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
637 /* IUnknown methods */
638 IDirectSoundCaptureImpl_QueryInterface
,
639 IDirectSoundCaptureImpl_AddRef
,
640 IDirectSoundCaptureImpl_Release
,
642 /* IDirectSoundCapture methods */
643 IDirectSoundCaptureImpl_CreateCaptureBuffer
,
644 IDirectSoundCaptureImpl_GetCaps
,
645 IDirectSoundCaptureImpl_Initialize
649 DSOUND_CreateDirectSoundCaptureBuffer(
650 IDirectSoundCaptureImpl
*ipDSC
,
651 LPCDSCBUFFERDESC lpcDSCBufferDesc
,
655 TRACE( "(%p,%p)\n", lpcDSCBufferDesc
, ppobj
);
658 WARN("invalid parameter: ipDSC == NULL\n");
659 return DSERR_INVALIDPARAM
;
662 if (lpcDSCBufferDesc
== NULL
) {
663 WARN("invalid parameter: lpcDSCBufferDesc == NULL\n");
664 return DSERR_INVALIDPARAM
;
668 WARN("invalid parameter: ppobj == NULL\n");
669 return DSERR_INVALIDPARAM
;
672 if ( ((lpcDSCBufferDesc
->dwSize
!= sizeof(DSCBUFFERDESC
)) &&
673 (lpcDSCBufferDesc
->dwSize
!= sizeof(DSCBUFFERDESC1
))) ||
674 (lpcDSCBufferDesc
->dwBufferBytes
== 0) ||
675 (lpcDSCBufferDesc
->lpwfxFormat
== NULL
) ) {
676 WARN("invalid lpcDSCBufferDesc\n");
678 return DSERR_INVALIDPARAM
;
681 if ( !ipDSC
->initialized
) {
682 WARN("not initialized\n");
684 return DSERR_UNINITIALIZED
;
687 wfex
= lpcDSCBufferDesc
->lpwfxFormat
;
690 TRACE("(formattag=0x%04x,chans=%d,samplerate=%ld,"
691 "bytespersec=%ld,blockalign=%d,bitspersamp=%d,cbSize=%d)\n",
692 wfex
->wFormatTag
, wfex
->nChannels
, wfex
->nSamplesPerSec
,
693 wfex
->nAvgBytesPerSec
, wfex
->nBlockAlign
,
694 wfex
->wBitsPerSample
, wfex
->cbSize
);
696 if (wfex
->wFormatTag
== WAVE_FORMAT_PCM
) {
697 ipDSC
->pwfx
= HeapAlloc(GetProcessHeap(),0,sizeof(WAVEFORMATEX
));
698 memcpy(ipDSC
->pwfx
, wfex
, sizeof(WAVEFORMATEX
));
699 ipDSC
->pwfx
->cbSize
= 0;
701 ipDSC
->pwfx
= HeapAlloc(GetProcessHeap(),0,sizeof(WAVEFORMATEX
)+wfex
->cbSize
);
702 memcpy(ipDSC
->pwfx
, wfex
, sizeof(WAVEFORMATEX
)+wfex
->cbSize
);
705 WARN("lpcDSCBufferDesc->lpwfxFormat == 0\n");
707 return DSERR_INVALIDPARAM
; /* FIXME: DSERR_BADFORMAT ? */
710 *ppobj
= HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,
711 sizeof(IDirectSoundCaptureBufferImpl
));
713 if ( *ppobj
== NULL
) {
714 WARN("out of memory\n");
716 return DSERR_OUTOFMEMORY
;
719 ICOM_THIS(IDirectSoundCaptureBufferImpl
,*ppobj
);
722 This
->dsound
= ipDSC
;
723 This
->dsound
->capture_buffer
= This
;
725 This
->nrofnotifies
= 0;
726 This
->hwnotify
= NULL
;
728 This
->pdscbd
= HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,
729 lpcDSCBufferDesc
->dwSize
);
731 memcpy(This
->pdscbd
, lpcDSCBufferDesc
, lpcDSCBufferDesc
->dwSize
);
734 This
->dsound
->capture_buffer
= 0;
735 HeapFree( GetProcessHeap(), 0, This
);
737 return DSERR_OUTOFMEMORY
;
740 This
->lpVtbl
= &dscbvt
;
743 err
= IDsCaptureDriver_CreateCaptureBuffer(ipDSC
->driver
,
744 ipDSC
->pwfx
,0,0,&(ipDSC
->buflen
),&(ipDSC
->buffer
),(LPVOID
*)&(ipDSC
->hwbuf
));
746 WARN("IDsCaptureDriver_CreateCaptureBuffer failed\n");
747 This
->dsound
->capture_buffer
= 0;
748 HeapFree( GetProcessHeap(), 0, This
);
755 DWORD flags
= CALLBACK_FUNCTION
;
756 if (ds_hw_accel
!= DS_HW_ACCEL_EMULATION
)
757 flags
|= WAVE_DIRECTSOUND
;
758 err
= mmErr(waveInOpen(&(ipDSC
->hwi
),
759 ipDSC
->drvdesc
.dnDevNode
, ipDSC
->pwfx
,
760 (DWORD
)DSOUND_capture_callback
, (DWORD
)ipDSC
, flags
));
762 WARN("waveInOpen failed\n");
763 This
->dsound
->capture_buffer
= 0;
764 HeapFree( GetProcessHeap(), 0, This
);
769 buflen
= lpcDSCBufferDesc
->dwBufferBytes
;
770 TRACE("desired buflen=%ld, old buffer=%p\n", buflen
, ipDSC
->buffer
);
772 newbuf
= HeapReAlloc(GetProcessHeap(),0,ipDSC
->buffer
,buflen
);
774 newbuf
= HeapAlloc(GetProcessHeap(),0,buflen
);
775 if (newbuf
== NULL
) {
776 WARN("failed to allocate capture buffer\n");
777 err
= DSERR_OUTOFMEMORY
;
778 /* but the old buffer might still exist and must be re-prepared */
780 ipDSC
->buffer
= newbuf
;
781 ipDSC
->buflen
= buflen
;
786 TRACE("returning DS_OK\n");
790 /*******************************************************************************
791 * IDirectSoundCaptureNotify
793 static HRESULT WINAPI
IDirectSoundCaptureNotifyImpl_QueryInterface(
794 LPDIRECTSOUNDNOTIFY iface
,
798 ICOM_THIS(IDirectSoundCaptureNotifyImpl
,iface
);
799 TRACE("(%p,%s,%p)\n",This
,debugstr_guid(riid
),ppobj
);
801 if (This
->dscb
== NULL
) {
802 WARN("invalid parameter\n");
806 return IDirectSoundCaptureBuffer_QueryInterface((LPDIRECTSOUNDCAPTUREBUFFER
)This
->dscb
, riid
, ppobj
);
809 static ULONG WINAPI
IDirectSoundCaptureNotifyImpl_AddRef(LPDIRECTSOUNDNOTIFY iface
)
811 ICOM_THIS(IDirectSoundCaptureNotifyImpl
,iface
);
814 TRACE("(%p) ref was %ld, thread is %04lx\n",This
, This
->ref
, GetCurrentThreadId());
816 ref
= InterlockedIncrement(&(This
->ref
));
820 static ULONG WINAPI
IDirectSoundCaptureNotifyImpl_Release(LPDIRECTSOUNDNOTIFY iface
)
822 ICOM_THIS(IDirectSoundCaptureNotifyImpl
,iface
);
825 TRACE("(%p) ref was %ld, thread is %04lx\n",This
, This
->ref
, GetCurrentThreadId());
827 ref
= InterlockedDecrement(&(This
->ref
));
829 if (This
->dscb
->hwnotify
)
830 IDsDriverNotify_Release(This
->dscb
->hwnotify
);
831 This
->dscb
->notify
=NULL
;
832 IDirectSoundCaptureBuffer_Release((LPDIRECTSOUNDCAPTUREBUFFER
)This
->dscb
);
833 HeapFree(GetProcessHeap(),0,This
);
834 TRACE("(%p) released\n",This
);
839 static HRESULT WINAPI
IDirectSoundCaptureNotifyImpl_SetNotificationPositions(
840 LPDIRECTSOUNDNOTIFY iface
,
842 LPCDSBPOSITIONNOTIFY notify
)
844 ICOM_THIS(IDirectSoundCaptureNotifyImpl
,iface
);
845 TRACE("(%p,0x%08lx,%p)\n",This
,howmuch
,notify
);
847 if (howmuch
> 0 && notify
== NULL
) {
848 WARN("invalid parameter: notify == NULL\n");
849 return DSERR_INVALIDPARAM
;
852 if (TRACE_ON(dsound
)) {
854 for (i
=0;i
<howmuch
;i
++)
855 TRACE("notify at %ld to 0x%08lx\n",
856 notify
[i
].dwOffset
,(DWORD
)notify
[i
].hEventNotify
);
859 if (This
->dscb
->hwnotify
) {
861 hres
= IDsDriverNotify_SetNotificationPositions(This
->dscb
->hwnotify
, howmuch
, notify
);
863 WARN("IDsDriverNotify_SetNotificationPositions failed\n");
865 } else if (howmuch
> 0) {
866 /* Make an internal copy of the caller-supplied array.
867 * Replace the existing copy if one is already present. */
868 if (This
->dscb
->notifies
)
869 This
->dscb
->notifies
= HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
870 This
->dscb
->notifies
, howmuch
* sizeof(DSBPOSITIONNOTIFY
));
872 This
->dscb
->notifies
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
873 howmuch
* sizeof(DSBPOSITIONNOTIFY
));
875 if (This
->dscb
->notifies
== NULL
) {
876 WARN("out of memory\n");
877 return DSERR_OUTOFMEMORY
;
879 memcpy(This
->dscb
->notifies
, notify
, howmuch
* sizeof(DSBPOSITIONNOTIFY
));
880 This
->dscb
->nrofnotifies
= howmuch
;
882 if (This
->dscb
->notifies
) {
883 HeapFree(GetProcessHeap(), 0, This
->dscb
->notifies
);
884 This
->dscb
->notifies
= NULL
;
886 This
->dscb
->nrofnotifies
= 0;
892 IDirectSoundNotifyVtbl dscnvt
=
894 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
895 IDirectSoundCaptureNotifyImpl_QueryInterface
,
896 IDirectSoundCaptureNotifyImpl_AddRef
,
897 IDirectSoundCaptureNotifyImpl_Release
,
898 IDirectSoundCaptureNotifyImpl_SetNotificationPositions
,
901 HRESULT WINAPI
IDirectSoundCaptureNotifyImpl_Create(
902 IDirectSoundCaptureBufferImpl
*dscb
,
903 IDirectSoundCaptureNotifyImpl
**pdscn
)
905 IDirectSoundCaptureNotifyImpl
* dscn
;
906 TRACE("(%p,%p)\n",dscb
,pdscn
);
908 dscn
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(dscn
));
911 WARN("out of memory\n");
912 return DSERR_OUTOFMEMORY
;
916 dscn
->lpVtbl
= &dscnvt
;
919 IDirectSoundCaptureBuffer_AddRef((LPDIRECTSOUNDCAPTUREBUFFER
)dscb
);
925 /*******************************************************************************
926 * IDirectSoundCaptureBuffer
928 static HRESULT WINAPI
929 IDirectSoundCaptureBufferImpl_QueryInterface(
930 LPDIRECTSOUNDCAPTUREBUFFER8 iface
,
934 ICOM_THIS(IDirectSoundCaptureBufferImpl
,iface
);
936 TRACE( "(%p,%s,%p)\n", This
, debugstr_guid(riid
), ppobj
);
939 WARN("invalid parameter\n");
945 if ( IsEqualGUID( &IID_IDirectSoundNotify
, riid
) ||
946 IsEqualGUID( &IID_IDirectSoundNotify8
, riid
) ) {
948 hres
= IDirectSoundCaptureNotifyImpl_Create(This
, &This
->notify
);
950 if (This
->dsound
->hwbuf
) {
951 hres
= IDsCaptureDriverBuffer_QueryInterface(This
->dsound
->hwbuf
,
952 &IID_IDsDriverNotify
, (LPVOID
*)&(This
->hwnotify
));
954 WARN("IDsCaptureDriverBuffer_QueryInterface failed\n");
960 IDirectSoundNotify_AddRef((LPDIRECTSOUNDNOTIFY
)This
->notify
);
961 *ppobj
= (LPVOID
)This
->notify
;
965 WARN("IID_IDirectSoundNotify\n");
969 if ( IsEqualGUID( &IID_IDirectSoundCaptureBuffer
, riid
) ||
970 IsEqualGUID( &IID_IDirectSoundCaptureBuffer8
, riid
) ) {
971 IDirectSoundCaptureBuffer8_AddRef(iface
);
976 FIXME("(%p,%s,%p) unsupported GUID\n", This
, debugstr_guid(riid
), ppobj
);
977 return E_NOINTERFACE
;
981 IDirectSoundCaptureBufferImpl_AddRef( LPDIRECTSOUNDCAPTUREBUFFER8 iface
)
984 ICOM_THIS(IDirectSoundCaptureBufferImpl
,iface
);
985 TRACE("(%p) ref was %ld, thread is %04lx\n",This
, This
->ref
, GetCurrentThreadId());
987 assert(This
->dsound
);
989 EnterCriticalSection( &(This
->dsound
->lock
) );
991 uRef
= ++(This
->ref
);
993 LeaveCriticalSection( &(This
->dsound
->lock
) );
999 IDirectSoundCaptureBufferImpl_Release( LPDIRECTSOUNDCAPTUREBUFFER8 iface
)
1002 ICOM_THIS(IDirectSoundCaptureBufferImpl
,iface
);
1003 TRACE("(%p) ref was %ld, thread is %04lx\n",This
, This
->ref
, GetCurrentThreadId());
1005 assert(This
->dsound
);
1007 EnterCriticalSection( &(This
->dsound
->lock
) );
1009 uRef
= --(This
->ref
);
1011 LeaveCriticalSection( &(This
->dsound
->lock
) );
1014 TRACE("deleting object\n");
1015 if (This
->dsound
->state
== STATE_CAPTURING
)
1016 This
->dsound
->state
= STATE_STOPPING
;
1019 HeapFree(GetProcessHeap(),0, This
->pdscbd
);
1021 if (This
->dsound
->hwi
) {
1022 waveInReset(This
->dsound
->hwi
);
1023 waveInClose(This
->dsound
->hwi
);
1024 if (This
->dsound
->pwave
) {
1025 HeapFree(GetProcessHeap(),0, This
->dsound
->pwave
);
1026 This
->dsound
->pwave
= 0;
1028 This
->dsound
->hwi
= 0;
1031 if (This
->dsound
->hwbuf
)
1032 IDsCaptureDriverBuffer_Release(This
->dsound
->hwbuf
);
1034 /* remove from IDirectSoundCaptureImpl */
1036 This
->dsound
->capture_buffer
= NULL
;
1038 ERR("does not reference dsound\n");
1041 IDirectSoundNotify_Release((LPDIRECTSOUNDNOTIFY
)This
->notify
);
1043 if (This
->notifies
!= NULL
)
1044 HeapFree(GetProcessHeap(), 0, This
->notifies
);
1046 HeapFree( GetProcessHeap(), 0, This
);
1047 TRACE("(%p) released\n",This
);
1053 static HRESULT WINAPI
1054 IDirectSoundCaptureBufferImpl_GetCaps(
1055 LPDIRECTSOUNDCAPTUREBUFFER8 iface
,
1056 LPDSCBCAPS lpDSCBCaps
)
1058 ICOM_THIS(IDirectSoundCaptureBufferImpl
,iface
);
1059 TRACE( "(%p,%p)\n", This
, lpDSCBCaps
);
1062 WARN("invalid parameter: This == NULL\n");
1063 return DSERR_INVALIDPARAM
;
1066 if (lpDSCBCaps
== NULL
) {
1067 WARN("invalid parameter: lpDSCBCaps == NULL\n");
1068 return DSERR_INVALIDPARAM
;
1071 if (lpDSCBCaps
->dwSize
< sizeof(DSCBCAPS
)) {
1072 WARN("invalid parameter: lpDSCBCaps->dwSize = %ld < %d\n",
1073 lpDSCBCaps
->dwSize
, sizeof(DSCBCAPS
));
1074 return DSERR_INVALIDPARAM
;
1077 if (This
->dsound
== NULL
) {
1078 WARN("invalid parameter: This->dsound == NULL\n");
1079 return DSERR_INVALIDPARAM
;
1082 lpDSCBCaps
->dwSize
= sizeof(DSCBCAPS
);
1083 lpDSCBCaps
->dwFlags
= This
->flags
;
1084 lpDSCBCaps
->dwBufferBytes
= This
->pdscbd
->dwBufferBytes
;
1085 lpDSCBCaps
->dwReserved
= 0;
1087 TRACE("returning DS_OK\n");
1091 static HRESULT WINAPI
1092 IDirectSoundCaptureBufferImpl_GetCurrentPosition(
1093 LPDIRECTSOUNDCAPTUREBUFFER8 iface
,
1094 LPDWORD lpdwCapturePosition
,
1095 LPDWORD lpdwReadPosition
)
1097 ICOM_THIS(IDirectSoundCaptureBufferImpl
,iface
);
1098 TRACE( "(%p,%p,%p)\n", This
, lpdwCapturePosition
, lpdwReadPosition
);
1101 WARN("invalid parameter: This == NULL\n");
1102 return DSERR_INVALIDPARAM
;
1105 if (This
->dsound
== NULL
) {
1106 WARN("invalid parameter: This->dsound == NULL\n");
1107 return DSERR_INVALIDPARAM
;
1110 if (This
->dsound
->driver
) {
1112 hres
= IDsCaptureDriverBuffer_GetPosition(This
->dsound
->hwbuf
, lpdwCapturePosition
, lpdwReadPosition
);
1113 if (hres
!= DS_OK
) {
1114 WARN("IDsCaptureDriverBuffer_GetPosition failed\n");
1117 } else if (This
->dsound
->hwi
) {
1118 EnterCriticalSection(&(This
->dsound
->lock
));
1119 TRACE("old This->dsound->state=%s\n",captureStateString
[This
->dsound
->state
]);
1120 if (lpdwCapturePosition
) {
1122 mtime
.wType
= TIME_BYTES
;
1123 waveInGetPosition(This
->dsound
->hwi
, &mtime
, sizeof(mtime
));
1124 TRACE("mtime.u.cb=%ld,This->dsound->buflen=%ld\n", mtime
.u
.cb
,
1125 This
->dsound
->buflen
);
1126 mtime
.u
.cb
= mtime
.u
.cb
% This
->dsound
->buflen
;
1127 *lpdwCapturePosition
= mtime
.u
.cb
;
1130 if (lpdwReadPosition
) {
1131 if (This
->dsound
->state
== STATE_STARTING
) {
1132 if (lpdwCapturePosition
)
1133 This
->dsound
->read_position
= *lpdwCapturePosition
;
1134 This
->dsound
->state
= STATE_CAPTURING
;
1136 *lpdwReadPosition
= This
->dsound
->read_position
;
1138 TRACE("new This->dsound->state=%s\n",captureStateString
[This
->dsound
->state
]);
1139 LeaveCriticalSection(&(This
->dsound
->lock
));
1140 if (lpdwCapturePosition
) TRACE("*lpdwCapturePosition=%ld\n",*lpdwCapturePosition
);
1141 if (lpdwReadPosition
) TRACE("*lpdwReadPosition=%ld\n",*lpdwReadPosition
);
1143 WARN("no driver\n");
1144 return DSERR_NODRIVER
;
1147 TRACE("returning DS_OK\n");
1151 static HRESULT WINAPI
1152 IDirectSoundCaptureBufferImpl_GetFormat(
1153 LPDIRECTSOUNDCAPTUREBUFFER8 iface
,
1154 LPWAVEFORMATEX lpwfxFormat
,
1155 DWORD dwSizeAllocated
,
1156 LPDWORD lpdwSizeWritten
)
1158 ICOM_THIS(IDirectSoundCaptureBufferImpl
,iface
);
1159 TRACE( "(%p,%p,0x%08lx,%p)\n", This
, lpwfxFormat
, dwSizeAllocated
,
1163 WARN("invalid parameter: This == NULL\n");
1164 return DSERR_INVALIDPARAM
;
1167 if (This
->dsound
== NULL
) {
1168 WARN("invalid parameter: This->dsound == NULL\n");
1169 return DSERR_INVALIDPARAM
;
1172 if (dwSizeAllocated
> (sizeof(WAVEFORMATEX
) + This
->dsound
->pwfx
->cbSize
))
1173 dwSizeAllocated
= sizeof(WAVEFORMATEX
) + This
->dsound
->pwfx
->cbSize
;
1175 if (lpwfxFormat
) { /* NULL is valid (just want size) */
1176 memcpy(lpwfxFormat
, This
->dsound
->pwfx
, dwSizeAllocated
);
1177 if (lpdwSizeWritten
)
1178 *lpdwSizeWritten
= dwSizeAllocated
;
1180 if (lpdwSizeWritten
)
1181 *lpdwSizeWritten
= sizeof(WAVEFORMATEX
) + This
->dsound
->pwfx
->cbSize
;
1183 TRACE("invalid parameter: lpdwSizeWritten = NULL\n");
1184 return DSERR_INVALIDPARAM
;
1188 TRACE("returning DS_OK\n");
1192 static HRESULT WINAPI
1193 IDirectSoundCaptureBufferImpl_GetStatus(
1194 LPDIRECTSOUNDCAPTUREBUFFER8 iface
,
1195 LPDWORD lpdwStatus
)
1197 ICOM_THIS(IDirectSoundCaptureBufferImpl
,iface
);
1198 TRACE( "(%p, %p), thread is %04lx\n", This
, lpdwStatus
, GetCurrentThreadId() );
1201 WARN("invalid parameter: This == NULL\n");
1202 return DSERR_INVALIDPARAM
;
1205 if (This
->dsound
== NULL
) {
1206 WARN("invalid parameter: This->dsound == NULL\n");
1207 return DSERR_INVALIDPARAM
;
1210 if (lpdwStatus
== NULL
) {
1211 WARN("invalid parameter: lpdwStatus == NULL\n");
1212 return DSERR_INVALIDPARAM
;
1216 EnterCriticalSection(&(This
->dsound
->lock
));
1218 TRACE("old This->dsound->state=%s, old lpdwStatus=%08lx\n",
1219 captureStateString
[This
->dsound
->state
],*lpdwStatus
);
1220 if ((This
->dsound
->state
== STATE_STARTING
) ||
1221 (This
->dsound
->state
== STATE_CAPTURING
)) {
1222 *lpdwStatus
|= DSCBSTATUS_CAPTURING
;
1223 if (This
->flags
& DSCBSTART_LOOPING
)
1224 *lpdwStatus
|= DSCBSTATUS_LOOPING
;
1226 TRACE("new This->dsound->state=%s, new lpdwStatus=%08lx\n",
1227 captureStateString
[This
->dsound
->state
],*lpdwStatus
);
1228 LeaveCriticalSection(&(This
->dsound
->lock
));
1230 TRACE("status=%lx\n", *lpdwStatus
);
1231 TRACE("returning DS_OK\n");
1235 static HRESULT WINAPI
1236 IDirectSoundCaptureBufferImpl_Initialize(
1237 LPDIRECTSOUNDCAPTUREBUFFER8 iface
,
1238 LPDIRECTSOUNDCAPTURE lpDSC
,
1239 LPCDSCBUFFERDESC lpcDSCBDesc
)
1241 ICOM_THIS(IDirectSoundCaptureBufferImpl
,iface
);
1243 FIXME( "(%p,%p,%p): stub\n", This
, lpDSC
, lpcDSCBDesc
);
1248 static HRESULT WINAPI
1249 IDirectSoundCaptureBufferImpl_Lock(
1250 LPDIRECTSOUNDCAPTUREBUFFER8 iface
,
1253 LPVOID
* lplpvAudioPtr1
,
1254 LPDWORD lpdwAudioBytes1
,
1255 LPVOID
* lplpvAudioPtr2
,
1256 LPDWORD lpdwAudioBytes2
,
1259 HRESULT err
= DS_OK
;
1260 ICOM_THIS(IDirectSoundCaptureBufferImpl
,iface
);
1261 TRACE( "(%p,%08lu,%08lu,%p,%p,%p,%p,0x%08lx) at %ld\n", This
, dwReadCusor
,
1262 dwReadBytes
, lplpvAudioPtr1
, lpdwAudioBytes1
, lplpvAudioPtr2
,
1263 lpdwAudioBytes2
, dwFlags
, GetTickCount() );
1266 WARN("invalid parameter: This == NULL\n");
1267 return DSERR_INVALIDPARAM
;
1270 if (This
->dsound
== NULL
) {
1271 WARN("invalid parameter: This->dsound == NULL\n");
1272 return DSERR_INVALIDPARAM
;
1275 if (lplpvAudioPtr1
== NULL
) {
1276 WARN("invalid parameter: lplpvAudioPtr1 == NULL\n");
1277 return DSERR_INVALIDPARAM
;
1280 if (lpdwAudioBytes1
== NULL
) {
1281 WARN("invalid parameter: lpdwAudioBytes1 == NULL\n");
1282 return DSERR_INVALIDPARAM
;
1285 EnterCriticalSection(&(This
->dsound
->lock
));
1287 if (This
->dsound
->driver
) {
1288 err
= IDsCaptureDriverBuffer_Lock(This
->dsound
->hwbuf
, lplpvAudioPtr1
,
1289 lpdwAudioBytes1
, lplpvAudioPtr2
, lpdwAudioBytes2
,
1290 dwReadCusor
, dwReadBytes
, dwFlags
);
1292 WARN("IDsCaptureDriverBuffer_Lock failed\n");
1293 } else if (This
->dsound
->hwi
) {
1294 *lplpvAudioPtr1
= This
->dsound
->buffer
+ dwReadCusor
;
1295 if ( (dwReadCusor
+ dwReadBytes
) > This
->dsound
->buflen
) {
1296 *lpdwAudioBytes1
= This
->dsound
->buflen
- dwReadCusor
;
1298 *lplpvAudioPtr2
= This
->dsound
->buffer
;
1299 if (lpdwAudioBytes2
)
1300 *lpdwAudioBytes2
= dwReadBytes
- *lpdwAudioBytes1
;
1302 *lpdwAudioBytes1
= dwReadBytes
;
1304 *lplpvAudioPtr2
= 0;
1305 if (lpdwAudioBytes2
)
1306 *lpdwAudioBytes2
= 0;
1309 TRACE("invalid call\n");
1310 err
= DSERR_INVALIDCALL
; /* DSERR_NODRIVER ? */
1313 LeaveCriticalSection(&(This
->dsound
->lock
));
1318 static HRESULT WINAPI
1319 IDirectSoundCaptureBufferImpl_Start(
1320 LPDIRECTSOUNDCAPTUREBUFFER8 iface
,
1323 HRESULT err
= DS_OK
;
1324 ICOM_THIS(IDirectSoundCaptureBufferImpl
,iface
);
1325 TRACE( "(%p,0x%08lx)\n", This
, dwFlags
);
1328 WARN("invalid parameter: This == NULL\n");
1329 return DSERR_INVALIDPARAM
;
1332 if (This
->dsound
== NULL
) {
1333 WARN("invalid parameter: This->dsound == NULL\n");
1334 return DSERR_INVALIDPARAM
;
1337 if ( (This
->dsound
->driver
== 0) && (This
->dsound
->hwi
== 0) ) {
1338 WARN("no driver\n");
1339 return DSERR_NODRIVER
;
1342 EnterCriticalSection(&(This
->dsound
->lock
));
1344 This
->flags
= dwFlags
;
1345 TRACE("old This->dsound->state=%s\n",captureStateString
[This
->dsound
->state
]);
1346 if (This
->dsound
->state
== STATE_STOPPED
)
1347 This
->dsound
->state
= STATE_STARTING
;
1348 else if (This
->dsound
->state
== STATE_STOPPING
)
1349 This
->dsound
->state
= STATE_CAPTURING
;
1350 TRACE("new This->dsound->state=%s\n",captureStateString
[This
->dsound
->state
]);
1352 LeaveCriticalSection(&(This
->dsound
->lock
));
1354 if (This
->dsound
->driver
) {
1355 err
= IDsCaptureDriverBuffer_Start(This
->dsound
->hwbuf
, dwFlags
);
1357 WARN("IDsCaptureDriverBuffer_Start failed\n");
1360 IDirectSoundCaptureImpl
* ipDSC
= This
->dsound
;
1362 if (ipDSC
->buffer
) {
1363 if (This
->nrofnotifies
) {
1366 ipDSC
->nrofpwaves
= This
->nrofnotifies
;
1367 TRACE("nrofnotifies=%d\n", This
->nrofnotifies
);
1369 /* prepare headers */
1371 ipDSC
->pwave
= HeapReAlloc(GetProcessHeap(),0,ipDSC
->pwave
,
1372 ipDSC
->nrofpwaves
*sizeof(WAVEHDR
));
1374 ipDSC
->pwave
= HeapAlloc(GetProcessHeap(),0,
1375 ipDSC
->nrofpwaves
*sizeof(WAVEHDR
));
1377 for (c
= 0; c
< ipDSC
->nrofpwaves
; c
++) {
1378 if (This
->notifies
[c
].dwOffset
== DSBPN_OFFSETSTOP
) {
1379 TRACE("got DSBPN_OFFSETSTOP\n");
1380 ipDSC
->nrofpwaves
= c
;
1384 ipDSC
->pwave
[0].lpData
= ipDSC
->buffer
;
1385 ipDSC
->pwave
[0].dwBufferLength
=
1386 This
->notifies
[0].dwOffset
+ 1;
1388 ipDSC
->pwave
[c
].lpData
= ipDSC
->buffer
+
1389 This
->notifies
[c
-1].dwOffset
+ 1;
1390 ipDSC
->pwave
[c
].dwBufferLength
=
1391 This
->notifies
[c
].dwOffset
-
1392 This
->notifies
[c
-1].dwOffset
;
1394 ipDSC
->pwave
[c
].dwBytesRecorded
= 0;
1395 ipDSC
->pwave
[c
].dwUser
= (DWORD
)ipDSC
;
1396 ipDSC
->pwave
[c
].dwFlags
= 0;
1397 ipDSC
->pwave
[c
].dwLoops
= 0;
1398 err
= mmErr(waveInPrepareHeader(ipDSC
->hwi
,
1399 &(ipDSC
->pwave
[c
]),sizeof(WAVEHDR
)));
1401 WARN("waveInPrepareHeader failed\n");
1403 waveInUnprepareHeader(ipDSC
->hwi
,
1404 &(ipDSC
->pwave
[c
]),sizeof(WAVEHDR
));
1408 err
= mmErr(waveInAddBuffer(ipDSC
->hwi
,
1409 &(ipDSC
->pwave
[c
]), sizeof(WAVEHDR
)));
1411 WARN("waveInAddBuffer failed\n");
1413 waveInUnprepareHeader(ipDSC
->hwi
,
1414 &(ipDSC
->pwave
[c
]),sizeof(WAVEHDR
));
1419 memset(ipDSC
->buffer
,
1420 (ipDSC
->pwfx
->wBitsPerSample
== 8) ? 128 : 0, ipDSC
->buflen
);
1422 TRACE("no notifiers specified\n");
1423 /* no notifiers specified so just create a single default header */
1424 ipDSC
->nrofpwaves
= 1;
1426 ipDSC
->pwave
= HeapReAlloc(GetProcessHeap(),0,ipDSC
->pwave
,sizeof(WAVEHDR
));
1428 ipDSC
->pwave
= HeapAlloc(GetProcessHeap(),0,sizeof(WAVEHDR
));
1430 ipDSC
->pwave
[0].lpData
= ipDSC
->buffer
;
1431 ipDSC
->pwave
[0].dwBufferLength
= ipDSC
->buflen
;
1432 ipDSC
->pwave
[0].dwBytesRecorded
= 0;
1433 ipDSC
->pwave
[0].dwUser
= (DWORD
)ipDSC
;
1434 ipDSC
->pwave
[0].dwFlags
= 0;
1435 ipDSC
->pwave
[0].dwLoops
= 0;
1437 err
= mmErr(waveInPrepareHeader(ipDSC
->hwi
,
1438 &(ipDSC
->pwave
[0]),sizeof(WAVEHDR
)));
1440 WARN("waveInPrepareHeader failed\n");
1441 waveInUnprepareHeader(ipDSC
->hwi
,
1442 &(ipDSC
->pwave
[0]),sizeof(WAVEHDR
));
1444 err
= mmErr(waveInAddBuffer(ipDSC
->hwi
,
1445 &(ipDSC
->pwave
[0]), sizeof(WAVEHDR
)));
1447 WARN("waveInAddBuffer failed\n");
1448 waveInUnprepareHeader(ipDSC
->hwi
,
1449 &(ipDSC
->pwave
[0]),sizeof(WAVEHDR
));
1455 ipDSC
->read_position
= 0;
1458 /* start filling the first buffer */
1459 err
= mmErr(waveInStart(ipDSC
->hwi
));
1461 WARN("waveInStart failed\n");
1466 WARN("calling waveInClose because of error\n");
1467 waveInClose(This
->dsound
->hwi
);
1468 This
->dsound
->hwi
= 0;
1471 TRACE("returning %ld\n", err
);
1475 static HRESULT WINAPI
1476 IDirectSoundCaptureBufferImpl_Stop( LPDIRECTSOUNDCAPTUREBUFFER8 iface
)
1478 HRESULT err
= DS_OK
;
1479 ICOM_THIS(IDirectSoundCaptureBufferImpl
,iface
);
1480 TRACE( "(%p)\n", This
);
1483 WARN("invalid parameter: This == NULL\n");
1484 return DSERR_INVALIDPARAM
;
1487 if (This
->dsound
== NULL
) {
1488 WARN("invalid parameter: This->dsound == NULL\n");
1489 return DSERR_INVALIDPARAM
;
1492 EnterCriticalSection(&(This
->dsound
->lock
));
1494 TRACE("old This->dsound->state=%s\n",captureStateString
[This
->dsound
->state
]);
1495 if (This
->dsound
->state
== STATE_CAPTURING
)
1496 This
->dsound
->state
= STATE_STOPPING
;
1497 else if (This
->dsound
->state
== STATE_STARTING
)
1498 This
->dsound
->state
= STATE_STOPPED
;
1499 TRACE("new This->dsound->state=%s\n",captureStateString
[This
->dsound
->state
]);
1501 LeaveCriticalSection(&(This
->dsound
->lock
));
1503 if (This
->dsound
->driver
) {
1504 err
= IDsCaptureDriverBuffer_Stop(This
->dsound
->hwbuf
);
1505 if (err
== DSERR_BUFFERLOST
) {
1506 /* Wine-only: the driver wants us to reopen the device */
1507 IDsCaptureDriverBuffer_Release(This
->dsound
->hwbuf
);
1508 err
= IDsCaptureDriver_CreateCaptureBuffer(This
->dsound
->driver
,
1509 This
->dsound
->pwfx
,0,0,&(This
->dsound
->buflen
),&(This
->dsound
->buffer
),
1510 (LPVOID
*)&(This
->dsound
->hwbuf
));
1512 WARN("IDsCaptureDriver_CreateCaptureBuffer failed\n");
1513 This
->dsound
->hwbuf
= 0;
1515 } else if (err
!= DS_OK
)
1516 WARN("IDsCaptureDriverBuffer_Stop failed\n");
1517 } else if (This
->dsound
->hwi
) {
1518 err
= waveInStop(This
->dsound
->hwi
);
1520 WARN("no driver\n");
1521 err
= DSERR_NODRIVER
;
1524 TRACE( "(%p) returning 0x%08lx\n", This
,err
);
1528 static HRESULT WINAPI
1529 IDirectSoundCaptureBufferImpl_Unlock(
1530 LPDIRECTSOUNDCAPTUREBUFFER8 iface
,
1531 LPVOID lpvAudioPtr1
,
1532 DWORD dwAudioBytes1
,
1533 LPVOID lpvAudioPtr2
,
1534 DWORD dwAudioBytes2
)
1536 ICOM_THIS(IDirectSoundCaptureBufferImpl
,iface
);
1537 TRACE( "(%p,%p,%08lu,%p,%08lu)\n", This
, lpvAudioPtr1
, dwAudioBytes1
,
1538 lpvAudioPtr2
, dwAudioBytes2
);
1541 WARN("invalid parameter: This == NULL\n");
1542 return DSERR_INVALIDPARAM
;
1545 if (lpvAudioPtr1
== NULL
) {
1546 WARN("invalid parameter: lpvAudioPtr1 == NULL\n");
1547 return DSERR_INVALIDPARAM
;
1550 if (This
->dsound
->driver
) {
1552 hres
= IDsCaptureDriverBuffer_Unlock(This
->dsound
->hwbuf
, lpvAudioPtr1
,
1553 dwAudioBytes1
, lpvAudioPtr2
, dwAudioBytes2
);
1555 WARN("IDsCaptureDriverBuffer_Unlock failed\n");
1557 } else if (This
->dsound
->hwi
) {
1558 This
->dsound
->read_position
= (This
->dsound
->read_position
+
1559 (dwAudioBytes1
+ dwAudioBytes2
)) % This
->dsound
->buflen
;
1561 WARN("invalid call\n");
1562 return DSERR_INVALIDCALL
;
1568 static HRESULT WINAPI
1569 IDirectSoundCaptureBufferImpl_GetObjectInPath(
1570 LPDIRECTSOUNDCAPTUREBUFFER8 iface
,
1571 REFGUID rguidObject
,
1573 REFGUID rguidInterface
,
1576 ICOM_THIS(IDirectSoundCaptureBufferImpl
,iface
);
1578 FIXME( "(%p,%s,%lu,%s,%p): stub\n", This
, debugstr_guid(rguidObject
),
1579 dwIndex
, debugstr_guid(rguidInterface
), ppObject
);
1584 static HRESULT WINAPI
1585 IDirectSoundCaptureBufferImpl_GetFXStatus(
1586 LPDIRECTSOUNDCAPTUREBUFFER8 iface
,
1588 LPDWORD pdwFXStatus
)
1590 ICOM_THIS(IDirectSoundCaptureBufferImpl
,iface
);
1592 FIXME( "(%p,%lu,%p): stub\n", This
, dwFXCount
, pdwFXStatus
);
1597 static IDirectSoundCaptureBuffer8Vtbl dscbvt
=
1599 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1600 /* IUnknown methods */
1601 IDirectSoundCaptureBufferImpl_QueryInterface
,
1602 IDirectSoundCaptureBufferImpl_AddRef
,
1603 IDirectSoundCaptureBufferImpl_Release
,
1605 /* IDirectSoundCaptureBuffer methods */
1606 IDirectSoundCaptureBufferImpl_GetCaps
,
1607 IDirectSoundCaptureBufferImpl_GetCurrentPosition
,
1608 IDirectSoundCaptureBufferImpl_GetFormat
,
1609 IDirectSoundCaptureBufferImpl_GetStatus
,
1610 IDirectSoundCaptureBufferImpl_Initialize
,
1611 IDirectSoundCaptureBufferImpl_Lock
,
1612 IDirectSoundCaptureBufferImpl_Start
,
1613 IDirectSoundCaptureBufferImpl_Stop
,
1614 IDirectSoundCaptureBufferImpl_Unlock
,
1616 /* IDirectSoundCaptureBuffer methods */
1617 IDirectSoundCaptureBufferImpl_GetObjectInPath
,
1618 IDirectSoundCaptureBufferImpl_GetFXStatus
1621 /*******************************************************************************
1622 * DirectSoundCapture ClassFactory
1625 static HRESULT WINAPI
1626 DSCCF_QueryInterface(LPCLASSFACTORY iface
,REFIID riid
,LPVOID
*ppobj
)
1628 ICOM_THIS(IClassFactoryImpl
,iface
);
1630 FIXME("(%p)->(%s,%p),stub!\n",This
,debugstr_guid(riid
),ppobj
);
1631 return E_NOINTERFACE
;
1635 DSCCF_AddRef(LPCLASSFACTORY iface
)
1637 ICOM_THIS(IClassFactoryImpl
,iface
);
1638 TRACE("(%p) ref was %ld\n", This
, This
->ref
);
1639 return ++(This
->ref
);
1643 DSCCF_Release(LPCLASSFACTORY iface
)
1645 ICOM_THIS(IClassFactoryImpl
,iface
);
1646 /* static class, won't be freed */
1647 TRACE("(%p) ref was %ld\n", This
, This
->ref
);
1648 return --(This
->ref
);
1651 static HRESULT WINAPI
1652 DSCCF_CreateInstance(
1653 LPCLASSFACTORY iface
,LPUNKNOWN pOuter
,REFIID riid
,LPVOID
*ppobj
)
1655 ICOM_THIS(IClassFactoryImpl
,iface
);
1656 TRACE("(%p)->(%p,%s,%p)\n",This
,pOuter
,debugstr_guid(riid
),ppobj
);
1658 if (ppobj
== NULL
) {
1659 WARN("invalid parameter\n");
1660 return E_INVALIDARG
;
1665 if ( IsEqualGUID( &IID_IDirectSoundCapture
, riid
) ||
1666 IsEqualGUID( &IID_IDirectSoundCapture8
, riid
) ) {
1667 return DirectSoundCaptureCreate8(0,(LPDIRECTSOUNDCAPTURE8
*)ppobj
,pOuter
);
1670 WARN("(%p,%p,%s,%p) Interface not found!\n",This
,pOuter
,debugstr_guid(riid
),ppobj
);
1671 return E_NOINTERFACE
;
1674 static HRESULT WINAPI
1675 DSCCF_LockServer(LPCLASSFACTORY iface
,BOOL dolock
)
1677 ICOM_THIS(IClassFactoryImpl
,iface
);
1678 FIXME("(%p)->(%d),stub!\n",This
,dolock
);
1682 static IClassFactoryVtbl DSCCF_Vtbl
=
1684 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1685 DSCCF_QueryInterface
,
1688 DSCCF_CreateInstance
,
1692 IClassFactoryImpl DSOUND_CAPTURE_CF
= { &DSCCF_Vtbl
, 1 };
1694 /***************************************************************************
1695 * DirectSoundFullDuplexCreate [DSOUND.10]
1697 * Create and initialize a DirectSoundFullDuplex interface.
1700 * pcGuidCaptureDevice [I] Address of sound capture device GUID.
1701 * pcGuidRenderDevice [I] Address of sound render device GUID.
1702 * pcDSCBufferDesc [I] Address of capture buffer description.
1703 * pcDSBufferDesc [I] Address of render buffer description.
1704 * hWnd [I] Handle to application window.
1705 * dwLevel [I] Cooperative level.
1706 * ppDSFD [O] Address where full duplex interface returned.
1707 * ppDSCBuffer8 [0] Address where capture buffer interface returned.
1708 * ppDSBuffer8 [0] Address where render buffer interface returned.
1709 * pUnkOuter [I] Must be NULL.
1713 * Failure: DSERR_NOAGGREGATION, DSERR_ALLOCATED, DSERR_INVALIDPARAM,
1714 * DSERR_OUTOFMEMORY DSERR_INVALIDCALL DSERR_NODRIVER
1717 DirectSoundFullDuplexCreate(
1718 LPCGUID pcGuidCaptureDevice
,
1719 LPCGUID pcGuidRenderDevice
,
1720 LPCDSCBUFFERDESC pcDSCBufferDesc
,
1721 LPCDSBUFFERDESC pcDSBufferDesc
,
1724 LPDIRECTSOUNDFULLDUPLEX
*ppDSFD
,
1725 LPDIRECTSOUNDCAPTUREBUFFER8
*ppDSCBuffer8
,
1726 LPDIRECTSOUNDBUFFER8
*ppDSBuffer8
,
1727 LPUNKNOWN pUnkOuter
)
1729 IDirectSoundFullDuplexImpl
** ippDSFD
=(IDirectSoundFullDuplexImpl
**)ppDSFD
;
1730 TRACE("(%s,%s,%p,%p,%lx,%lx,%p,%p,%p,%p)\n", debugstr_guid(pcGuidCaptureDevice
),
1731 debugstr_guid(pcGuidRenderDevice
), pcDSCBufferDesc
, pcDSBufferDesc
,
1732 (DWORD
)hWnd
, dwLevel
, ppDSFD
, ppDSCBuffer8
, ppDSBuffer8
, pUnkOuter
);
1735 WARN("pUnkOuter != 0\n");
1736 return DSERR_NOAGGREGATION
;
1739 *ippDSFD
= HeapAlloc(GetProcessHeap(),
1740 HEAP_ZERO_MEMORY
, sizeof(IDirectSoundFullDuplexImpl
));
1742 if (*ippDSFD
== NULL
) {
1743 WARN("out of memory\n");
1744 return DSERR_OUTOFMEMORY
;
1747 ICOM_THIS(IDirectSoundFullDuplexImpl
, *ippDSFD
);
1750 This
->lpVtbl
= &dsfdvt
;
1752 InitializeCriticalSection( &(This
->lock
) );
1753 This
->lock
.DebugInfo
->Spare
[1] = (DWORD
)"DSDUPLEX_lock";
1755 hres
= IDirectSoundFullDuplexImpl_Initialize( (LPDIRECTSOUNDFULLDUPLEX
)This
,
1756 pcGuidCaptureDevice
, pcGuidRenderDevice
,
1757 pcDSCBufferDesc
, pcDSBufferDesc
,
1758 hWnd
, dwLevel
, ppDSCBuffer8
, ppDSBuffer8
);
1760 WARN("IDirectSoundFullDuplexImpl_Initialize failed\n");
1764 return DSERR_GENERIC
;
1767 static HRESULT WINAPI
1768 IDirectSoundFullDuplexImpl_QueryInterface(
1769 LPDIRECTSOUNDFULLDUPLEX iface
,
1773 ICOM_THIS(IDirectSoundFullDuplexImpl
,iface
);
1774 TRACE( "(%p,%s,%p)\n", This
, debugstr_guid(riid
), ppobj
);
1776 if (ppobj
== NULL
) {
1777 WARN("invalid parameter\n");
1778 return E_INVALIDARG
;
1782 return E_NOINTERFACE
;
1786 IDirectSoundFullDuplexImpl_AddRef( LPDIRECTSOUNDFULLDUPLEX iface
)
1789 ICOM_THIS(IDirectSoundFullDuplexImpl
,iface
);
1790 TRACE("(%p) ref was %ld, thread is %04lx\n",This
, This
->ref
, GetCurrentThreadId());
1792 EnterCriticalSection( &(This
->lock
) );
1794 uRef
= ++(This
->ref
);
1796 LeaveCriticalSection( &(This
->lock
) );
1802 IDirectSoundFullDuplexImpl_Release( LPDIRECTSOUNDFULLDUPLEX iface
)
1805 ICOM_THIS(IDirectSoundFullDuplexImpl
,iface
);
1806 TRACE("(%p) ref was %ld, thread is %04lx\n",This
, This
->ref
, GetCurrentThreadId());
1808 EnterCriticalSection( &(This
->lock
) );
1810 uRef
= --(This
->ref
);
1812 LeaveCriticalSection( &(This
->lock
) );
1815 DeleteCriticalSection( &(This
->lock
) );
1816 HeapFree( GetProcessHeap(), 0, This
);
1817 TRACE("(%p) released\n",This
);
1823 static HRESULT WINAPI
1824 IDirectSoundFullDuplexImpl_Initialize(
1825 LPDIRECTSOUNDFULLDUPLEX iface
,
1826 LPCGUID pCaptureGuid
,
1827 LPCGUID pRendererGuid
,
1828 LPCDSCBUFFERDESC lpDscBufferDesc
,
1829 LPCDSBUFFERDESC lpDsBufferDesc
,
1832 LPLPDIRECTSOUNDCAPTUREBUFFER8 lplpDirectSoundCaptureBuffer8
,
1833 LPLPDIRECTSOUNDBUFFER8 lplpDirectSoundBuffer8
)
1835 ICOM_THIS(IDirectSoundFullDuplexImpl
,iface
);
1836 IDirectSoundCaptureBufferImpl
** ippdscb
=(IDirectSoundCaptureBufferImpl
**)lplpDirectSoundCaptureBuffer8
;
1837 IDirectSoundBufferImpl
** ippdsc
=(IDirectSoundBufferImpl
**)lplpDirectSoundBuffer8
;
1839 FIXME( "(%p,%s,%s,%p,%p,%lx,%lx,%p,%p) stub!\n", This
, debugstr_guid(pCaptureGuid
),
1840 debugstr_guid(pRendererGuid
), lpDscBufferDesc
, lpDsBufferDesc
, (DWORD
)hWnd
, dwLevel
,
1846 static IDirectSoundFullDuplexVtbl dsfdvt
=
1848 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1849 /* IUnknown methods */
1850 IDirectSoundFullDuplexImpl_QueryInterface
,
1851 IDirectSoundFullDuplexImpl_AddRef
,
1852 IDirectSoundFullDuplexImpl_Release
,
1854 /* IDirectSoundFullDuplex methods */
1855 IDirectSoundFullDuplexImpl_Initialize
1858 /*******************************************************************************
1859 * DirectSoundFullDuplex ClassFactory
1862 static HRESULT WINAPI
1863 DSFDCF_QueryInterface(LPCLASSFACTORY iface
,REFIID riid
,LPVOID
*ppobj
)
1865 ICOM_THIS(IClassFactoryImpl
,iface
);
1867 FIXME("(%p)->(%s,%p),stub!\n",This
,debugstr_guid(riid
),ppobj
);
1868 return E_NOINTERFACE
;
1872 DSFDCF_AddRef(LPCLASSFACTORY iface
)
1874 ICOM_THIS(IClassFactoryImpl
,iface
);
1875 TRACE("(%p) ref was %ld\n", This
, This
->ref
);
1876 return ++(This
->ref
);
1880 DSFDCF_Release(LPCLASSFACTORY iface
)
1882 ICOM_THIS(IClassFactoryImpl
,iface
);
1883 /* static class, won't be freed */
1884 TRACE("(%p) ref was %ld\n", This
, This
->ref
);
1885 return --(This
->ref
);
1888 static HRESULT WINAPI
1889 DSFDCF_CreateInstance(
1890 LPCLASSFACTORY iface
,LPUNKNOWN pOuter
,REFIID riid
,LPVOID
*ppobj
)
1892 ICOM_THIS(IClassFactoryImpl
,iface
);
1894 TRACE("(%p)->(%p,%s,%p)\n",This
,pOuter
,debugstr_guid(riid
),ppobj
);
1896 if (ppobj
== NULL
) {
1897 WARN("invalid parameter\n");
1898 return E_INVALIDARG
;
1903 if ( IsEqualGUID( &IID_IDirectSoundFullDuplex
, riid
) ) {
1904 /* FIXME: how do we do this one ? */
1905 FIXME("not implemented\n");
1906 return E_NOINTERFACE
;
1909 WARN("(%p,%p,%s,%p) Interface not found!\n",This
,pOuter
,debugstr_guid(riid
),ppobj
);
1910 return E_NOINTERFACE
;
1913 static HRESULT WINAPI
1914 DSFDCF_LockServer(LPCLASSFACTORY iface
,BOOL dolock
)
1916 ICOM_THIS(IClassFactoryImpl
,iface
);
1917 FIXME("(%p)->(%d),stub!\n",This
,dolock
);
1921 static IClassFactoryVtbl DSFDCF_Vtbl
=
1923 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1924 DSFDCF_QueryInterface
,
1927 DSFDCF_CreateInstance
,
1931 IClassFactoryImpl DSOUND_FULLDUPLEX_CF
= { &DSFDCF_Vtbl
, 1 };