advapi32/tests: Test for enumeration order preservation of reg keys.
[wine] / dlls / dmusic / port.c
1 /* IDirectMusicPort Implementation
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 "dmusic_private.h"
21
22 WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
23
24 /* IDirectMusicPortImpl IUnknown part: */
25 static HRESULT WINAPI IDirectMusicPortImpl_QueryInterface (LPDIRECTMUSICPORT iface, REFIID riid, LPVOID *ppobj) {
26         ICOM_THIS_MULTI(IDirectMusicPortImpl, lpVtbl, iface);
27
28         TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
29
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;
46         }
47         WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
48         return E_NOINTERFACE;
49 }
50
51 static ULONG WINAPI IDirectMusicPortImpl_AddRef (LPDIRECTMUSICPORT iface) {
52         IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
53         ULONG refCount = InterlockedIncrement(&This->ref);
54
55         TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
56
57         DMUSIC_LockModule();
58
59         return refCount;
60 }
61
62 static ULONG WINAPI IDirectMusicPortImpl_Release (LPDIRECTMUSICPORT iface) {
63         IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
64         ULONG refCount = InterlockedDecrement(&This->ref);
65
66         TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
67
68         if (!refCount) {
69                 HeapFree(GetProcessHeap(), 0, This);
70         }
71
72         DMUSIC_UnlockModule();
73
74         return refCount;
75 }
76
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;
82 }
83
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;
88 }
89
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;
94 }
95
96 static HRESULT WINAPI IDirectMusicPortImpl_DownloadInstrument (LPDIRECTMUSICPORT iface, IDirectMusicInstrument* pInstrument, IDirectMusicDownloadedInstrument** ppDownloadedInstrument, DMUS_NOTERANGE* pNoteRanges, DWORD dwNumNoteRanges) {
97         IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
98
99         FIXME("(%p, %p, %p, %p, %d): stub\n", This, pInstrument, ppDownloadedInstrument, pNoteRanges, dwNumNoteRanges);
100
101         if (!pInstrument || !ppDownloadedInstrument || (dwNumNoteRanges && !pNoteRanges))
102                 return E_POINTER;
103
104         return DMUSIC_CreateDirectMusicDownloadedInstrumentImpl(&IID_IDirectMusicDownloadedInstrument, (LPVOID*)ppDownloadedInstrument, NULL);
105 }
106
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;
111 }
112
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;
119 }
120
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;
125 }
126
127 static HRESULT WINAPI IDirectMusicPortImpl_Compact (LPDIRECTMUSICPORT iface) {
128         IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
129         FIXME("(%p): stub\n", This);
130         return S_OK;
131 }
132
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;
138 }
139
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;
144 }
145
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;
151 }
152
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;
158 }
159
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;
165 }
166
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;*/
173         }       
174         return S_OK;
175 }
176
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;
182 }
183
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;
188 }
189
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);
194
195         if (pWaveFormatEx == NULL)
196         {
197                 if (pdwWaveFormatExSize)
198                         *pdwWaveFormatExSize = sizeof(format);
199                 else
200                         return E_POINTER;
201         }
202         else
203         {
204                 if (pdwWaveFormatExSize == NULL)
205                         return E_POINTER;
206
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;
216
217                 if (*pdwWaveFormatExSize >= sizeof(format))
218                 {
219                         CopyMemory(pWaveFormatEx, &format, min(sizeof(format), *pdwWaveFormatExSize));
220                         *pdwWaveFormatExSize = sizeof(format);  /* FIXME check if this is set */
221                 }
222                 else
223                         return E_POINTER;       /* FIXME find right error */
224         }
225
226         if (pdwBufferSize)
227                 *pdwBufferSize = 44100 * 2 * 2;
228         else
229                 return E_POINTER;
230
231         return S_OK;
232 }
233
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
255 };
256
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);
262 }
263
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));
268 }
269
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));
274 }
275
276 /* IDirectMusicPortDownload Interface follow: */
277 static HRESULT WINAPI IDirectMusicPortDownloadImpl_GetBuffer (LPDIRECTMUSICPORTDOWNLOAD iface, DWORD dwDLId, IDirectMusicDownload** ppIDMDownload) {
278         ICOM_THIS_MULTI(IDirectMusicPortImpl, lpDownloadVtbl, iface);
279
280         FIXME("(%p/%p)->(%d, %p): stub\n", This, iface, dwDLId, ppIDMDownload);
281
282         if (!ppIDMDownload)
283                 return E_POINTER;
284
285         return DMUSIC_CreateDirectMusicDownloadImpl(&IID_IDirectMusicDownload, (LPVOID*)ppIDMDownload, NULL);
286 }
287
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;
292 }
293
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;
298 }
299
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;
304 }
305
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;
310 }
311
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;
316 }
317
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
328 };
329
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);
335 }
336
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));
341 }
342
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));
347 }
348
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;
354 }
355
356 static const IDirectMusicThruVtbl DirectMusicThru_Vtbl = {
357         IDirectMusicThruImpl_QueryInterface,
358         IDirectMusicThruImpl_AddRef,
359         IDirectMusicThruImpl_Release,
360         IDirectMusicThruImpl_ThruChannel
361 };
362
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
367         TRACE("(%p,%p,%p)\n", lpcGUID, ppobj, pUnkOuter);
368
369         obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicPortImpl));
370         if (NULL == obj) {
371                 *ppobj = NULL;
372                 return E_OUTOFMEMORY;
373         }
374         obj->lpVtbl = &DirectMusicPort_Vtbl;
375         obj->lpDownloadVtbl = &DirectMusicPortDownload_Vtbl;
376         obj->lpThruVtbl = &DirectMusicThru_Vtbl;
377         obj->ref = 0;  /* will be inited by QueryInterface */
378         obj->fActive = FALSE;
379         obj->params = *pPortParams;
380         obj->caps = *pPortCaps;
381         obj->pDirectSound = NULL;
382         obj->pLatencyClock = NULL;
383         hr = DMUSIC_CreateReferenceClockImpl(&IID_IReferenceClock, (LPVOID*)&obj->pLatencyClock, NULL);
384
385 #if 0
386         if (pPortParams->dwValidParams & DMUS_PORTPARAMS_CHANNELGROUPS) {
387           obj->nrofgroups = pPortParams->dwChannelGroups;
388           /* setting default priorities */                      
389           for (j = 0; j < obj->nrofgroups; j++) {
390             TRACE ("Setting default channel priorities on channel group %i\n", j + 1);
391             obj->group[j].channel[0].priority = DAUD_CHAN1_DEF_VOICE_PRIORITY;
392             obj->group[j].channel[1].priority = DAUD_CHAN2_DEF_VOICE_PRIORITY;
393             obj->group[j].channel[2].priority = DAUD_CHAN3_DEF_VOICE_PRIORITY;
394             obj->group[j].channel[3].priority = DAUD_CHAN4_DEF_VOICE_PRIORITY;
395             obj->group[j].channel[4].priority = DAUD_CHAN5_DEF_VOICE_PRIORITY;
396             obj->group[j].channel[5].priority = DAUD_CHAN6_DEF_VOICE_PRIORITY;
397             obj->group[j].channel[6].priority = DAUD_CHAN7_DEF_VOICE_PRIORITY;
398             obj->group[j].channel[7].priority = DAUD_CHAN8_DEF_VOICE_PRIORITY;
399             obj->group[j].channel[8].priority = DAUD_CHAN9_DEF_VOICE_PRIORITY;
400             obj->group[j].channel[9].priority = DAUD_CHAN10_DEF_VOICE_PRIORITY;
401             obj->group[j].channel[10].priority = DAUD_CHAN11_DEF_VOICE_PRIORITY;
402             obj->group[j].channel[11].priority = DAUD_CHAN12_DEF_VOICE_PRIORITY;
403             obj->group[j].channel[12].priority = DAUD_CHAN13_DEF_VOICE_PRIORITY;
404             obj->group[j].channel[13].priority = DAUD_CHAN14_DEF_VOICE_PRIORITY;
405             obj->group[j].channel[14].priority = DAUD_CHAN15_DEF_VOICE_PRIORITY;
406             obj->group[j].channel[15].priority = DAUD_CHAN16_DEF_VOICE_PRIORITY;
407           }
408         }
409 #endif
410
411         return IDirectMusicPortImpl_QueryInterface ((LPDIRECTMUSICPORT)obj, lpcGUID, ppobj);
412 }