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=%ld\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=%ld\n", This
, ref
);
75 /* IDirectMusicComposerImpl IDirectMusicComposer part: */
76 static HRESULT WINAPI
IDirectMusicComposerImpl_ComposeSegmentFromTemplate(IDirectMusicComposer
*iface
,
77 IDirectMusicStyle
*style
, IDirectMusicSegment
*template, WORD activity
, IDirectMusicChordMap
*chordmap
,
78 IDirectMusicSegment
**segment
)
80 IDirectMusicComposerImpl
*This
= impl_from_IDirectMusicComposer(iface
);
81 IDirectMusicTrack
*track
;
84 FIXME("(%p, %p, %p, %d, %p, %p): semi-stub\n", This
, style
, template, activity
, chordmap
, segment
);
92 hr
= IDirectMusicSegment_GetTrack(template, &CLSID_DirectMusicStyleTrack
, 0xFFFFFFFF,
93 DMUS_SEG_ANYTRACK
, &track
);
97 IDirectMusicTrack_Release(track
); /* Temp to not leak memory */
100 hr
= IDirectMusicSegment_GetTrack(template, &CLSID_DirectMusicChordMapTrack
, 0xFFFFFFFF,
101 DMUS_SEG_ANYTRACK
, &track
);
105 IDirectMusicTrack_Release(track
); /* Temp to not leak memory */
108 return IDirectMusicSegment_Clone(template, -1, 0, segment
);
111 static HRESULT WINAPI
IDirectMusicComposerImpl_ComposeSegmentFromShape(IDirectMusicComposer
*iface
,
112 IDirectMusicStyle
*pStyle
, WORD wNumMeasures
, WORD wShape
, WORD wActivity
, BOOL fIntro
,
113 BOOL fEnd
, IDirectMusicChordMap
*pChordMap
, IDirectMusicSegment
**ppSegment
)
115 IDirectMusicComposerImpl
*This
= impl_from_IDirectMusicComposer(iface
);
116 FIXME("(%p, %p, %d, %d, %d, %d, %d, %p, %p): stub\n", This
, pStyle
, wNumMeasures
, wShape
, wActivity
, fIntro
, fEnd
, pChordMap
, ppSegment
);
120 static HRESULT WINAPI
IDirectMusicComposerImpl_ComposeTransition(IDirectMusicComposer
*iface
,
121 IDirectMusicSegment
*pFromSeg
, IDirectMusicSegment
*pToSeg
, MUSIC_TIME mtTime
,
122 WORD wCommand
, DWORD dwFlags
, IDirectMusicChordMap
*pChordMap
,
123 IDirectMusicSegment
**ppTransSeg
)
125 IDirectMusicComposerImpl
*This
= impl_from_IDirectMusicComposer(iface
);
126 FIXME("(%p, %p, %p, %ld, %d, %ld, %p, %p): stub\n", This
, pFromSeg
, pToSeg
, mtTime
, wCommand
, dwFlags
, pChordMap
, ppTransSeg
);
130 static HRESULT WINAPI
IDirectMusicComposerImpl_AutoTransition(IDirectMusicComposer
*iface
,
131 IDirectMusicPerformance
*pPerformance
, IDirectMusicSegment
*pToSeg
, WORD wCommand
,
132 DWORD dwFlags
, IDirectMusicChordMap
*pChordMap
, IDirectMusicSegment
**ppTransSeg
,
133 IDirectMusicSegmentState
**ppToSegState
, IDirectMusicSegmentState
**ppTransSegState
)
135 IDirectMusicComposerImpl
*This
= impl_from_IDirectMusicComposer(iface
);
136 FIXME("(%p, %p, %d, %ld, %p, %p, %p, %p): stub\n", This
, pPerformance
, wCommand
, dwFlags
, pChordMap
, ppTransSeg
, ppToSegState
, ppTransSegState
);
140 static HRESULT WINAPI
IDirectMusicComposerImpl_ComposeTemplateFromShape(IDirectMusicComposer
*iface
,
141 WORD wNumMeasures
, WORD wShape
, BOOL fIntro
, BOOL fEnd
, WORD wEndLength
,
142 IDirectMusicSegment
**ppTemplate
)
144 IDirectMusicComposerImpl
*This
= impl_from_IDirectMusicComposer(iface
);
145 FIXME("(%p, %d, %d, %d, %d, %d, %p): stub\n", This
, wNumMeasures
, wShape
, fIntro
, fEnd
, wEndLength
, ppTemplate
);
149 static HRESULT WINAPI
IDirectMusicComposerImpl_ChangeChordMap(IDirectMusicComposer
*iface
,
150 IDirectMusicSegment
*pSegment
, BOOL fTrackScale
, IDirectMusicChordMap
*pChordMap
)
152 IDirectMusicComposerImpl
*This
= impl_from_IDirectMusicComposer(iface
);
153 FIXME("(%p, %p, %d, %p): stub\n", This
, pSegment
, fTrackScale
, pChordMap
);
157 static const IDirectMusicComposerVtbl dmcomposer_vtbl
= {
158 IDirectMusicComposerImpl_QueryInterface
,
159 IDirectMusicComposerImpl_AddRef
,
160 IDirectMusicComposerImpl_Release
,
161 IDirectMusicComposerImpl_ComposeSegmentFromTemplate
,
162 IDirectMusicComposerImpl_ComposeSegmentFromShape
,
163 IDirectMusicComposerImpl_ComposeTransition
,
164 IDirectMusicComposerImpl_AutoTransition
,
165 IDirectMusicComposerImpl_ComposeTemplateFromShape
,
166 IDirectMusicComposerImpl_ChangeChordMap
169 /* for ClassFactory */
170 HRESULT
create_dmcomposer(REFIID riid
, void **ret_iface
)
172 IDirectMusicComposerImpl
*obj
;
176 if (!(obj
= calloc(1, sizeof(*obj
)))) return E_OUTOFMEMORY
;
177 obj
->IDirectMusicComposer_iface
.lpVtbl
= &dmcomposer_vtbl
;
180 hr
= IDirectMusicComposer_QueryInterface(&obj
->IDirectMusicComposer_iface
, riid
, ret_iface
);
181 IDirectMusicComposer_Release(&obj
->IDirectMusicComposer_iface
);