1 /* IDirectMusicComposer
3 * Copyright (C) 2003-2004 Rok Mandeljc
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "dmcompos_private.h"
23 WINE_DEFAULT_DEBUG_CHANNEL(dmcompos
);
25 typedef struct IDirectMusicComposerImpl
{
26 IDirectMusicComposer IDirectMusicComposer_iface
;
28 } IDirectMusicComposerImpl
;
30 static inline IDirectMusicComposerImpl
*impl_from_IDirectMusicComposer(IDirectMusicComposer
*iface
)
32 return CONTAINING_RECORD(iface
, IDirectMusicComposerImpl
, IDirectMusicComposer_iface
);
35 static HRESULT WINAPI
IDirectMusicComposerImpl_QueryInterface(IDirectMusicComposer
*iface
,
36 REFIID riid
, void **ret_iface
)
38 TRACE("(%p, %s, %p)\n", iface
, debugstr_dmguid(riid
), ret_iface
);
40 if (IsEqualIID(riid
, &IID_IUnknown
) || IsEqualIID(riid
, &IID_IDirectMusicComposer
))
43 IDirectMusicComposer_AddRef(iface
);
47 WARN("(%p, %s, %p): not found\n", iface
, debugstr_dmguid(riid
), ret_iface
);
53 static ULONG WINAPI
IDirectMusicComposerImpl_AddRef(IDirectMusicComposer
*iface
)
55 IDirectMusicComposerImpl
*This
= impl_from_IDirectMusicComposer(iface
);
56 ULONG ref
= InterlockedIncrement(&This
->ref
);
58 TRACE("(%p) ref=%d\n", This
, ref
);
63 static ULONG WINAPI
IDirectMusicComposerImpl_Release(IDirectMusicComposer
*iface
)
65 IDirectMusicComposerImpl
*This
= impl_from_IDirectMusicComposer(iface
);
66 ULONG ref
= InterlockedDecrement(&This
->ref
);
68 TRACE("(%p) ref=%d\n", This
, ref
);
71 HeapFree(GetProcessHeap(), 0, This
);
72 DMCOMPOS_UnlockModule();
78 /* IDirectMusicComposerImpl IDirectMusicComposer part: */
79 static HRESULT WINAPI
IDirectMusicComposerImpl_ComposeSegmentFromTemplate(IDirectMusicComposer
*iface
,
80 IDirectMusicStyle
*pStyle
, IDirectMusicSegment
*pTemplate
, WORD wActivity
,
81 IDirectMusicChordMap
*pChordMap
, IDirectMusicSegment
**ppSegment
)
83 IDirectMusicComposerImpl
*This
= impl_from_IDirectMusicComposer(iface
);
84 FIXME("(%p, %p, %p, %d, %p, %p): stub\n", This
, pStyle
, pTemplate
, wActivity
, pChordMap
, ppSegment
);
88 static HRESULT WINAPI
IDirectMusicComposerImpl_ComposeSegmentFromShape(IDirectMusicComposer
*iface
,
89 IDirectMusicStyle
*pStyle
, WORD wNumMeasures
, WORD wShape
, WORD wActivity
, BOOL fIntro
,
90 BOOL fEnd
, IDirectMusicChordMap
*pChordMap
, IDirectMusicSegment
**ppSegment
)
92 IDirectMusicComposerImpl
*This
= impl_from_IDirectMusicComposer(iface
);
93 FIXME("(%p, %p, %d, %d, %d, %d, %d, %p, %p): stub\n", This
, pStyle
, wNumMeasures
, wShape
, wActivity
, fIntro
, fEnd
, pChordMap
, ppSegment
);
97 static HRESULT WINAPI
IDirectMusicComposerImpl_ComposeTransition(IDirectMusicComposer
*iface
,
98 IDirectMusicSegment
*pFromSeg
, IDirectMusicSegment
*pToSeg
, MUSIC_TIME mtTime
,
99 WORD wCommand
, DWORD dwFlags
, IDirectMusicChordMap
*pChordMap
,
100 IDirectMusicSegment
**ppTransSeg
)
102 IDirectMusicComposerImpl
*This
= impl_from_IDirectMusicComposer(iface
);
103 FIXME("(%p, %p, %p, %d, %d, %d, %p, %p): stub\n", This
, pFromSeg
, pToSeg
, mtTime
, wCommand
, dwFlags
, pChordMap
, ppTransSeg
);
107 static HRESULT WINAPI
IDirectMusicComposerImpl_AutoTransition(IDirectMusicComposer
*iface
,
108 IDirectMusicPerformance
*pPerformance
, IDirectMusicSegment
*pToSeg
, WORD wCommand
,
109 DWORD dwFlags
, IDirectMusicChordMap
*pChordMap
, IDirectMusicSegment
**ppTransSeg
,
110 IDirectMusicSegmentState
**ppToSegState
, IDirectMusicSegmentState
**ppTransSegState
)
112 IDirectMusicComposerImpl
*This
= impl_from_IDirectMusicComposer(iface
);
113 FIXME("(%p, %p, %d, %d, %p, %p, %p, %p): stub\n", This
, pPerformance
, wCommand
, dwFlags
, pChordMap
, ppTransSeg
, ppToSegState
, ppTransSegState
);
117 static HRESULT WINAPI
IDirectMusicComposerImpl_ComposeTemplateFromShape(IDirectMusicComposer
*iface
,
118 WORD wNumMeasures
, WORD wShape
, BOOL fIntro
, BOOL fEnd
, WORD wEndLength
,
119 IDirectMusicSegment
**ppTemplate
)
121 IDirectMusicComposerImpl
*This
= impl_from_IDirectMusicComposer(iface
);
122 FIXME("(%p, %d, %d, %d, %d, %d, %p): stub\n", This
, wNumMeasures
, wShape
, fIntro
, fEnd
, wEndLength
, ppTemplate
);
126 static HRESULT WINAPI
IDirectMusicComposerImpl_ChangeChordMap(IDirectMusicComposer
*iface
,
127 IDirectMusicSegment
*pSegment
, BOOL fTrackScale
, IDirectMusicChordMap
*pChordMap
)
129 IDirectMusicComposerImpl
*This
= impl_from_IDirectMusicComposer(iface
);
130 FIXME("(%p, %p, %d, %p): stub\n", This
, pSegment
, fTrackScale
, pChordMap
);
134 static const IDirectMusicComposerVtbl dmcomposer_vtbl
= {
135 IDirectMusicComposerImpl_QueryInterface
,
136 IDirectMusicComposerImpl_AddRef
,
137 IDirectMusicComposerImpl_Release
,
138 IDirectMusicComposerImpl_ComposeSegmentFromTemplate
,
139 IDirectMusicComposerImpl_ComposeSegmentFromShape
,
140 IDirectMusicComposerImpl_ComposeTransition
,
141 IDirectMusicComposerImpl_AutoTransition
,
142 IDirectMusicComposerImpl_ComposeTemplateFromShape
,
143 IDirectMusicComposerImpl_ChangeChordMap
146 /* for ClassFactory */
147 HRESULT WINAPI
create_dmcomposer(REFIID riid
, void **ret_iface
)
149 IDirectMusicComposerImpl
*obj
;
152 obj
= HeapAlloc(GetProcessHeap(), 0, sizeof(*obj
));
155 return E_OUTOFMEMORY
;
157 obj
->IDirectMusicComposer_iface
.lpVtbl
= &dmcomposer_vtbl
;
160 DMCOMPOS_LockModule();
161 hr
= IDirectMusicComposer_QueryInterface(&obj
->IDirectMusicComposer_iface
, riid
, ret_iface
);
162 IDirectMusicComposer_Release(&obj
->IDirectMusicComposer_iface
);