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
36a88d28
Commit
36a88d28
authored
May 10, 2017
by
Michael Stefaniuc
Committed by
Alexandre Julliard
May 10, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmusic: Implement IDirectMusic8::SetDirectSound().
Signed-off-by:
Michael Stefaniuc
<
mstefani@winehq.org
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b75e8bc6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
16 deletions
+46
-16
performance.c
dlls/dmime/tests/performance.c
+4
-4
Makefile.in
dlls/dmusic/Makefile.in
+1
-1
dmusic.c
dlls/dmusic/dmusic.c
+31
-2
dmusic_private.h
dlls/dmusic/dmusic_private.h
+1
-0
dmusic.c
dlls/dmusic/tests/dmusic.c
+9
-9
No files found.
dlls/dmime/tests/performance.c
View file @
36a88d28
...
...
@@ -169,11 +169,11 @@ static HRESULT test_InitAudio(void)
IDirectMusic_SetDirectSound
(
dmusic
,
dsound
,
NULL
);
ok
(
hr
==
S_OK
,
"SetDirectSound failed: %08x
\n
"
,
hr
);
ref
=
get_refcount
(
dsound
);
todo_wine
ok
(
ref
==
2
,
"dsound ref count got %d expected 2
\n
"
,
ref
);
ok
(
ref
==
2
,
"dsound ref count got %d expected 2
\n
"
,
ref
);
hr
=
IDirectMusicPerformance8_InitAudio
(
performance
,
&
dmusic
,
NULL
,
NULL
,
0
,
64
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"InitAudio failed: %08x
\n
"
,
hr
);
ref
=
get_refcount
(
dsound
);
todo_wine
ok
(
ref
==
2
,
"dsound ref count got %d expected 2
\n
"
,
ref
);
ok
(
ref
==
2
,
"dsound ref count got %d expected 2
\n
"
,
ref
);
ref
=
get_refcount
(
dmusic
);
ok
(
ref
==
2
,
"dmusic ref count got %d expected 2
\n
"
,
ref
);
destroy_performance
(
performance
,
dmusic
,
dsound
);
...
...
@@ -183,11 +183,11 @@ static HRESULT test_InitAudio(void)
IDirectMusic_SetDirectSound
(
dmusic
,
dsound
,
NULL
);
ok
(
hr
==
S_OK
,
"SetDirectSound failed: %08x
\n
"
,
hr
);
ref
=
get_refcount
(
dsound
);
todo_wine
ok
(
ref
==
2
,
"dsound ref count got %d expected 2
\n
"
,
ref
);
ok
(
ref
==
2
,
"dsound ref count got %d expected 2
\n
"
,
ref
);
hr
=
IDirectMusicPerformance8_InitAudio
(
performance
,
&
dmusic
,
&
dsound
,
NULL
,
0
,
64
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"InitAudio failed: %08x
\n
"
,
hr
);
ref
=
get_refcount
(
dsound
);
todo_wine
ok
(
ref
==
3
,
"dsound ref count got %d expected 3
\n
"
,
ref
);
ok
(
ref
==
3
,
"dsound ref count got %d expected 3
\n
"
,
ref
);
ref
=
get_refcount
(
dmusic
);
ok
(
ref
==
2
,
"dmusic ref count got %d expected 2
\n
"
,
ref
);
destroy_performance
(
performance
,
dmusic
,
dsound
);
...
...
dlls/dmusic/Makefile.in
View file @
36a88d28
MODULE
=
dmusic.dll
IMPORTS
=
dxguid uuid ole32 advapi32 winmm
IMPORTS
=
dxguid uuid ole32 advapi32
dsound user32
winmm
C_SRCS
=
\
buffer.c
\
...
...
dlls/dmusic/dmusic.c
View file @
36a88d28
...
...
@@ -73,6 +73,8 @@ static ULONG WINAPI IDirectMusic8Impl_Release(LPDIRECTMUSIC8 iface)
if
(
!
ref
)
{
IReferenceClock_Release
(
&
This
->
master_clock
->
IReferenceClock_iface
);
if
(
This
->
dsound
)
IDirectSound_Release
(
This
->
dsound
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
system_ports
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
ports
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
...
...
@@ -271,11 +273,38 @@ static HRESULT WINAPI IDirectMusic8Impl_GetDefaultPort(LPDIRECTMUSIC8 iface, LPG
return
S_OK
;
}
static
HRESULT
WINAPI
IDirectMusic8Impl_SetDirectSound
(
LPDIRECTMUSIC8
iface
,
LPDIRECTSOUND
dsound
,
HWND
wnd
)
static
HRESULT
WINAPI
IDirectMusic8Impl_SetDirectSound
(
IDirectMusic8
*
iface
,
IDirectSound
*
dsound
,
HWND
hwnd
)
{
IDirectMusic8Impl
*
This
=
impl_from_IDirectMusic8
(
iface
);
HRESULT
hr
;
int
i
;
TRACE
(
"(%p)->(%p, %p)
\n
"
,
This
,
dsound
,
hwnd
);
for
(
i
=
0
;
i
<
This
->
num_ports
;
i
++
)
{
hr
=
IDirectMusicPort_SetDirectSound
(
This
->
ports
[
i
],
NULL
,
NULL
);
if
(
FAILED
(
hr
))
return
hr
;
}
if
(
This
->
dsound
)
IDirectSound_Release
(
This
->
dsound
);
if
(
!
dsound
)
{
hr
=
DirectSoundCreate8
(
NULL
,
(
IDirectSound8
**
)
&
This
->
dsound
,
NULL
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
IDirectSound_SetCooperativeLevel
(
This
->
dsound
,
hwnd
?
hwnd
:
GetForegroundWindow
(),
DSSCL_PRIORITY
);
if
(
FAILED
(
hr
))
IDirectSound_Release
(
This
->
dsound
);
return
hr
;
}
FIXME
(
"(%p)->(%p, %p): stub
\n
"
,
This
,
dsound
,
wnd
);
IDirectSound_AddRef
(
dsound
);
This
->
dsound
=
dsound
;
return
S_OK
;
}
...
...
dlls/dmusic/dmusic_private.h
View file @
36a88d28
...
...
@@ -108,6 +108,7 @@ extern HRESULT DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID*
struct
IDirectMusic8Impl
{
IDirectMusic8
IDirectMusic8_iface
;
LONG
ref
;
IDirectSound
*
dsound
;
IReferenceClockImpl
*
master_clock
;
IDirectMusicPort
**
ports
;
int
num_ports
;
...
...
dlls/dmusic/tests/dmusic.c
View file @
36a88d28
...
...
@@ -171,11 +171,11 @@ static void test_setdsound(void)
hr
=
IDirectMusic_SetDirectSound
(
dmusic
,
dsound
,
NULL
);
ok
(
hr
==
S_OK
,
"SetDirectSound failed: %08x
\n
"
,
hr
);
ref
=
get_refcount
(
dsound
);
todo_wine
ok
(
ref
==
2
,
"dsound ref count got %d expected 2
\n
"
,
ref
);
ok
(
ref
==
2
,
"dsound ref count got %d expected 2
\n
"
,
ref
);
hr
=
IDirectMusic_CreatePort
(
dmusic
,
&
GUID_NULL
,
&
params
,
&
port
,
NULL
);
ok
(
hr
==
S_OK
,
"CreatePort returned: %x
\n
"
,
hr
);
ref
=
get_refcount
(
dsound
);
todo_wine
ok
(
ref
==
2
,
"dsound ref count got %d expected 2
\n
"
,
ref
);
ok
(
ref
==
2
,
"dsound ref count got %d expected 2
\n
"
,
ref
);
hr
=
IDirectMusicPort_Activate
(
port
,
TRUE
);
ok
(
hr
==
S_OK
,
"Port Activate returned: %x
\n
"
,
hr
);
ref
=
get_refcount
(
dsound
);
...
...
@@ -197,11 +197,11 @@ static void test_setdsound(void)
hr
=
IDirectMusic_SetDirectSound
(
dmusic
,
dsound
,
NULL
);
ok
(
hr
==
S_OK
,
"SetDirectSound failed: %08x
\n
"
,
hr
);
ref
=
get_refcount
(
dsound
);
todo_wine
ok
(
ref
==
2
,
"dsound ref count got %d expected 2
\n
"
,
ref
);
ok
(
ref
==
2
,
"dsound ref count got %d expected 2
\n
"
,
ref
);
hr
=
IDirectMusic_SetDirectSound
(
dmusic
,
dsound
,
NULL
);
ok
(
hr
==
S_OK
,
"SetDirectSound failed: %08x
\n
"
,
hr
);
ref
=
get_refcount
(
dsound
);
todo_wine
ok
(
ref
==
2
,
"dsound ref count got %d expected 2
\n
"
,
ref
);
ok
(
ref
==
2
,
"dsound ref count got %d expected 2
\n
"
,
ref
);
/* Replacing one dsound with another */
hr
=
DirectSoundCreate8
(
NULL
,
(
IDirectSound8
**
)
&
dsound2
,
NULL
);
...
...
@@ -211,7 +211,7 @@ static void test_setdsound(void)
ref
=
get_refcount
(
dsound
);
ok
(
ref
==
1
,
"dsound ref count got %d expected 1
\n
"
,
ref
);
ref
=
get_refcount
(
dsound2
);
todo_wine
ok
(
ref
==
2
,
"dsound2 ref count got %d expected 2
\n
"
,
ref
);
ok
(
ref
==
2
,
"dsound2 ref count got %d expected 2
\n
"
,
ref
);
/* Replacing the dsound in the port */
hr
=
IDirectMusicPort_SetDirectSound
(
port
,
dsound
,
NULL
);
...
...
@@ -219,27 +219,27 @@ static void test_setdsound(void)
ref
=
get_refcount
(
dsound
);
todo_wine
ok
(
ref
==
2
,
"dsound ref count got %d expected 2
\n
"
,
ref
);
ref
=
get_refcount
(
dsound2
);
todo_wine
ok
(
ref
==
2
,
"dsound2 ref count got %d expected 2
\n
"
,
ref
);
ok
(
ref
==
2
,
"dsound2 ref count got %d expected 2
\n
"
,
ref
);
/* Setting the dsound again on the port will mess with the parent dmusic */
hr
=
IDirectMusicPort_SetDirectSound
(
port
,
dsound
,
NULL
);
ok
(
hr
==
S_OK
,
"SetDirectSound failed: %08x
\n
"
,
hr
);
ref
=
get_refcount
(
dsound
);
todo_wine
ok
(
ref
==
3
,
"dsound ref count got %d expected 3
\n
"
,
ref
);
ref
=
get_refcount
(
dsound2
);
ok
(
ref
==
1
,
"dsound2 ref count got %d expected 1
\n
"
,
ref
);
todo_wine
ok
(
ref
==
1
,
"dsound2 ref count got %d expected 1
\n
"
,
ref
);
IDirectSound_AddRef
(
dsound2
);
/* Crash prevention */
hr
=
IDirectMusicPort_Activate
(
port
,
TRUE
);
ok
(
hr
==
S_OK
,
"Activate returned: %x
\n
"
,
hr
);
ref
=
get_refcount
(
dsound
);
todo_wine
ok
(
ref
==
4
,
"dsound ref count got %d expected 4
\n
"
,
ref
);
ref
=
get_refcount
(
dsound2
);
ok
(
ref
==
2
,
"dsound2 ref count got %d expected 2
\n
"
,
ref
);
todo_wine
ok
(
ref
==
2
,
"dsound2 ref count got %d expected 2
\n
"
,
ref
);
hr
=
IDirectMusicPort_Activate
(
port
,
TRUE
);
todo_wine
ok
(
hr
==
S_FALSE
,
"Activate returned: %x
\n
"
,
hr
);
ref
=
get_refcount
(
dsound
);
todo_wine
ok
(
ref
==
4
,
"dsound ref count got %d expected 4
\n
"
,
ref
);
ref
=
get_refcount
(
dsound2
);
ok
(
ref
==
2
,
"dsound2 ref count got %d expected 2
\n
"
,
ref
);
todo_wine
ok
(
ref
==
2
,
"dsound2 ref count got %d expected 2
\n
"
,
ref
);
/* Deactivating the port messes with the dsound refcount in the parent dmusic */
hr
=
IDirectMusicPort_Activate
(
port
,
FALSE
);
...
...
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