ReactOS  0.4.13-dev-99-g7e18b6d
capture.c
Go to the documentation of this file.
1 /* DirectSoundCapture
2  *
3  * Copyright 1998 Marcus Meissner
4  * Copyright 1998 Rob Riggs
5  * Copyright 2000-2001 TransGaming Technologies, Inc.
6  *
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.
11  *
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.
16  *
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21 /*
22  * TODO:
23  * Implement FX support.
24  * Implement both IDirectSoundCaptureBuffer and IDirectSoundCaptureBuffer8
25  * Make DirectSoundCaptureCreate and DirectSoundCaptureCreate8 behave differently
26  */
27 
28 #include "dsound_private.h"
29 
30 /*****************************************************************************
31  * IDirectSoundCaptureNotify implementation structure
32  */
34 {
35  /* IUnknown fields */
36  const IDirectSoundNotifyVtbl *lpVtbl;
39 };
40 
41 /*******************************************************************************
42  * IDirectSoundCaptureNotify
43  */
45  LPDIRECTSOUNDNOTIFY iface,
46  REFIID riid,
47  LPVOID *ppobj)
48 {
50  TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
51 
52  if (This->dscb == NULL) {
53  WARN("invalid parameter\n");
54  return E_INVALIDARG;
55  }
56 
58 }
59 
61 {
64  TRACE("(%p) ref was %d\n", This, ref - 1);
65  return ref;
66 }
67 
69 {
72  TRACE("(%p) ref was %d\n", This, ref + 1);
73 
74  if (!ref) {
75  if (This->dscb->hwnotify)
76  IDsDriverNotify_Release(This->dscb->hwnotify);
77  This->dscb->notify=NULL;
80  TRACE("(%p) released\n", This);
81  }
82  return ref;
83 }
84 
86  LPDIRECTSOUNDNOTIFY iface,
87  DWORD howmuch,
89 {
91  TRACE("(%p,0x%08x,%p)\n",This,howmuch,notify);
92 
93  if (howmuch > 0 && notify == NULL) {
94  WARN("invalid parameter: notify == NULL\n");
95  return DSERR_INVALIDPARAM;
96  }
97 
98  if (TRACE_ON(dsound)) {
99  unsigned int i;
100  for (i=0;i<howmuch;i++)
101  TRACE("notify at %d to %p\n",
102  notify[i].dwOffset,notify[i].hEventNotify);
103  }
104 
105  if (This->dscb->hwnotify) {
106  HRESULT hres;
107  hres = IDsDriverNotify_SetNotificationPositions(This->dscb->hwnotify, howmuch, notify);
108  if (hres != DS_OK)
109  WARN("IDsDriverNotify_SetNotificationPositions failed\n");
110  return hres;
111  } else if (howmuch > 0) {
112  /* Make an internal copy of the caller-supplied array.
113  * Replace the existing copy if one is already present. */
114  if (This->dscb->notifies)
115  This->dscb->notifies = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
116  This->dscb->notifies, howmuch * sizeof(DSBPOSITIONNOTIFY));
117  else
118  This->dscb->notifies = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
119  howmuch * sizeof(DSBPOSITIONNOTIFY));
120 
121  if (This->dscb->notifies == NULL) {
122  WARN("out of memory\n");
123  return DSERR_OUTOFMEMORY;
124  }
125  CopyMemory(This->dscb->notifies, notify, howmuch * sizeof(DSBPOSITIONNOTIFY));
126  This->dscb->nrofnotifies = howmuch;
127  } else {
128  HeapFree(GetProcessHeap(), 0, This->dscb->notifies);
129  This->dscb->notifies = NULL;
130  This->dscb->nrofnotifies = 0;
131  }
132 
133  return S_OK;
134 }
135 
136 static const IDirectSoundNotifyVtbl dscnvt =
137 {
142 };
143 
147 {
149  TRACE("(%p,%p)\n",dscb,pdscn);
150 
151  dscn = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*dscn));
152 
153  if (dscn == NULL) {
154  WARN("out of memory\n");
155  return DSERR_OUTOFMEMORY;
156  }
157 
158  dscn->ref = 0;
159  dscn->lpVtbl = &dscnvt;
160  dscn->dscb = dscb;
161  dscb->notify = dscn;
163 
164  *pdscn = dscn;
165  return DS_OK;
166 }
167 
168 
169 static const char * const captureStateString[] = {
170  "STATE_STOPPED",
171  "STATE_STARTING",
172  "STATE_CAPTURING",
173  "STATE_STOPPING"
174 };
175 
176 
177 /*******************************************************************************
178  * IDirectSoundCaptureBuffer
179  */
180 static HRESULT WINAPI
183  REFIID riid,
184  LPVOID* ppobj )
185 {
187  HRESULT hres;
188  TRACE( "(%p,%s,%p)\n", This, debugstr_guid(riid), ppobj );
189 
190  if (ppobj == NULL) {
191  WARN("invalid parameter\n");
192  return E_INVALIDARG;
193  }
194 
195  *ppobj = NULL;
196 
197  if ( IsEqualGUID( &IID_IDirectSoundNotify, riid ) ) {
198  if (!This->notify)
200  if (This->notify) {
202  if (This->device->hwbuf && !This->hwnotify) {
204  &IID_IDsDriverNotify, (LPVOID*)&(This->hwnotify));
205  if (hres != DS_OK) {
206  WARN("IDsCaptureDriverBuffer_QueryInterface failed\n");
208  *ppobj = 0;
209  return hres;
210  }
211  }
212 
213  *ppobj = This->notify;
214  return DS_OK;
215  }
216 
217  WARN("IID_IDirectSoundNotify\n");
218  return E_FAIL;
219  }
220 
221  if ( IsEqualGUID( &IID_IDirectSoundCaptureBuffer, riid ) ||
222  IsEqualGUID( &IID_IDirectSoundCaptureBuffer8, riid ) ) {
224  *ppobj = This;
225  return NO_ERROR;
226  }
227 
228  FIXME("(%p,%s,%p) unsupported GUID\n", This, debugstr_guid(riid), ppobj);
229  return E_NOINTERFACE;
230 }
231 
232 static ULONG WINAPI
234 {
236  ULONG ref = InterlockedIncrement(&(This->ref));
237  TRACE("(%p) ref was %d\n", This, ref - 1);
238  return ref;
239 }
240 
241 static ULONG WINAPI
243 {
245  ULONG ref = InterlockedDecrement(&(This->ref));
246  TRACE("(%p) ref was %d\n", This, ref + 1);
247 
248  if (!ref) {
249  TRACE("deleting object\n");
250  if (This->device->state == STATE_CAPTURING)
251  This->device->state = STATE_STOPPING;
252 
253  HeapFree(GetProcessHeap(),0, This->pdscbd);
254 
255  if (This->device->hwi) {
256  waveInReset(This->device->hwi);
257  waveInClose(This->device->hwi);
258  HeapFree(GetProcessHeap(),0, This->device->pwave);
259  This->device->pwave = 0;
260  This->device->hwi = 0;
261  }
262 
263  if (This->device->hwbuf)
264  IDsCaptureDriverBuffer_Release(This->device->hwbuf);
265 
266  /* remove from DirectSoundCaptureDevice */
267  This->device->capture_buffer = NULL;
268 
269  if (This->notify)
271 
272  /* If driver manages its own buffer, IDsCaptureDriverBuffer_Release
273  should have freed the buffer. Prevent freeing it again in
274  IDirectSoundCaptureBufferImpl_Create */
275  if (!(This->device->drvdesc.dwFlags & DSDDESC_USESYSTEMMEMORY))
276  This->device->buffer = NULL;
277 
278  HeapFree(GetProcessHeap(), 0, This->notifies);
279  HeapFree( GetProcessHeap(), 0, This );
280  TRACE("(%p) released\n", This);
281  }
282  return ref;
283 }
284 
285 static HRESULT WINAPI
288  LPDSCBCAPS lpDSCBCaps )
289 {
291  TRACE( "(%p,%p)\n", This, lpDSCBCaps );
292 
293  if (lpDSCBCaps == NULL) {
294  WARN("invalid parameter: lpDSCBCaps == NULL\n");
295  return DSERR_INVALIDPARAM;
296  }
297 
298  if (lpDSCBCaps->dwSize < sizeof(DSCBCAPS)) {
299  WARN("invalid parameter: lpDSCBCaps->dwSize = %d\n", lpDSCBCaps->dwSize);
300  return DSERR_INVALIDPARAM;
301  }
302 
303  if (This->device == NULL) {
304  WARN("invalid parameter: This->device == NULL\n");
305  return DSERR_INVALIDPARAM;
306  }
307 
308  lpDSCBCaps->dwSize = sizeof(DSCBCAPS);
309  lpDSCBCaps->dwFlags = This->flags;
310  lpDSCBCaps->dwBufferBytes = This->pdscbd->dwBufferBytes;
311  lpDSCBCaps->dwReserved = 0;
312 
313  TRACE("returning DS_OK\n");
314  return DS_OK;
315 }
316 
317 static HRESULT WINAPI
320  LPDWORD lpdwCapturePosition,
321  LPDWORD lpdwReadPosition )
322 {
324  HRESULT hres = DS_OK;
325  TRACE( "(%p,%p,%p)\n", This, lpdwCapturePosition, lpdwReadPosition );
326 
327  if (This->device == NULL) {
328  WARN("invalid parameter: This->device == NULL\n");
329  return DSERR_INVALIDPARAM;
330  }
331 
332  if (This->device->driver) {
333  hres = IDsCaptureDriverBuffer_GetPosition(This->device->hwbuf, lpdwCapturePosition, lpdwReadPosition );
334  if (hres != DS_OK)
335  WARN("IDsCaptureDriverBuffer_GetPosition failed\n");
336  } else if (This->device->hwi) {
337  DWORD pos;
338 
339  EnterCriticalSection(&This->device->lock);
340  pos = (DWORD_PTR)This->device->pwave[This->device->index].lpData - (DWORD_PTR)This->device->buffer;
341  if (lpdwCapturePosition)
342  *lpdwCapturePosition = (This->device->pwave[This->device->index].dwBufferLength + pos) % This->device->buflen;
343  if (lpdwReadPosition)
344  *lpdwReadPosition = pos;
345  LeaveCriticalSection(&This->device->lock);
346 
347  } else {
348  WARN("no driver\n");
350  }
351 
352  TRACE("cappos=%d readpos=%d\n", (lpdwCapturePosition?*lpdwCapturePosition:-1), (lpdwReadPosition?*lpdwReadPosition:-1));
353  TRACE("returning %08x\n", hres);
354  return hres;
355 }
356 
357 static HRESULT WINAPI
360  LPWAVEFORMATEX lpwfxFormat,
361  DWORD dwSizeAllocated,
362  LPDWORD lpdwSizeWritten )
363 {
365  HRESULT hres = DS_OK;
366  TRACE( "(%p,%p,0x%08x,%p)\n", This, lpwfxFormat, dwSizeAllocated,
367  lpdwSizeWritten );
368 
369  if (This->device == NULL) {
370  WARN("invalid parameter: This->device == NULL\n");
371  return DSERR_INVALIDPARAM;
372  }
373 
374  if (dwSizeAllocated > (sizeof(WAVEFORMATEX) + This->device->pwfx->cbSize))
375  dwSizeAllocated = sizeof(WAVEFORMATEX) + This->device->pwfx->cbSize;
376 
377  if (lpwfxFormat) { /* NULL is valid (just want size) */
378  CopyMemory(lpwfxFormat, This->device->pwfx, dwSizeAllocated);
379  if (lpdwSizeWritten)
380  *lpdwSizeWritten = dwSizeAllocated;
381  } else {
382  if (lpdwSizeWritten)
383  *lpdwSizeWritten = sizeof(WAVEFORMATEX) + This->device->pwfx->cbSize;
384  else {
385  TRACE("invalid parameter: lpdwSizeWritten = NULL\n");
387  }
388  }
389 
390  TRACE("returning %08x\n", hres);
391  return hres;
392 }
393 
394 static HRESULT WINAPI
397  LPDWORD lpdwStatus )
398 {
400  TRACE( "(%p, %p), thread is %04x\n", This, lpdwStatus, GetCurrentThreadId() );
401 
402  if (This->device == NULL) {
403  WARN("invalid parameter: This->device == NULL\n");
404  return DSERR_INVALIDPARAM;
405  }
406 
407  if (lpdwStatus == NULL) {
408  WARN("invalid parameter: lpdwStatus == NULL\n");
409  return DSERR_INVALIDPARAM;
410  }
411 
412  *lpdwStatus = 0;
413  EnterCriticalSection(&(This->device->lock));
414 
415  TRACE("old This->device->state=%s, old lpdwStatus=%08x\n",
416  captureStateString[This->device->state],*lpdwStatus);
417  if ((This->device->state == STATE_STARTING) ||
418  (This->device->state == STATE_CAPTURING)) {
419  *lpdwStatus |= DSCBSTATUS_CAPTURING;
420  if (This->flags & DSCBSTART_LOOPING)
421  *lpdwStatus |= DSCBSTATUS_LOOPING;
422  }
423  TRACE("new This->device->state=%s, new lpdwStatus=%08x\n",
424  captureStateString[This->device->state],*lpdwStatus);
425  LeaveCriticalSection(&(This->device->lock));
426 
427  TRACE("status=%x\n", *lpdwStatus);
428  TRACE("returning DS_OK\n");
429  return DS_OK;
430 }
431 
432 static HRESULT WINAPI
435  LPDIRECTSOUNDCAPTURE lpDSC,
436  LPCDSCBUFFERDESC lpcDSCBDesc )
437 {
439 
440  FIXME( "(%p,%p,%p): stub\n", This, lpDSC, lpcDSCBDesc );
441 
442  return DS_OK;
443 }
444 
445 static HRESULT WINAPI
448  DWORD dwReadCusor,
449  DWORD dwReadBytes,
450  LPVOID* lplpvAudioPtr1,
451  LPDWORD lpdwAudioBytes1,
452  LPVOID* lplpvAudioPtr2,
453  LPDWORD lpdwAudioBytes2,
454  DWORD dwFlags )
455 {
456  HRESULT hres = DS_OK;
458  TRACE( "(%p,%08u,%08u,%p,%p,%p,%p,0x%08x) at %d\n", This, dwReadCusor,
459  dwReadBytes, lplpvAudioPtr1, lpdwAudioBytes1, lplpvAudioPtr2,
460  lpdwAudioBytes2, dwFlags, GetTickCount() );
461 
462  if (This->device == NULL) {
463  WARN("invalid parameter: This->device == NULL\n");
464  return DSERR_INVALIDPARAM;
465  }
466 
467  if (lplpvAudioPtr1 == NULL) {
468  WARN("invalid parameter: lplpvAudioPtr1 == NULL\n");
469  return DSERR_INVALIDPARAM;
470  }
471 
472  if (lpdwAudioBytes1 == NULL) {
473  WARN("invalid parameter: lpdwAudioBytes1 == NULL\n");
474  return DSERR_INVALIDPARAM;
475  }
476 
477  EnterCriticalSection(&(This->device->lock));
478 
479  if (This->device->driver) {
480  hres = IDsCaptureDriverBuffer_Lock(This->device->hwbuf, lplpvAudioPtr1,
481  lpdwAudioBytes1, lplpvAudioPtr2,
482  lpdwAudioBytes2, dwReadCusor,
483  dwReadBytes, dwFlags);
484  if (hres != DS_OK)
485  WARN("IDsCaptureDriverBuffer_Lock failed\n");
486  } else if (This->device->hwi) {
487  *lplpvAudioPtr1 = This->device->buffer + dwReadCusor;
488  if ( (dwReadCusor + dwReadBytes) > This->device->buflen) {
489  *lpdwAudioBytes1 = This->device->buflen - dwReadCusor;
490  if (lplpvAudioPtr2)
491  *lplpvAudioPtr2 = This->device->buffer;
492  if (lpdwAudioBytes2)
493  *lpdwAudioBytes2 = dwReadBytes - *lpdwAudioBytes1;
494  } else {
495  *lpdwAudioBytes1 = dwReadBytes;
496  if (lplpvAudioPtr2)
497  *lplpvAudioPtr2 = 0;
498  if (lpdwAudioBytes2)
499  *lpdwAudioBytes2 = 0;
500  }
501  } else {
502  TRACE("invalid call\n");
503  hres = DSERR_INVALIDCALL; /* DSERR_NODRIVER ? */
504  }
505 
506  LeaveCriticalSection(&(This->device->lock));
507 
508  TRACE("returning %08x\n", hres);
509  return hres;
510 }
511 
512 static HRESULT WINAPI
515  DWORD dwFlags )
516 {
517  HRESULT hres = DS_OK;
519  TRACE( "(%p,0x%08x)\n", This, dwFlags );
520 
521  if (This->device == NULL) {
522  WARN("invalid parameter: This->device == NULL\n");
523  return DSERR_INVALIDPARAM;
524  }
525 
526  if ( (This->device->driver == 0) && (This->device->hwi == 0) ) {
527  WARN("no driver\n");
528  return DSERR_NODRIVER;
529  }
530 
531  EnterCriticalSection(&(This->device->lock));
532 
533  This->flags = dwFlags;
534  TRACE("old This->state=%s\n",captureStateString[This->device->state]);
535  if (This->device->state == STATE_STOPPED)
536  This->device->state = STATE_STARTING;
537  else if (This->device->state == STATE_STOPPING)
538  This->device->state = STATE_CAPTURING;
539  TRACE("new This->device->state=%s\n",captureStateString[This->device->state]);
540 
541  LeaveCriticalSection(&(This->device->lock));
542 
543  if (This->device->driver) {
544  hres = IDsCaptureDriverBuffer_Start(This->device->hwbuf, dwFlags);
545  if (hres != DS_OK)
546  WARN("IDsCaptureDriverBuffer_Start failed\n");
547  } else if (This->device->hwi) {
549 
550  if (device->buffer) {
551  int c;
552  DWORD blocksize = DSOUND_fraglen(device->pwfx->nSamplesPerSec, device->pwfx->nBlockAlign);
553  device->nrofpwaves = device->buflen / blocksize + !!(device->buflen % blocksize);
554  TRACE("nrofpwaves=%d\n", device->nrofpwaves);
555 
556  /* prepare headers */
557  if (device->pwave)
558  device->pwave = HeapReAlloc(GetProcessHeap(), 0,device->pwave, device->nrofpwaves*sizeof(WAVEHDR));
559  else
560  device->pwave = HeapAlloc(GetProcessHeap(), 0, device->nrofpwaves*sizeof(WAVEHDR));
561 
562  for (c = 0; c < device->nrofpwaves; ++c) {
563  device->pwave[c].lpData = (char *)device->buffer + c * blocksize;
564  if (c + 1 == device->nrofpwaves)
565  device->pwave[c].dwBufferLength = device->buflen - c * blocksize;
566  else
567  device->pwave[c].dwBufferLength = blocksize;
568  device->pwave[c].dwBytesRecorded = 0;
569  device->pwave[c].dwUser = (DWORD_PTR)device;
570  device->pwave[c].dwFlags = 0;
571  device->pwave[c].dwLoops = 0;
572  hres = mmErr(waveInPrepareHeader(device->hwi, &(device->pwave[c]),sizeof(WAVEHDR)));
573  if (hres != DS_OK) {
574  WARN("waveInPrepareHeader failed\n");
575  while (c--)
576  waveInUnprepareHeader(device->hwi, &(device->pwave[c]),sizeof(WAVEHDR));
577  break;
578  }
579 
580  hres = mmErr(waveInAddBuffer(device->hwi, &(device->pwave[c]), sizeof(WAVEHDR)));
581  if (hres != DS_OK) {
582  WARN("waveInAddBuffer failed\n");
583  while (c--)
584  waveInUnprepareHeader(device->hwi, &(device->pwave[c]),sizeof(WAVEHDR));
585  break;
586  }
587  }
588 
589  FillMemory(device->buffer, device->buflen, (device->pwfx->wBitsPerSample == 8) ? 128 : 0);
590  }
591 
592  device->index = 0;
593 
594  if (hres == DS_OK) {
595  /* start filling the first buffer */
596  hres = mmErr(waveInStart(device->hwi));
597  if (hres != DS_OK)
598  WARN("waveInStart failed\n");
599  }
600 
601  if (hres != DS_OK) {
602  WARN("calling waveInClose because of error\n");
603  waveInClose(device->hwi);
604  device->hwi = 0;
605  }
606  } else {
607  WARN("no driver\n");
609  }
610 
611  TRACE("returning %08x\n", hres);
612  return hres;
613 }
614 
615 static HRESULT WINAPI
617 {
618  HRESULT hres = DS_OK;
620  TRACE( "(%p)\n", This );
621 
622  if (This->device == NULL) {
623  WARN("invalid parameter: This->device == NULL\n");
624  return DSERR_INVALIDPARAM;
625  }
626 
627  EnterCriticalSection(&(This->device->lock));
628 
629  TRACE("old This->device->state=%s\n",captureStateString[This->device->state]);
630  if (This->device->state == STATE_CAPTURING)
631  This->device->state = STATE_STOPPING;
632  else if (This->device->state == STATE_STARTING)
633  This->device->state = STATE_STOPPED;
634  TRACE("new This->device->state=%s\n",captureStateString[This->device->state]);
635 
636  LeaveCriticalSection(&(This->device->lock));
637 
638  if (This->device->driver) {
639  hres = IDsCaptureDriverBuffer_Stop(This->device->hwbuf);
640  if (hres != DS_OK)
641  WARN("IDsCaptureDriverBuffer_Stop() failed\n");
642  } else if (This->device->hwi) {
643  hres = mmErr(waveInReset(This->device->hwi));
644  if (hres != DS_OK)
645  WARN("waveInReset() failed\n");
646  } else {
647  WARN("no driver\n");
649  }
650 
651  TRACE("returning %08x\n", hres);
652  return hres;
653 }
654 
655 static HRESULT WINAPI
658  LPVOID lpvAudioPtr1,
659  DWORD dwAudioBytes1,
660  LPVOID lpvAudioPtr2,
661  DWORD dwAudioBytes2 )
662 {
663  HRESULT hres = DS_OK;
665  TRACE( "(%p,%p,%08u,%p,%08u)\n", This, lpvAudioPtr1, dwAudioBytes1,
666  lpvAudioPtr2, dwAudioBytes2 );
667 
668  if (lpvAudioPtr1 == NULL) {
669  WARN("invalid parameter: lpvAudioPtr1 == NULL\n");
670  return DSERR_INVALIDPARAM;
671  }
672 
673  if (This->device->driver) {
674  hres = IDsCaptureDriverBuffer_Unlock(This->device->hwbuf, lpvAudioPtr1,
675  dwAudioBytes1, lpvAudioPtr2, dwAudioBytes2);
676  if (hres != DS_OK)
677  WARN("IDsCaptureDriverBuffer_Unlock failed\n");
678  } else if (!This->device->hwi) {
679  WARN("invalid call\n");
681  }
682 
683  TRACE("returning %08x\n", hres);
684  return hres;
685 }
686 
687 static HRESULT WINAPI
690  REFGUID rguidObject,
691  DWORD dwIndex,
692  REFGUID rguidInterface,
693  LPVOID* ppObject )
694 {
696 
697  FIXME( "(%p,%s,%u,%s,%p): stub\n", This, debugstr_guid(rguidObject),
698  dwIndex, debugstr_guid(rguidInterface), ppObject );
699 
700  return DS_OK;
701 }
702 
703 static HRESULT WINAPI
706  DWORD dwFXCount,
707  LPDWORD pdwFXStatus )
708 {
710 
711  FIXME( "(%p,%u,%p): stub\n", This, dwFXCount, pdwFXStatus );
712 
713  return DS_OK;
714 }
715 
716 static const IDirectSoundCaptureBuffer8Vtbl dscbvt =
717 {
718  /* IUnknown methods */
722 
723  /* IDirectSoundCaptureBuffer methods */
733 
734  /* IDirectSoundCaptureBuffer methods */
737 };
738 
740 {
741  int i;
742  for (i = 0; i < This->nrofnotifies; ++i) {
743  LPDSBPOSITIONNOTIFY event = This->notifies + i;
744  DWORD offset = event->dwOffset;
745  TRACE("checking %d, position %d, event = %p\n", i, offset, event->hEventNotify);
746 
747  if (offset == DSBPN_OFFSETSTOP) {
748  if (!from && !len) {
749  SetEvent(event->hEventNotify);
750  TRACE("signalled event %p (%d)\n", event->hEventNotify, i);
751  return;
752  }
753  else return;
754  }
755 
756  if (offset >= from && offset < (from + len))
757  {
758  TRACE("signalled event %p (%d)\n", event->hEventNotify, i);
759  SetEvent(event->hEventNotify);
760  }
761  }
762 }
763 
764 static void CALLBACK
766  DWORD_PTR dw2)
767 {
769  IDirectSoundCaptureBufferImpl * Moi = This->capture_buffer;
770  TRACE("(%p,%08x(%s),%08lx,%08lx,%08lx) entering at %d\n",hwi,msg,
771  msg == MM_WIM_OPEN ? "MM_WIM_OPEN" : msg == MM_WIM_CLOSE ? "MM_WIM_CLOSE" :
772  msg == MM_WIM_DATA ? "MM_WIM_DATA" : "UNKNOWN",dwUser,dw1,dw2,GetTickCount());
773 
774  if (msg == MM_WIM_DATA) {
775  EnterCriticalSection( &(This->lock) );
776  TRACE("DirectSoundCapture msg=MM_WIM_DATA, old This->state=%s, old This->index=%d\n",
777  captureStateString[This->state],This->index);
778  if (This->state != STATE_STOPPED) {
779  int index = This->index;
780  if (This->state == STATE_STARTING)
781  This->state = STATE_CAPTURING;
782  capture_CheckNotify(Moi, (DWORD_PTR)This->pwave[index].lpData - (DWORD_PTR)This->buffer, This->pwave[index].dwBufferLength);
783  This->index = (This->index + 1) % This->nrofpwaves;
784  if ( (This->index == 0) && !(This->capture_buffer->flags & DSCBSTART_LOOPING) ) {
785  TRACE("end of buffer\n");
786  This->state = STATE_STOPPED;
787  capture_CheckNotify(Moi, 0, 0);
788  } else {
789  if (This->state == STATE_CAPTURING) {
790  waveInUnprepareHeader(hwi, &(This->pwave[index]), sizeof(WAVEHDR));
791  waveInPrepareHeader(hwi, &(This->pwave[index]), sizeof(WAVEHDR));
792  waveInAddBuffer(hwi, &(This->pwave[index]), sizeof(WAVEHDR));
793  } else if (This->state == STATE_STOPPING) {
794  TRACE("stopping\n");
795  This->state = STATE_STOPPED;
796  }
797  }
798  }
799  TRACE("DirectSoundCapture new This->state=%s, new This->index=%d\n",
800  captureStateString[This->state],This->index);
801  LeaveCriticalSection( &(This->lock) );
802  }
803 
804  TRACE("completed\n");
805 }
806 
810  LPCDSCBUFFERDESC lpcDSCBufferDesc)
811 {
812  LPWAVEFORMATEX wfex;
813  TRACE( "(%p,%p,%p)\n", device, ppobj, lpcDSCBufferDesc);
814 
815  if (ppobj == NULL) {
816  WARN("invalid parameter: ppobj == NULL\n");
817  return DSERR_INVALIDPARAM;
818  }
819 
820  if (!device) {
821  WARN("not initialized\n");
822  *ppobj = NULL;
823  return DSERR_UNINITIALIZED;
824  }
825 
826  if (lpcDSCBufferDesc == NULL) {
827  WARN("invalid parameter: lpcDSCBufferDesc == NULL\n");
828  *ppobj = NULL;
829  return DSERR_INVALIDPARAM;
830  }
831 
832  if ( ((lpcDSCBufferDesc->dwSize != sizeof(DSCBUFFERDESC)) &&
833  (lpcDSCBufferDesc->dwSize != sizeof(DSCBUFFERDESC1))) ||
834  (lpcDSCBufferDesc->dwBufferBytes == 0) ||
835  (lpcDSCBufferDesc->lpwfxFormat == NULL) ) { /* FIXME: DSERR_BADFORMAT ? */
836  WARN("invalid lpcDSCBufferDesc\n");
837  *ppobj = NULL;
838  return DSERR_INVALIDPARAM;
839  }
840 
841  wfex = lpcDSCBufferDesc->lpwfxFormat;
842 
843  TRACE("(formattag=0x%04x,chans=%d,samplerate=%d,"
844  "bytespersec=%d,blockalign=%d,bitspersamp=%d,cbSize=%d)\n",
845  wfex->wFormatTag, wfex->nChannels, wfex->nSamplesPerSec,
846  wfex->nAvgBytesPerSec, wfex->nBlockAlign,
847  wfex->wBitsPerSample, wfex->cbSize);
848 
849  device->pwfx = DSOUND_CopyFormat(wfex);
850  if ( device->pwfx == NULL ) {
851  *ppobj = NULL;
852  return DSERR_OUTOFMEMORY;
853  }
854 
857 
858  if ( *ppobj == NULL ) {
859  WARN("out of memory\n");
860  *ppobj = NULL;
861  return DSERR_OUTOFMEMORY;
862  } else {
863  HRESULT err = DS_OK;
864  LPBYTE newbuf;
865  DWORD buflen;
867 
868  This->ref = 1;
869  This->device = device;
870  This->device->capture_buffer = This;
871  This->notify = NULL;
872  This->nrofnotifies = 0;
873  This->hwnotify = NULL;
874 
876  lpcDSCBufferDesc->dwSize);
877  if (This->pdscbd)
878  CopyMemory(This->pdscbd, lpcDSCBufferDesc, lpcDSCBufferDesc->dwSize);
879  else {
880  WARN("no memory\n");
881  This->device->capture_buffer = 0;
882  HeapFree( GetProcessHeap(), 0, This );
883  *ppobj = NULL;
884  return DSERR_OUTOFMEMORY;
885  }
886 
887  This->lpVtbl = &dscbvt;
888 
889  if (device->driver) {
890  if (This->device->drvdesc.dwFlags & DSDDESC_DOMMSYSTEMOPEN)
891  FIXME("DSDDESC_DOMMSYSTEMOPEN not supported\n");
892 
893  if (This->device->drvdesc.dwFlags & DSDDESC_USESYSTEMMEMORY) {
894  /* allocate buffer from system memory */
895  buflen = lpcDSCBufferDesc->dwBufferBytes;
896  TRACE("desired buflen=%d, old buffer=%p\n", buflen, device->buffer);
897  if (device->buffer)
898  newbuf = HeapReAlloc(GetProcessHeap(),0,device->buffer,buflen);
899  else
900  newbuf = HeapAlloc(GetProcessHeap(),0,buflen);
901 
902  if (newbuf == NULL) {
903  WARN("failed to allocate capture buffer\n");
905  /* but the old buffer might still exist and must be re-prepared */
906  } else {
907  device->buffer = newbuf;
908  device->buflen = buflen;
909  }
910  } else {
911  /* let driver allocate memory */
912  device->buflen = lpcDSCBufferDesc->dwBufferBytes;
913  /* FIXME: */
914  HeapFree( GetProcessHeap(), 0, device->buffer);
915  device->buffer = NULL;
916  }
917 
919  device->pwfx,0,0,&(device->buflen),&(device->buffer),(LPVOID*)&(device->hwbuf));
920  if (err != DS_OK) {
921  WARN("IDsCaptureDriver_CreateCaptureBuffer failed\n");
922  This->device->capture_buffer = 0;
923  HeapFree( GetProcessHeap(), 0, This );
924  *ppobj = NULL;
925  return err;
926  }
927  } else {
929  err = mmErr(waveInOpen(&(device->hwi),
930  device->drvdesc.dnDevNode, device->pwfx,
932  if (err != DS_OK) {
933  WARN("waveInOpen failed\n");
934  This->device->capture_buffer = 0;
935  HeapFree( GetProcessHeap(), 0, This );
936  *ppobj = NULL;
937  return err;
938  }
939 
940  buflen = lpcDSCBufferDesc->dwBufferBytes;
941  TRACE("desired buflen=%d, old buffer=%p\n", buflen, device->buffer);
942  if (device->buffer)
943  newbuf = HeapReAlloc(GetProcessHeap(),0,device->buffer,buflen);
944  else
945  newbuf = HeapAlloc(GetProcessHeap(),0,buflen);
946  if (newbuf == NULL) {
947  WARN("failed to allocate capture buffer\n");
949  /* but the old buffer might still exist and must be re-prepared */
950  } else {
951  device->buffer = newbuf;
952  device->buflen = buflen;
953  }
954  }
955  }
956 
957  TRACE("returning DS_OK\n");
958  return DS_OK;
959 }
960 
961 
962 /*******************************************************************************
963  * DirectSoundCaptureDevice
964  */
966 
968  DirectSoundCaptureDevice ** ppDevice)
969 {
971  TRACE("(%p)\n", ppDevice);
972 
973  /* Allocate memory */
975 
976  if (device == NULL) {
977  WARN("out of memory\n");
978  return DSERR_OUTOFMEMORY;
979  }
980 
981  device->ref = 1;
982  device->state = STATE_STOPPED;
983 
984  InitializeCriticalSection( &(device->lock) );
985  device->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": DirectSoundCaptureDevice.lock");
986 
987  *ppDevice = device;
988 
989  return DS_OK;
990 }
991 
994 {
996  TRACE("(%p) ref was %d\n", device, ref + 1);
997 
998  if (!ref) {
999  TRACE("deleting object\n");
1000  if (device->capture_buffer)
1002  (LPDIRECTSOUNDCAPTUREBUFFER8) device->capture_buffer);
1003 
1004  if (device->driver) {
1005  IDsCaptureDriver_Close(device->driver);
1007  }
1008 
1009  HeapFree(GetProcessHeap(), 0, device->pwfx);
1010  device->lock.DebugInfo->Spare[0] = 0;
1011  DeleteCriticalSection( &(device->lock) );
1012  DSOUND_capture[device->drvdesc.dnDevNode] = NULL;
1014  TRACE("(%p) released\n", device);
1015  }
1016  return ref;
1017 }
1018 
1020  DirectSoundCaptureDevice ** ppDevice,
1021  LPCGUID lpcGUID)
1022 {
1024  unsigned wid, widn;
1025  BOOLEAN found = FALSE;
1026  GUID devGUID;
1027  DirectSoundCaptureDevice *device = *ppDevice;
1028  TRACE("(%p, %s)\n", ppDevice, debugstr_guid(lpcGUID));
1029 
1030  /* Default device? */
1031  if ( !lpcGUID || IsEqualGUID(lpcGUID, &GUID_NULL) )
1032  lpcGUID = &DSDEVID_DefaultCapture;
1033 
1034  if (GetDeviceID(lpcGUID, &devGUID) != DS_OK) {
1035  WARN("invalid parameter: lpcGUID\n");
1036  return DSERR_INVALIDPARAM;
1037  }
1038 
1039  widn = waveInGetNumDevs();
1040  if (!widn) {
1041  WARN("no audio devices found\n");
1042  return DSERR_NODRIVER;
1043  }
1044 
1045  /* enumerate WINMM audio devices and find the one we want */
1046  for (wid=0; wid<widn; wid++) {
1047  if (IsEqualGUID( &devGUID, &DSOUND_capture_guids[wid]) ) {
1048  found = TRUE;
1049  break;
1050  }
1051  }
1052 
1053  if (found == FALSE) {
1054  WARN("No device found matching given ID!\n");
1055  return DSERR_NODRIVER;
1056  }
1057 
1058  if (DSOUND_capture[wid]) {
1059  WARN("already in use\n");
1060  return DSERR_ALLOCATED;
1061  }
1062 
1064  if (err != DS_OK) {
1065  WARN("DirectSoundCaptureDevice_Create failed\n");
1066  return err;
1067  }
1068 
1069  *ppDevice = device;
1070  device->guid = devGUID;
1071 
1072  /* Disable the direct sound driver to force emulation if requested. */
1073  device->driver = NULL;
1075  {
1076  err = mmErr(waveInMessage(UlongToHandle(wid),DRV_QUERYDSOUNDIFACE,(DWORD_PTR)&device->driver,0));
1077  if ( (err != DS_OK) && (err != DSERR_UNSUPPORTED) ) {
1078  WARN("waveInMessage failed; err=%x\n",err);
1079  return err;
1080  }
1081  }
1082  err = DS_OK;
1083 
1084  /* Get driver description */
1085  if (device->driver) {
1086  TRACE("using DirectSound driver\n");
1087  err = IDsCaptureDriver_GetDriverDesc(device->driver, &(device->drvdesc));
1088  if (err != DS_OK) {
1089  WARN("IDsCaptureDriver_GetDriverDesc failed\n");
1090  return err;
1091  }
1092  } else {
1093  TRACE("using WINMM\n");
1094  /* if no DirectSound interface available, use WINMM API instead */
1095  device->drvdesc.dwFlags = DSDDESC_DOMMSYSTEMOPEN |
1097  }
1098 
1099  device->drvdesc.dnDevNode = wid;
1100 
1101  /* open the DirectSound driver if available */
1102  if (device->driver && (err == DS_OK))
1103  err = IDsCaptureDriver_Open(device->driver);
1104 
1105  if (err == DS_OK) {
1106  *ppDevice = device;
1107 
1108  /* the driver is now open, so it's now allowed to call GetCaps */
1109  if (device->driver) {
1110  device->drvcaps.dwSize = sizeof(device->drvcaps);
1111  err = IDsCaptureDriver_GetCaps(device->driver,&(device->drvcaps));
1112  if (err != DS_OK) {
1113  WARN("IDsCaptureDriver_GetCaps failed\n");
1114  return err;
1115  }
1116  } else /*if (device->hwi)*/ {
1117  WAVEINCAPSA wic;
1118  err = mmErr(waveInGetDevCapsA((UINT)device->drvdesc.dnDevNode, &wic, sizeof(wic)));
1119 
1120  if (err == DS_OK) {
1121  device->drvcaps.dwFlags = 0;
1122  lstrcpynA(device->drvdesc.szDrvname, wic.szPname,
1123  sizeof(device->drvdesc.szDrvname));
1124 
1125  device->drvcaps.dwFlags |= DSCCAPS_EMULDRIVER;
1126  device->drvcaps.dwFormats = wic.dwFormats;
1127  device->drvcaps.dwChannels = wic.wChannels;
1128  }
1129  }
1130  }
1131 
1132  return err;
1133 }
1134 
1135 
1136 /*****************************************************************************
1137  * IDirectSoundCapture implementation structure
1138  */
1140 {
1141  /* IUnknown fields */
1142  const IDirectSoundCaptureVtbl *lpVtbl;
1144 
1146 };
1147 
1148 /***************************************************************************
1149  * IDirectSoundCaptureImpl
1150  */
1151 static HRESULT WINAPI
1153  LPDIRECTSOUNDCAPTURE iface,
1154  REFIID riid,
1155  LPVOID* ppobj )
1156 {
1158  TRACE( "(%p,%s,%p)\n", This, debugstr_guid(riid), ppobj );
1159 
1160  if (ppobj == NULL) {
1161  WARN("invalid parameter\n");
1162  return E_INVALIDARG;
1163  }
1164 
1165  *ppobj = NULL;
1166 
1167  if (IsEqualIID(riid, &IID_IUnknown)) {
1169  *ppobj = This;
1170  return DS_OK;
1171  } else if (IsEqualIID(riid, &IID_IDirectSoundCapture)) {
1173  *ppobj = This;
1174  return DS_OK;
1175  }
1176 
1177  WARN("unsupported riid: %s\n", debugstr_guid(riid));
1178  return E_NOINTERFACE;
1179 }
1180 
1181 static ULONG WINAPI
1183 {
1185  ULONG ref = InterlockedIncrement(&(This->ref));
1186  TRACE("(%p) ref was %d\n", This, ref - 1);
1187  return ref;
1188 }
1189 
1190 static ULONG WINAPI
1192 {
1194  ULONG ref = InterlockedDecrement(&(This->ref));
1195  TRACE("(%p) ref was %d\n", This, ref + 1);
1196 
1197  if (!ref) {
1198  if (This->device)
1200 
1201  HeapFree( GetProcessHeap(), 0, This );
1202  TRACE("(%p) released\n", This);
1203  }
1204  return ref;
1205 }
1206 
1208  LPDIRECTSOUNDCAPTURE iface,
1209  LPCDSCBUFFERDESC lpcDSCBufferDesc,
1210  LPDIRECTSOUNDCAPTUREBUFFER* lplpDSCaptureBuffer,
1211  LPUNKNOWN pUnk )
1212 {
1213  HRESULT hr;
1215 
1216  TRACE( "(%p,%p,%p,%p)\n",iface,lpcDSCBufferDesc,lplpDSCaptureBuffer,pUnk);
1217 
1218  if (lpcDSCBufferDesc == NULL) {
1219  WARN("invalid parameter: lpcDSCBufferDesc == NULL)\n");
1220  return DSERR_INVALIDPARAM;
1221  }
1222 
1223  if (lplpDSCaptureBuffer == NULL) {
1224  WARN("invalid parameter: lplpDSCaptureBuffer == NULL\n");
1225  return DSERR_INVALIDPARAM;
1226  }
1227 
1228  if (pUnk != NULL) {
1229  WARN("invalid parameter: pUnk != NULL\n");
1230  return DSERR_INVALIDPARAM;
1231  }
1232 
1233  /* FIXME: We can only have one buffer so what do we do here? */
1234  if (This->device->capture_buffer) {
1235  WARN("invalid parameter: already has buffer\n");
1236  return DSERR_INVALIDPARAM; /* DSERR_GENERIC ? */
1237  }
1238 
1240  (IDirectSoundCaptureBufferImpl **)lplpDSCaptureBuffer, lpcDSCBufferDesc);
1241 
1242  if (hr != DS_OK)
1243  WARN("IDirectSoundCaptureBufferImpl_Create failed\n");
1244 
1245  return hr;
1246 }
1247 
1249  LPDIRECTSOUNDCAPTURE iface,
1250  LPDSCCAPS lpDSCCaps )
1251 {
1253  TRACE("(%p,%p)\n",This,lpDSCCaps);
1254 
1255  if (This->device == NULL) {
1256  WARN("not initialized\n");
1257  return DSERR_UNINITIALIZED;
1258  }
1259 
1260  if (lpDSCCaps== NULL) {
1261  WARN("invalid parameter: lpDSCCaps== NULL\n");
1262  return DSERR_INVALIDPARAM;
1263  }
1264 
1265  if (lpDSCCaps->dwSize < sizeof(*lpDSCCaps)) {
1266  WARN("invalid parameter: lpDSCCaps->dwSize = %d\n", lpDSCCaps->dwSize);
1267  return DSERR_INVALIDPARAM;
1268  }
1269 
1270  lpDSCCaps->dwFlags = This->device->drvcaps.dwFlags;
1271  lpDSCCaps->dwFormats = This->device->drvcaps.dwFormats;
1272  lpDSCCaps->dwChannels = This->device->drvcaps.dwChannels;
1273 
1274  TRACE("(flags=0x%08x,format=0x%08x,channels=%d)\n",lpDSCCaps->dwFlags,
1275  lpDSCCaps->dwFormats, lpDSCCaps->dwChannels);
1276 
1277  return DS_OK;
1278 }
1279 
1281  LPDIRECTSOUNDCAPTURE iface,
1282  LPCGUID lpcGUID )
1283 {
1285  TRACE("(%p,%s)\n", This, debugstr_guid(lpcGUID));
1286 
1287  if (This->device != NULL) {
1288  WARN("already initialized\n");
1289  return DSERR_ALREADYINITIALIZED;
1290  }
1291  return DirectSoundCaptureDevice_Initialize(&This->device, lpcGUID);
1292 }
1293 
1294 static const IDirectSoundCaptureVtbl dscvt =
1295 {
1296  /* IUnknown methods */
1300 
1301  /* IDirectSoundCapture methods */
1305 };
1306 
1308  LPDIRECTSOUNDCAPTURE8 * ppDSC)
1309 {
1311  TRACE("(%p)\n", ppDSC);
1312 
1313  /* Allocate memory */
1315  if (pDSC == NULL) {
1316  WARN("out of memory\n");
1317  *ppDSC = NULL;
1318  return DSERR_OUTOFMEMORY;
1319  }
1320 
1321  pDSC->lpVtbl = &dscvt;
1322  pDSC->ref = 0;
1323  pDSC->device = NULL;
1324 
1325  *ppDSC = (LPDIRECTSOUNDCAPTURE8)pDSC;
1326 
1327  return DS_OK;
1328 }
1329 
1331  REFIID riid,
1332  LPDIRECTSOUNDCAPTURE *ppDSC)
1333 {
1334  LPDIRECTSOUNDCAPTURE pDSC;
1335  HRESULT hr;
1336  TRACE("(%s, %p)\n", debugstr_guid(riid), ppDSC);
1337 
1338  if (!IsEqualIID(riid, &IID_IUnknown) &&
1339  !IsEqualIID(riid, &IID_IDirectSoundCapture)) {
1340  *ppDSC = 0;
1341  return E_NOINTERFACE;
1342  }
1343 
1344  /* Get dsound configuration */
1346 
1348  if (hr == DS_OK) {
1350  *ppDSC = pDSC;
1351  } else {
1352  WARN("IDirectSoundCaptureImpl_Create failed\n");
1353  *ppDSC = 0;
1354  }
1355 
1356  return hr;
1357 }
1358 
1360  REFIID riid,
1361  LPDIRECTSOUNDCAPTURE8 *ppDSC8)
1362 {
1363  LPDIRECTSOUNDCAPTURE8 pDSC8;
1364  HRESULT hr;
1365  TRACE("(%s, %p)\n", debugstr_guid(riid), ppDSC8);
1366 
1367  if (!IsEqualIID(riid, &IID_IUnknown) &&
1369  *ppDSC8 = 0;
1370  return E_NOINTERFACE;
1371  }
1372 
1373  /* Get dsound configuration */
1375 
1377  if (hr == DS_OK) {
1379  *ppDSC8 = pDSC8;
1380  } else {
1381  WARN("IDirectSoundCaptureImpl_Create failed\n");
1382  *ppDSC8 = 0;
1383  }
1384 
1385  return hr;
1386 }
1387 
1388 /***************************************************************************
1389  * DirectSoundCaptureCreate [DSOUND.6]
1390  *
1391  * Create and initialize a DirectSoundCapture interface.
1392  *
1393  * PARAMS
1394  * lpcGUID [I] Address of the GUID that identifies the sound capture device.
1395  * lplpDSC [O] Address of a variable to receive the interface pointer.
1396  * pUnkOuter [I] Must be NULL.
1397  *
1398  * RETURNS
1399  * Success: DS_OK
1400  * Failure: DSERR_NOAGGREGATION, DSERR_ALLOCATED, DSERR_INVALIDPARAM,
1401  * DSERR_OUTOFMEMORY
1402  *
1403  * NOTES
1404  * lpcGUID must be one of the values returned from DirectSoundCaptureEnumerate
1405  * or NULL for the default device or DSDEVID_DefaultCapture or
1406  * DSDEVID_DefaultVoiceCapture.
1407  *
1408  * DSERR_ALLOCATED is returned for sound devices that do not support full duplex.
1409  */
1411  LPCGUID lpcGUID,
1412  LPDIRECTSOUNDCAPTURE *ppDSC,
1413  LPUNKNOWN pUnkOuter)
1414 {
1415  HRESULT hr;
1416  LPDIRECTSOUNDCAPTURE pDSC;
1417  TRACE("(%s,%p,%p)\n", debugstr_guid(lpcGUID), ppDSC, pUnkOuter);
1418 
1419  if (ppDSC == NULL) {
1420  WARN("invalid parameter: ppDSC == NULL\n");
1421  return DSERR_INVALIDPARAM;
1422  }
1423 
1424  if (pUnkOuter) {
1425  WARN("invalid parameter: pUnkOuter != NULL\n");
1426  *ppDSC = NULL;
1427  return DSERR_NOAGGREGATION;
1428  }
1429 
1430  hr = DSOUND_CaptureCreate(&IID_IDirectSoundCapture, &pDSC);
1431  if (hr == DS_OK) {
1432  hr = IDirectSoundCapture_Initialize(pDSC, lpcGUID);
1433  if (hr != DS_OK) {
1435  pDSC = 0;
1436  }
1437  }
1438 
1439  *ppDSC = pDSC;
1440 
1441  return hr;
1442 }
1443 
1444 /***************************************************************************
1445  * DirectSoundCaptureCreate8 [DSOUND.12]
1446  *
1447  * Create and initialize a DirectSoundCapture interface.
1448  *
1449  * PARAMS
1450  * lpcGUID [I] Address of the GUID that identifies the sound capture device.
1451  * lplpDSC [O] Address of a variable to receive the interface pointer.
1452  * pUnkOuter [I] Must be NULL.
1453  *
1454  * RETURNS
1455  * Success: DS_OK
1456  * Failure: DSERR_NOAGGREGATION, DSERR_ALLOCATED, DSERR_INVALIDPARAM,
1457  * DSERR_OUTOFMEMORY
1458  *
1459  * NOTES
1460  * lpcGUID must be one of the values returned from DirectSoundCaptureEnumerate
1461  * or NULL for the default device or DSDEVID_DefaultCapture or
1462  * DSDEVID_DefaultVoiceCapture.
1463  *
1464  * DSERR_ALLOCATED is returned for sound devices that do not support full duplex.
1465  */
1467  LPCGUID lpcGUID,
1468  LPDIRECTSOUNDCAPTURE8 *ppDSC8,
1469  LPUNKNOWN pUnkOuter)
1470 {
1471  HRESULT hr;
1472  LPDIRECTSOUNDCAPTURE8 pDSC8;
1473  TRACE("(%s,%p,%p)\n", debugstr_guid(lpcGUID), ppDSC8, pUnkOuter);
1474 
1475  if (ppDSC8 == NULL) {
1476  WARN("invalid parameter: ppDSC8 == NULL\n");
1477  return DSERR_INVALIDPARAM;
1478  }
1479 
1480  if (pUnkOuter) {
1481  WARN("invalid parameter: pUnkOuter != NULL\n");
1482  *ppDSC8 = NULL;
1483  return DSERR_NOAGGREGATION;
1484  }
1485 
1487  if (hr == DS_OK) {
1488  hr = IDirectSoundCapture_Initialize(pDSC8, lpcGUID);
1489  if (hr != DS_OK) {
1491  pDSC8 = 0;
1492  }
1493  }
1494 
1495  *ppDSC8 = pDSC8;
1496 
1497  return hr;
1498 }
void setup_dsound_options(void)
Definition: dsound_main.c:101
#define IDirectSoundCaptureBuffer_AddRef(p)
Definition: dsound.h:778
LPWAVEFORMATEX lpwfxFormat
Definition: dsound.h:361
DWORD dwSize
Definition: dsound.h:357
UINT WINAPI waveInClose(HWAVEIN hWaveIn)
Definition: winmm.c:2637
IDirectSoundCaptureNotifyImpl * notify
#define REFIID
Definition: guiddef.h:113
#define TRUE
Definition: types.h:120
HRESULT WINAPI GetDeviceID(LPCGUID pGuidSrc, LPGUID pGuidDest)
Definition: dsound.c:53
#define E_NOINTERFACE
Definition: winerror.h:2364
#define MM_WIM_OPEN
Definition: mmsystem.h:59
#define DSERR_INVALIDCALL
Definition: dsound.h:122
static HRESULT WINAPI IDirectSoundCaptureNotifyImpl_SetNotificationPositions(LPDIRECTSOUNDNOTIFY iface, DWORD howmuch, LPCDSBPOSITIONNOTIFY notify)
Definition: capture.c:85
#define DWORD_PTR
Definition: treelist.c:76
#define IDsCaptureDriverBuffer_GetPosition(p, a, b)
Definition: dsdriver.h:356
HRESULT hr
Definition: shlfolder.c:183
Definition: scsiwmi.h:51
MMRESULT WINAPI waveInOpen(HWAVEIN *lphWaveIn, UINT uDeviceID, LPCWAVEFORMATEX lpFormat, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD dwFlags)
Definition: winmm.c:2626
CHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1050
#define IDirectSoundCapture_Release(p)
Definition: dsound.h:736
REFIID riid
Definition: precomp.h:44
#define DSERR_UNINITIALIZED
Definition: dsound.h:133
DWORD nAvgBytesPerSec
Definition: mmreg.h:81
#define IDsCaptureDriver_Open(p)
Definition: dsdriver.h:320
WORD nChannels
Definition: mmreg.h:79
#define WARN(fmt,...)
Definition: debug.h:111
int notify
Definition: msacm.c:1353
static ULONG WINAPI IDirectSoundCaptureBufferImpl_AddRef(LPDIRECTSOUNDCAPTUREBUFFER8 iface)
Definition: capture.c:233
#define DSERR_ALREADYINITIALIZED
Definition: dsound.h:129
#define IDirectSoundCaptureBuffer_Release(p)
Definition: dsound.h:779
GLintptr offset
Definition: glext.h:5920
#define IDsCaptureDriver_Release(p)
Definition: dsdriver.h:317
#define CALLBACK
Definition: compat.h:27
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:445
#define DSBPN_OFFSETSTOP
Definition: dsound.h:876
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
DWORD dwBufferBytes
Definition: dsound.h:359
const IDirectSoundNotifyVtbl * lpVtbl
Definition: capture.c:36
static ULONG WINAPI IDirectSoundCaptureBufferImpl_Release(LPDIRECTSOUNDCAPTUREBUFFER8 iface)
Definition: capture.c:242
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Start(LPDIRECTSOUNDCAPTUREBUFFER8 iface, DWORD dwFlags)
Definition: capture.c:513
struct tWAVEFORMATEX WAVEFORMATEX
Definition: austream.idl:23
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Stop(LPDIRECTSOUNDCAPTUREBUFFER8 iface)
Definition: capture.c:616
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define IDsCaptureDriverBuffer_Stop(p)
Definition: dsdriver.h:359
#define NO_ERROR
Definition: dderror.h:5
#define E_FAIL
Definition: ddrawi.h:102
#define MM_WIM_DATA
Definition: mmsystem.h:61
UINT WINAPI waveInPrepareHeader(HWAVEIN hWaveIn, WAVEHDR *lpWaveInHdr, UINT uSize)
Definition: winmm.c:2656
Definition: send.c:47
UINT WINAPI waveInMessage(HWAVEIN hWaveIn, UINT uMessage, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
Definition: winmm.c:2816
HRESULT DSOUND_CaptureCreate8(REFIID riid, LPDIRECTSOUNDCAPTURE8 *ppDSC8)
Definition: capture.c:1359
_In_ DWORD _In_ DWORD dwOffset
Definition: ntgdi.h:2032
#define DSDDESC_DOMMSYSTEMSETFORMAT
Definition: dsdriver.h:51
#define DSDDESC_DOMMSYSTEMOPEN
Definition: dsdriver.h:50
DWORD dwBufferBytes
Definition: dsound.h:380
#define IDsCaptureDriverBuffer_Release(p)
Definition: dsdriver.h:351
static void CALLBACK DSOUND_capture_callback(HWAVEIN hwi, UINT msg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2)
Definition: capture.c:765
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define DSERR_OUTOFMEMORY
Definition: dsound.h:125
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetStatus(LPDIRECTSOUNDCAPTUREBUFFER8 iface, LPDWORD lpdwStatus)
Definition: capture.c:395
unsigned char * LPBYTE
Definition: typedefs.h:52
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
#define IDirectSoundCaptureBuffer8_AddRef(p)
Definition: dsound.h:836
long LONG
Definition: pedump.c:60
Definition: devices.h:37
GUID DSOUND_capture_guids[MAXWAVEDRIVERS]
Definition: dsound_main.c:42
struct IDirectSoundCapture * LPDIRECTSOUNDCAPTURE8
Definition: dsound.h:94
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetFormat(LPDIRECTSOUNDCAPTUREBUFFER8 iface, LPWAVEFORMATEX lpwfxFormat, DWORD dwSizeAllocated, LPDWORD lpdwSizeWritten)
Definition: capture.c:358
#define CALLBACK_FUNCTION
Definition: mmsystem.h:150
GLenum GLint ref
Definition: glext.h:6028
DWORD dwSize
Definition: dsound.h:378
#define FIXME(fmt,...)
Definition: debug.h:110
DWORD dwFlags
Definition: dsound.h:379
UINT WINAPI waveInUnprepareHeader(HWAVEIN hWaveIn, WAVEHDR *lpWaveInHdr, UINT uSize)
Definition: winmm.c:2687
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_QueryInterface(LPDIRECTSOUNDCAPTUREBUFFER8 iface, REFIID riid, LPVOID *ppobj)
Definition: capture.c:181
#define E_INVALIDARG
Definition: ddrawi.h:101
unsigned char BOOLEAN
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:697
smooth NULL
Definition: ftsmooth.c:416
#define DSERR_NODRIVER
Definition: dsound.h:128
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetFXStatus(LPDIRECTSOUNDCAPTUREBUFFER8 iface, DWORD dwFXCount, LPDWORD pdwFXStatus)
Definition: capture.c:704
static ULONG WINAPI IDirectSoundCaptureImpl_Release(LPDIRECTSOUNDCAPTURE iface)
Definition: capture.c:1191
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Initialize(LPDIRECTSOUNDCAPTUREBUFFER8 iface, LPDIRECTSOUNDCAPTURE lpDSC, LPCDSCBUFFERDESC lpcDSCBDesc)
Definition: capture.c:433
GLuint index
Definition: glext.h:6031
#define DS_HW_ACCEL_EMULATION
HRESULT WINAPI DirectSoundCaptureCreate8(LPCGUID lpcGUID, LPDIRECTSOUNDCAPTURE8 *ppDSC8, LPUNKNOWN pUnkOuter)
Definition: capture.c:332
#define debugstr_guid
Definition: kernel32.h:35
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Lock(LPDIRECTSOUNDCAPTUREBUFFER8 iface, DWORD dwReadCusor, DWORD dwReadBytes, LPVOID *lplpvAudioPtr1, LPDWORD lpdwAudioBytes1, LPVOID *lplpvAudioPtr2, LPDWORD lpdwAudioBytes2, DWORD dwFlags)
Definition: capture.c:446
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:421
IDirectSoundCaptureBufferImpl * dscb
Definition: capture.c:38
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Unlock(LPDIRECTSOUNDCAPTUREBUFFER8 iface, LPVOID lpvAudioPtr1, DWORD dwAudioBytes1, LPVOID lpvAudioPtr2, DWORD dwAudioBytes2)
Definition: capture.c:656
#define STATE_STOPPED
static HRESULT IDirectSoundCaptureBufferImpl_Create(DirectSoundCaptureDevice *device, IDirectSoundCaptureBufferImpl **ppobj, LPCDSCBUFFERDESC lpcDSCBufferDesc)
Definition: capture.c:807
HRESULT mmErr(UINT err)
Definition: dsound_main.c:44
static ULONG WINAPI IDirectSoundCaptureImpl_AddRef(LPDIRECTSOUNDCAPTURE iface)
Definition: capture.c:1182
#define IDirectSoundNotify_AddRef(p)
Definition: dsound.h:893
HRESULT DSOUND_CaptureCreate(REFIID riid, LPDIRECTSOUNDCAPTURE *ppDSC)
Definition: capture.c:1330
static HRESULT WINAPI IDirectSoundCaptureImpl_Initialize(LPDIRECTSOUNDCAPTURE iface, LPCGUID lpcGUID)
Definition: capture.c:1280
#define DS_OK
Definition: dsound.h:116
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
static ULONG WINAPI IDirectSoundCaptureNotifyImpl_Release(LPDIRECTSOUNDNOTIFY iface)
Definition: capture.c:68
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define MM_WIM_CLOSE
Definition: mmsystem.h:60
const IDirectSoundCaptureVtbl * lpVtbl
Definition: capture.c:1142
#define IDsCaptureDriver_CreateCaptureBuffer(p, a, b, c, d, e, f)
Definition: dsdriver.h:323
if(!(yy_init))
Definition: macro.lex.yy.c:714
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
DWORD dwFormats
Definition: dsound.h:371
LONG HRESULT
Definition: typedefs.h:77
#define DSCBSTATUS_CAPTURING
Definition: dsound.h:396
#define UlongToHandle(ul)
Definition: basetsd.h:97
const GUID IID_IUnknown
#define IDsCaptureDriver_GetCaps(p, a)
Definition: dsdriver.h:322
static void capture_CheckNotify(IDirectSoundCaptureBufferImpl *This, DWORD from, DWORD len)
Definition: capture.c:739
#define IDsDriverNotify_Release(p)
Definition: dsdriver.h:289
#define STATE_CAPTURING
DWORD dwFormats
Definition: mmsystem.h:1051
#define WINAPI
Definition: msvc.h:8
#define IDirectSoundCapture_Initialize(p, a)
Definition: dsound.h:740
const GLubyte * c
Definition: glext.h:8905
LPWAVEFORMATEX DSOUND_CopyFormat(LPCWAVEFORMATEX wfex) DECLSPEC_HIDDEN
Definition: primary.c:437
#define IDsCaptureDriver_Close(p)
Definition: dsdriver.h:321
#define CopyMemory
Definition: winbase.h:1633
#define IDsCaptureDriverBuffer_QueryInterface(p, a, b)
Definition: dsdriver.h:349
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IID_IDirectSoundCapture8
Definition: dsound.h:93
#define FillMemory(BUF, SIZ, MASK)
Definition: strucsup.c:31
static HRESULT IDirectSoundCaptureNotifyImpl_Create(IDirectSoundCaptureBufferImpl *dscb, IDirectSoundCaptureNotifyImpl **pdscn)
Definition: capture.c:144
GLbitfield flags
Definition: glext.h:7161
static HRESULT WINAPI IDirectSoundCaptureImpl_GetCaps(LPDIRECTSOUNDCAPTURE iface, LPDSCCAPS lpDSCCaps)
Definition: capture.c:1248
#define DSERR_UNSUPPORTED
Definition: dsound.h:127
WORD wFormatTag
Definition: mmreg.h:78
#define MAXWAVEDRIVERS
Definition: mmddk.h:33
static HRESULT DirectSoundCaptureDevice_Create(DirectSoundCaptureDevice **ppDevice)
Definition: capture.c:967
#define STATE_STARTING
static ULONG DirectSoundCaptureDevice_Release(DirectSoundCaptureDevice *device)
Definition: capture.c:992
static const IDirectSoundCaptureBuffer8Vtbl dscbvt
Definition: capture.c:716
static LPDIRECTSOUNDCAPTURE LPUNKNOWN
Definition: capture.c:28
#define DSCBSTART_LOOPING
Definition: dsound.h:393
#define InterlockedDecrement
Definition: armddk.h:52
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
UINT WINAPI waveInAddBuffer(HWAVEIN hWaveIn, WAVEHDR *lpWaveInHdr, UINT uSize)
Definition: winmm.c:2720
struct _DSCBCAPS DSCBCAPS
GLenum GLsizei len
Definition: glext.h:6722
#define GUID_NULL
Definition: ks.h:106
#define err(...)
struct _cl_event * event
Definition: glext.h:7739
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define IDsCaptureDriverBuffer_Start(p, a)
Definition: dsdriver.h:358
static HRESULT WINAPI IDirectSoundCaptureImpl_CreateCaptureBuffer(LPDIRECTSOUNDCAPTURE iface, LPCDSCBUFFERDESC lpcDSCBufferDesc, LPDIRECTSOUNDCAPTUREBUFFER *lplpDSCaptureBuffer, LPUNKNOWN pUnk)
Definition: capture.c:1207
struct IDirectSoundCapture * LPDIRECTSOUNDCAPTURE
Definition: dsound.h:92
#define IDsCaptureDriver_GetDriverDesc(p, a)
Definition: dsdriver.h:319
UINT WINAPI waveInStart(HWAVEIN hWaveIn)
Definition: winmm.c:2752
struct IDirectSoundNotify * LPDIRECTSOUNDNOTIFY
Definition: dsound.h:82
UINT WINAPI waveInReset(HWAVEIN hWaveIn)
Definition: winmm.c:2737
static const IDirectSoundCaptureVtbl dscvt
Definition: capture.c:1294
static HRESULT WINAPI IDirectSoundCaptureNotifyImpl_QueryInterface(LPDIRECTSOUNDNOTIFY iface, REFIID riid, LPVOID *ppobj)
Definition: capture.c:44
DWORD DSOUND_fraglen(DWORD nSamplesPerSec, DWORD nBlockAlign) DECLSPEC_HIDDEN
Definition: primary.c:36
#define S_OK
Definition: intsafe.h:59
DWORD dwReserved
Definition: dsound.h:381
#define InterlockedIncrement
Definition: armddk.h:53
DWORD dwFlags
Definition: dsound.h:370
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetCaps(LPDIRECTSOUNDCAPTUREBUFFER8 iface, LPDSCBCAPS lpDSCBCaps)
Definition: capture.c:286
static HRESULT DirectSoundCaptureDevice_Initialize(DirectSoundCaptureDevice **ppDevice, LPCGUID lpcGUID)
Definition: capture.c:1019
struct IDirectSoundCaptureBuffer * LPDIRECTSOUNDCAPTUREBUFFER
Definition: dsound.h:97
#define HeapReAlloc
Definition: compat.h:393
WORD cbSize
Definition: mmreg.h:84
#define DSERR_NOAGGREGATION
Definition: dsound.h:130
#define WAVE_MAPPED
Definition: mmsystem.h:190
HRESULT WINAPI DirectSoundCaptureCreate(LPCGUID lpcGUID, LPDIRECTSOUNDCAPTURE *ppDSC, LPUNKNOWN pUnkOuter)
Definition: capture.c:322
#define DSCCAPS_EMULDRIVER
Definition: dsound.h:385
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
#define lstrcpynA
Definition: compat.h:408
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
DWORD dwChannels
Definition: dsound.h:372
static const char *const captureStateString[]
Definition: capture.c:169
DWORD nSamplesPerSec
Definition: mmreg.h:80
#define msg(x)
Definition: auth_time.c:54
WORD nBlockAlign
Definition: mmreg.h:82
#define IDirectSoundCapture_AddRef(p)
Definition: dsound.h:735
UINT WINAPI waveInGetDevCapsA(UINT_PTR uDeviceID, LPWAVEINCAPSA lpCaps, UINT uSize)
Definition: winmm.c:2600
uint32_t * LPDWORD
Definition: typedefs.h:57
WORD wBitsPerSample
Definition: mmreg.h:83
#define DSERR_ALLOCATED
Definition: dsound.h:119
#define c
Definition: ke_i.h:80
unsigned int ULONG
Definition: retypes.h:1
static ULONG WINAPI IDirectSoundCaptureNotifyImpl_AddRef(LPDIRECTSOUNDNOTIFY iface)
Definition: capture.c:60
#define IDirectSoundNotify_Release(p)
Definition: dsound.h:894
UINT WINAPI waveInGetNumDevs(void)
Definition: winmm.c:2568
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetCurrentPosition(LPDIRECTSOUNDCAPTUREBUFFER8 iface, LPDWORD lpdwCapturePosition, LPDWORD lpdwReadPosition)
Definition: capture.c:318
#define STATE_STOPPING
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
struct IDirectSoundCaptureBuffer8 * LPDIRECTSOUNDCAPTUREBUFFER8
Definition: dsound.h:100
CardRegion * from
Definition: spigame.cpp:19
static HRESULT WINAPI IDirectSoundCaptureImpl_QueryInterface(LPDIRECTSOUNDCAPTURE iface, REFIID riid, LPVOID *ppobj)
Definition: capture.c:1152
#define IDsCaptureDriverBuffer_Lock(p, a, b, c, d, e, f, g)
Definition: dsdriver.h:353
DirectSoundCaptureDevice * device
Definition: capture.c:1145
#define IDirectSoundCaptureBuffer_QueryInterface(p, a, b)
Definition: dsound.h:777
#define DSCBSTATUS_LOOPING
Definition: dsound.h:397
#define TRACE_ON(x)
Definition: compat.h:65
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
#define HeapFree(x, y, z)
Definition: compat.h:394
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetObjectInPath(LPDIRECTSOUNDCAPTUREBUFFER8 iface, REFGUID rguidObject, DWORD dwIndex, REFGUID rguidInterface, LPVOID *ppObject)
Definition: capture.c:688
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90
static const IDirectSoundNotifyVtbl dscnvt
Definition: capture.c:136
DWORD dwSize
Definition: dsound.h:369
#define IDsDriverNotify_SetNotificationPositions(p, a, b)
Definition: dsdriver.h:291
DirectSoundCaptureDevice * DSOUND_capture[MAXWAVEDRIVERS]
Definition: capture.c:965
static HRESULT IDirectSoundCaptureImpl_Create(LPDIRECTSOUNDCAPTURE8 *ppDSC)
Definition: capture.c:1307
#define DSDDESC_USESYSTEMMEMORY
Definition: dsdriver.h:52
int ds_hw_accel
Definition: dsound_main.c:77
#define IDsCaptureDriverBuffer_Unlock(p, a, b, c, d)
Definition: dsdriver.h:354