Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
6ec5b351
Commit
6ec5b351
authored
May 06, 2005
by
Robert Reif
Committed by
Alexandre Julliard
May 06, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move initialization to IDirectSound_Initialize.
Fix error paths to handle a failed IDirectSound_Initialize. Add tests for IDirectSound_Initialize.
parent
15934680
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
177 additions
and
156 deletions
+177
-156
dsound.c
dlls/dsound/dsound.c
+157
-150
dsound.c
dlls/dsound/tests/dsound.c
+11
-3
dsound8.c
dlls/dsound/tests/dsound8.c
+9
-3
No files found.
dlls/dsound/dsound.c
View file @
6ec5b351
...
@@ -684,11 +684,107 @@ static HRESULT WINAPI IDirectSoundImpl_Initialize(
...
@@ -684,11 +684,107 @@ static HRESULT WINAPI IDirectSoundImpl_Initialize(
LPCGUID
lpcGuid
)
LPCGUID
lpcGuid
)
{
{
IDirectSoundImpl
*
This
=
(
IDirectSoundImpl
*
)
iface
;
IDirectSoundImpl
*
This
=
(
IDirectSoundImpl
*
)
iface
;
HRESULT
hr
=
DS_OK
;
TRACE
(
"(%p,%s)
\n
"
,
This
,
debugstr_guid
(
lpcGuid
));
TRACE
(
"(%p,%s)
\n
"
,
This
,
debugstr_guid
(
lpcGuid
));
This
->
initialized
=
TRUE
;
if
(
This
->
initialized
==
TRUE
)
{
WARN
(
"already initialized
\n
"
);
return
DSERR_ALREADYINITIALIZED
;
}
return
DS_OK
;
/* If the driver requests being opened through MMSYSTEM
* (which is recommended by the DDK), it is supposed to happen
* before the DirectSound interface is opened */
if
(
This
->
drvdesc
.
dwFlags
&
DSDDESC_DOMMSYSTEMOPEN
)
{
DWORD
flags
=
CALLBACK_FUNCTION
;
/* disable direct sound if requested */
if
(
ds_hw_accel
!=
DS_HW_ACCEL_EMULATION
)
flags
|=
WAVE_DIRECTSOUND
;
hr
=
mmErr
(
waveOutOpen
(
&
(
This
->
hwo
),
This
->
drvdesc
.
dnDevNode
,
This
->
pwfx
,
(
DWORD
)
DSOUND_callback
,
(
DWORD
)
This
,
flags
));
if
(
hr
!=
DS_OK
)
{
WARN
(
"waveOutOpen failed
\n
"
);
return
hr
;
}
}
if
(
This
->
driver
)
{
hr
=
IDsDriver_Open
(
This
->
driver
);
if
(
hr
!=
DS_OK
)
{
WARN
(
"IDsDriver_Open failed
\n
"
);
return
hr
;
}
/* the driver is now open, so it's now allowed to call GetCaps */
hr
=
IDsDriver_GetCaps
(
This
->
driver
,
&
(
This
->
drvcaps
));
if
(
hr
!=
DS_OK
)
{
WARN
(
"IDsDriver_GetCaps failed
\n
"
);
return
hr
;
}
}
else
{
WAVEOUTCAPSA
woc
;
hr
=
mmErr
(
waveOutGetDevCapsA
(
This
->
drvdesc
.
dnDevNode
,
&
woc
,
sizeof
(
woc
)));
if
(
hr
!=
DS_OK
)
{
WARN
(
"waveOutGetDevCaps failed
\n
"
);
return
hr
;
}
ZeroMemory
(
&
This
->
drvcaps
,
sizeof
(
This
->
drvcaps
));
if
((
woc
.
dwFormats
&
WAVE_FORMAT_1M08
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_2M08
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_4M08
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_48M08
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_96M08
))
{
This
->
drvcaps
.
dwFlags
|=
DSCAPS_PRIMARY8BIT
;
This
->
drvcaps
.
dwFlags
|=
DSCAPS_PRIMARYMONO
;
}
if
((
woc
.
dwFormats
&
WAVE_FORMAT_1M16
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_2M16
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_4M16
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_48M16
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_96M16
))
{
This
->
drvcaps
.
dwFlags
|=
DSCAPS_PRIMARY16BIT
;
This
->
drvcaps
.
dwFlags
|=
DSCAPS_PRIMARYMONO
;
}
if
((
woc
.
dwFormats
&
WAVE_FORMAT_1S08
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_2S08
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_4S08
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_48S08
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_96S08
))
{
This
->
drvcaps
.
dwFlags
|=
DSCAPS_PRIMARY8BIT
;
This
->
drvcaps
.
dwFlags
|=
DSCAPS_PRIMARYSTEREO
;
}
if
((
woc
.
dwFormats
&
WAVE_FORMAT_1S16
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_2S16
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_4S16
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_48S16
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_96S16
))
{
This
->
drvcaps
.
dwFlags
|=
DSCAPS_PRIMARY16BIT
;
This
->
drvcaps
.
dwFlags
|=
DSCAPS_PRIMARYSTEREO
;
}
if
(
ds_emuldriver
)
This
->
drvcaps
.
dwFlags
|=
DSCAPS_EMULDRIVER
;
This
->
drvcaps
.
dwMinSecondarySampleRate
=
DSBFREQUENCY_MIN
;
This
->
drvcaps
.
dwMaxSecondarySampleRate
=
DSBFREQUENCY_MAX
;
This
->
drvcaps
.
dwPrimaryBuffers
=
1
;
}
hr
=
DSOUND_PrimaryCreate
((
IDirectSoundImpl
*
)
This
);
if
(
hr
==
DS_OK
)
{
This
->
initialized
=
TRUE
;
DSOUND_renderer
=
(
IDirectSoundImpl
*
)
This
;
timeBeginPeriod
(
DS_TIME_RES
);
DSOUND_renderer
->
timerID
=
timeSetEvent
(
DS_TIME_DEL
,
DS_TIME_RES
,
DSOUND_timer
,
(
DWORD
)
DSOUND_renderer
,
TIME_PERIODIC
|
TIME_CALLBACK_FUNCTION
);
}
else
{
WARN
(
"DSOUND_PrimaryCreate failed
\n
"
);
}
return
hr
;
}
}
static
HRESULT
WINAPI
IDirectSoundImpl_VerifyCertification
(
static
HRESULT
WINAPI
IDirectSoundImpl_VerifyCertification
(
...
@@ -841,11 +937,11 @@ HRESULT WINAPI IDirectSoundImpl_Create(
...
@@ -841,11 +937,11 @@ HRESULT WINAPI IDirectSoundImpl_Create(
return
DSERR_OUTOFMEMORY
;
return
DSERR_OUTOFMEMORY
;
}
}
pDS
->
pwfx
->
wFormatTag
=
WAVE_FORMAT_PCM
;
/* We rely on the sound driver to return the actual sound format of
/* We rely on the sound driver to return the actual sound format of
* the device if it does not support 22050x8x2 and is given the
* the device if it does not support 22050x8x2 and is given the
* WAVE_DIRECTSOUND flag.
* WAVE_DIRECTSOUND flag.
*/
*/
pDS
->
pwfx
->
wFormatTag
=
WAVE_FORMAT_PCM
;
pDS
->
pwfx
->
nSamplesPerSec
=
22050
;
pDS
->
pwfx
->
nSamplesPerSec
=
22050
;
pDS
->
pwfx
->
wBitsPerSample
=
8
;
pDS
->
pwfx
->
wBitsPerSample
=
8
;
pDS
->
pwfx
->
nChannels
=
2
;
pDS
->
pwfx
->
nChannels
=
2
;
...
@@ -853,95 +949,6 @@ HRESULT WINAPI IDirectSoundImpl_Create(
...
@@ -853,95 +949,6 @@ HRESULT WINAPI IDirectSoundImpl_Create(
pDS
->
pwfx
->
nAvgBytesPerSec
=
pDS
->
pwfx
->
nSamplesPerSec
*
pDS
->
pwfx
->
nBlockAlign
;
pDS
->
pwfx
->
nAvgBytesPerSec
=
pDS
->
pwfx
->
nSamplesPerSec
*
pDS
->
pwfx
->
nBlockAlign
;
pDS
->
pwfx
->
cbSize
=
0
;
pDS
->
pwfx
->
cbSize
=
0
;
/* If the driver requests being opened through MMSYSTEM
* (which is recommended by the DDK), it is supposed to happen
* before the DirectSound interface is opened */
if
(
pDS
->
drvdesc
.
dwFlags
&
DSDDESC_DOMMSYSTEMOPEN
)
{
DWORD
flags
=
CALLBACK_FUNCTION
;
/* disable direct sound if requested */
if
(
ds_hw_accel
!=
DS_HW_ACCEL_EMULATION
)
flags
|=
WAVE_DIRECTSOUND
;
err
=
mmErr
(
waveOutOpen
(
&
(
pDS
->
hwo
),
pDS
->
drvdesc
.
dnDevNode
,
pDS
->
pwfx
,
(
DWORD
)
DSOUND_callback
,
(
DWORD
)
pDS
,
flags
));
if
(
err
!=
DS_OK
)
{
WARN
(
"waveOutOpen failed
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
pDS
);
*
ppDS
=
NULL
;
return
err
;
}
}
if
(
drv
)
{
err
=
IDsDriver_Open
(
drv
);
if
(
err
!=
DS_OK
)
{
WARN
(
"IDsDriver_Open failed
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
pDS
);
*
ppDS
=
NULL
;
return
err
;
}
/* the driver is now open, so it's now allowed to call GetCaps */
err
=
IDsDriver_GetCaps
(
drv
,
&
(
pDS
->
drvcaps
));
if
(
err
!=
DS_OK
)
{
WARN
(
"IDsDriver_GetCaps failed
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
pDS
);
*
ppDS
=
NULL
;
return
err
;
}
}
else
{
WAVEOUTCAPSA
woc
;
err
=
mmErr
(
waveOutGetDevCapsA
(
pDS
->
drvdesc
.
dnDevNode
,
&
woc
,
sizeof
(
woc
)));
if
(
err
!=
DS_OK
)
{
WARN
(
"waveOutGetDevCaps failed
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
pDS
);
*
ppDS
=
NULL
;
return
err
;
}
ZeroMemory
(
&
pDS
->
drvcaps
,
sizeof
(
pDS
->
drvcaps
));
if
((
woc
.
dwFormats
&
WAVE_FORMAT_1M08
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_2M08
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_4M08
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_48M08
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_96M08
))
{
pDS
->
drvcaps
.
dwFlags
|=
DSCAPS_PRIMARY8BIT
;
pDS
->
drvcaps
.
dwFlags
|=
DSCAPS_PRIMARYMONO
;
}
if
((
woc
.
dwFormats
&
WAVE_FORMAT_1M16
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_2M16
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_4M16
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_48M16
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_96M16
))
{
pDS
->
drvcaps
.
dwFlags
|=
DSCAPS_PRIMARY16BIT
;
pDS
->
drvcaps
.
dwFlags
|=
DSCAPS_PRIMARYMONO
;
}
if
((
woc
.
dwFormats
&
WAVE_FORMAT_1S08
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_2S08
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_4S08
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_48S08
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_96S08
))
{
pDS
->
drvcaps
.
dwFlags
|=
DSCAPS_PRIMARY8BIT
;
pDS
->
drvcaps
.
dwFlags
|=
DSCAPS_PRIMARYSTEREO
;
}
if
((
woc
.
dwFormats
&
WAVE_FORMAT_1S16
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_2S16
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_4S16
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_48S16
)
||
(
woc
.
dwFormats
&
WAVE_FORMAT_96S16
))
{
pDS
->
drvcaps
.
dwFlags
|=
DSCAPS_PRIMARY16BIT
;
pDS
->
drvcaps
.
dwFlags
|=
DSCAPS_PRIMARYSTEREO
;
}
if
(
ds_emuldriver
)
pDS
->
drvcaps
.
dwFlags
|=
DSCAPS_EMULDRIVER
;
pDS
->
drvcaps
.
dwMinSecondarySampleRate
=
DSBFREQUENCY_MIN
;
pDS
->
drvcaps
.
dwMaxSecondarySampleRate
=
DSBFREQUENCY_MAX
;
pDS
->
drvcaps
.
dwPrimaryBuffers
=
1
;
}
InitializeCriticalSection
(
&
(
pDS
->
mixlock
));
InitializeCriticalSection
(
&
(
pDS
->
mixlock
));
pDS
->
mixlock
.
DebugInfo
->
Spare
[
1
]
=
(
DWORD
)
"DSOUND_mixlock"
;
pDS
->
mixlock
.
DebugInfo
->
Spare
[
1
]
=
(
DWORD
)
"DSOUND_mixlock"
;
...
@@ -1610,16 +1617,6 @@ HRESULT WINAPI DSOUND_Create(
...
@@ -1610,16 +1617,6 @@ HRESULT WINAPI DSOUND_Create(
TRACE
(
"(%s,%p,%p)
\n
"
,
debugstr_guid
(
lpcGUID
),
ppDS
,
pUnkOuter
);
TRACE
(
"(%s,%p,%p)
\n
"
,
debugstr_guid
(
lpcGUID
),
ppDS
,
pUnkOuter
);
if
(
pUnkOuter
!=
NULL
)
{
WARN
(
"invalid parameter: pUnkOuter != NULL
\n
"
);
return
DSERR_INVALIDPARAM
;
}
if
(
ppDS
==
NULL
)
{
WARN
(
"invalid parameter: ppDS == NULL
\n
"
);
return
DSERR_INVALIDPARAM
;
}
/* Get dsound configuration */
/* Get dsound configuration */
setup_dsound_options
();
setup_dsound_options
();
...
@@ -1649,22 +1646,11 @@ HRESULT WINAPI DSOUND_Create(
...
@@ -1649,22 +1646,11 @@ HRESULT WINAPI DSOUND_Create(
LPDIRECTSOUND8
pDS
;
LPDIRECTSOUND8
pDS
;
hr
=
IDirectSoundImpl_Create
(
&
devGuid
,
&
pDS
);
hr
=
IDirectSoundImpl_Create
(
&
devGuid
,
&
pDS
);
if
(
hr
==
DS_OK
)
{
if
(
hr
==
DS_OK
)
{
hr
=
DSOUND_PrimaryCreate
((
IDirectSoundImpl
*
)
pDS
);
hr
=
IDirectSound_IDirectSound_Create
(
pDS
,
ppDS
);
if
(
hr
==
DS_OK
)
{
if
(
*
ppDS
)
hr
=
IDirectSound_IDirectSound_Create
(
pDS
,
ppDS
);
IDirectSound_IDirectSound_AddRef
(
*
ppDS
);
if
(
*
ppDS
)
{
else
{
IDirectSound_IDirectSound_AddRef
(
*
ppDS
);
WARN
(
"IDirectSound_IDirectSound_Create failed
\n
"
);
DSOUND_renderer
=
(
IDirectSoundImpl
*
)
pDS
;
timeBeginPeriod
(
DS_TIME_RES
);
DSOUND_renderer
->
timerID
=
timeSetEvent
(
DS_TIME_DEL
,
DS_TIME_RES
,
DSOUND_timer
,
(
DWORD
)
DSOUND_renderer
,
TIME_PERIODIC
|
TIME_CALLBACK_FUNCTION
);
}
else
{
WARN
(
"IDirectSound_IDirectSound_Create failed
\n
"
);
IDirectSound8_Release
(
pDS
);
}
}
else
{
WARN
(
"DSOUND_PrimaryCreate failed
\n
"
);
IDirectSound8_Release
(
pDS
);
IDirectSound8_Release
(
pDS
);
}
}
}
else
}
else
...
@@ -1695,12 +1681,33 @@ HRESULT WINAPI DirectSoundCreate(
...
@@ -1695,12 +1681,33 @@ HRESULT WINAPI DirectSoundCreate(
IUnknown
*
pUnkOuter
)
IUnknown
*
pUnkOuter
)
{
{
HRESULT
hr
;
HRESULT
hr
;
LPDIRECTSOUND
pDS
;
TRACE
(
"(%s,%p,%p)
\n
"
,
debugstr_guid
(
lpcGUID
),
ppDS
,
pUnkOuter
);
TRACE
(
"(%s,%p,%p)
\n
"
,
debugstr_guid
(
lpcGUID
),
ppDS
,
pUnkOuter
);
hr
=
DSOUND_Create
(
lpcGUID
,
ppDS
,
pUnkOuter
);
if
(
ppDS
==
NULL
)
{
if
(
hr
==
DS_OK
)
WARN
(
"invalid parameter: ppDS == NULL
\n
"
);
IDirectSound_Initialize
(
*
ppDS
,
lpcGUID
);
return
DSERR_INVALIDPARAM
;
}
if
(
pUnkOuter
!=
NULL
)
{
WARN
(
"invalid parameter: pUnkOuter != NULL
\n
"
);
*
ppDS
=
0
;
return
DSERR_INVALIDPARAM
;
}
hr
=
DSOUND_Create
(
lpcGUID
,
&
pDS
,
pUnkOuter
);
if
(
hr
==
DS_OK
)
{
IDirectSound_IDirectSound
*
pp
=
(
IDirectSound_IDirectSound
*
)
pDS
;
IDirectSoundImpl
*
p
=
(
IDirectSoundImpl
*
)(
pp
->
pds
);
if
(
!
(
p
->
initialized
))
{
hr
=
IDirectSound_Initialize
(
pDS
,
lpcGUID
);
if
(
hr
!=
DS_OK
)
IDirectSound_Release
(
pDS
);
}
}
*
ppDS
=
pDS
;
return
hr
;
return
hr
;
}
}
...
@@ -1715,16 +1722,6 @@ HRESULT WINAPI DSOUND_Create8(
...
@@ -1715,16 +1722,6 @@ HRESULT WINAPI DSOUND_Create8(
TRACE
(
"(%s,%p,%p)
\n
"
,
debugstr_guid
(
lpcGUID
),
ppDS
,
pUnkOuter
);
TRACE
(
"(%s,%p,%p)
\n
"
,
debugstr_guid
(
lpcGUID
),
ppDS
,
pUnkOuter
);
if
(
pUnkOuter
!=
NULL
)
{
WARN
(
"invalid parameter: pUnkOuter != NULL
\n
"
);
return
DSERR_INVALIDPARAM
;
}
if
(
ppDS
==
NULL
)
{
WARN
(
"invalid parameter: ppDS == NULL
\n
"
);
return
DSERR_INVALIDPARAM
;
}
/* Get dsound configuration */
/* Get dsound configuration */
setup_dsound_options
();
setup_dsound_options
();
...
@@ -1754,22 +1751,11 @@ HRESULT WINAPI DSOUND_Create8(
...
@@ -1754,22 +1751,11 @@ HRESULT WINAPI DSOUND_Create8(
LPDIRECTSOUND8
pDS
;
LPDIRECTSOUND8
pDS
;
hr
=
IDirectSoundImpl_Create
(
&
devGuid
,
&
pDS
);
hr
=
IDirectSoundImpl_Create
(
&
devGuid
,
&
pDS
);
if
(
hr
==
DS_OK
)
{
if
(
hr
==
DS_OK
)
{
hr
=
DSOUND_PrimaryCreate
((
IDirectSoundImpl
*
)
pDS
);
hr
=
IDirectSound8_IDirectSound8_Create
(
pDS
,
ppDS
);
if
(
hr
==
DS_OK
)
{
if
(
*
ppDS
)
hr
=
IDirectSound8_IDirectSound8_Create
(
pDS
,
ppDS
);
IDirectSound8_IDirectSound8_AddRef
(
*
ppDS
);
if
(
*
ppDS
)
{
else
{
IDirectSound8_IDirectSound8_AddRef
(
*
ppDS
);
WARN
(
"IDirectSound8_IDirectSound8_Create failed
\n
"
);
DSOUND_renderer
=
(
IDirectSoundImpl
*
)
pDS
;
timeBeginPeriod
(
DS_TIME_RES
);
DSOUND_renderer
->
timerID
=
timeSetEvent
(
DS_TIME_DEL
,
DS_TIME_RES
,
DSOUND_timer
,
(
DWORD
)
DSOUND_renderer
,
TIME_PERIODIC
|
TIME_CALLBACK_FUNCTION
);
}
else
{
WARN
(
"IDirectSound8_IDirectSound8_Create failed
\n
"
);
IDirectSound8_Release
(
pDS
);
}
}
else
{
WARN
(
"DSOUND_PrimaryCreate failed
\n
"
);
IDirectSound8_Release
(
pDS
);
IDirectSound8_Release
(
pDS
);
}
}
}
else
}
else
...
@@ -1800,12 +1786,33 @@ HRESULT WINAPI DirectSoundCreate8(
...
@@ -1800,12 +1786,33 @@ HRESULT WINAPI DirectSoundCreate8(
IUnknown
*
pUnkOuter
)
IUnknown
*
pUnkOuter
)
{
{
HRESULT
hr
;
HRESULT
hr
;
LPDIRECTSOUND8
pDS
;
TRACE
(
"(%s,%p,%p)
\n
"
,
debugstr_guid
(
lpcGUID
),
ppDS
,
pUnkOuter
);
TRACE
(
"(%s,%p,%p)
\n
"
,
debugstr_guid
(
lpcGUID
),
ppDS
,
pUnkOuter
);
hr
=
DSOUND_Create8
(
lpcGUID
,
ppDS
,
pUnkOuter
);
if
(
ppDS
==
NULL
)
{
if
(
hr
==
DS_OK
)
WARN
(
"invalid parameter: ppDS == NULL
\n
"
);
IDirectSound8_Initialize
(
*
ppDS
,
lpcGUID
);
return
DSERR_INVALIDPARAM
;
}
if
(
pUnkOuter
!=
NULL
)
{
WARN
(
"invalid parameter: pUnkOuter != NULL
\n
"
);
*
ppDS
=
0
;
return
DSERR_INVALIDPARAM
;
}
hr
=
DSOUND_Create8
(
lpcGUID
,
&
pDS
,
pUnkOuter
);
if
(
hr
==
DS_OK
)
{
IDirectSound8_IDirectSound8
*
pp
=
(
IDirectSound8_IDirectSound8
*
)
pDS
;
IDirectSoundImpl
*
p
=
(
IDirectSoundImpl
*
)(
pp
->
pds
);
if
(
!
(
p
->
initialized
))
{
hr
=
IDirectSound8_Initialize
(
pDS
,
lpcGUID
);
if
(
hr
!=
DS_OK
)
IDirectSound8_Release
(
pDS
);
}
}
*
ppDS
=
pDS
;
return
hr
;
return
hr
;
}
}
...
...
dlls/dsound/tests/dsound.c
View file @
6ec5b351
...
@@ -93,16 +93,21 @@ static void IDirectSound_test(LPDIRECTSOUND dso, BOOL initialized,
...
@@ -93,16 +93,21 @@ static void IDirectSound_test(LPDIRECTSOUND dso, BOOL initialized,
"IDirectSound_Initialize() failed: %s
\n
"
,
DXGetErrorString8
(
rc
));
"IDirectSound_Initialize() failed: %s
\n
"
,
DXGetErrorString8
(
rc
));
if
(
rc
==
DSERR_NODRIVER
)
{
if
(
rc
==
DSERR_NODRIVER
)
{
trace
(
" No Driver
\n
"
);
trace
(
" No Driver
\n
"
);
return
;
goto
EXIT
;
}
else
if
(
rc
==
E_FAIL
)
{
}
else
if
(
rc
==
E_FAIL
)
{
trace
(
" No Device
\n
"
);
trace
(
" No Device
\n
"
);
return
;
goto
EXIT
;
}
else
if
(
rc
==
DSERR_ALLOCATED
)
{
}
else
if
(
rc
==
DSERR_ALLOCATED
)
{
trace
(
" Already In Use
\n
"
);
trace
(
" Already In Use
\n
"
);
return
;
goto
EXIT
;
}
}
}
}
rc
=
IDirectSound_Initialize
(
dso
,
lpGuid
);
ok
(
rc
==
DSERR_ALREADYINITIALIZED
,
"IDirectSound_Initialize() "
"should have returned DSERR_ALREADYINITIALIZED: %s
\n
"
,
DXGetErrorString8
(
rc
));
/* DSOUND: Error: Invalid caps buffer */
/* DSOUND: Error: Invalid caps buffer */
rc
=
IDirectSound_GetCaps
(
dso
,
0
);
rc
=
IDirectSound_GetCaps
(
dso
,
0
);
ok
(
rc
==
DSERR_INVALIDPARAM
,
"IDirectSound_GetCaps(NULL) "
ok
(
rc
==
DSERR_INVALIDPARAM
,
"IDirectSound_GetCaps(NULL) "
...
@@ -158,6 +163,7 @@ static void IDirectSound_test(LPDIRECTSOUND dso, BOOL initialized,
...
@@ -158,6 +163,7 @@ static void IDirectSound_test(LPDIRECTSOUND dso, BOOL initialized,
speaker_config
,
new_speaker_config
);
speaker_config
,
new_speaker_config
);
}
}
EXIT:
ref
=
IDirectSound_Release
(
dso
);
ref
=
IDirectSound_Release
(
dso
);
ok
(
ref
==
0
,
"IDirectSound_Release() has %d references, should have 0
\n
"
,
ref
);
ok
(
ref
==
0
,
"IDirectSound_Release() has %d references, should have 0
\n
"
,
ref
);
}
}
...
@@ -238,6 +244,8 @@ static void IDirectSound_tests()
...
@@ -238,6 +244,8 @@ static void IDirectSound_tests()
rc
=
DirectSoundCreate
(
&
DSDEVID_DefaultVoiceCapture
,
&
dso
,
NULL
);
rc
=
DirectSoundCreate
(
&
DSDEVID_DefaultVoiceCapture
,
&
dso
,
NULL
);
ok
(
rc
==
DSERR_NODRIVER
,
"DirectSoundCreate(DSDEVID_DefaultVoiceCapture) "
ok
(
rc
==
DSERR_NODRIVER
,
"DirectSoundCreate(DSDEVID_DefaultVoiceCapture) "
"should have failed: %s
\n
"
,
DXGetErrorString8
(
rc
));
"should have failed: %s
\n
"
,
DXGetErrorString8
(
rc
));
if
(
rc
==
DS_OK
&&
dso
)
IDirectSound_Release
(
dso
);
}
}
static
HRESULT
test_dsound
(
LPGUID
lpGuid
)
static
HRESULT
test_dsound
(
LPGUID
lpGuid
)
...
...
dlls/dsound/tests/dsound8.c
View file @
6ec5b351
...
@@ -108,16 +108,21 @@ static void IDirectSound8_test(LPDIRECTSOUND8 dso, BOOL initialized,
...
@@ -108,16 +108,21 @@ static void IDirectSound8_test(LPDIRECTSOUND8 dso, BOOL initialized,
"IDirectSound8_Initialize() failed: %s
\n
"
,
DXGetErrorString8
(
rc
));
"IDirectSound8_Initialize() failed: %s
\n
"
,
DXGetErrorString8
(
rc
));
if
(
rc
==
DSERR_NODRIVER
)
{
if
(
rc
==
DSERR_NODRIVER
)
{
trace
(
" No Driver
\n
"
);
trace
(
" No Driver
\n
"
);
return
;
goto
EXIT
;
}
else
if
(
rc
==
E_FAIL
)
{
}
else
if
(
rc
==
E_FAIL
)
{
trace
(
" No Device
\n
"
);
trace
(
" No Device
\n
"
);
return
;
goto
EXIT
;
}
else
if
(
rc
==
DSERR_ALLOCATED
)
{
}
else
if
(
rc
==
DSERR_ALLOCATED
)
{
trace
(
" Already In Use
\n
"
);
trace
(
" Already In Use
\n
"
);
return
;
goto
EXIT
;
}
}
}
}
rc
=
IDirectSound8_Initialize
(
dso
,
lpGuid
);
ok
(
rc
==
DSERR_ALREADYINITIALIZED
,
"IDirectSound8_Initialize() "
"should have returned DSERR_ALREADYINITIALIZED: %s
\n
"
,
DXGetErrorString8
(
rc
));
/* DSOUND: Error: Invalid caps buffer */
/* DSOUND: Error: Invalid caps buffer */
rc
=
IDirectSound8_GetCaps
(
dso
,
0
);
rc
=
IDirectSound8_GetCaps
(
dso
,
0
);
ok
(
rc
==
DSERR_INVALIDPARAM
,
"IDirectSound8_GetCaps() "
ok
(
rc
==
DSERR_INVALIDPARAM
,
"IDirectSound8_GetCaps() "
...
@@ -177,6 +182,7 @@ static void IDirectSound8_test(LPDIRECTSOUND8 dso, BOOL initialized,
...
@@ -177,6 +182,7 @@ static void IDirectSound8_test(LPDIRECTSOUND8 dso, BOOL initialized,
ok
(
rc
==
DS_OK
||
rc
==
E_NOTIMPL
,
"IDirectSound8_VerifyCertification() failed: %s
\n
"
,
ok
(
rc
==
DS_OK
||
rc
==
E_NOTIMPL
,
"IDirectSound8_VerifyCertification() failed: %s
\n
"
,
DXGetErrorString8
(
rc
));
DXGetErrorString8
(
rc
));
EXIT:
ref
=
IDirectSound8_Release
(
dso
);
ref
=
IDirectSound8_Release
(
dso
);
ok
(
ref
==
0
,
"IDirectSound8_Release() has %d references, should have 0
\n
"
,
ref
);
ok
(
ref
==
0
,
"IDirectSound8_Release() has %d references, should have 0
\n
"
,
ref
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment