ReactOS 0.4.17-dev-934-g091855f
composer.c
Go to the documentation of this file.
1/* IDirectMusicComposer
2 *
3 * Copyright (C) 2003-2004 Rok Mandeljc
4 *
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.
9 *
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.
14 *
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
18 */
19
20#include "dmcompos_private.h"
21#include "dmobject.h"
22
24
26 IDirectMusicComposer IDirectMusicComposer_iface;
29
30static inline IDirectMusicComposerImpl *impl_from_IDirectMusicComposer(IDirectMusicComposer *iface)
31{
32 return CONTAINING_RECORD(iface, IDirectMusicComposerImpl, IDirectMusicComposer_iface);
33}
34
35static HRESULT WINAPI IDirectMusicComposerImpl_QueryInterface(IDirectMusicComposer *iface,
36 REFIID riid, void **ret_iface)
37{
38 TRACE("(%p, %s, %p)\n", iface, debugstr_dmguid(riid), ret_iface);
39
40 if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDirectMusicComposer))
41{
42 *ret_iface = iface;
44 return S_OK;
45 }
46
47 WARN("(%p, %s, %p): not found\n", iface, debugstr_dmguid(riid), ret_iface);
48 *ret_iface = NULL;
49
50 return E_NOINTERFACE;
51}
52
53static ULONG WINAPI IDirectMusicComposerImpl_AddRef(IDirectMusicComposer *iface)
54{
57
58 TRACE("(%p) ref=%ld\n", This, ref);
59
60 return ref;
61}
62
63static ULONG WINAPI IDirectMusicComposerImpl_Release(IDirectMusicComposer *iface)
64{
67
68 TRACE("(%p) ref=%ld\n", This, ref);
69
70 if (!ref) free(This);
71
72 return ref;
73}
74
75/* IDirectMusicComposerImpl IDirectMusicComposer part: */
77 IDirectMusicStyle *style, IDirectMusicSegment *template, WORD activity, IDirectMusicChordMap *chordmap,
78 IDirectMusicSegment **segment)
79{
81 IDirectMusicTrack *track;
82 HRESULT hr;
83
84 FIXME("(%p, %p, %p, %d, %p, %p): semi-stub\n", This, style, template, activity, chordmap, segment);
85
86 if (!segment)
87 return E_POINTER;
88 if (!template)
89 return E_INVALIDARG;
90
91 if (!style) {
92 hr = IDirectMusicSegment_GetTrack(template, &CLSID_DirectMusicStyleTrack, 0xFFFFFFFF,
93 DMUS_SEG_ANYTRACK, &track);
94 if (FAILED(hr))
95 return E_INVALIDARG;
96 else
97 IDirectMusicTrack_Release(track); /* Temp to not leak memory */
98 }
99 if (!chordmap) {
100 hr = IDirectMusicSegment_GetTrack(template, &CLSID_DirectMusicChordMapTrack, 0xFFFFFFFF,
101 DMUS_SEG_ANYTRACK, &track);
102 if (FAILED(hr))
103 return E_INVALIDARG;
104 else
105 IDirectMusicTrack_Release(track); /* Temp to not leak memory */
106 }
107
108 return IDirectMusicSegment_Clone(template, -1, 0, segment);
109}
110
112 IDirectMusicStyle *pStyle, WORD wNumMeasures, WORD wShape, WORD wActivity, BOOL fIntro,
113 BOOL fEnd, IDirectMusicChordMap *pChordMap, IDirectMusicSegment **ppSegment)
114{
116 FIXME("(%p, %p, %d, %d, %d, %d, %d, %p, %p): stub\n", This, pStyle, wNumMeasures, wShape, wActivity, fIntro, fEnd, pChordMap, ppSegment);
117 return S_OK;
118}
119
121 IDirectMusicSegment *pFromSeg, IDirectMusicSegment *pToSeg, MUSIC_TIME mtTime,
122 WORD wCommand, DWORD dwFlags, IDirectMusicChordMap *pChordMap,
123 IDirectMusicSegment **ppTransSeg)
124{
126 FIXME("(%p, %p, %p, %ld, %d, %ld, %p, %p): stub\n", This, pFromSeg, pToSeg, mtTime, wCommand, dwFlags, pChordMap, ppTransSeg);
127 return S_OK;
128}
129
130static 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)
134{
136 FIXME("(%p, %p, %d, %ld, %p, %p, %p, %p): stub\n", This, pPerformance, wCommand, dwFlags, pChordMap, ppTransSeg, ppToSegState, ppTransSegState);
137 return S_OK;
138}
139
141 WORD wNumMeasures, WORD wShape, BOOL fIntro, BOOL fEnd, WORD wEndLength,
142 IDirectMusicSegment **ppTemplate)
143{
145 FIXME("(%p, %d, %d, %d, %d, %d, %p): stub\n", This, wNumMeasures, wShape, fIntro, fEnd, wEndLength, ppTemplate);
146 return S_OK;
147}
148
149static HRESULT WINAPI IDirectMusicComposerImpl_ChangeChordMap(IDirectMusicComposer *iface,
150 IDirectMusicSegment *pSegment, BOOL fTrackScale, IDirectMusicChordMap *pChordMap)
151{
153 FIXME("(%p, %p, %d, %p): stub\n", This, pSegment, fTrackScale, pChordMap);
154 return S_OK;
155}
156
157static const IDirectMusicComposerVtbl dmcomposer_vtbl = {
167};
168
169/* for ClassFactory */
171{
173 HRESULT hr;
174
175 *ret_iface = NULL;
176 if (!(obj = calloc(1, sizeof(*obj)))) return E_OUTOFMEMORY;
177 obj->IDirectMusicComposer_iface.lpVtbl = &dmcomposer_vtbl;
178 obj->ref = 1;
179
180 hr = IDirectMusicComposer_QueryInterface(&obj->IDirectMusicComposer_iface, riid, ret_iface);
181 IDirectMusicComposer_Release(&obj->IDirectMusicComposer_iface);
182
183 return hr;
184}
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
const GUID IID_IUnknown
static const IDirectMusicComposerVtbl dmcomposer_vtbl
Definition: composer.c:157
HRESULT create_dmcomposer(REFIID riid, void **ret_iface)
Definition: composer.c:170
static HRESULT WINAPI IDirectMusicComposerImpl_ComposeTemplateFromShape(IDirectMusicComposer *iface, WORD wNumMeasures, WORD wShape, BOOL fIntro, BOOL fEnd, WORD wEndLength, IDirectMusicSegment **ppTemplate)
Definition: composer.c:140
static IDirectMusicComposerImpl * impl_from_IDirectMusicComposer(IDirectMusicComposer *iface)
Definition: composer.c:30
static HRESULT WINAPI IDirectMusicComposerImpl_ChangeChordMap(IDirectMusicComposer *iface, IDirectMusicSegment *pSegment, BOOL fTrackScale, IDirectMusicChordMap *pChordMap)
Definition: composer.c:149
static HRESULT WINAPI IDirectMusicComposerImpl_QueryInterface(IDirectMusicComposer *iface, REFIID riid, void **ret_iface)
Definition: composer.c:35
static ULONG WINAPI IDirectMusicComposerImpl_AddRef(IDirectMusicComposer *iface)
Definition: composer.c:53
static HRESULT WINAPI IDirectMusicComposerImpl_ComposeSegmentFromTemplate(IDirectMusicComposer *iface, IDirectMusicStyle *style, IDirectMusicSegment *template, WORD activity, IDirectMusicChordMap *chordmap, IDirectMusicSegment **segment)
Definition: composer.c:76
static HRESULT WINAPI IDirectMusicComposerImpl_ComposeTransition(IDirectMusicComposer *iface, IDirectMusicSegment *pFromSeg, IDirectMusicSegment *pToSeg, MUSIC_TIME mtTime, WORD wCommand, DWORD dwFlags, IDirectMusicChordMap *pChordMap, IDirectMusicSegment **ppTransSeg)
Definition: composer.c:120
static ULONG WINAPI IDirectMusicComposerImpl_Release(IDirectMusicComposer *iface)
Definition: composer.c:63
static HRESULT WINAPI IDirectMusicComposerImpl_AutoTransition(IDirectMusicComposer *iface, IDirectMusicPerformance *pPerformance, IDirectMusicSegment *pToSeg, WORD wCommand, DWORD dwFlags, IDirectMusicChordMap *pChordMap, IDirectMusicSegment **ppTransSeg, IDirectMusicSegmentState **ppToSegState, IDirectMusicSegmentState **ppTransSegState)
Definition: composer.c:130
static HRESULT WINAPI IDirectMusicComposerImpl_ComposeSegmentFromShape(IDirectMusicComposer *iface, IDirectMusicStyle *pStyle, WORD wNumMeasures, WORD wShape, WORD wActivity, BOOL fIntro, BOOL fEnd, IDirectMusicChordMap *pChordMap, IDirectMusicSegment **ppSegment)
Definition: composer.c:111
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define free
Definition: debug_ros.c:5
HRESULT hr
Definition: delayimp.cpp:582
#define NULL
Definition: types.h:112
const char * debugstr_dmguid(const GUID *id)
Definition: dmobject.c:36
#define IDirectMusicTrack_Release(p)
Definition: dmplugin.h:226
LONG MUSIC_TIME
Definition: dmplugin.h:95
#define IDirectMusicComposer_QueryInterface(p, a, b)
Definition: dmusici.h:1622
#define DMUS_SEG_ANYTRACK
Definition: dmusici.h:318
#define IDirectMusicSegment_Clone(p, a, b, c)
Definition: dmusici.h:1027
#define IDirectMusicSegment_GetTrack(p, a, b, c, d)
Definition: dmusici.h:1016
#define IDirectMusicComposer_Release(p)
Definition: dmusici.h:1624
#define IDirectMusicComposer_AddRef(p)
Definition: dmusici.h:1623
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
long LONG
Definition: pedump.c:60
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
#define calloc
Definition: rosglue.h:14
#define TRACE(s)
Definition: solgame.cpp:4
IDirectMusicComposer IDirectMusicComposer_iface
Definition: composer.c:26
Definition: send.c:48
Definition: style.c:91
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:3479
#define E_POINTER
Definition: winerror.h:3480