Don't depend on the name of the main binary, always load
[wine] / dlls / dmcompos / composer.c
1 /* IDirectMusicComposer
2  *
3  * Copyright (C) 2003-2004 Rok Mandeljc
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (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
13  * GNU Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 #include "dmcompos_private.h"
21
22 WINE_DEFAULT_DEBUG_CHANNEL(dmcompos);
23
24 /* IDirectMusicComposerImpl IUnknown part: */
25 HRESULT WINAPI IDirectMusicComposerImpl_QueryInterface (LPDIRECTMUSICCOMPOSER iface, REFIID riid, LPVOID *ppobj) {
26         ICOM_THIS(IDirectMusicComposerImpl,iface);
27
28         if (IsEqualIID (riid, &IID_IUnknown) || 
29             IsEqualIID (riid, &IID_IDirectMusicComposer)) {
30                 IDirectMusicComposerImpl_AddRef(iface);
31                 *ppobj = This;
32                 return S_OK;
33         }
34         WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
35         return E_NOINTERFACE;
36 }
37
38 ULONG WINAPI IDirectMusicComposerImpl_AddRef (LPDIRECTMUSICCOMPOSER iface) {
39         ICOM_THIS(IDirectMusicComposerImpl,iface);
40         TRACE("(%p) : AddRef from %ld\n", This, This->ref);
41         return ++(This->ref);
42 }
43
44 ULONG WINAPI IDirectMusicComposerImpl_Release (LPDIRECTMUSICCOMPOSER iface) {
45         ICOM_THIS(IDirectMusicComposerImpl,iface);
46         ULONG ref = --This->ref;
47         TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
48         if (ref == 0) {
49                 HeapFree(GetProcessHeap(), 0, This);
50         }
51         return ref;
52 }
53
54 /* IDirectMusicComposerImpl IDirectMusicComposer part: */
55 HRESULT WINAPI IDirectMusicComposerImpl_ComposeSegmentFromTemplate (LPDIRECTMUSICCOMPOSER iface, IDirectMusicStyle* pStyle, IDirectMusicSegment* pTemplate, WORD wActivity, IDirectMusicChordMap* pChordMap, IDirectMusicSegment** ppSegment) {
56         ICOM_THIS(IDirectMusicComposerImpl,iface);
57         FIXME("(%p, %p, %p, %d, %p, %p): stub\n", This, pStyle, pTemplate, wActivity, pChordMap, ppSegment);
58         return S_OK;
59 }
60
61 HRESULT WINAPI IDirectMusicComposerImpl_ComposeSegmentFromShape (LPDIRECTMUSICCOMPOSER iface, IDirectMusicStyle* pStyle, WORD wNumMeasures, WORD wShape, WORD wActivity, BOOL fIntro, BOOL fEnd, IDirectMusicChordMap* pChordMap, IDirectMusicSegment** ppSegment) {
62         ICOM_THIS(IDirectMusicComposerImpl,iface);
63         FIXME("(%p, %p, %d, %d, %d, %d, %d, %p, %p): stub\n", This, pStyle, wNumMeasures, wShape, wActivity, fIntro, fEnd, pChordMap, ppSegment);
64         return S_OK;
65 }
66
67 HRESULT WINAPI IDirectMusicComposerImpl_ComposeTransition (LPDIRECTMUSICCOMPOSER iface, IDirectMusicSegment* pFromSeg, IDirectMusicSegment* pToSeg, MUSIC_TIME mtTime, WORD wCommand, DWORD dwFlags, IDirectMusicChordMap* pChordMap, IDirectMusicSegment** ppTransSeg) {
68         ICOM_THIS(IDirectMusicComposerImpl,iface);
69         FIXME("(%p, %p, %p, %ld, %d, %ld, %p, %p): stub\n", This, pFromSeg, pToSeg, mtTime, wCommand, dwFlags, pChordMap, ppTransSeg);
70         return S_OK;
71 }
72
73 HRESULT WINAPI IDirectMusicComposerImpl_AutoTransition (LPDIRECTMUSICCOMPOSER iface, IDirectMusicPerformance* pPerformance, IDirectMusicSegment* pToSeg, WORD wCommand, DWORD dwFlags, IDirectMusicChordMap* pChordMap, IDirectMusicSegment** ppTransSeg, IDirectMusicSegmentState** ppToSegState, IDirectMusicSegmentState** ppTransSegState) {
74         ICOM_THIS(IDirectMusicComposerImpl,iface);
75         FIXME("(%p, %p, %d, %ld, %p, %p, %p, %p): stub\n", This, pPerformance, wCommand, dwFlags, pChordMap, ppTransSeg, ppToSegState, ppTransSegState);
76         return S_OK;
77 }
78
79 HRESULT WINAPI IDirectMusicComposerImpl_ComposeTemplateFromShape (LPDIRECTMUSICCOMPOSER iface, WORD wNumMeasures, WORD wShape, BOOL fIntro, BOOL fEnd, WORD wEndLength, IDirectMusicSegment** ppTemplate) {
80         ICOM_THIS(IDirectMusicComposerImpl,iface);
81         FIXME("(%p, %d, %d, %d, %d, %d, %p): stub\n", This, wNumMeasures, wShape, fIntro, fEnd, wEndLength, ppTemplate);
82         return S_OK;
83 }
84
85 HRESULT WINAPI IDirectMusicComposerImpl_ChangeChordMap (LPDIRECTMUSICCOMPOSER iface, IDirectMusicSegment* pSegment, BOOL fTrackScale, IDirectMusicChordMap* pChordMap) {
86         ICOM_THIS(IDirectMusicComposerImpl,iface);
87         FIXME("(%p, %p, %d, %p): stub\n", This, pSegment, fTrackScale, pChordMap);
88         return S_OK;
89 }
90
91 ICOM_VTABLE(IDirectMusicComposer) DirectMusicComposer_Vtbl = {
92     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
93         IDirectMusicComposerImpl_QueryInterface,
94         IDirectMusicComposerImpl_AddRef,
95         IDirectMusicComposerImpl_Release,
96         IDirectMusicComposerImpl_ComposeSegmentFromTemplate,
97         IDirectMusicComposerImpl_ComposeSegmentFromShape,
98         IDirectMusicComposerImpl_ComposeTransition,
99         IDirectMusicComposerImpl_AutoTransition,
100         IDirectMusicComposerImpl_ComposeTemplateFromShape,
101         IDirectMusicComposerImpl_ChangeChordMap
102 };
103
104 /* for ClassFactory */
105 HRESULT WINAPI DMUSIC_CreateDirectMusicComposerImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
106         IDirectMusicComposerImpl* obj;
107         
108         obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicComposerImpl));
109         if (NULL == obj) {
110                 *ppobj = (LPDIRECTMUSICCOMPOSER) NULL;
111                 return E_OUTOFMEMORY;
112         }
113         obj->lpVtbl = &DirectMusicComposer_Vtbl;
114         obj->ref = 0; /* will be inited by QueryInterface */
115         
116         return IDirectMusicComposerImpl_QueryInterface ((LPDIRECTMUSICCOMPOSER)obj, lpcGUID, ppobj);    
117 }