Fixed a problem when multiple devices are present and a device other
than the first one is used.
This commit is contained in:
parent
fc47be5735
commit
fa13d013e8
|
@ -517,8 +517,9 @@ IDirectSoundCaptureImpl_Initialize(
|
|||
/* if no DirectSound interface available, use WINMM API instead */
|
||||
This->drvdesc.dwFlags = DSDDESC_DOMMSYSTEMOPEN |
|
||||
DSDDESC_DOMMSYSTEMSETFORMAT;
|
||||
This->drvdesc.dnDevNode = wid; /* FIXME? */
|
||||
}
|
||||
|
||||
This->drvdesc.dnDevNode = wid;
|
||||
|
||||
/* open the DirectSound driver if available */
|
||||
if (This->driver && (err == DS_OK))
|
||||
|
|
|
@ -718,8 +718,10 @@ HRESULT WINAPI DirectSoundCreate8(LPCGUID lpcGUID,LPDIRECTSOUND8 *ppDS,IUnknown
|
|||
GUID devGuid;
|
||||
TRACE("(%p,%p,%p)\n",lpcGUID,ippDS,pUnkOuter);
|
||||
|
||||
if (ippDS == NULL)
|
||||
if (ippDS == NULL) {
|
||||
WARN("invalid parameter\n");
|
||||
return DSERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
/* Get dsound configuration */
|
||||
setup_dsound_options();
|
||||
|
@ -733,9 +735,9 @@ HRESULT WINAPI DirectSoundCreate8(LPCGUID lpcGUID,LPDIRECTSOUND8 *ppDS,IUnknown
|
|||
return DSERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
if (dsound && IsEqualGUID(&devGuid, &dsound->guid) ) {
|
||||
ERR("dsound already opened\n");
|
||||
if (dsound) {
|
||||
if (IsEqualGUID(&devGuid, &dsound->guid) ) {
|
||||
ERR("dsound already opened\n");
|
||||
IDirectSound_AddRef((LPDIRECTSOUND)dsound);
|
||||
*ippDS = dsound;
|
||||
return DS_OK;
|
||||
|
@ -791,7 +793,6 @@ HRESULT WINAPI DirectSoundCreate8(LPCGUID lpcGUID,LPDIRECTSOUND8 *ppDS,IUnknown
|
|||
(*ippDS)->state = STATE_STOPPED;
|
||||
(*ippDS)->nrofbuffers = 0;
|
||||
(*ippDS)->buffers = NULL;
|
||||
/* (*ippDS)->primary = NULL; */
|
||||
(*ippDS)->listener = NULL;
|
||||
|
||||
(*ippDS)->prebuf = ds_snd_queue_max;
|
||||
|
@ -803,9 +804,10 @@ HRESULT WINAPI DirectSoundCreate8(LPCGUID lpcGUID,LPDIRECTSOUND8 *ppDS,IUnknown
|
|||
} else {
|
||||
/* if no DirectSound interface available, use WINMM API instead */
|
||||
(*ippDS)->drvdesc.dwFlags = DSDDESC_DOMMSYSTEMOPEN | DSDDESC_DOMMSYSTEMSETFORMAT;
|
||||
(*ippDS)->drvdesc.dnDevNode = wod; /* FIXME? */
|
||||
}
|
||||
|
||||
(*ippDS)->drvdesc.dnDevNode = wod;
|
||||
|
||||
/* Set default wave format (may need it for waveOutOpen) */
|
||||
(*ippDS)->wfx.wFormatTag = WAVE_FORMAT_PCM;
|
||||
/* We rely on the sound driver to return the actual sound format of
|
||||
|
@ -830,22 +832,10 @@ HRESULT WINAPI DirectSoundCreate8(LPCGUID lpcGUID,LPDIRECTSOUND8 *ppDS,IUnknown
|
|||
if (ds_hw_accel != DS_HW_ACCEL_EMULATION)
|
||||
flags |= WAVE_DIRECTSOUND;
|
||||
|
||||
/* FIXME: is this right? */
|
||||
(*ippDS)->drvdesc.dnDevNode = 0;
|
||||
err = DSERR_ALLOCATED;
|
||||
|
||||
/* if this device is busy try the next one */
|
||||
while((err == DSERR_ALLOCATED) &&
|
||||
((*ippDS)->drvdesc.dnDevNode < wodn))
|
||||
{
|
||||
err = mmErr(waveOutOpen(&((*ippDS)->hwo),
|
||||
err = mmErr(waveOutOpen(&((*ippDS)->hwo),
|
||||
(*ippDS)->drvdesc.dnDevNode, &((*ippDS)->wfx),
|
||||
(DWORD)DSOUND_callback, (DWORD)(*ippDS),
|
||||
flags));
|
||||
(*ippDS)->drvdesc.dnDevNode++; /* next wave device */
|
||||
}
|
||||
|
||||
(*ippDS)->drvdesc.dnDevNode--; /* take away last increment */
|
||||
}
|
||||
|
||||
if (drv && (err == DS_OK))
|
||||
|
|
Loading…
Reference in New Issue