imagehlp: Remove unused variable.
[wine] / dlls / dmsynth / synth.c
1 /*
2  * IDirectMusicSynth8 Implementation
3  *
4  * Copyright (C) 2003-2004 Rok Mandeljc
5  * Copyright (C) 2012 Christian Costa
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
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 GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21
22 #define COBJMACROS
23
24 #define NONAMELESSUNION
25 #define NONAMELESSSTRUCT
26 #include "objbase.h"
27 #include "initguid.h"
28 #include "dmksctrl.h"
29
30 #include "dmsynth_private.h"
31
32 WINE_DEFAULT_DEBUG_CHANNEL(dmsynth);
33
34 static inline IDirectMusicSynth8Impl *impl_from_IDirectMusicSynth8(IDirectMusicSynth8 *iface)
35 {
36     return CONTAINING_RECORD(iface, IDirectMusicSynth8Impl, IDirectMusicSynth8_iface);
37 }
38
39 /* IDirectMusicSynth8Impl IUnknown part: */
40 static HRESULT WINAPI IDirectMusicSynth8Impl_QueryInterface(LPDIRECTMUSICSYNTH8 iface, REFIID riid, LPVOID *ret_iface)
41 {
42     IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
43
44     TRACE("(%p)->(%s, %p)\n", iface, debugstr_dmguid(riid), ret_iface);
45
46     if (IsEqualIID (riid, &IID_IUnknown) ||
47         IsEqualIID (riid, &IID_IDirectMusicSynth) ||
48         IsEqualIID (riid, &IID_IDirectMusicSynth8))
49     {
50         IUnknown_AddRef(iface);
51         *ret_iface = iface;
52         return S_OK;
53     }
54     else if (IsEqualIID(riid, &IID_IKsControl))
55     {
56         IUnknown_AddRef(iface);
57         *ret_iface = &This->IKsControl_iface;
58         return S_OK;
59     }
60
61     *ret_iface = NULL;
62
63     WARN("(%p)->(%s, %p): not found\n", iface, debugstr_dmguid(riid), ret_iface);
64
65     return E_NOINTERFACE;
66 }
67
68 static ULONG WINAPI IDirectMusicSynth8Impl_AddRef(LPDIRECTMUSICSYNTH8 iface)
69 {
70     IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
71     ULONG ref = InterlockedIncrement(&This->ref);
72
73     TRACE("(%p)->(): new ref = %u\n", This, ref);
74
75     DMSYNTH_LockModule();
76
77     return ref;
78 }
79
80 static ULONG WINAPI IDirectMusicSynth8Impl_Release(LPDIRECTMUSICSYNTH8 iface)
81 {
82     IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
83     ULONG ref = InterlockedDecrement(&This->ref);
84
85     TRACE("(%p)->(): new ref = %u\n", This, ref);
86
87     if (!ref) {
88         if (This->pLatencyClock)
89             IReferenceClock_Release(This->pLatencyClock);
90         HeapFree(GetProcessHeap(), 0, This);
91     }
92
93     DMSYNTH_UnlockModule();
94
95     return ref;
96 }
97
98 /* IDirectMusicSynth8Impl IDirectMusicSynth part: */
99 static HRESULT WINAPI IDirectMusicSynth8Impl_Open(LPDIRECTMUSICSYNTH8 iface, LPDMUS_PORTPARAMS pPortParams)
100 {
101     IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
102
103     FIXME("(%p)->(%p): stub\n", This, pPortParams);
104
105     return S_OK;
106 }
107
108 static HRESULT WINAPI IDirectMusicSynth8Impl_Close(LPDIRECTMUSICSYNTH8 iface)
109 {
110     IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
111
112     FIXME("(%p)->(): stub\n", This);
113
114     return S_OK;
115 }
116
117 static HRESULT WINAPI IDirectMusicSynth8Impl_SetNumChannelGroups(LPDIRECTMUSICSYNTH8 iface, DWORD groups)
118 {
119     IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
120
121     FIXME("(%p->(%d): stub\n", This, groups);
122
123     return S_OK;
124 }
125
126 static HRESULT WINAPI IDirectMusicSynth8Impl_Download(LPDIRECTMUSICSYNTH8 iface, LPHANDLE hDownload, LPVOID data, LPBOOL free)
127 {
128     IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
129     DMUS_DOWNLOADINFO* info = (DMUS_DOWNLOADINFO*)data;
130
131     FIXME("(%p)->(%p, %p, %p): stub\n", This, hDownload, data, free);
132
133     if (!hDownload || !data || !free)
134         return E_POINTER;
135
136     if (TRACE_ON(dmsynth))
137     {
138         TRACE("Dump DMUS_DOWNLOADINFO struct:\n");
139         TRACE(" - dwDLType                = %u\n", info->dwDLType);
140         TRACE(" - dwDLId                  = %u\n", info->dwDLId);
141         TRACE(" - dwNumOffsetTableEntries = %u\n", info->dwNumOffsetTableEntries);
142         TRACE(" - cbSize                  = %u\n", info->cbSize);
143     }
144
145     if (info->dwDLType == DMUS_DOWNLOADINFO_INSTRUMENT)
146     {
147         FIXME("Download type DMUS_DOWNLOADINFO_INSTRUMENT not yet supported\n");
148     }
149     else if (info->dwDLType == DMUS_DOWNLOADINFO_WAVE)
150     {
151         FIXME("Download type DMUS_DOWNLOADINFO_WAVE not yet supported\n");
152     }
153     else if (info->dwDLType == DMUS_DOWNLOADINFO_INSTRUMENT2)
154     {
155         FIXME("Download type DMUS_DOWNLOADINFO_INSTRUMENT2 not yet supported\n");
156     }
157     else if (info->dwDLType == DMUS_DOWNLOADINFO_WAVEARTICULATION)
158     {
159         FIXME("Download type DMUS_DOWNLOADINFO_WAVEARTICULATION not yet supported\n");
160     }
161     else if (info->dwDLType == DMUS_DOWNLOADINFO_STREAMINGWAVE)
162     {
163         FIXME("Download type DMUS_DOWNLOADINFO_STREAMINGWAVE not yet supported\n");
164     }
165     else if (info->dwDLType == DMUS_DOWNLOADINFO_ONESHOTWAVE)
166     {
167         FIXME("Download type DMUS_DOWNLOADINFO_ONESHOTWAVE not yet supported\n");
168     }
169     else
170     {
171         WARN("Unknown download type %u\n", info->dwDLType);
172         return DMUS_E_UNKNOWNDOWNLOAD;
173     }
174
175     return S_OK;
176 }
177
178 static HRESULT WINAPI IDirectMusicSynth8Impl_Unload(LPDIRECTMUSICSYNTH8 iface, HANDLE hDownload, HRESULT (CALLBACK* lpFreeHandle)(HANDLE,HANDLE), HANDLE hUserData)
179 {
180     IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
181
182     FIXME("(%p)->(%p, %p, %p): stub\n", This, hDownload, lpFreeHandle, hUserData);
183
184     return S_OK;
185 }
186
187 static HRESULT WINAPI IDirectMusicSynth8Impl_PlayBuffer(LPDIRECTMUSICSYNTH8 iface, REFERENCE_TIME rt, LPBYTE buffer, DWORD size)
188 {
189     IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
190
191     FIXME("(%p)->(0x%s, %p, %u): stub\n", This, wine_dbgstr_longlong(rt), buffer, size);
192
193     return S_OK;
194 }
195
196 static HRESULT WINAPI IDirectMusicSynth8Impl_GetRunningStats(LPDIRECTMUSICSYNTH8 iface, LPDMUS_SYNTHSTATS stats)
197 {
198     IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
199
200     FIXME("(%p)->(%p): stub\n", This, stats);
201
202     return S_OK;
203 }
204
205 static HRESULT WINAPI IDirectMusicSynth8Impl_GetPortCaps(LPDIRECTMUSICSYNTH8 iface, LPDMUS_PORTCAPS caps)
206 {
207     IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
208
209     TRACE("(%p)->(%p)\n", This, caps);
210
211     *caps = This->pCaps;
212
213     return S_OK;
214 }
215
216 static HRESULT WINAPI IDirectMusicSynth8Impl_SetMasterClock(LPDIRECTMUSICSYNTH8 iface, IReferenceClock* clock)
217 {
218     IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
219
220     FIXME("(%p)->(%p): stub\n", This, clock);
221
222     return S_OK;
223 }
224
225 static HRESULT WINAPI IDirectMusicSynth8Impl_GetLatencyClock(LPDIRECTMUSICSYNTH8 iface, IReferenceClock** clock)
226 {
227     IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
228
229     TRACE("(%p)->(%p)\n", iface, clock);
230
231     if (!clock)
232         return E_POINTER;
233
234     if (!This->pSynthSink)
235         return DMUS_E_NOSYNTHSINK;
236
237     *clock = This->pLatencyClock;
238     IReferenceClock_AddRef(This->pLatencyClock);
239
240     return S_OK;
241 }
242
243 static HRESULT WINAPI IDirectMusicSynth8Impl_Activate(LPDIRECTMUSICSYNTH8 iface, BOOL enable)
244 {
245     IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
246
247     TRACE("(%p)->(%d)\n", This, enable);
248
249     This->fActive = enable;
250
251     return S_OK;
252 }
253
254 static HRESULT WINAPI IDirectMusicSynth8Impl_SetSynthSink(LPDIRECTMUSICSYNTH8 iface, IDirectMusicSynthSink* synth_sink)
255 {
256     IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
257
258     TRACE("(%p)->(%p)\n", iface, synth_sink);
259
260     This->pSynthSink = (IDirectMusicSynthSinkImpl*)synth_sink;
261
262     if (synth_sink)
263         return IDirectMusicSynthSink_GetLatencyClock(synth_sink, &This->pLatencyClock);
264
265     return S_OK;
266 }
267
268 static HRESULT WINAPI IDirectMusicSynth8Impl_Render(LPDIRECTMUSICSYNTH8 iface, short* buffer, DWORD length, LONGLONG position)
269 {
270     IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
271
272     FIXME("(%p)->(%p, %d, 0x%s): stub\n", This, buffer, length, wine_dbgstr_longlong(position));
273
274     return S_OK;
275 }
276
277 static HRESULT WINAPI IDirectMusicSynth8Impl_SetChannelPriority(LPDIRECTMUSICSYNTH8 iface, DWORD channel_group, DWORD channel, DWORD priority)
278 {
279     /* IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface); */
280
281     /* Silenced because of too many messages - 1000 groups * 16 channels ;=) */
282     /* FIXME("(%p)->(%ld, %ld, %ld): stub\n", This, channel_group, channel, priority); */
283
284     return S_OK;
285 }
286
287 static HRESULT WINAPI IDirectMusicSynth8Impl_GetChannelPriority(LPDIRECTMUSICSYNTH8 iface, DWORD channel_group, DWORD channel, LPDWORD priority)
288 {
289     IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
290
291     FIXME("(%p)->(%d, %d, %p): stub\n", This, channel_group, channel, priority);
292
293     return S_OK;
294 }
295
296 static HRESULT WINAPI IDirectMusicSynth8Impl_GetFormat(LPDIRECTMUSICSYNTH8 iface, LPWAVEFORMATEX wave_format, LPDWORD wave_format_size)
297 {
298     IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
299
300     FIXME("(%p)->(%p, %p): stub\n", This, wave_format, wave_format_size);
301
302     return S_OK;
303 }
304
305 static HRESULT WINAPI IDirectMusicSynth8Impl_GetAppend(LPDIRECTMUSICSYNTH8 iface, DWORD* append)
306 {
307     TRACE("(%p)->(%p)\n", iface, append);
308
309     /* We don't need extra space at the end of buffers passed to us for now */
310     *append = 0;
311
312     return S_OK;
313 }
314
315 /* IDirectMusicSynth8Impl IDirectMusicSynth8 part: */
316 static HRESULT WINAPI IDirectMusicSynth8Impl_PlayVoice(LPDIRECTMUSICSYNTH8 iface, REFERENCE_TIME ref_time, DWORD voice_id, DWORD channel_group, DWORD channel,
317                                                        DWORD dwDLId, LONG prPitch, LONG vrVolume, SAMPLE_TIME stVoiceStart, SAMPLE_TIME stLoopStart, SAMPLE_TIME stLoopEnd)
318 {
319     IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
320
321     FIXME("(%p)->(0x%s, %d, %d, %d, %d, %i, %i,0x%s, 0x%s, 0x%s): stub\n",
322           This, wine_dbgstr_longlong(ref_time), voice_id, channel_group, channel, dwDLId, prPitch, vrVolume,
323           wine_dbgstr_longlong(stVoiceStart), wine_dbgstr_longlong(stLoopStart), wine_dbgstr_longlong(stLoopEnd));
324
325     return S_OK;
326 }
327
328 static HRESULT WINAPI IDirectMusicSynth8Impl_StopVoice(LPDIRECTMUSICSYNTH8 iface, REFERENCE_TIME ref_time, DWORD voice_id)
329 {
330     IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
331
332     FIXME("(%p)->(0x%s, %d): stub\n", This, wine_dbgstr_longlong(ref_time), voice_id);
333
334     return S_OK;
335 }
336
337 static HRESULT WINAPI IDirectMusicSynth8Impl_GetVoiceState(LPDIRECTMUSICSYNTH8 iface, DWORD dwVoice[], DWORD cbVoice, DMUS_VOICE_STATE dwVoiceState[])
338 {
339     IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
340
341     FIXME("(%p)->(%p, %d, %p): stub\n", This, dwVoice, cbVoice, dwVoiceState);
342
343     return S_OK;
344 }
345
346 static HRESULT WINAPI IDirectMusicSynth8Impl_Refresh(LPDIRECTMUSICSYNTH8 iface, DWORD download_id, DWORD flags)
347 {
348     IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
349
350     FIXME("(%p)->(%d, %d): stub\n", This, download_id, flags);
351
352     return S_OK;
353 }
354
355 static HRESULT WINAPI IDirectMusicSynth8Impl_AssignChannelToBuses(LPDIRECTMUSICSYNTH8 iface, DWORD channel_group, DWORD channel, LPDWORD pdwBuses, DWORD cBuses)
356 {
357     IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
358
359     FIXME("(%p)->(%d, %d, %p, %d): stub\n", This, channel_group, channel, pdwBuses, cBuses);
360
361     return S_OK;
362 }
363
364 static const IDirectMusicSynth8Vtbl DirectMusicSynth8_Vtbl = {
365         IDirectMusicSynth8Impl_QueryInterface,
366         IDirectMusicSynth8Impl_AddRef,
367         IDirectMusicSynth8Impl_Release,
368         IDirectMusicSynth8Impl_Open,
369         IDirectMusicSynth8Impl_Close,
370         IDirectMusicSynth8Impl_SetNumChannelGroups,
371         IDirectMusicSynth8Impl_Download,
372         IDirectMusicSynth8Impl_Unload,
373         IDirectMusicSynth8Impl_PlayBuffer,
374         IDirectMusicSynth8Impl_GetRunningStats,
375         IDirectMusicSynth8Impl_GetPortCaps,
376         IDirectMusicSynth8Impl_SetMasterClock,
377         IDirectMusicSynth8Impl_GetLatencyClock,
378         IDirectMusicSynth8Impl_Activate,
379         IDirectMusicSynth8Impl_SetSynthSink,
380         IDirectMusicSynth8Impl_Render,
381         IDirectMusicSynth8Impl_SetChannelPriority,
382         IDirectMusicSynth8Impl_GetChannelPriority,
383         IDirectMusicSynth8Impl_GetFormat,
384         IDirectMusicSynth8Impl_GetAppend,
385         IDirectMusicSynth8Impl_PlayVoice,
386         IDirectMusicSynth8Impl_StopVoice,
387         IDirectMusicSynth8Impl_GetVoiceState,
388         IDirectMusicSynth8Impl_Refresh,
389         IDirectMusicSynth8Impl_AssignChannelToBuses
390 };
391
392 static inline IDirectMusicSynth8Impl *impl_from_IKsControl(IKsControl *iface)
393 {
394     return CONTAINING_RECORD(iface, IDirectMusicSynth8Impl, IKsControl_iface);
395 }
396
397 static HRESULT WINAPI DMSynthImpl_IKsControl_QueryInterface(IKsControl* iface, REFIID riid, LPVOID *ppobj)
398 {
399     IDirectMusicSynth8Impl *This = impl_from_IKsControl(iface);
400
401     return IDirectMusicSynth8Impl_QueryInterface(&This->IDirectMusicSynth8_iface, riid, ppobj);
402 }
403
404 static ULONG WINAPI DMSynthImpl_IKsControl_AddRef(IKsControl* iface)
405 {
406     IDirectMusicSynth8Impl *This = impl_from_IKsControl(iface);
407
408     return IDirectMusicSynth8Impl_AddRef(&This->IDirectMusicSynth8_iface);
409 }
410
411 static ULONG WINAPI DMSynthImpl_IKsControl_Release(IKsControl* iface)
412 {
413     IDirectMusicSynth8Impl *This = impl_from_IKsControl(iface);
414
415     return IDirectMusicSynth8Impl_Release(&This->IDirectMusicSynth8_iface);
416 }
417
418 static HRESULT WINAPI DMSynthImpl_IKsControl_KsProperty(IKsControl* iface, PKSPROPERTY Property, ULONG PropertyLength, LPVOID PropertyData,
419                                                         ULONG DataLength, ULONG* BytesReturned)
420 {
421     TRACE("(%p)->(%p, %u, %p, %u, %p)\n", iface, Property, PropertyLength, PropertyData, DataLength, BytesReturned);
422
423     TRACE("Property = %s - %u - %u\n", debugstr_guid(&Property->u.s.Set), Property->u.s.Id, Property->u.s.Flags);
424
425     if (Property->u.s.Flags != KSPROPERTY_TYPE_GET)
426     {
427         FIXME("Property flags %u not yet supported\n", Property->u.s.Flags);
428         return S_FALSE;
429     }
430
431     if (DataLength <  sizeof(DWORD))
432         return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
433
434     if (IsEqualGUID(&Property->u.s.Set, &GUID_DMUS_PROP_INSTRUMENT2))
435     {
436         *(DWORD*)PropertyData = TRUE;
437         *BytesReturned = sizeof(DWORD);
438     }
439     else if (IsEqualGUID(&Property->u.s.Set, &GUID_DMUS_PROP_DLS2))
440     {
441         *(DWORD*)PropertyData = TRUE;
442         *BytesReturned = sizeof(DWORD);
443     }
444     else if (IsEqualGUID(&Property->u.s.Set, &GUID_DMUS_PROP_GM_Hardware))
445     {
446         *(DWORD*)PropertyData = FALSE;
447         *BytesReturned = sizeof(DWORD);
448     }
449     else if (IsEqualGUID(&Property->u.s.Set, &GUID_DMUS_PROP_GS_Hardware))
450     {
451         *(DWORD*)PropertyData = FALSE;
452         *BytesReturned = sizeof(DWORD);
453     }
454     else if (IsEqualGUID(&Property->u.s.Set, &GUID_DMUS_PROP_XG_Hardware))
455     {
456         *(DWORD*)PropertyData = FALSE;
457         *BytesReturned = sizeof(DWORD);
458     }
459     else
460     {
461         FIXME("Unknown property %s\n", debugstr_guid(&Property->u.s.Set));
462         *(DWORD*)PropertyData = FALSE;
463         *BytesReturned = sizeof(DWORD);
464     }
465
466     return S_OK;
467 }
468
469 static HRESULT WINAPI DMSynthImpl_IKsControl_KsMethod(IKsControl* iface, PKSMETHOD Method, ULONG MethodLength, LPVOID MethodData,
470                                                       ULONG DataLength, ULONG* BytesReturned)
471 {
472     FIXME("(%p)->(%p, %u, %p, %u, %p): stub\n", iface, Method, MethodLength, MethodData, DataLength, BytesReturned);
473
474     return E_NOTIMPL;
475 }
476
477 static HRESULT WINAPI DMSynthImpl_IKsControl_KsEvent(IKsControl* iface, PKSEVENT Event, ULONG EventLength, LPVOID EventData,
478                                                      ULONG DataLength, ULONG* BytesReturned)
479 {
480     FIXME("(%p)->(%p, %u, %p, %u, %p): stub\n", iface, Event, EventLength, EventData, DataLength, BytesReturned);
481
482     return E_NOTIMPL;
483 }
484
485
486 static const IKsControlVtbl DMSynthImpl_IKsControl_Vtbl = {
487     DMSynthImpl_IKsControl_QueryInterface,
488     DMSynthImpl_IKsControl_AddRef,
489     DMSynthImpl_IKsControl_Release,
490     DMSynthImpl_IKsControl_KsProperty,
491     DMSynthImpl_IKsControl_KsMethod,
492     DMSynthImpl_IKsControl_KsEvent
493 };
494
495 /* for ClassFactory */
496 HRESULT WINAPI DMUSIC_CreateDirectMusicSynthImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter)
497 {
498         IDirectMusicSynth8Impl *obj;
499         
500         TRACE("(%p,%p,%p)\n", lpcGUID, ppobj, pUnkOuter);
501         obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSynth8Impl));
502         if (NULL == obj) {
503                 *ppobj = NULL;
504                 return E_OUTOFMEMORY;
505         }
506         obj->IDirectMusicSynth8_iface.lpVtbl = &DirectMusicSynth8_Vtbl;
507         obj->IKsControl_iface.lpVtbl = &DMSynthImpl_IKsControl_Vtbl;
508         obj->ref = 0;
509         /* fill in caps */
510         obj->pCaps.dwSize = sizeof(DMUS_PORTCAPS);
511         obj->pCaps.dwFlags = DMUS_PC_DLS | DMUS_PC_SOFTWARESYNTH | DMUS_PC_DIRECTSOUND | DMUS_PC_DLS2 | DMUS_PC_AUDIOPATH | DMUS_PC_WAVE;
512         obj->pCaps.guidPort = CLSID_DirectMusicSynth;
513         obj->pCaps.dwClass = DMUS_PC_OUTPUTCLASS;
514         obj->pCaps.dwType = DMUS_PORT_USER_MODE_SYNTH;
515         obj->pCaps.dwMemorySize = DMUS_PC_SYSTEMMEMORY;
516         obj->pCaps.dwMaxChannelGroups = 1000;
517         obj->pCaps.dwMaxVoices = 1000;
518         obj->pCaps.dwMaxAudioChannels = 2;
519         obj->pCaps.dwEffectFlags = DMUS_EFFECT_REVERB;
520         MultiByteToWideChar (CP_ACP, 0, "Microsoft Synthesizer", -1, obj->pCaps.wszDescription, sizeof(obj->pCaps.wszDescription)/sizeof(WCHAR));
521
522         return IDirectMusicSynth8Impl_QueryInterface ((LPDIRECTMUSICSYNTH8)obj, lpcGUID, ppobj);
523 }