Split the dmusic interfaces.
[wine] / dlls / dmcompos / composer.c
1 /* IDirectMusicComposer
2  *
3  * Copyright (C) 2003 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 "windef.h"
21 #include "winbase.h"
22 #include "winuser.h"
23 #include "wingdi.h"
24 #include "wine/debug.h"
25
26 #include "dmcompos_private.h"
27
28 WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
29
30 /* IDirectMusicComposer IUnknown parts follow: */
31 HRESULT WINAPI IDirectMusicComposerImpl_QueryInterface (LPDIRECTMUSICCOMPOSER iface, REFIID riid, LPVOID *ppobj)
32 {
33         ICOM_THIS(IDirectMusicComposerImpl,iface);
34
35         if (IsEqualGUID(riid, &IID_IUnknown) || 
36             IsEqualGUID(riid, &IID_IDirectMusicComposer))
37         {
38                 IDirectMusicComposerImpl_AddRef(iface);
39                 *ppobj = This;
40                 return S_OK;
41         }
42         WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
43         return E_NOINTERFACE;
44 }
45
46 ULONG WINAPI IDirectMusicComposerImpl_AddRef (LPDIRECTMUSICCOMPOSER iface)
47 {
48         ICOM_THIS(IDirectMusicComposerImpl,iface);
49         TRACE("(%p) : AddRef from %ld\n", This, This->ref);
50         return ++(This->ref);
51 }
52
53 ULONG WINAPI IDirectMusicComposerImpl_Release (LPDIRECTMUSICCOMPOSER iface)
54 {
55         ICOM_THIS(IDirectMusicComposerImpl,iface);
56         ULONG ref = --This->ref;
57         TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
58         if (ref == 0)
59         {
60                 HeapFree(GetProcessHeap(), 0, This);
61         }
62         return ref;
63 }
64
65 /* IDirectMusicComposer Interface follow: */
66 HRESULT WINAPI IDirectMusicComposerImpl_ComposeSegmentFromTemplate (LPDIRECTMUSICCOMPOSER iface, IDirectMusicStyle* pStyle, IDirectMusicSegment* pTemplate, WORD wActivity, IDirectMusicChordMap* pChordMap, IDirectMusicSegment** ppSegment)
67 {
68         ICOM_THIS(IDirectMusicComposerImpl,iface);
69
70         FIXME("(%p, %p, %p, %d, %p, %p): stub\n", This, pStyle, pTemplate, wActivity, pChordMap, ppSegment);
71
72         return S_OK;
73 }
74
75 HRESULT WINAPI IDirectMusicComposerImpl_ComposeSegmentFromShape (LPDIRECTMUSICCOMPOSER iface, IDirectMusicStyle* pStyle, WORD wNumMeasures, WORD wShape, WORD wActivity, BOOL fIntro, BOOL fEnd, IDirectMusicChordMap* pChordMap, IDirectMusicSegment** ppSegment)
76 {
77         ICOM_THIS(IDirectMusicComposerImpl,iface);
78
79         FIXME("(%p, %p, %d, %d, %d, %d, %d, %p, %p): stub\n", This, pStyle, wNumMeasures, wShape, wActivity, fIntro, fEnd, pChordMap, ppSegment);
80
81         return S_OK;
82 }
83
84 HRESULT WINAPI IDirectMusicComposerImpl_ComposeTransition (LPDIRECTMUSICCOMPOSER iface, IDirectMusicSegment* pFromSeg, IDirectMusicSegment* pToSeg, MUSIC_TIME mtTime, WORD wCommand, DWORD dwFlags, IDirectMusicChordMap* pChordMap, IDirectMusicSegment** ppTransSeg)
85 {
86         ICOM_THIS(IDirectMusicComposerImpl,iface);
87
88         FIXME("(%p, %p, %p, %ld, %d, %ld, %p, %p): stub\n", This, pFromSeg, pToSeg, mtTime, wCommand, dwFlags, pChordMap, ppTransSeg);
89
90         return S_OK;
91 }
92
93 HRESULT WINAPI IDirectMusicComposerImpl_AutoTransition (LPDIRECTMUSICCOMPOSER iface, IDirectMusicPerformance* pPerformance, IDirectMusicSegment* pToSeg, WORD wCommand, DWORD dwFlags, IDirectMusicChordMap* pChordMap, IDirectMusicSegment** ppTransSeg, IDirectMusicSegmentState** ppToSegState, IDirectMusicSegmentState** ppTransSegState)
94 {
95         ICOM_THIS(IDirectMusicComposerImpl,iface);
96
97         FIXME("(%p, %p, %d, %ld, %p, %p, %p, %p): stub\n", This, pPerformance, wCommand, dwFlags, pChordMap, ppTransSeg, ppToSegState, ppTransSegState);
98
99         return S_OK;
100 }
101
102 HRESULT WINAPI IDirectMusicComposerImpl_ComposeTemplateFromShape (LPDIRECTMUSICCOMPOSER iface, WORD wNumMeasures, WORD wShape, BOOL fIntro, BOOL fEnd, WORD wEndLength, IDirectMusicSegment** ppTemplate)
103 {
104         ICOM_THIS(IDirectMusicComposerImpl,iface);
105
106         FIXME("(%p, %d, %d, %d, %d, %d, %p): stub\n", This, wNumMeasures, wShape, fIntro, fEnd, wEndLength, ppTemplate);
107
108         return S_OK;
109 }
110
111 HRESULT WINAPI IDirectMusicComposerImpl_ChangeChordMap (LPDIRECTMUSICCOMPOSER iface, IDirectMusicSegment* pSegment, BOOL fTrackScale, IDirectMusicChordMap* pChordMap)
112 {
113         ICOM_THIS(IDirectMusicComposerImpl,iface);
114
115         FIXME("(%p, %p, %d, %p): stub\n", This, pSegment, fTrackScale, pChordMap);
116
117         return S_OK;
118 }
119
120 ICOM_VTABLE(IDirectMusicComposer) DirectMusicComposer_Vtbl =
121 {
122     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
123         IDirectMusicComposerImpl_QueryInterface,
124         IDirectMusicComposerImpl_AddRef,
125         IDirectMusicComposerImpl_Release,
126         IDirectMusicComposerImpl_ComposeSegmentFromTemplate,
127         IDirectMusicComposerImpl_ComposeSegmentFromShape,
128         IDirectMusicComposerImpl_ComposeTransition,
129         IDirectMusicComposerImpl_AutoTransition,
130         IDirectMusicComposerImpl_ComposeTemplateFromShape,
131         IDirectMusicComposerImpl_ChangeChordMap
132 };
133
134 /* for ClassFactory */
135 HRESULT WINAPI DMUSIC_CreateDirectMusicComposer (LPCGUID lpcGUID, LPDIRECTMUSICCOMPOSER* ppDMCP, LPUNKNOWN pUnkOuter)
136 {
137         IDirectMusicComposerImpl* dmcompos;
138         
139         if (IsEqualGUID (lpcGUID, &IID_IDirectMusicComposer))
140         {
141                 dmcompos = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicComposerImpl));
142                 if (NULL == dmcompos) {
143                         *ppDMCP = (LPDIRECTMUSICCOMPOSER) NULL;
144                         return E_OUTOFMEMORY;
145                 }
146                 dmcompos->lpVtbl = &DirectMusicComposer_Vtbl;
147                 dmcompos->ref = 1;
148                 *ppDMCP = (LPDIRECTMUSICCOMPOSER) dmcompos;
149                 return S_OK;
150         }
151         WARN("No interface found\n");
152         
153         return E_NOINTERFACE;   
154 }