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
9cc62d32
Commit
9cc62d32
authored
Jul 19, 2012
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Jul 19, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dsound: Handle IDirectSound by the IDirectSound8 implementation.
parent
6fecd3d6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
195 deletions
+6
-195
dsound.c
dlls/dsound/dsound.c
+3
-191
dsound_private.h
dlls/dsound/dsound_private.h
+0
-1
dsound8.c
dlls/dsound/tests/dsound8.c
+3
-3
No files found.
dlls/dsound/dsound.c
View file @
9cc62d32
...
...
@@ -41,28 +41,14 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
dsound
);
/*****************************************************************************
* IDirectSound COM components
*/
struct
IDirectSound_IDirectSound
{
const
IDirectSoundVtbl
*
lpVtbl
;
LONG
ref
;
LPDIRECTSOUND8
pds
;
};
static
HRESULT
IDirectSound_IDirectSound_Create
(
LPDIRECTSOUND8
pds
,
LPDIRECTSOUND
*
ppds
);
typedef
struct
IDirectSoundImpl
{
IUnknown
IUnknown_iface
;
/* Separate refcount, not for COM aggregation */
IDirectSound8
IDirectSound8_iface
;
LONG
ref
,
refds
,
numIfaces
;
DirectSoundDevice
*
device
;
BOOL
has_ds8
;
LPDIRECTSOUND
pDS
;
}
IDirectSoundImpl
;
static
ULONG
WINAPI
IDirectSound_IDirectSound_AddRef
(
LPDIRECTSOUND
iface
);
const
char
*
dumpCooperativeLevel
(
DWORD
level
)
{
#define LE(x) case x: return #x
...
...
@@ -150,19 +136,7 @@ static HRESULT DSOUND_QueryInterface(
IUnknown_AddRef
(
&
This
->
IUnknown_iface
);
*
ppobj
=
&
This
->
IUnknown_iface
;
return
S_OK
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IDirectSound
))
{
if
(
!
This
->
pDS
)
{
IDirectSound_IDirectSound_Create
(
iface
,
&
This
->
pDS
);
if
(
!
This
->
pDS
)
{
WARN
(
"IDirectSound_IDirectSound_Create() failed
\n
"
);
*
ppobj
=
NULL
;
return
E_NOINTERFACE
;
}
}
IDirectSound_IDirectSound_AddRef
(
This
->
pDS
);
*
ppobj
=
This
->
pDS
;
return
S_OK
;
}
else
if
(
This
->
has_ds8
&&
IsEqualIID
(
riid
,
&
IID_IDirectSound8
))
{
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IDirectSound
)
||
(
This
->
has_ds8
&&
IsEqualIID
(
riid
,
&
IID_IDirectSound8
)))
{
IDirectSound8_AddRef
(
&
This
->
IDirectSound8_iface
);
*
ppobj
=
&
This
->
IDirectSound8_iface
;
return
S_OK
;
...
...
@@ -230,169 +204,7 @@ static const IUnknownVtbl unk_vtbl =
};
/*******************************************************************************
* IDirectSound_IDirectSound
*/
static
HRESULT
WINAPI
IDirectSound_IDirectSound_QueryInterface
(
LPDIRECTSOUND
iface
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
IDirectSound_IDirectSound
*
This
=
(
IDirectSound_IDirectSound
*
)
iface
;
TRACE
(
"(%p,%s,%p)
\n
"
,
This
,
debugstr_guid
(
riid
),
ppobj
);
return
DSOUND_QueryInterface
(
This
->
pds
,
riid
,
ppobj
);
}
static
ULONG
WINAPI
IDirectSound_IDirectSound_AddRef
(
LPDIRECTSOUND
iface
)
{
IDirectSound_IDirectSound
*
This
=
(
IDirectSound_IDirectSound
*
)
iface
;
ULONG
ref
=
InterlockedIncrement
(
&
(
This
->
ref
));
TRACE
(
"(%p) ref was %d
\n
"
,
This
,
ref
-
1
);
return
ref
;
}
static
ULONG
WINAPI
IDirectSound_IDirectSound_Release
(
LPDIRECTSOUND
iface
)
{
IDirectSound_IDirectSound
*
This
=
(
IDirectSound_IDirectSound
*
)
iface
;
ULONG
ref
=
InterlockedDecrement
(
&
(
This
->
ref
));
TRACE
(
"(%p) ref was %d
\n
"
,
This
,
ref
+
1
);
if
(
!
ref
&&
!
InterlockedDecrement
(
&
((
IDirectSoundImpl
*
)
This
->
pds
)
->
numIfaces
))
{
((
IDirectSoundImpl
*
)
This
->
pds
)
->
pDS
=
NULL
;
directsound_destroy
((
IDirectSoundImpl
*
)
This
->
pds
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
TRACE
(
"(%p) released
\n
"
,
This
);
}
return
ref
;
}
static
HRESULT
WINAPI
IDirectSound_IDirectSound_CreateSoundBuffer
(
LPDIRECTSOUND
iface
,
LPCDSBUFFERDESC
dsbd
,
LPLPDIRECTSOUNDBUFFER
ppdsb
,
LPUNKNOWN
lpunk
)
{
IDirectSound_IDirectSound
*
This
=
(
IDirectSound_IDirectSound
*
)
iface
;
TRACE
(
"(%p,%p,%p,%p)
\n
"
,
This
,
dsbd
,
ppdsb
,
lpunk
);
return
DirectSoundDevice_CreateSoundBuffer
(((
IDirectSoundImpl
*
)
This
->
pds
)
->
device
,
dsbd
,
ppdsb
,
lpunk
,((
IDirectSoundImpl
*
)
This
->
pds
)
->
has_ds8
);
}
static
HRESULT
WINAPI
IDirectSound_IDirectSound_GetCaps
(
LPDIRECTSOUND
iface
,
LPDSCAPS
lpDSCaps
)
{
IDirectSound_IDirectSound
*
This
=
(
IDirectSound_IDirectSound
*
)
iface
;
TRACE
(
"(%p,%p)
\n
"
,
This
,
lpDSCaps
);
return
DirectSoundDevice_GetCaps
(((
IDirectSoundImpl
*
)
This
->
pds
)
->
device
,
lpDSCaps
);
}
static
HRESULT
WINAPI
IDirectSound_IDirectSound_DuplicateSoundBuffer
(
LPDIRECTSOUND
iface
,
LPDIRECTSOUNDBUFFER
psb
,
LPLPDIRECTSOUNDBUFFER
ppdsb
)
{
IDirectSound_IDirectSound
*
This
=
(
IDirectSound_IDirectSound
*
)
iface
;
TRACE
(
"(%p,%p,%p)
\n
"
,
This
,
psb
,
ppdsb
);
return
DirectSoundDevice_DuplicateSoundBuffer
(((
IDirectSoundImpl
*
)
This
->
pds
)
->
device
,
psb
,
ppdsb
);
}
static
HRESULT
WINAPI
IDirectSound_IDirectSound_SetCooperativeLevel
(
LPDIRECTSOUND
iface
,
HWND
hwnd
,
DWORD
level
)
{
IDirectSound_IDirectSound
*
This
=
(
IDirectSound_IDirectSound
*
)
iface
;
TRACE
(
"(%p,%p,%s)
\n
"
,
This
,
hwnd
,
dumpCooperativeLevel
(
level
));
return
DirectSoundDevice_SetCooperativeLevel
(((
IDirectSoundImpl
*
)
This
->
pds
)
->
device
,
hwnd
,
level
);
}
static
HRESULT
WINAPI
IDirectSound_IDirectSound_Compact
(
LPDIRECTSOUND
iface
)
{
IDirectSound_IDirectSound
*
This
=
(
IDirectSound_IDirectSound
*
)
iface
;
TRACE
(
"(%p)
\n
"
,
This
);
return
DirectSoundDevice_Compact
(((
IDirectSoundImpl
*
)
This
->
pds
)
->
device
);
}
static
HRESULT
WINAPI
IDirectSound_IDirectSound_GetSpeakerConfig
(
LPDIRECTSOUND
iface
,
LPDWORD
lpdwSpeakerConfig
)
{
IDirectSound_IDirectSound
*
This
=
(
IDirectSound_IDirectSound
*
)
iface
;
TRACE
(
"(%p, %p)
\n
"
,
This
,
lpdwSpeakerConfig
);
return
DirectSoundDevice_GetSpeakerConfig
(((
IDirectSoundImpl
*
)
This
->
pds
)
->
device
,
lpdwSpeakerConfig
);
}
static
HRESULT
WINAPI
IDirectSound_IDirectSound_SetSpeakerConfig
(
LPDIRECTSOUND
iface
,
DWORD
config
)
{
IDirectSound_IDirectSound
*
This
=
(
IDirectSound_IDirectSound
*
)
iface
;
TRACE
(
"(%p,0x%08x)
\n
"
,
This
,
config
);
return
DirectSoundDevice_SetSpeakerConfig
(((
IDirectSoundImpl
*
)
This
->
pds
)
->
device
,
config
);
}
static
HRESULT
WINAPI
IDirectSound_IDirectSound_Initialize
(
LPDIRECTSOUND
iface
,
LPCGUID
lpcGuid
)
{
IDirectSound_IDirectSound
*
This
=
(
IDirectSound_IDirectSound
*
)
iface
;
TRACE
(
"(%p, %s)
\n
"
,
This
,
debugstr_guid
(
lpcGuid
));
return
DirectSoundDevice_Initialize
(
&
((
IDirectSoundImpl
*
)
This
->
pds
)
->
device
,
lpcGuid
);
}
static
const
IDirectSoundVtbl
DirectSound_DirectSound_Vtbl
=
{
IDirectSound_IDirectSound_QueryInterface
,
IDirectSound_IDirectSound_AddRef
,
IDirectSound_IDirectSound_Release
,
IDirectSound_IDirectSound_CreateSoundBuffer
,
IDirectSound_IDirectSound_GetCaps
,
IDirectSound_IDirectSound_DuplicateSoundBuffer
,
IDirectSound_IDirectSound_SetCooperativeLevel
,
IDirectSound_IDirectSound_Compact
,
IDirectSound_IDirectSound_GetSpeakerConfig
,
IDirectSound_IDirectSound_SetSpeakerConfig
,
IDirectSound_IDirectSound_Initialize
};
static
HRESULT
IDirectSound_IDirectSound_Create
(
LPDIRECTSOUND8
pds
,
LPDIRECTSOUND
*
ppds
)
{
IDirectSound_IDirectSound
*
pdsds
;
TRACE
(
"(%p,%p)
\n
"
,
pds
,
ppds
);
if
(
ppds
==
NULL
)
{
ERR
(
"invalid parameter: ppds == NULL
\n
"
);
return
DSERR_INVALIDPARAM
;
}
if
(
pds
==
NULL
)
{
ERR
(
"invalid parameter: pds == NULL
\n
"
);
*
ppds
=
NULL
;
return
DSERR_INVALIDPARAM
;
}
pdsds
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
pdsds
));
if
(
pdsds
==
NULL
)
{
WARN
(
"out of memory
\n
"
);
*
ppds
=
NULL
;
return
DSERR_OUTOFMEMORY
;
}
pdsds
->
lpVtbl
=
&
DirectSound_DirectSound_Vtbl
;
pdsds
->
ref
=
0
;
pdsds
->
pds
=
pds
;
InterlockedIncrement
(
&
((
IDirectSoundImpl
*
)
pds
)
->
numIfaces
);
*
ppds
=
(
LPDIRECTSOUND
)
pdsds
;
return
DS_OK
;
}
/*******************************************************************************
* IDirectSound8 Implementation
* IDirectSound and IDirectSound8 Implementation
*/
static
inline
IDirectSoundImpl
*
impl_from_IDirectSound8
(
IDirectSound8
*
iface
)
{
...
...
@@ -438,7 +250,7 @@ static HRESULT WINAPI IDirectSound8Impl_CreateSoundBuffer(IDirectSound8 *iface,
{
IDirectSoundImpl
*
This
=
impl_from_IDirectSound8
(
iface
);
TRACE
(
"(%p,%p,%p,%p)
\n
"
,
This
,
dsbd
,
ppdsb
,
lpunk
);
return
DirectSoundDevice_CreateSoundBuffer
(
This
->
device
,
dsbd
,
ppdsb
,
lpunk
,
T
RUE
);
return
DirectSoundDevice_CreateSoundBuffer
(
This
->
device
,
dsbd
,
ppdsb
,
lpunk
,
T
his
->
has_ds8
);
}
static
HRESULT
WINAPI
IDirectSound8Impl_GetCaps
(
IDirectSound8
*
iface
,
DSCAPS
*
lpDSCaps
)
...
...
dlls/dsound/dsound_private.h
View file @
9cc62d32
...
...
@@ -39,7 +39,6 @@ extern int ds_default_bits_per_sample DECLSPEC_HIDDEN;
/*****************************************************************************
* Predeclare the interface implementation structures
*/
typedef
struct
IDirectSound_IDirectSound
IDirectSound_IDirectSound
;
typedef
struct
IDirectSoundBufferImpl
IDirectSoundBufferImpl
;
typedef
struct
IDirectSoundCaptureImpl
IDirectSoundCaptureImpl
;
typedef
struct
IDirectSoundCaptureBufferImpl
IDirectSoundCaptureBufferImpl
;
...
...
dlls/dsound/tests/dsound8.c
View file @
9cc62d32
...
...
@@ -1146,9 +1146,9 @@ static void test_COM(void)
hr
=
IDirectSound8_QueryInterface
(
ds8
,
&
IID_IDirectSound
,
(
void
**
)
&
ds
);
ok
(
hr
==
S_OK
,
"QueryInterface for IID_IDirectSound failed: %08x
\n
"
,
hr
);
refcount
=
IDirectSound8_AddRef
(
ds8
);
todo_wine
ok
(
refcount
==
4
,
"refcount == %u, expected 4
\n
"
,
refcount
);
ok
(
refcount
==
4
,
"refcount == %u, expected 4
\n
"
,
refcount
);
refcount
=
IDirectSound_AddRef
(
ds
);
todo_wine
ok
(
refcount
==
5
,
"refcount == %u, expected 5
\n
"
,
refcount
);
ok
(
refcount
==
5
,
"refcount == %u, expected 5
\n
"
,
refcount
);
/* Separate refcount for IUnknown */
hr
=
IDirectSound_QueryInterface
(
ds
,
&
IID_IUnknown
,
(
void
**
)
&
unk
);
...
...
@@ -1160,7 +1160,7 @@ static void test_COM(void)
refcount
=
IUnknown_AddRef
(
unk8
);
ok
(
refcount
==
4
,
"refcount == %u, expected 4
\n
"
,
refcount
);
refcount
=
IDirectSound_AddRef
(
ds
);
todo_wine
ok
(
refcount
==
6
,
"refcount == %u, expected 6
\n
"
,
refcount
);
ok
(
refcount
==
6
,
"refcount == %u, expected 6
\n
"
,
refcount
);
while
(
IDirectSound_Release
(
ds
));
while
(
IUnknown_Release
(
unk
));
...
...
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