- fix multiple consecutive downloads (by flushing when needed the
[wine/multimedia.git] / dlls / dmusic / dmusic_instrument.c
blob65594005e879dc245c36c387d870fb4e01cbc3a7
1 /* IDirectMusicInstrument Implementation
2 * IDirectMusicDownloadedInstrument Implementation
3 * IDirectMusicCollection Implementation
5 * Copyright (C) 2003 Rok Mandeljc
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Library General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #include "windef.h"
23 #include "winbase.h"
24 #include "winuser.h"
25 #include "wingdi.h"
26 #include "wine/debug.h"
28 #include "dmusic_private.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
32 /* IDirectMusicInstrument IUnknown parts follow: */
33 HRESULT WINAPI IDirectMusicInstrumentImpl_QueryInterface (LPDIRECTMUSICINSTRUMENT iface, REFIID riid, LPVOID *ppobj)
35 ICOM_THIS(IDirectMusicInstrumentImpl,iface);
37 if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectMusicInstrument))
39 IDirectMusicInstrumentImpl_AddRef(iface);
40 *ppobj = This;
41 return S_OK;
43 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
44 return E_NOINTERFACE;
47 ULONG WINAPI IDirectMusicInstrumentImpl_AddRef (LPDIRECTMUSICINSTRUMENT iface)
49 ICOM_THIS(IDirectMusicInstrumentImpl,iface);
50 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
51 return ++(This->ref);
54 ULONG WINAPI IDirectMusicInstrumentImpl_Release (LPDIRECTMUSICINSTRUMENT iface)
56 ICOM_THIS(IDirectMusicInstrumentImpl,iface);
57 ULONG ref = --This->ref;
58 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
59 if (ref == 0)
61 HeapFree(GetProcessHeap(), 0, This);
63 return ref;
66 /* IDirectMusicInstrument Interface follow: */
67 HRESULT WINAPI IDirectMusicInstrumentImpl_GetPatch (LPDIRECTMUSICINSTRUMENT iface, DWORD* pdwPatch)
69 ICOM_THIS(IDirectMusicInstrumentImpl,iface);
71 TRACE("(%p, %p)\n", This, pdwPatch);
72 *pdwPatch = This->patch;
74 return S_OK;
77 HRESULT WINAPI IDirectMusicInstrumentImpl_SetPatch (LPDIRECTMUSICINSTRUMENT iface, DWORD dwPatch)
79 ICOM_THIS(IDirectMusicInstrumentImpl,iface);
81 TRACE("(%p, %ld)\n", This, dwPatch);
82 This->patch = dwPatch;
84 return S_OK;
87 ICOM_VTABLE(IDirectMusicInstrument) DirectMusicInstrument_Vtbl =
89 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
90 IDirectMusicInstrumentImpl_QueryInterface,
91 IDirectMusicInstrumentImpl_AddRef,
92 IDirectMusicInstrumentImpl_Release,
93 IDirectMusicInstrumentImpl_GetPatch,
94 IDirectMusicInstrumentImpl_SetPatch
98 /* IDirectMusicDownloadedInstrument IUnknown parts follow: */
99 HRESULT WINAPI IDirectMusicDownloadedInstrumentImpl_QueryInterface (LPDIRECTMUSICDOWNLOADEDINSTRUMENT iface, REFIID riid, LPVOID *ppobj)
101 ICOM_THIS(IDirectMusicDownloadedInstrumentImpl,iface);
103 if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectMusicDownloadedInstrument))
105 IDirectMusicDownloadedInstrumentImpl_AddRef(iface);
106 *ppobj = This;
107 return S_OK;
109 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
110 return E_NOINTERFACE;
113 ULONG WINAPI IDirectMusicDownloadedInstrumentImpl_AddRef (LPDIRECTMUSICDOWNLOADEDINSTRUMENT iface)
115 ICOM_THIS(IDirectMusicDownloadedInstrumentImpl,iface);
116 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
117 return ++(This->ref);
120 ULONG WINAPI IDirectMusicDownloadedInstrumentImpl_Release (LPDIRECTMUSICDOWNLOADEDINSTRUMENT iface)
122 ICOM_THIS(IDirectMusicDownloadedInstrumentImpl,iface);
123 ULONG ref = --This->ref;
124 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
125 if (ref == 0)
127 HeapFree(GetProcessHeap(), 0, This);
129 return ref;
132 /* IDirectMusicDownloadedInstrument Interface follow: */
133 /* none at this time */
135 ICOM_VTABLE(IDirectMusicDownloadedInstrument) DirectMusicDownloadedInstrument_Vtbl =
137 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
138 IDirectMusicDownloadedInstrumentImpl_QueryInterface,
139 IDirectMusicDownloadedInstrumentImpl_AddRef,
140 IDirectMusicDownloadedInstrumentImpl_Release
144 /* IDirectMusicCollection IUnknown parts follow: */
145 HRESULT WINAPI IDirectMusicCollectionImpl_QueryInterface (LPDIRECTMUSICCOLLECTION iface, REFIID riid, LPVOID *ppobj)
147 ICOM_THIS(IDirectMusicCollectionImpl,iface);
149 if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectMusicCollection))
151 IDirectMusicCollectionImpl_AddRef(iface);
152 *ppobj = This;
153 return S_OK;
155 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
156 return E_NOINTERFACE;
159 ULONG WINAPI IDirectMusicCollectionImpl_AddRef (LPDIRECTMUSICCOLLECTION iface)
161 ICOM_THIS(IDirectMusicCollectionImpl,iface);
162 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
163 return ++(This->ref);
166 ULONG WINAPI IDirectMusicCollectionImpl_Release (LPDIRECTMUSICCOLLECTION iface)
168 ICOM_THIS(IDirectMusicCollectionImpl,iface);
169 ULONG ref = --This->ref;
170 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
171 if (ref == 0)
173 HeapFree(GetProcessHeap(), 0, This);
175 return ref;
178 /* IDirectMusicCollection Interface follow: */
179 HRESULT WINAPI IDirectMusicCollectionImpl_GetInstrument (LPDIRECTMUSICCOLLECTION iface, DWORD dwPatch, IDirectMusicInstrument** ppInstrument)
181 ICOM_THIS(IDirectMusicCollectionImpl,iface);
183 FIXME("(%p, %ld, %p): stub\n", This, dwPatch, ppInstrument);
185 return S_OK;
188 HRESULT WINAPI IDirectMusicCollectionImpl_EnumInstrument (LPDIRECTMUSICCOLLECTION iface, DWORD dwIndex, DWORD* pdwPatch, LPWSTR pwszName, DWORD dwNameLen)
190 ICOM_THIS(IDirectMusicCollectionImpl,iface);
192 FIXME("(%p, %ld, %p, %p, %ld): stub\n", This, dwIndex, pdwPatch, pwszName, dwNameLen);
194 return S_OK;
197 ICOM_VTABLE(IDirectMusicCollection) DirectMusicCollection_Vtbl =
199 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
200 IDirectMusicCollectionImpl_QueryInterface,
201 IDirectMusicCollectionImpl_AddRef,
202 IDirectMusicCollectionImpl_Release,
203 IDirectMusicCollectionImpl_GetInstrument,
204 IDirectMusicCollectionImpl_EnumInstrument