Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Ferrillo
wine
Commits
8978a4b5
Commit
8978a4b5
authored
12 years ago
by
Michael Stefaniuc
Committed by
Alexandre Julliard
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
dsound: Merge IUnknown into the main DirectSound object.
parent
478191c0
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/dsound/dsound.c
+38
-88
38 additions, 88 deletions
dlls/dsound/dsound.c
dlls/dsound/dsound_private.h
+0
-2
0 additions, 2 deletions
dlls/dsound/dsound_private.h
with
38 additions
and
90 deletions
dlls/dsound/dsound.c
+
38
−
88
View file @
8978a4b5
...
...
@@ -44,14 +44,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(dsound);
/*****************************************************************************
* IDirectSound COM components
*/
struct
IDirectSound_IUnknown
{
const
IUnknownVtbl
*
lpVtbl
;
LONG
ref
;
LPDIRECTSOUND8
pds
;
};
static
HRESULT
IDirectSound_IUnknown_Create
(
LPDIRECTSOUND8
pds
,
LPUNKNOWN
*
ppunk
);
struct
IDirectSound_IDirectSound
{
const
IDirectSoundVtbl
*
lpVtbl
;
LONG
ref
;
...
...
@@ -72,20 +64,15 @@ struct IDirectSound8_IDirectSound8 {
static
HRESULT
IDirectSound8_IDirectSound8_Create
(
LPDIRECTSOUND8
pds
,
LPDIRECTSOUND8
*
ppds
);
static
ULONG
WINAPI
IDirectSound8_IDirectSound8_AddRef
(
LPDIRECTSOUND8
iface
);
/*****************************************************************************
* IDirectSound implementation structure
*/
struct
IDirectSoundImpl
{
LONG
numIfaces
;
typedef
struct
IDirectSoundImpl
{
IUnknown
IUnknown_iface
;
/* Separate refcount, not for COM aggregation */
LONG
ref
,
numIfaces
;
DirectSoundDevice
*
device
;
BOOL
has_ds8
;
LPUNKNOWN
pUnknown
;
LPDIRECTSOUND
pDS
;
LPDIRECTSOUND8
pDS8
;
};
}
IDirectSoundImpl
;
static
ULONG
WINAPI
IDirectSound_IUnknown_AddRef
(
LPUNKNOWN
iface
);
static
ULONG
WINAPI
IDirectSound_IDirectSound_AddRef
(
LPDIRECTSOUND
iface
);
const
char
*
dumpCooperativeLevel
(
DWORD
level
)
...
...
@@ -172,16 +159,8 @@ static HRESULT DSOUND_QueryInterface(
}
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
))
{
if
(
!
This
->
pUnknown
)
{
IDirectSound_IUnknown_Create
(
iface
,
&
This
->
pUnknown
);
if
(
!
This
->
pUnknown
)
{
WARN
(
"IDirectSound_IUnknown_Create() failed
\n
"
);
*
ppobj
=
NULL
;
return
E_NOINTERFACE
;
}
}
IDirectSound_IUnknown_AddRef
(
This
->
pUnknown
);
*
ppobj
=
This
->
pUnknown
;
IUnknown_AddRef
(
&
This
->
IUnknown_iface
);
*
ppobj
=
&
This
->
IUnknown_iface
;
return
S_OK
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IDirectSound
))
{
if
(
!
This
->
pDS
)
{
...
...
@@ -223,84 +202,53 @@ static void directsound_destroy(IDirectSoundImpl *This)
}
/*******************************************************************************
*
I
DirectSound
_IUnknown
*
IUnknown Implementation for
DirectSound
*/
static
HRESULT
WINAPI
IDirectSound_IUnknown_QueryInterface
(
LPUNKNOWN
iface
,
REFIID
riid
,
LPVOID
*
ppobj
)
static
inline
IDirectSoundImpl
*
impl_from_IUnknown
(
IUnknown
*
iface
)
{
IDirectSound_IUnknown
*
This
=
(
IDirectSound_IUnknown
*
)
iface
;
TRACE
(
"(%p,%s,%p)
\n
"
,
This
,
debugstr_guid
(
riid
),
ppobj
);
return
DSOUND_QueryInterface
(
This
->
pds
,
riid
,
ppobj
);
return
CONTAINING_RECORD
(
iface
,
IDirectSoundImpl
,
IUnknown_iface
);
}
static
ULONG
WINAPI
IDirectSound_IUnknown_AddRef
(
LPUNKNOWN
iface
)
static
HRESULT
WINAPI
IUnknownImpl_QueryInterface
(
IUnknown
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
IDirectSound_IUnknown
*
This
=
(
IDirectSound_IUnknown
*
)
iface
;
ULONG
ref
=
InterlockedIncrement
(
&
(
This
->
ref
));
TRACE
(
"(%p) ref was %d
\n
"
,
This
,
ref
-
1
);
return
ref
;
}
static
ULONG
WINAPI
IDirectSound_IUnknown_Release
(
LPUNKNOWN
iface
)
{
IDirectSound_IUnknown
*
This
=
(
IDirectSound_IUnknown
*
)
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
)
->
pUnknown
=
NULL
;
directsound_destroy
((
IDirectSoundImpl
*
)
This
->
pds
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
TRACE
(
"(%p) released
\n
"
,
This
);
}
return
ref
;
IDirectSoundImpl
*
This
=
impl_from_IUnknown
(
iface
);
TRACE
(
"(%p,%s,%p)
\n
"
,
This
,
debugstr_guid
(
riid
),
ppv
);
return
DSOUND_QueryInterface
((
IDirectSound8
*
)
This
,
riid
,
ppv
);
}
static
const
IUnknownVtbl
DirectSound_Unknown_Vtbl
=
static
ULONG
WINAPI
IUnknownImpl_AddRef
(
IUnknown
*
iface
)
{
IDirectSound_IUnknown_QueryInterface
,
IDirectSound_IUnknown_AddRef
,
IDirectSound_IUnknown_Release
};
IDirectSoundImpl
*
This
=
impl_from_IUnknown
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
static
HRESULT
IDirectSound_IUnknown_Create
(
LPDIRECTSOUND8
pds
,
LPUNKNOWN
*
ppunk
)
{
IDirectSound_IUnknown
*
pdsunk
;
TRACE
(
"(%p,%p)
\n
"
,
pds
,
ppunk
);
TRACE
(
"(%p) ref=%d
\n
"
,
This
,
ref
);
if
(
ppunk
==
NULL
)
{
ERR
(
"invalid parameter: ppunk == NULL
\n
"
);
return
DSERR_INVALIDPARAM
;
}
if
(
ref
==
1
)
InterlockedIncrement
(
&
This
->
numIfaces
);
if
(
pds
==
NULL
)
{
ERR
(
"invalid parameter: pds == NULL
\n
"
);
*
ppunk
=
NULL
;
return
DSERR_INVALIDPARAM
;
}
return
ref
;
}
pdsunk
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
pdsunk
));
if
(
pdsunk
==
NULL
)
{
WARN
(
"out of memory
\n
"
);
*
ppunk
=
NULL
;
return
DSERR_OUTOFMEMORY
;
}
static
ULONG
WINAPI
IUnknownImpl_Release
(
IUnknown
*
iface
)
{
IDirectSoundImpl
*
This
=
impl_from_IUnknown
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
pdsunk
->
lpVtbl
=
&
DirectSound_Unknown_Vtbl
;
pdsunk
->
ref
=
0
;
pdsunk
->
pds
=
pds
;
TRACE
(
"(%p) ref=%d
\n
"
,
This
,
ref
);
Interlocked
In
crement
(
&
((
IDirectSoundImpl
*
)
pds
)
->
numIfaces
)
;
*
ppunk
=
(
LPUNKNOWN
)
pdsunk
;
if
(
!
ref
&&
!
Interlocked
De
crement
(
&
This
->
numIfaces
)
)
directsound_destroy
(
This
)
;
return
DS_OK
;
return
ref
;
}
static
const
IUnknownVtbl
unk_vtbl
=
{
IUnknownImpl_QueryInterface
,
IUnknownImpl_AddRef
,
IUnknownImpl_Release
};
/*******************************************************************************
* IDirectSound_IDirectSound
*/
...
...
@@ -646,6 +594,8 @@ static HRESULT IDirectSoundImpl_Create(void **ppv, BOOL has_ds8)
return
DSERR_OUTOFMEMORY
;
}
obj
->
IUnknown_iface
.
lpVtbl
=
&
unk_vtbl
;
obj
->
ref
=
0
;
obj
->
numIfaces
=
0
;
obj
->
device
=
NULL
;
obj
->
has_ds8
=
has_ds8
;
...
...
This diff is collapsed.
Click to expand it.
dlls/dsound/dsound_private.h
+
0
−
2
View file @
8978a4b5
...
...
@@ -39,8 +39,6 @@ extern int ds_default_bits_per_sample DECLSPEC_HIDDEN;
/*****************************************************************************
* Predeclare the interface implementation structures
*/
typedef
struct
IDirectSoundImpl
IDirectSoundImpl
;
typedef
struct
IDirectSound_IUnknown
IDirectSound_IUnknown
;
typedef
struct
IDirectSound_IDirectSound
IDirectSound_IDirectSound
;
typedef
struct
IDirectSound8_IDirectSound8
IDirectSound8_IDirectSound8
;
typedef
struct
IDirectSoundBufferImpl
IDirectSoundBufferImpl
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment