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