Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
c7f5f10a
Commit
c7f5f10a
authored
Jan 20, 2012
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Jan 20, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dsound: Merge IDirectSoundNotify into the secondary buffer object.
parent
ca75c4a8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
101 deletions
+46
-101
buffer.c
dlls/dsound/buffer.c
+43
-95
dsound_private.h
dlls/dsound/dsound_private.h
+3
-6
No files found.
dlls/dsound/buffer.c
View file @
c7f5f10a
...
@@ -40,59 +40,52 @@ WINE_DEFAULT_DEBUG_CHANNEL(dsound);
...
@@ -40,59 +40,52 @@ WINE_DEFAULT_DEBUG_CHANNEL(dsound);
* IDirectSoundNotify
* IDirectSoundNotify
*/
*/
st
ruct
IDirectSoundNotifyImpl
st
atic
inline
struct
IDirectSoundBufferImpl
*
impl_from_IDirectSoundNotify
(
IDirectSoundNotify
*
iface
)
{
{
/* IUnknown fields */
return
CONTAINING_RECORD
(
iface
,
struct
IDirectSoundBufferImpl
,
IDirectSoundNotify_iface
);
const
IDirectSoundNotifyVtbl
*
lpVtbl
;
}
LONG
ref
;
IDirectSoundBufferImpl
*
dsb
;
};
static
HRESULT
IDirectSoundNotifyImpl_Create
(
IDirectSoundBufferImpl
*
dsb
,
static
HRESULT
WINAPI
IDirectSoundNotifyImpl_QueryInterface
(
IDirectSoundNotify
*
iface
,
REFIID
riid
,
IDirectSoundNotifyImpl
**
pdsn
);
void
**
ppobj
)
static
HRESULT
IDirectSoundNotifyImpl_Destroy
(
IDirectSoundNotifyImpl
*
pdsn
);
{
IDirectSoundBufferImpl
*
This
=
impl_from_IDirectSoundNotify
(
iface
);
static
HRESULT
WINAPI
IDirectSoundNotifyImpl_QueryInterface
(
TRACE
(
"(%p,%s,%p)
\n
"
,
This
,
debugstr_guid
(
riid
),
ppobj
);
LPDIRECTSOUNDNOTIFY
iface
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
IDirectSoundNotifyImpl
*
This
=
(
IDirectSoundNotifyImpl
*
)
iface
;
TRACE
(
"(%p,%s,%p)
\n
"
,
This
,
debugstr_guid
(
riid
),
ppobj
);
if
(
This
->
dsb
==
NULL
)
{
return
IDirectSoundBuffer8_QueryInterface
(
&
This
->
IDirectSoundBuffer8_iface
,
riid
,
ppobj
);
WARN
(
"invalid parameter
\n
"
);
return
E_INVALIDARG
;
}
return
IDirectSoundBuffer_QueryInterface
((
LPDIRECTSOUNDBUFFER
)
This
->
dsb
,
riid
,
ppobj
);
}
}
static
ULONG
WINAPI
IDirectSoundNotifyImpl_AddRef
(
LPDIRECTSOUNDNOTIFY
iface
)
static
ULONG
WINAPI
IDirectSoundNotifyImpl_AddRef
(
IDirectSoundNotify
*
iface
)
{
{
IDirectSoundNotifyImpl
*
This
=
(
IDirectSoundNotifyImpl
*
)
iface
;
IDirectSoundBufferImpl
*
This
=
impl_from_IDirectSoundNotify
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
(
This
->
ref
));
ULONG
ref
=
InterlockedIncrement
(
&
This
->
refn
);
TRACE
(
"(%p) ref was %d
\n
"
,
This
,
ref
-
1
);
TRACE
(
"(%p) ref was %d
\n
"
,
This
,
ref
-
1
);
if
(
ref
==
1
)
InterlockedIncrement
(
&
This
->
numIfaces
);
return
ref
;
return
ref
;
}
}
static
ULONG
WINAPI
IDirectSoundNotifyImpl_Release
(
LPDIRECTSOUNDNOTIFY
iface
)
static
ULONG
WINAPI
IDirectSoundNotifyImpl_Release
(
IDirectSoundNotify
*
iface
)
{
{
IDirectSoundNotifyImpl
*
This
=
(
IDirectSoundNotifyImpl
*
)
iface
;
IDirectSoundBufferImpl
*
This
=
impl_from_IDirectSoundNotify
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
(
This
->
ref
));
ULONG
ref
=
InterlockedDecrement
(
&
This
->
refn
);
TRACE
(
"(%p) ref was %d
\n
"
,
This
,
ref
+
1
);
TRACE
(
"(%p) ref was %d
\n
"
,
This
,
ref
+
1
);
if
(
!
ref
)
{
if
(
!
ref
&&
!
InterlockedDecrement
(
&
This
->
numIfaces
))
This
->
dsb
->
notify
=
NULL
;
secondarybuffer_destroy
(
This
);
IDirectSoundBuffer_Release
((
LPDIRECTSOUNDBUFFER
)
This
->
dsb
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
TRACE
(
"(%p) released
\n
"
,
This
);
}
return
ref
;
return
ref
;
}
}
static
HRESULT
WINAPI
IDirectSoundNotifyImpl_SetNotificationPositions
(
static
HRESULT
WINAPI
IDirectSoundNotifyImpl_SetNotificationPositions
(
IDirectSoundNotify
*
iface
,
LPDIRECTSOUNDNOTIFY
iface
,
DWORD
howmuch
,
LPCDSBPOSITIONNOTIFY
notify
DWORD
howmuch
,
const
DSBPOSITIONNOTIFY
*
notify
)
)
{
{
IDirectSoundNotifyImpl
*
This
=
(
IDirectSoundNotifyImpl
*
)
iface
;
IDirectSoundBufferImpl
*
This
=
impl_from_IDirectSoundNotify
(
iface
);
TRACE
(
"(%p,0x%08x,%p)
\n
"
,
This
,
howmuch
,
notify
);
TRACE
(
"(%p,0x%08x,%p)
\n
"
,
This
,
howmuch
,
notify
);
if
(
howmuch
>
0
&&
notify
==
NULL
)
{
if
(
howmuch
>
0
&&
notify
==
NULL
)
{
...
@@ -110,20 +103,20 @@ static HRESULT WINAPI IDirectSoundNotifyImpl_SetNotificationPositions(
...
@@ -110,20 +103,20 @@ static HRESULT WINAPI IDirectSoundNotifyImpl_SetNotificationPositions(
if
(
howmuch
>
0
)
{
if
(
howmuch
>
0
)
{
/* Make an internal copy of the caller-supplied array.
/* Make an internal copy of the caller-supplied array.
* Replace the existing copy if one is already present. */
* Replace the existing copy if one is already present. */
HeapFree
(
GetProcessHeap
(),
0
,
This
->
dsb
->
notifies
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
notifies
);
This
->
dsb
->
notifies
=
HeapAlloc
(
GetProcessHeap
(),
0
,
This
->
notifies
=
HeapAlloc
(
GetProcessHeap
(),
0
,
howmuch
*
sizeof
(
DSBPOSITIONNOTIFY
));
howmuch
*
sizeof
(
DSBPOSITIONNOTIFY
));
if
(
This
->
dsb
->
notifies
==
NULL
)
{
if
(
This
->
notifies
==
NULL
)
{
WARN
(
"out of memory
\n
"
);
WARN
(
"out of memory
\n
"
);
return
DSERR_OUTOFMEMORY
;
return
DSERR_OUTOFMEMORY
;
}
}
CopyMemory
(
This
->
dsb
->
notifies
,
notify
,
howmuch
*
sizeof
(
DSBPOSITIONNOTIFY
));
CopyMemory
(
This
->
notifies
,
notify
,
howmuch
*
sizeof
(
DSBPOSITIONNOTIFY
));
This
->
dsb
->
nrofnotifies
=
howmuch
;
This
->
nrofnotifies
=
howmuch
;
}
else
{
}
else
{
HeapFree
(
GetProcessHeap
(),
0
,
This
->
dsb
->
notifies
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
notifies
);
This
->
dsb
->
notifies
=
NULL
;
This
->
notifies
=
NULL
;
This
->
dsb
->
nrofnotifies
=
0
;
This
->
nrofnotifies
=
0
;
}
}
return
S_OK
;
return
S_OK
;
...
@@ -137,40 +130,6 @@ static const IDirectSoundNotifyVtbl dsnvt =
...
@@ -137,40 +130,6 @@ static const IDirectSoundNotifyVtbl dsnvt =
IDirectSoundNotifyImpl_SetNotificationPositions
,
IDirectSoundNotifyImpl_SetNotificationPositions
,
};
};
static
HRESULT
IDirectSoundNotifyImpl_Create
(
IDirectSoundBufferImpl
*
dsb
,
IDirectSoundNotifyImpl
**
pdsn
)
{
IDirectSoundNotifyImpl
*
dsn
;
TRACE
(
"(%p,%p)
\n
"
,
dsb
,
pdsn
);
dsn
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
dsn
));
if
(
dsn
==
NULL
)
{
WARN
(
"out of memory
\n
"
);
return
DSERR_OUTOFMEMORY
;
}
dsn
->
ref
=
0
;
dsn
->
lpVtbl
=
&
dsnvt
;
dsn
->
dsb
=
dsb
;
dsb
->
notify
=
dsn
;
IDirectSoundBuffer_AddRef
((
LPDIRECTSOUNDBUFFER
)
dsb
);
*
pdsn
=
dsn
;
return
DS_OK
;
}
static
HRESULT
IDirectSoundNotifyImpl_Destroy
(
IDirectSoundNotifyImpl
*
pdsn
)
{
TRACE
(
"(%p)
\n
"
,
pdsn
);
while
(
IDirectSoundNotifyImpl_Release
((
LPDIRECTSOUNDNOTIFY
)
pdsn
)
>
0
);
return
DS_OK
;
}
/*******************************************************************************
/*******************************************************************************
* IDirectSoundBuffer
* IDirectSoundBuffer
*/
*/
...
@@ -800,15 +759,9 @@ static HRESULT WINAPI IDirectSoundBufferImpl_QueryInterface(IDirectSoundBuffer8
...
@@ -800,15 +759,9 @@ static HRESULT WINAPI IDirectSoundBufferImpl_QueryInterface(IDirectSoundBuffer8
}
}
if
(
IsEqualGUID
(
&
IID_IDirectSoundNotify
,
riid
)
)
{
if
(
IsEqualGUID
(
&
IID_IDirectSoundNotify
,
riid
)
)
{
if
(
!
This
->
notify
)
IDirectSoundNotify_AddRef
(
&
This
->
IDirectSoundNotify_iface
);
IDirectSoundNotifyImpl_Create
(
This
,
&
(
This
->
notify
));
*
ppobj
=
&
This
->
IDirectSoundNotify_iface
;
if
(
This
->
notify
)
{
return
S_OK
;
IDirectSoundNotify_AddRef
((
LPDIRECTSOUNDNOTIFY
)
This
->
notify
);
*
ppobj
=
This
->
notify
;
return
S_OK
;
}
WARN
(
"IID_IDirectSoundNotify
\n
"
);
return
E_NOINTERFACE
;
}
}
if
(
IsEqualGUID
(
&
IID_IDirectSound3DBuffer
,
riid
)
)
{
if
(
IsEqualGUID
(
&
IID_IDirectSound3DBuffer
,
riid
)
)
{
...
@@ -889,11 +842,13 @@ HRESULT IDirectSoundBufferImpl_Create(
...
@@ -889,11 +842,13 @@ HRESULT IDirectSoundBufferImpl_Create(
TRACE
(
"Created buffer at %p
\n
"
,
dsb
);
TRACE
(
"Created buffer at %p
\n
"
,
dsb
);
dsb
->
ref
=
0
;
dsb
->
ref
=
0
;
dsb
->
refn
=
0
;
dsb
->
ref3D
=
0
;
dsb
->
ref3D
=
0
;
dsb
->
refiks
=
0
;
dsb
->
refiks
=
0
;
dsb
->
numIfaces
=
0
;
dsb
->
numIfaces
=
0
;
dsb
->
device
=
device
;
dsb
->
device
=
device
;
dsb
->
IDirectSoundBuffer8_iface
.
lpVtbl
=
&
dsbvt
;
dsb
->
IDirectSoundBuffer8_iface
.
lpVtbl
=
&
dsbvt
;
dsb
->
IDirectSoundNotify_iface
.
lpVtbl
=
&
dsnvt
;
dsb
->
IDirectSound3DBuffer_iface
.
lpVtbl
=
&
ds3dbvt
;
dsb
->
IDirectSound3DBuffer_iface
.
lpVtbl
=
&
ds3dbvt
;
dsb
->
IKsPropertySet_iface
.
lpVtbl
=
&
iksbvt
;
dsb
->
IKsPropertySet_iface
.
lpVtbl
=
&
iksbvt
;
...
@@ -915,7 +870,6 @@ HRESULT IDirectSoundBufferImpl_Create(
...
@@ -915,7 +870,6 @@ HRESULT IDirectSoundBufferImpl_Create(
dsb
->
buflen
=
dsbd
->
dwBufferBytes
;
dsb
->
buflen
=
dsbd
->
dwBufferBytes
;
dsb
->
freq
=
dsbd
->
lpwfxFormat
->
nSamplesPerSec
;
dsb
->
freq
=
dsbd
->
lpwfxFormat
->
nSamplesPerSec
;
dsb
->
notify
=
NULL
;
dsb
->
notifies
=
NULL
;
dsb
->
notifies
=
NULL
;
dsb
->
nrofnotifies
=
0
;
dsb
->
nrofnotifies
=
0
;
...
@@ -1036,12 +990,6 @@ HRESULT IDirectSoundBufferImpl_Destroy(
...
@@ -1036,12 +990,6 @@ HRESULT IDirectSoundBufferImpl_Destroy(
* this object until it is ready to be deleted */
* this object until it is ready to be deleted */
InterlockedIncrement
(
&
pdsb
->
numIfaces
);
InterlockedIncrement
(
&
pdsb
->
numIfaces
);
if
(
pdsb
->
notify
)
{
WARN
(
"notify not NULL
\n
"
);
IDirectSoundNotifyImpl_Destroy
(
pdsb
->
notify
);
pdsb
->
notify
=
NULL
;
}
secondarybuffer_destroy
(
pdsb
);
secondarybuffer_destroy
(
pdsb
);
return
S_OK
;
return
S_OK
;
...
@@ -1080,12 +1028,12 @@ HRESULT IDirectSoundBufferImpl_Duplicate(
...
@@ -1080,12 +1028,12 @@ HRESULT IDirectSoundBufferImpl_Duplicate(
dsb
->
buffer
->
ref
++
;
dsb
->
buffer
->
ref
++
;
list_add_head
(
&
dsb
->
buffer
->
buffers
,
&
dsb
->
entry
);
list_add_head
(
&
dsb
->
buffer
->
buffers
,
&
dsb
->
entry
);
dsb
->
ref
=
0
;
dsb
->
ref
=
0
;
dsb
->
refn
=
0
;
dsb
->
ref3D
=
0
;
dsb
->
ref3D
=
0
;
dsb
->
refiks
=
0
;
dsb
->
refiks
=
0
;
dsb
->
numIfaces
=
0
;
dsb
->
numIfaces
=
0
;
dsb
->
state
=
STATE_STOPPED
;
dsb
->
state
=
STATE_STOPPED
;
dsb
->
buf_mixpos
=
dsb
->
sec_mixpos
=
0
;
dsb
->
buf_mixpos
=
dsb
->
sec_mixpos
=
0
;
dsb
->
notify
=
NULL
;
dsb
->
notifies
=
NULL
;
dsb
->
notifies
=
NULL
;
dsb
->
nrofnotifies
=
0
;
dsb
->
nrofnotifies
=
0
;
dsb
->
device
=
device
;
dsb
->
device
=
device
;
...
...
dlls/dsound/dsound_private.h
View file @
c7f5f10a
...
@@ -48,7 +48,6 @@ typedef struct IDirectSound8_IDirectSound8 IDirectSound8_IDirectSound8;
...
@@ -48,7 +48,6 @@ typedef struct IDirectSound8_IDirectSound8 IDirectSound8_IDirectSound8;
typedef
struct
IDirectSoundBufferImpl
IDirectSoundBufferImpl
;
typedef
struct
IDirectSoundBufferImpl
IDirectSoundBufferImpl
;
typedef
struct
IDirectSoundCaptureImpl
IDirectSoundCaptureImpl
;
typedef
struct
IDirectSoundCaptureImpl
IDirectSoundCaptureImpl
;
typedef
struct
IDirectSoundCaptureBufferImpl
IDirectSoundCaptureBufferImpl
;
typedef
struct
IDirectSoundCaptureBufferImpl
IDirectSoundCaptureBufferImpl
;
typedef
struct
IDirectSoundNotifyImpl
IDirectSoundNotifyImpl
;
typedef
struct
DirectSoundDevice
DirectSoundDevice
;
typedef
struct
DirectSoundDevice
DirectSoundDevice
;
typedef
struct
DirectSoundCaptureDevice
DirectSoundCaptureDevice
;
typedef
struct
DirectSoundCaptureDevice
DirectSoundCaptureDevice
;
...
@@ -163,11 +162,12 @@ HRESULT DirectSoundDevice_VerifyCertification(DirectSoundDevice * device,
...
@@ -163,11 +162,12 @@ HRESULT DirectSoundDevice_VerifyCertification(DirectSoundDevice * device,
struct
IDirectSoundBufferImpl
struct
IDirectSoundBufferImpl
{
{
IDirectSoundBuffer8
IDirectSoundBuffer8_iface
;
IDirectSoundBuffer8
IDirectSoundBuffer8_iface
;
IDirectSoundNotify
IDirectSoundNotify_iface
;
IDirectSound3DListener
IDirectSound3DListener_iface
;
/* only primary buffer */
IDirectSound3DListener
IDirectSound3DListener_iface
;
/* only primary buffer */
IDirectSound3DBuffer
IDirectSound3DBuffer_iface
;
/* only secondary buffer */
IDirectSound3DBuffer
IDirectSound3DBuffer_iface
;
/* only secondary buffer */
IKsPropertySet
IKsPropertySet_iface
;
IKsPropertySet
IKsPropertySet_iface
;
LONG
numIfaces
;
/* "in use interfaces" refcount */
LONG
numIfaces
;
/* "in use interfaces" refcount */
LONG
ref
,
ref3D
,
refiks
;
LONG
ref
,
ref
n
,
ref
3D
,
refiks
;
/* IDirectSoundBufferImpl fields */
/* IDirectSoundBufferImpl fields */
DirectSoundDevice
*
device
;
DirectSoundDevice
*
device
;
RTL_RWLOCK
lock
;
RTL_RWLOCK
lock
;
...
@@ -183,12 +183,9 @@ struct IDirectSoundBufferImpl
...
@@ -183,12 +183,9 @@ struct IDirectSoundBufferImpl
ULONG
freqneeded
,
freqAdjust
,
freqAcc
,
freqAccNext
;
ULONG
freqneeded
,
freqAdjust
,
freqAcc
,
freqAccNext
;
/* used for mixing */
/* used for mixing */
DWORD
primary_mixpos
,
buf_mixpos
,
sec_mixpos
;
DWORD
primary_mixpos
,
buf_mixpos
,
sec_mixpos
;
/* IDirectSoundNotify fields */
/* IDirectSoundNotifyImpl fields */
IDirectSoundNotifyImpl
*
notify
;
LPDSBPOSITIONNOTIFY
notifies
;
LPDSBPOSITIONNOTIFY
notifies
;
int
nrofnotifies
;
int
nrofnotifies
;
/* DirectSound3DBuffer fields */
/* DirectSound3DBuffer fields */
DS3DBUFFER
ds3db_ds3db
;
DS3DBUFFER
ds3db_ds3db
;
LONG
ds3db_lVolume
;
LONG
ds3db_lVolume
;
...
...
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