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
b177ceff
Commit
b177ceff
authored
Sep 20, 2012
by
Christian Costa
Committed by
Alexandre Julliard
Sep 20, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmusic: Setup and free all DirectMusicSynth objects when creating and releasing Synth port.
parent
0c9ee666
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
7 deletions
+44
-7
dmusic_private.h
dlls/dmusic/dmusic_private.h
+2
-0
port.c
dlls/dmusic/port.c
+42
-7
No files found.
dlls/dmusic/dmusic_private.h
View file @
b177ceff
...
...
@@ -160,6 +160,8 @@ struct SynthPortImpl {
/* IDirectMusicPort fields */
IDirectSound
*
pDirectSound
;
IReferenceClock
*
pLatencyClock
;
IDirectMusicSynth
*
synth
;
IDirectMusicSynthSink
*
synth_sink
;
BOOL
fActive
;
DMUS_PORTCAPS
caps
;
DMUS_PORTPARAMS
params
;
...
...
dlls/dmusic/port.c
View file @
b177ceff
...
...
@@ -2,6 +2,7 @@
* IDirectMusicPort Implementation
*
* Copyright (C) 2003-2004 Rok Mandeljc
* Copyright (C) 2012 Christian Costa
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -85,7 +86,14 @@ static ULONG WINAPI SynthPortImpl_IDirectMusicPort_Release(LPDIRECTMUSICPORT ifa
TRACE
(
"(%p)->(): new ref = %u
\n
"
,
This
,
ref
);
if
(
!
ref
)
{
IDirectMusicSynth_Activate
(
This
->
synth
,
FALSE
);
IDirectMusicSynth_Close
(
This
->
synth
);
IDirectMusicSynth_Release
(
This
->
synth
);
IDirectMusicSynthSink_Release
(
This
->
synth_sink
);
IReferenceClock_Release
(
This
->
pLatencyClock
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
DMUSIC_UnlockModule
();
...
...
@@ -480,11 +488,11 @@ HRESULT DMUSIC_CreateSynthPortImpl(LPCGUID guid, LPVOID *object, LPUNKNOWN unkou
TRACE
(
"(%p,%p,%p,%p,%p%d)
\n
"
,
guid
,
object
,
unkouter
,
port_params
,
port_caps
,
device
);
*
object
=
NULL
;
obj
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
SynthPortImpl
));
if
(
!
obj
)
{
*
object
=
NULL
;
if
(
!
obj
)
return
E_OUTOFMEMORY
;
}
obj
->
IDirectMusicPort_iface
.
lpVtbl
=
&
SynthPortImpl_DirectMusicPort_Vtbl
;
obj
->
IDirectMusicPortDownload_iface
.
lpVtbl
=
&
SynthPortImpl_DirectMusicPortDownload_Vtbl
;
...
...
@@ -493,16 +501,32 @@ HRESULT DMUSIC_CreateSynthPortImpl(LPCGUID guid, LPVOID *object, LPUNKNOWN unkou
obj
->
fActive
=
FALSE
;
obj
->
params
=
*
port_params
;
obj
->
caps
=
*
port_caps
;
obj
->
pDirectSound
=
NULL
;
obj
->
pLatencyClock
=
NULL
;
hr
=
DMUSIC_CreateReferenceClockImpl
(
&
IID_IReferenceClock
,
(
LPVOID
*
)
&
obj
->
pLatencyClock
,
NULL
);
if
(
hr
!=
S_OK
)
{
HeapFree
(
GetProcessHeap
(),
0
,
obj
);
*
object
=
NULL
;
return
hr
;
}
if
(
SUCCEEDED
(
hr
))
hr
=
CoCreateInstance
(
&
CLSID_DirectMusicSynth
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IDirectMusicSynth
,
(
void
**
)
&
obj
->
synth
);
if
(
SUCCEEDED
(
hr
))
hr
=
CoCreateInstance
(
&
CLSID_DirectMusicSynthSink
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IDirectMusicSynthSink
,
(
void
**
)
&
obj
->
synth_sink
);
if
(
SUCCEEDED
(
hr
))
hr
=
IDirectMusicSynth_SetMasterClock
(
obj
->
synth
,
obj
->
pLatencyClock
);
if
(
SUCCEEDED
(
hr
))
hr
=
IDirectMusicSynthSink_SetMasterClock
(
obj
->
synth_sink
,
obj
->
pLatencyClock
);
if
(
SUCCEEDED
(
hr
))
hr
=
IDirectMusicSynth_SetSynthSink
(
obj
->
synth
,
obj
->
synth_sink
);
if
(
SUCCEEDED
(
hr
))
hr
=
IDirectMusicSynth_Open
(
obj
->
synth
,
port_params
);
if
(
0
)
{
if
(
port_params
->
dwValidParams
&
DMUS_PORTPARAMS_CHANNELGROUPS
)
{
...
...
@@ -530,7 +554,18 @@ HRESULT DMUSIC_CreateSynthPortImpl(LPCGUID guid, LPVOID *object, LPUNKNOWN unkou
}
}
return
IDirectMusicPort_QueryInterface
((
LPDIRECTMUSICPORT
)
obj
,
guid
,
object
);
if
(
SUCCEEDED
(
hr
))
return
IDirectMusicPort_QueryInterface
((
LPDIRECTMUSICPORT
)
obj
,
guid
,
object
);
if
(
obj
->
synth
)
IDirectMusicSynth_Release
(
obj
->
synth
);
if
(
obj
->
synth_sink
)
IDirectMusicSynthSink_Release
(
obj
->
synth_sink
);
if
(
obj
->
pLatencyClock
)
IReferenceClock_Release
(
obj
->
pLatencyClock
);
HeapFree
(
GetProcessHeap
(),
0
,
obj
);
return
hr
;
}
HRESULT
DMUSIC_CreateMidiOutPortImpl
(
LPCGUID
guid
,
LPVOID
*
object
,
LPUNKNOWN
unkouter
,
LPDMUS_PORTPARAMS
port_params
,
LPDMUS_PORTCAPS
port_caps
,
DWORD
device
)
...
...
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