d3d9: Win7+Nvidia returns c2 in COISSUE'd CND.
[wine.git] / dlls / dmusic / port.c
blob021f1e2530a51b1b1a8a67daf2f420f5b01f8d6a
1 /* IDirectMusicPort Implementation
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 "dmusic_private.h"
22 WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
24 /* IDirectMusicPortImpl IUnknown part: */
25 static HRESULT WINAPI IDirectMusicPortImpl_QueryInterface (LPDIRECTMUSICPORT iface, REFIID riid, LPVOID *ppobj) {
26 ICOM_THIS_MULTI(IDirectMusicPortImpl, lpVtbl, iface);
28 TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
30 if (IsEqualIID (riid, &IID_IUnknown) ||
31 IsEqualGUID(riid, &IID_IDirectMusicPort) ||
32 IsEqualGUID(riid, &IID_IDirectMusicPort8)) {
33 *ppobj = &This->lpVtbl;
34 IDirectMusicPort_AddRef((LPDIRECTMUSICPORT)*ppobj);
35 return S_OK;
36 } else if (IsEqualGUID(riid, &IID_IDirectMusicPortDownload) ||
37 IsEqualGUID(riid, &IID_IDirectMusicPortDownload8)) {
38 *ppobj = &This->lpDownloadVtbl;
39 IDirectMusicPortDownload_AddRef((LPDIRECTMUSICPORTDOWNLOAD)*ppobj);
40 return S_OK;
41 } else if (IsEqualGUID(riid, &IID_IDirectMusicThru) ||
42 IsEqualGUID(riid, &IID_IDirectMusicThru8)) {
43 *ppobj = &This->lpThruVtbl;
44 IDirectMusicThru_AddRef((LPDIRECTMUSICTHRU)*ppobj);
45 return S_OK;
47 WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
48 return E_NOINTERFACE;
51 static ULONG WINAPI IDirectMusicPortImpl_AddRef (LPDIRECTMUSICPORT iface) {
52 IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
53 ULONG refCount = InterlockedIncrement(&This->ref);
55 TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
57 DMUSIC_LockModule();
59 return refCount;
62 static ULONG WINAPI IDirectMusicPortImpl_Release (LPDIRECTMUSICPORT iface) {
63 IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
64 ULONG refCount = InterlockedDecrement(&This->ref);
66 TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
68 if (!refCount) {
69 HeapFree(GetProcessHeap(), 0, This);
72 DMUSIC_UnlockModule();
74 return refCount;
77 /* IDirectMusicPortImpl IDirectMusicPort part: */
78 static HRESULT WINAPI IDirectMusicPortImpl_PlayBuffer (LPDIRECTMUSICPORT iface, LPDIRECTMUSICBUFFER pBuffer) {
79 IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
80 FIXME("(%p, %p): stub\n", This, pBuffer);
81 return S_OK;
84 static HRESULT WINAPI IDirectMusicPortImpl_SetReadNotificationHandle (LPDIRECTMUSICPORT iface, HANDLE hEvent) {
85 IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
86 FIXME("(%p, %p): stub\n", This, hEvent);
87 return S_OK;
90 static HRESULT WINAPI IDirectMusicPortImpl_Read (LPDIRECTMUSICPORT iface, LPDIRECTMUSICBUFFER pBuffer) {
91 IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
92 FIXME("(%p, %p): stub\n", This, pBuffer);
93 return S_OK;
96 static HRESULT WINAPI IDirectMusicPortImpl_DownloadInstrument (LPDIRECTMUSICPORT iface, IDirectMusicInstrument* pInstrument, IDirectMusicDownloadedInstrument** ppDownloadedInstrument, DMUS_NOTERANGE* pNoteRanges, DWORD dwNumNoteRanges) {
97 IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
99 FIXME("(%p, %p, %p, %p, %d): stub\n", This, pInstrument, ppDownloadedInstrument, pNoteRanges, dwNumNoteRanges);
101 if (!pInstrument || !ppDownloadedInstrument || (dwNumNoteRanges && !pNoteRanges))
102 return E_POINTER;
104 return DMUSIC_CreateDirectMusicDownloadedInstrumentImpl(&IID_IDirectMusicDownloadedInstrument, (LPVOID*)ppDownloadedInstrument, NULL);
107 static HRESULT WINAPI IDirectMusicPortImpl_UnloadInstrument (LPDIRECTMUSICPORT iface, IDirectMusicDownloadedInstrument *pDownloadedInstrument) {
108 IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
109 FIXME("(%p, %p): stub\n", This, pDownloadedInstrument);
110 return S_OK;
113 static HRESULT WINAPI IDirectMusicPortImpl_GetLatencyClock (LPDIRECTMUSICPORT iface, IReferenceClock** ppClock) {
114 IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
115 TRACE("(%p, %p)\n", This, ppClock);
116 *ppClock = This->pLatencyClock;
117 IReferenceClock_AddRef (*ppClock);
118 return S_OK;
121 static HRESULT WINAPI IDirectMusicPortImpl_GetRunningStats (LPDIRECTMUSICPORT iface, LPDMUS_SYNTHSTATS pStats) {
122 IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
123 FIXME("(%p, %p): stub\n", This, pStats);
124 return S_OK;
127 static HRESULT WINAPI IDirectMusicPortImpl_Compact (LPDIRECTMUSICPORT iface) {
128 IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
129 FIXME("(%p): stub\n", This);
130 return S_OK;
133 static HRESULT WINAPI IDirectMusicPortImpl_GetCaps (LPDIRECTMUSICPORT iface, LPDMUS_PORTCAPS pPortCaps) {
134 IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
135 TRACE("(%p, %p)\n", This, pPortCaps);
136 *pPortCaps = This->caps;
137 return S_OK;
140 static HRESULT WINAPI IDirectMusicPortImpl_DeviceIoControl (LPDIRECTMUSICPORT iface, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped) {
141 IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
142 FIXME("(%p, %d, %p, %d, %p, %d, %p, %p): stub\n", This, dwIoControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned, lpOverlapped);
143 return S_OK;
146 static HRESULT WINAPI IDirectMusicPortImpl_SetNumChannelGroups (LPDIRECTMUSICPORT iface, DWORD dwChannelGroups) {
147 IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
148 FIXME("(%p, %d): semi-stub\n", This, dwChannelGroups);
149 This->nrofgroups = dwChannelGroups;
150 return S_OK;
153 static HRESULT WINAPI IDirectMusicPortImpl_GetNumChannelGroups (LPDIRECTMUSICPORT iface, LPDWORD pdwChannelGroups) {
154 IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
155 TRACE("(%p, %p)\n", This, pdwChannelGroups);
156 *pdwChannelGroups = This->nrofgroups;
157 return S_OK;
160 HRESULT WINAPI IDirectMusicPortImpl_Activate (LPDIRECTMUSICPORT iface, BOOL fActive) {
161 IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
162 TRACE("(%p, %d)\n", This, fActive);
163 This->fActive = fActive;
164 return S_OK;
167 static HRESULT WINAPI IDirectMusicPortImpl_SetChannelPriority (LPDIRECTMUSICPORT iface, DWORD dwChannelGroup, DWORD dwChannel, DWORD dwPriority) {
168 IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
169 FIXME("(%p, %d, %d, %d): semi-stub\n", This, dwChannelGroup, dwChannel, dwPriority);
170 if (dwChannel > 16) {
171 WARN("isn't there supposed to be 16 channels (no. %d requested)?! (faking as it is ok)\n", dwChannel);
172 /*return E_INVALIDARG;*/
174 return S_OK;
177 static HRESULT WINAPI IDirectMusicPortImpl_GetChannelPriority (LPDIRECTMUSICPORT iface, DWORD dwChannelGroup, DWORD dwChannel, LPDWORD pdwPriority) {
178 IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
179 TRACE("(%p, %d, %d, %p)\n", This, dwChannelGroup, dwChannel, pdwPriority);
180 *pdwPriority = This->group[dwChannelGroup-1].channel[dwChannel].priority;
181 return S_OK;
184 static HRESULT WINAPI IDirectMusicPortImpl_SetDirectSound (LPDIRECTMUSICPORT iface, LPDIRECTSOUND pDirectSound, LPDIRECTSOUNDBUFFER pDirectSoundBuffer) {
185 IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
186 FIXME("(%p, %p, %p): stub\n", This, pDirectSound, pDirectSoundBuffer);
187 return S_OK;
190 static HRESULT WINAPI IDirectMusicPortImpl_GetFormat (LPDIRECTMUSICPORT iface, LPWAVEFORMATEX pWaveFormatEx, LPDWORD pdwWaveFormatExSize, LPDWORD pdwBufferSize) {
191 IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
192 WAVEFORMATEX format;
193 FIXME("(%p, %p, %p, %p): stub\n", This, pWaveFormatEx, pdwWaveFormatExSize, pdwBufferSize);
195 if (pWaveFormatEx == NULL)
197 if (pdwWaveFormatExSize)
198 *pdwWaveFormatExSize = sizeof(format);
199 else
200 return E_POINTER;
202 else
204 if (pdwWaveFormatExSize == NULL)
205 return E_POINTER;
207 /* Just fill this in with something that will not crash Direct Sound for now. */
208 /* It won't be used anyway until Performances are completed */
209 format.wFormatTag = WAVE_FORMAT_PCM;
210 format.nChannels = 2; /* This->params.dwAudioChannels; */
211 format.nSamplesPerSec = 44100; /* This->params.dwSampleRate; */
212 format.wBitsPerSample = 16; /* FIXME: check this */
213 format.nBlockAlign = (format.wBitsPerSample * format.nChannels) / 8;
214 format.nAvgBytesPerSec = format.nSamplesPerSec * format.nBlockAlign;
215 format.cbSize = 0;
217 if (*pdwWaveFormatExSize >= sizeof(format))
219 CopyMemory(pWaveFormatEx, &format, min(sizeof(format), *pdwWaveFormatExSize));
220 *pdwWaveFormatExSize = sizeof(format); /* FIXME check if this is set */
222 else
223 return E_POINTER; /* FIXME find right error */
226 if (pdwBufferSize)
227 *pdwBufferSize = 44100 * 2 * 2;
228 else
229 return E_POINTER;
231 return S_OK;
234 static const IDirectMusicPortVtbl DirectMusicPort_Vtbl = {
235 IDirectMusicPortImpl_QueryInterface,
236 IDirectMusicPortImpl_AddRef,
237 IDirectMusicPortImpl_Release,
238 IDirectMusicPortImpl_PlayBuffer,
239 IDirectMusicPortImpl_SetReadNotificationHandle,
240 IDirectMusicPortImpl_Read,
241 IDirectMusicPortImpl_DownloadInstrument,
242 IDirectMusicPortImpl_UnloadInstrument,
243 IDirectMusicPortImpl_GetLatencyClock,
244 IDirectMusicPortImpl_GetRunningStats,
245 IDirectMusicPortImpl_Compact,
246 IDirectMusicPortImpl_GetCaps,
247 IDirectMusicPortImpl_DeviceIoControl,
248 IDirectMusicPortImpl_SetNumChannelGroups,
249 IDirectMusicPortImpl_GetNumChannelGroups,
250 IDirectMusicPortImpl_Activate,
251 IDirectMusicPortImpl_SetChannelPriority,
252 IDirectMusicPortImpl_GetChannelPriority,
253 IDirectMusicPortImpl_SetDirectSound,
254 IDirectMusicPortImpl_GetFormat
257 /* IDirectMusicPortDownload IUnknown parts follow: */
258 static HRESULT WINAPI IDirectMusicPortDownloadImpl_QueryInterface (LPDIRECTMUSICPORTDOWNLOAD iface, REFIID riid, LPVOID *ppobj) {
259 ICOM_THIS_MULTI(IDirectMusicPortImpl, lpDownloadVtbl, iface);
260 TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_dmguid(riid), ppobj);
261 return IUnknown_QueryInterface((IUnknown *)&(This->lpVtbl), riid, ppobj);
264 static ULONG WINAPI IDirectMusicPortDownloadImpl_AddRef (LPDIRECTMUSICPORTDOWNLOAD iface) {
265 ICOM_THIS_MULTI(IDirectMusicPortImpl, lpDownloadVtbl, iface);
266 TRACE("(%p/%p)->()\n", This, iface);
267 return IUnknown_AddRef((IUnknown *)&(This->lpVtbl));
270 static ULONG WINAPI IDirectMusicPortDownloadImpl_Release (LPDIRECTMUSICPORTDOWNLOAD iface) {
271 ICOM_THIS_MULTI(IDirectMusicPortImpl, lpDownloadVtbl, iface);
272 TRACE("(%p/%p)->()\n", This, iface);
273 return IUnknown_Release((IUnknown *)&(This->lpVtbl));
276 /* IDirectMusicPortDownload Interface follow: */
277 static HRESULT WINAPI IDirectMusicPortDownloadImpl_GetBuffer (LPDIRECTMUSICPORTDOWNLOAD iface, DWORD dwDLId, IDirectMusicDownload** ppIDMDownload) {
278 ICOM_THIS_MULTI(IDirectMusicPortImpl, lpDownloadVtbl, iface);
280 FIXME("(%p/%p)->(%d, %p): stub\n", This, iface, dwDLId, ppIDMDownload);
282 if (!ppIDMDownload)
283 return E_POINTER;
285 return DMUSIC_CreateDirectMusicDownloadImpl(&IID_IDirectMusicDownload, (LPVOID*)ppIDMDownload, NULL);
288 static HRESULT WINAPI IDirectMusicPortDownloadImpl_AllocateBuffer (LPDIRECTMUSICPORTDOWNLOAD iface, DWORD dwSize, IDirectMusicDownload** ppIDMDownload) {
289 ICOM_THIS_MULTI(IDirectMusicPortImpl, lpDownloadVtbl, iface);
290 FIXME("(%p/%p)->(%d, %p): stub\n", This, iface, dwSize, ppIDMDownload);
291 return S_OK;
294 static HRESULT WINAPI IDirectMusicPortDownloadImpl_GetDLId (LPDIRECTMUSICPORTDOWNLOAD iface, DWORD* pdwStartDLId, DWORD dwCount) {
295 ICOM_THIS_MULTI(IDirectMusicPortImpl, lpDownloadVtbl, iface);
296 FIXME("(%p/%p)->(%p, %d): stub\n", This, iface, pdwStartDLId, dwCount);
297 return S_OK;
300 static HRESULT WINAPI IDirectMusicPortDownloadImpl_GetAppend (LPDIRECTMUSICPORTDOWNLOAD iface, DWORD* pdwAppend) {
301 IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
302 FIXME("(%p/%p)->(%p): stub\n", This, iface, pdwAppend);
303 return S_OK;
306 static HRESULT WINAPI IDirectMusicPortDownloadImpl_Download (LPDIRECTMUSICPORTDOWNLOAD iface, IDirectMusicDownload* pIDMDownload) {
307 IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
308 FIXME("(%p/%p)->(%p): stub\n", This, iface, pIDMDownload);
309 return S_OK;
312 static HRESULT WINAPI IDirectMusicPortDownloadImpl_Unload (LPDIRECTMUSICPORTDOWNLOAD iface, IDirectMusicDownload* pIDMDownload) {
313 IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
314 FIXME("(%p/%p)->(%p): stub\n", This, iface, pIDMDownload);
315 return S_OK;
318 static const IDirectMusicPortDownloadVtbl DirectMusicPortDownload_Vtbl = {
319 IDirectMusicPortDownloadImpl_QueryInterface,
320 IDirectMusicPortDownloadImpl_AddRef,
321 IDirectMusicPortDownloadImpl_Release,
322 IDirectMusicPortDownloadImpl_GetBuffer,
323 IDirectMusicPortDownloadImpl_AllocateBuffer,
324 IDirectMusicPortDownloadImpl_GetDLId,
325 IDirectMusicPortDownloadImpl_GetAppend,
326 IDirectMusicPortDownloadImpl_Download,
327 IDirectMusicPortDownloadImpl_Unload
330 /* IDirectMusicThru IUnknown parts follow: */
331 static HRESULT WINAPI IDirectMusicThruImpl_QueryInterface (LPDIRECTMUSICTHRU iface, REFIID riid, LPVOID *ppobj) {
332 ICOM_THIS_MULTI(IDirectMusicPortImpl, lpThruVtbl, iface);
333 TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_dmguid(riid), ppobj);
334 return IUnknown_QueryInterface((IUnknown *)&(This->lpVtbl), riid, ppobj);
337 static ULONG WINAPI IDirectMusicThruImpl_AddRef (LPDIRECTMUSICTHRU iface) {
338 ICOM_THIS_MULTI(IDirectMusicPortImpl, lpThruVtbl, iface);
339 TRACE("(%p/%p)->()\n", This, iface);
340 return IUnknown_AddRef((IUnknown *)&(This->lpVtbl));
343 static ULONG WINAPI IDirectMusicThruImpl_Release (LPDIRECTMUSICTHRU iface) {
344 ICOM_THIS_MULTI(IDirectMusicPortImpl, lpThruVtbl, iface);
345 TRACE("(%p/%p)->()\n", This, iface);
346 return IUnknown_Release((IUnknown *)&(This->lpVtbl));
349 /* IDirectMusicThru Interface follow: */
350 static HRESULT WINAPI IDirectMusicThruImpl_ThruChannel (LPDIRECTMUSICTHRU iface, DWORD dwSourceChannelGroup, DWORD dwSourceChannel, DWORD dwDestinationChannelGroup, DWORD dwDestinationChannel, LPDIRECTMUSICPORT pDestinationPort) {
351 ICOM_THIS_MULTI(IDirectMusicPortImpl, lpThruVtbl, iface);
352 FIXME("(%p/%p)->(%d, %d, %d, %d, %p): stub\n", This, iface, dwSourceChannelGroup, dwSourceChannel, dwDestinationChannelGroup, dwDestinationChannel, pDestinationPort);
353 return S_OK;
356 static const IDirectMusicThruVtbl DirectMusicThru_Vtbl = {
357 IDirectMusicThruImpl_QueryInterface,
358 IDirectMusicThruImpl_AddRef,
359 IDirectMusicThruImpl_Release,
360 IDirectMusicThruImpl_ThruChannel
363 HRESULT WINAPI DMUSIC_CreateDirectMusicPortImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter, LPDMUS_PORTPARAMS pPortParams, LPDMUS_PORTCAPS pPortCaps) {
364 IDirectMusicPortImpl *obj;
365 HRESULT hr = E_FAIL;
366 UINT j;
368 TRACE("(%p,%p,%p)\n", lpcGUID, ppobj, pUnkOuter);
370 obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicPortImpl));
371 if (NULL == obj) {
372 *ppobj = NULL;
373 return E_OUTOFMEMORY;
375 obj->lpVtbl = &DirectMusicPort_Vtbl;
376 obj->lpDownloadVtbl = &DirectMusicPortDownload_Vtbl;
377 obj->lpThruVtbl = &DirectMusicThru_Vtbl;
378 obj->ref = 0; /* will be inited by QueryInterface */
379 obj->fActive = FALSE;
380 obj->params = *pPortParams;
381 obj->caps = *pPortCaps;
382 obj->pDirectSound = NULL;
383 obj->pLatencyClock = NULL;
384 hr = DMUSIC_CreateReferenceClockImpl(&IID_IReferenceClock, (LPVOID*)&obj->pLatencyClock, NULL);
386 if(0)
388 if (pPortParams->dwValidParams & DMUS_PORTPARAMS_CHANNELGROUPS) {
389 obj->nrofgroups = pPortParams->dwChannelGroups;
390 /* setting default priorities */
391 for (j = 0; j < obj->nrofgroups; j++) {
392 TRACE ("Setting default channel priorities on channel group %i\n", j + 1);
393 obj->group[j].channel[0].priority = DAUD_CHAN1_DEF_VOICE_PRIORITY;
394 obj->group[j].channel[1].priority = DAUD_CHAN2_DEF_VOICE_PRIORITY;
395 obj->group[j].channel[2].priority = DAUD_CHAN3_DEF_VOICE_PRIORITY;
396 obj->group[j].channel[3].priority = DAUD_CHAN4_DEF_VOICE_PRIORITY;
397 obj->group[j].channel[4].priority = DAUD_CHAN5_DEF_VOICE_PRIORITY;
398 obj->group[j].channel[5].priority = DAUD_CHAN6_DEF_VOICE_PRIORITY;
399 obj->group[j].channel[6].priority = DAUD_CHAN7_DEF_VOICE_PRIORITY;
400 obj->group[j].channel[7].priority = DAUD_CHAN8_DEF_VOICE_PRIORITY;
401 obj->group[j].channel[8].priority = DAUD_CHAN9_DEF_VOICE_PRIORITY;
402 obj->group[j].channel[9].priority = DAUD_CHAN10_DEF_VOICE_PRIORITY;
403 obj->group[j].channel[10].priority = DAUD_CHAN11_DEF_VOICE_PRIORITY;
404 obj->group[j].channel[11].priority = DAUD_CHAN12_DEF_VOICE_PRIORITY;
405 obj->group[j].channel[12].priority = DAUD_CHAN13_DEF_VOICE_PRIORITY;
406 obj->group[j].channel[13].priority = DAUD_CHAN14_DEF_VOICE_PRIORITY;
407 obj->group[j].channel[14].priority = DAUD_CHAN15_DEF_VOICE_PRIORITY;
408 obj->group[j].channel[15].priority = DAUD_CHAN16_DEF_VOICE_PRIORITY;
413 return IDirectMusicPortImpl_QueryInterface ((LPDIRECTMUSICPORT)obj, lpcGUID, ppobj);