makefiles: Install PE files in an architecture-specific directory.
[wine.git] / dlls / dmsynth / synth.c
blob19789b5a256b74c12c7c5105e8609122ef81e866
1 /*
2 * IDirectMusicSynth8 Implementation
4 * Copyright (C) 2003-2004 Rok Mandeljc
5 * Copyright (C) 2012 Christian Costa
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.
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.
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
22 #define COBJMACROS
24 #define NONAMELESSUNION
25 #define NONAMELESSSTRUCT
26 #include "objbase.h"
27 #include "initguid.h"
28 #include "dmksctrl.h"
30 #include "dmsynth_private.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(dmsynth);
34 static inline IDirectMusicSynth8Impl *impl_from_IDirectMusicSynth8(IDirectMusicSynth8 *iface)
36 return CONTAINING_RECORD(iface, IDirectMusicSynth8Impl, IDirectMusicSynth8_iface);
39 /* IDirectMusicSynth8Impl IUnknown part: */
40 static HRESULT WINAPI IDirectMusicSynth8Impl_QueryInterface(IDirectMusicSynth8 *iface, REFIID riid,
41 void **ret_iface)
43 IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
45 TRACE("(%p)->(%s, %p)\n", iface, debugstr_dmguid(riid), ret_iface);
47 if (IsEqualIID (riid, &IID_IUnknown) ||
48 IsEqualIID (riid, &IID_IDirectMusicSynth) ||
49 IsEqualIID (riid, &IID_IDirectMusicSynth8))
51 IUnknown_AddRef(iface);
52 *ret_iface = iface;
53 return S_OK;
55 else if (IsEqualIID(riid, &IID_IKsControl))
57 IUnknown_AddRef(iface);
58 *ret_iface = &This->IKsControl_iface;
59 return S_OK;
62 *ret_iface = NULL;
64 WARN("(%p)->(%s, %p): not found\n", iface, debugstr_dmguid(riid), ret_iface);
66 return E_NOINTERFACE;
69 static ULONG WINAPI IDirectMusicSynth8Impl_AddRef(IDirectMusicSynth8 *iface)
71 IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
72 ULONG ref = InterlockedIncrement(&This->ref);
74 TRACE("(%p)->(): new ref = %u\n", This, ref);
76 return ref;
79 static ULONG WINAPI IDirectMusicSynth8Impl_Release(IDirectMusicSynth8 *iface)
81 IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
82 ULONG ref = InterlockedDecrement(&This->ref);
84 TRACE("(%p)->(): new ref = %u\n", This, ref);
86 if (!ref) {
87 if (This->pLatencyClock)
88 IReferenceClock_Release(This->pLatencyClock);
89 HeapFree(GetProcessHeap(), 0, This);
90 DMSYNTH_UnlockModule();
93 return ref;
96 /* IDirectMusicSynth8Impl IDirectMusicSynth part: */
97 static HRESULT WINAPI IDirectMusicSynth8Impl_Open(IDirectMusicSynth8 *iface,
98 DMUS_PORTPARAMS *pPortParams)
100 IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
102 FIXME("(%p)->(%p): stub\n", This, pPortParams);
104 return S_OK;
107 static HRESULT WINAPI IDirectMusicSynth8Impl_Close(IDirectMusicSynth8 *iface)
109 IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
111 FIXME("(%p)->(): stub\n", This);
113 return S_OK;
116 static HRESULT WINAPI IDirectMusicSynth8Impl_SetNumChannelGroups(IDirectMusicSynth8 *iface,
117 DWORD groups)
119 IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
121 FIXME("(%p)->(%d): stub\n", This, groups);
123 return S_OK;
126 static HRESULT WINAPI IDirectMusicSynth8Impl_Download(IDirectMusicSynth8 *iface, HANDLE *hDownload,
127 void *data, BOOL *free)
129 IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
130 LPBYTE buffer = data;
131 DMUS_DOWNLOADINFO *info = (DMUS_DOWNLOADINFO*)buffer;
132 ULONG *offsets = ((DMUS_OFFSETTABLE*)(buffer + sizeof(DMUS_DOWNLOADINFO)))->ulOffsetTable;
133 LPBYTE object = buffer + sizeof(DMUS_DOWNLOADINFO) + info->dwNumOffsetTableEntries * sizeof(ULONG);
135 FIXME("(%p)->(%p, %p, %p): stub\n", This, hDownload, data, free);
137 /* FIXME: Currently we only dump data which is very useful to known how native dmusic behave and debug builtin dmusic */
139 if (!hDownload || !free)
140 return E_POINTER;
142 if (TRACE_ON(dmsynth))
144 TRACE("Dump DMUS_DOWNLOADINFO struct:\n");
145 TRACE(" - dwDLType = %u\n", info->dwDLType);
146 TRACE(" - dwDLId = %u\n", info->dwDLId);
147 TRACE(" - dwNumOffsetTableEntries = %u\n", info->dwNumOffsetTableEntries);
148 TRACE(" - cbSize = %u\n", info->cbSize);
151 /* The struct should have at least one offset corresponding to the download object itself */
152 if (!info->dwNumOffsetTableEntries)
154 FIXME("Offset table is empty\n");
155 return DMUS_E_BADOFFSETTABLE;
158 /* First offset should point to the download object */
159 if ((buffer + offsets[0]) != object)
161 FIXME("Object is not at the beginning\n");
162 return DMUS_E_BADOFFSETTABLE;
165 if (info->dwDLType == DMUS_DOWNLOADINFO_INSTRUMENT)
167 FIXME("Download type DMUS_DOWNLOADINFO_INSTRUMENT not yet supported\n");
169 else if (info->dwDLType == DMUS_DOWNLOADINFO_WAVE)
171 DMUS_WAVE *wave = (DMUS_WAVE*)object;
172 DMUS_WAVEDATA *wave_data;
174 TRACE("Processing download type DMUS_DOWNLOADINFO_WAVE\n");
176 if (TRACE_ON(dmsynth))
178 TRACE("Dump DMUS_WAVE struct\n");
179 TRACE(" - ulFirstExtCkIdx = %u\n", wave->ulFirstExtCkIdx);
180 TRACE(" - ulCopyrightIdx = %u\n", wave->ulCopyrightIdx);
181 TRACE(" - ulWaveDataIdx = %u\n", wave->ulWaveDataIdx);
182 TRACE(" - WaveformatEx:\n");
183 TRACE(" - wFormatTag = %u\n", wave->WaveformatEx.wFormatTag);
184 TRACE(" - nChannels = %u\n", wave->WaveformatEx.nChannels);
185 TRACE(" - nSamplesPerSec = %u\n", wave->WaveformatEx.nSamplesPerSec);
186 TRACE(" - nAvgBytesPerSec = %u\n", wave->WaveformatEx.nAvgBytesPerSec);
187 TRACE(" - nBlockAlign = %u\n", wave->WaveformatEx.nBlockAlign);
188 TRACE(" - wBitsPerSample = %u\n", wave->WaveformatEx.wBitsPerSample);
189 TRACE(" - cbSize = %u\n", wave->WaveformatEx.cbSize);
191 if (wave->ulCopyrightIdx)
193 DMUS_COPYRIGHT *copyright = (DMUS_COPYRIGHT*)(buffer + offsets[wave->ulCopyrightIdx]);
194 TRACE("Copyright = '%s'\n", (char*)copyright->byCopyright);
197 wave_data = (DMUS_WAVEDATA*)(buffer + offsets[wave->ulWaveDataIdx]);
198 TRACE("Found %u bytes of wave data\n", wave_data->cbSize);
201 else if (info->dwDLType == DMUS_DOWNLOADINFO_INSTRUMENT2)
203 DMUS_INSTRUMENT *instrument = (DMUS_INSTRUMENT*)object;
204 ULONG nb_regions = 0;
206 TRACE("Processing download type DMUS_DOWNLOADINFO_INSTRUMENT2\n");
208 if (TRACE_ON(dmsynth))
210 TRACE("Dump DMUS_INSTRUMENT struct\n");
211 TRACE(" - ulPatch = %u\n", instrument->ulPatch);
212 TRACE(" - ulFirstRegionIdx = %u\n", instrument->ulFirstRegionIdx);
213 TRACE(" - ulGlobalArtIdx = %u\n", instrument->ulGlobalArtIdx);
214 TRACE(" - ulFirstExtCkIdx = %u\n", instrument->ulFirstExtCkIdx);
215 TRACE(" - ulCopyrightIdx = %u\n", instrument->ulCopyrightIdx);
216 TRACE(" - ulFlags = %u\n", instrument->ulFlags);
218 if (instrument->ulCopyrightIdx)
220 DMUS_COPYRIGHT *copyright = (DMUS_COPYRIGHT*)(buffer + offsets[instrument->ulCopyrightIdx]);
221 TRACE("Copyright = '%s'\n", (char*)copyright->byCopyright);
225 if (instrument->ulFirstRegionIdx)
227 ULONG region_idx = instrument->ulFirstRegionIdx;
229 while (region_idx)
231 DMUS_REGION *region = (DMUS_REGION*)(buffer + offsets[region_idx]);
233 region_idx = region->ulNextRegionIdx;
234 nb_regions++;
238 TRACE("Number of regions = %u\n", nb_regions);
240 else if (info->dwDLType == DMUS_DOWNLOADINFO_WAVEARTICULATION)
242 FIXME("Download type DMUS_DOWNLOADINFO_WAVEARTICULATION not yet supported\n");
244 else if (info->dwDLType == DMUS_DOWNLOADINFO_STREAMINGWAVE)
246 FIXME("Download type DMUS_DOWNLOADINFO_STREAMINGWAVE not yet supported\n");
248 else if (info->dwDLType == DMUS_DOWNLOADINFO_ONESHOTWAVE)
250 FIXME("Download type DMUS_DOWNLOADINFO_ONESHOTWAVE not yet supported\n");
252 else
254 WARN("Unknown download type %u\n", info->dwDLType);
255 return DMUS_E_UNKNOWNDOWNLOAD;
258 return S_OK;
261 static HRESULT WINAPI IDirectMusicSynth8Impl_Unload(IDirectMusicSynth8 *iface, HANDLE hDownload,
262 HRESULT (CALLBACK *lpFreeHandle)(HANDLE,HANDLE), HANDLE hUserData)
264 IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
266 FIXME("(%p)->(%p, %p, %p): stub\n", This, hDownload, lpFreeHandle, hUserData);
268 return S_OK;
271 static HRESULT WINAPI IDirectMusicSynth8Impl_PlayBuffer(IDirectMusicSynth8 *iface,
272 REFERENCE_TIME rt, BYTE *buffer, DWORD size)
274 IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
276 FIXME("(%p)->(0x%s, %p, %u): stub\n", This, wine_dbgstr_longlong(rt), buffer, size);
278 return S_OK;
281 static HRESULT WINAPI IDirectMusicSynth8Impl_GetRunningStats(IDirectMusicSynth8 *iface,
282 DMUS_SYNTHSTATS *stats)
284 IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
286 FIXME("(%p)->(%p): stub\n", This, stats);
288 return S_OK;
291 static HRESULT WINAPI IDirectMusicSynth8Impl_GetPortCaps(IDirectMusicSynth8 *iface,
292 DMUS_PORTCAPS *caps)
294 IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
296 TRACE("(%p)->(%p)\n", This, caps);
298 *caps = This->pCaps;
300 return S_OK;
303 static HRESULT WINAPI IDirectMusicSynth8Impl_SetMasterClock(IDirectMusicSynth8 *iface,
304 IReferenceClock *clock)
306 IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
308 FIXME("(%p)->(%p): stub\n", This, clock);
310 return S_OK;
313 static HRESULT WINAPI IDirectMusicSynth8Impl_GetLatencyClock(IDirectMusicSynth8 *iface,
314 IReferenceClock **clock)
316 IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
318 TRACE("(%p)->(%p)\n", iface, clock);
320 if (!clock)
321 return E_POINTER;
323 if (!This->synth_sink)
324 return DMUS_E_NOSYNTHSINK;
326 *clock = This->pLatencyClock;
327 IReferenceClock_AddRef(This->pLatencyClock);
329 return S_OK;
332 static HRESULT WINAPI IDirectMusicSynth8Impl_Activate(IDirectMusicSynth8 *iface, BOOL enable)
334 IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
336 TRACE("(%p)->(%d)\n", This, enable);
338 This->fActive = enable;
340 return S_OK;
343 static HRESULT WINAPI IDirectMusicSynth8Impl_SetSynthSink(IDirectMusicSynth8 *iface,
344 IDirectMusicSynthSink *synth_sink)
346 IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
348 TRACE("(%p)->(%p)\n", iface, synth_sink);
350 This->synth_sink = synth_sink;
352 if (synth_sink)
353 return IDirectMusicSynthSink_GetLatencyClock(synth_sink, &This->pLatencyClock);
355 return S_OK;
358 static HRESULT WINAPI IDirectMusicSynth8Impl_Render(IDirectMusicSynth8 *iface, short *buffer,
359 DWORD length, LONGLONG position)
361 IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
363 FIXME("(%p)->(%p, %d, 0x%s): stub\n", This, buffer, length, wine_dbgstr_longlong(position));
365 return S_OK;
368 static HRESULT WINAPI IDirectMusicSynth8Impl_SetChannelPriority(IDirectMusicSynth8 *iface,
369 DWORD channel_group, DWORD channel, DWORD priority)
371 /* IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface); */
373 /* Silenced because of too many messages - 1000 groups * 16 channels ;=) */
374 /* FIXME("(%p)->(%ld, %ld, %ld): stub\n", This, channel_group, channel, priority); */
376 return S_OK;
379 static HRESULT WINAPI IDirectMusicSynth8Impl_GetChannelPriority(IDirectMusicSynth8 *iface,
380 DWORD channel_group, DWORD channel, DWORD *priority)
382 IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
384 FIXME("(%p)->(%d, %d, %p): stub\n", This, channel_group, channel, priority);
386 return S_OK;
389 static HRESULT WINAPI IDirectMusicSynth8Impl_GetFormat(IDirectMusicSynth8 *iface,
390 WAVEFORMATEX *wave_format, DWORD *wave_format_size)
392 IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
394 FIXME("(%p)->(%p, %p): stub\n", This, wave_format, wave_format_size);
396 return S_OK;
399 static HRESULT WINAPI IDirectMusicSynth8Impl_GetAppend(IDirectMusicSynth8 *iface, DWORD *append)
401 TRACE("(%p)->(%p)\n", iface, append);
403 /* We don't need extra space at the end of buffers passed to us for now */
404 *append = 0;
406 return S_OK;
409 /* IDirectMusicSynth8Impl IDirectMusicSynth8 part: */
410 static HRESULT WINAPI IDirectMusicSynth8Impl_PlayVoice(IDirectMusicSynth8 *iface,
411 REFERENCE_TIME ref_time, DWORD voice_id, DWORD channel_group, DWORD channel, DWORD dwDLId,
412 LONG prPitch, LONG vrVolume, SAMPLE_TIME stVoiceStart, SAMPLE_TIME stLoopStart,
413 SAMPLE_TIME stLoopEnd)
415 IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
417 FIXME("(%p)->(0x%s, %d, %d, %d, %d, %i, %i,0x%s, 0x%s, 0x%s): stub\n",
418 This, wine_dbgstr_longlong(ref_time), voice_id, channel_group, channel, dwDLId, prPitch, vrVolume,
419 wine_dbgstr_longlong(stVoiceStart), wine_dbgstr_longlong(stLoopStart), wine_dbgstr_longlong(stLoopEnd));
421 return S_OK;
424 static HRESULT WINAPI IDirectMusicSynth8Impl_StopVoice(IDirectMusicSynth8 *iface,
425 REFERENCE_TIME ref_time, DWORD voice_id)
427 IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
429 FIXME("(%p)->(0x%s, %d): stub\n", This, wine_dbgstr_longlong(ref_time), voice_id);
431 return S_OK;
434 static HRESULT WINAPI IDirectMusicSynth8Impl_GetVoiceState(IDirectMusicSynth8 *iface,
435 DWORD dwVoice[], DWORD cbVoice, DMUS_VOICE_STATE dwVoiceState[])
437 IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
439 FIXME("(%p)->(%p, %d, %p): stub\n", This, dwVoice, cbVoice, dwVoiceState);
441 return S_OK;
444 static HRESULT WINAPI IDirectMusicSynth8Impl_Refresh(IDirectMusicSynth8 *iface, DWORD download_id,
445 DWORD flags)
447 IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
449 FIXME("(%p)->(%d, %d): stub\n", This, download_id, flags);
451 return S_OK;
454 static HRESULT WINAPI IDirectMusicSynth8Impl_AssignChannelToBuses(IDirectMusicSynth8 *iface,
455 DWORD channel_group, DWORD channel, DWORD *pdwBuses, DWORD cBuses)
457 IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
459 FIXME("(%p)->(%d, %d, %p, %d): stub\n", This, channel_group, channel, pdwBuses, cBuses);
461 return S_OK;
464 static const IDirectMusicSynth8Vtbl DirectMusicSynth8_Vtbl = {
465 IDirectMusicSynth8Impl_QueryInterface,
466 IDirectMusicSynth8Impl_AddRef,
467 IDirectMusicSynth8Impl_Release,
468 IDirectMusicSynth8Impl_Open,
469 IDirectMusicSynth8Impl_Close,
470 IDirectMusicSynth8Impl_SetNumChannelGroups,
471 IDirectMusicSynth8Impl_Download,
472 IDirectMusicSynth8Impl_Unload,
473 IDirectMusicSynth8Impl_PlayBuffer,
474 IDirectMusicSynth8Impl_GetRunningStats,
475 IDirectMusicSynth8Impl_GetPortCaps,
476 IDirectMusicSynth8Impl_SetMasterClock,
477 IDirectMusicSynth8Impl_GetLatencyClock,
478 IDirectMusicSynth8Impl_Activate,
479 IDirectMusicSynth8Impl_SetSynthSink,
480 IDirectMusicSynth8Impl_Render,
481 IDirectMusicSynth8Impl_SetChannelPriority,
482 IDirectMusicSynth8Impl_GetChannelPriority,
483 IDirectMusicSynth8Impl_GetFormat,
484 IDirectMusicSynth8Impl_GetAppend,
485 IDirectMusicSynth8Impl_PlayVoice,
486 IDirectMusicSynth8Impl_StopVoice,
487 IDirectMusicSynth8Impl_GetVoiceState,
488 IDirectMusicSynth8Impl_Refresh,
489 IDirectMusicSynth8Impl_AssignChannelToBuses
492 static inline IDirectMusicSynth8Impl *impl_from_IKsControl(IKsControl *iface)
494 return CONTAINING_RECORD(iface, IDirectMusicSynth8Impl, IKsControl_iface);
497 static HRESULT WINAPI DMSynthImpl_IKsControl_QueryInterface(IKsControl* iface, REFIID riid, LPVOID *ppobj)
499 IDirectMusicSynth8Impl *This = impl_from_IKsControl(iface);
501 return IDirectMusicSynth8Impl_QueryInterface(&This->IDirectMusicSynth8_iface, riid, ppobj);
504 static ULONG WINAPI DMSynthImpl_IKsControl_AddRef(IKsControl* iface)
506 IDirectMusicSynth8Impl *This = impl_from_IKsControl(iface);
508 return IDirectMusicSynth8Impl_AddRef(&This->IDirectMusicSynth8_iface);
511 static ULONG WINAPI DMSynthImpl_IKsControl_Release(IKsControl* iface)
513 IDirectMusicSynth8Impl *This = impl_from_IKsControl(iface);
515 return IDirectMusicSynth8Impl_Release(&This->IDirectMusicSynth8_iface);
518 static HRESULT WINAPI DMSynthImpl_IKsControl_KsProperty(IKsControl* iface, PKSPROPERTY Property, ULONG PropertyLength, LPVOID PropertyData,
519 ULONG DataLength, ULONG* BytesReturned)
521 TRACE("(%p)->(%p, %u, %p, %u, %p)\n", iface, Property, PropertyLength, PropertyData, DataLength, BytesReturned);
523 TRACE("Property = %s - %u - %u\n", debugstr_guid(&Property->u.s.Set), Property->u.s.Id, Property->u.s.Flags);
525 if (Property->u.s.Flags != KSPROPERTY_TYPE_GET)
527 FIXME("Property flags %u not yet supported\n", Property->u.s.Flags);
528 return S_FALSE;
531 if (DataLength < sizeof(DWORD))
532 return E_NOT_SUFFICIENT_BUFFER;
534 if (IsEqualGUID(&Property->u.s.Set, &GUID_DMUS_PROP_INSTRUMENT2))
536 *(DWORD*)PropertyData = TRUE;
537 *BytesReturned = sizeof(DWORD);
539 else if (IsEqualGUID(&Property->u.s.Set, &GUID_DMUS_PROP_DLS2))
541 *(DWORD*)PropertyData = TRUE;
542 *BytesReturned = sizeof(DWORD);
544 else if (IsEqualGUID(&Property->u.s.Set, &GUID_DMUS_PROP_GM_Hardware))
546 *(DWORD*)PropertyData = FALSE;
547 *BytesReturned = sizeof(DWORD);
549 else if (IsEqualGUID(&Property->u.s.Set, &GUID_DMUS_PROP_GS_Hardware))
551 *(DWORD*)PropertyData = FALSE;
552 *BytesReturned = sizeof(DWORD);
554 else if (IsEqualGUID(&Property->u.s.Set, &GUID_DMUS_PROP_XG_Hardware))
556 *(DWORD*)PropertyData = FALSE;
557 *BytesReturned = sizeof(DWORD);
559 else
561 FIXME("Unknown property %s\n", debugstr_guid(&Property->u.s.Set));
562 *(DWORD*)PropertyData = FALSE;
563 *BytesReturned = sizeof(DWORD);
566 return S_OK;
569 static HRESULT WINAPI DMSynthImpl_IKsControl_KsMethod(IKsControl* iface, PKSMETHOD Method, ULONG MethodLength, LPVOID MethodData,
570 ULONG DataLength, ULONG* BytesReturned)
572 FIXME("(%p)->(%p, %u, %p, %u, %p): stub\n", iface, Method, MethodLength, MethodData, DataLength, BytesReturned);
574 return E_NOTIMPL;
577 static HRESULT WINAPI DMSynthImpl_IKsControl_KsEvent(IKsControl* iface, PKSEVENT Event, ULONG EventLength, LPVOID EventData,
578 ULONG DataLength, ULONG* BytesReturned)
580 FIXME("(%p)->(%p, %u, %p, %u, %p): stub\n", iface, Event, EventLength, EventData, DataLength, BytesReturned);
582 return E_NOTIMPL;
586 static const IKsControlVtbl DMSynthImpl_IKsControl_Vtbl = {
587 DMSynthImpl_IKsControl_QueryInterface,
588 DMSynthImpl_IKsControl_AddRef,
589 DMSynthImpl_IKsControl_Release,
590 DMSynthImpl_IKsControl_KsProperty,
591 DMSynthImpl_IKsControl_KsMethod,
592 DMSynthImpl_IKsControl_KsEvent
595 /* for ClassFactory */
596 HRESULT WINAPI DMUSIC_CreateDirectMusicSynthImpl(REFIID riid, void **ppobj)
598 IDirectMusicSynth8Impl *obj;
599 HRESULT hr;
601 TRACE("(%s, %p)\n", debugstr_guid(riid), ppobj);
603 obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*obj));
604 if (NULL == obj) {
605 *ppobj = NULL;
606 return E_OUTOFMEMORY;
608 obj->IDirectMusicSynth8_iface.lpVtbl = &DirectMusicSynth8_Vtbl;
609 obj->IKsControl_iface.lpVtbl = &DMSynthImpl_IKsControl_Vtbl;
610 obj->ref = 1;
611 /* fill in caps */
612 obj->pCaps.dwSize = sizeof(DMUS_PORTCAPS);
613 obj->pCaps.dwFlags = DMUS_PC_DLS | DMUS_PC_SOFTWARESYNTH | DMUS_PC_DIRECTSOUND | DMUS_PC_DLS2 | DMUS_PC_AUDIOPATH | DMUS_PC_WAVE;
614 obj->pCaps.guidPort = CLSID_DirectMusicSynth;
615 obj->pCaps.dwClass = DMUS_PC_OUTPUTCLASS;
616 obj->pCaps.dwType = DMUS_PORT_USER_MODE_SYNTH;
617 obj->pCaps.dwMemorySize = DMUS_PC_SYSTEMMEMORY;
618 obj->pCaps.dwMaxChannelGroups = 1000;
619 obj->pCaps.dwMaxVoices = 1000;
620 obj->pCaps.dwMaxAudioChannels = 2;
621 obj->pCaps.dwEffectFlags = DMUS_EFFECT_REVERB;
622 lstrcpyW(obj->pCaps.wszDescription, L"Microsoft Synthesizer");
624 DMSYNTH_LockModule();
625 hr = IDirectMusicSynth8_QueryInterface(&obj->IDirectMusicSynth8_iface, riid, ppobj);
626 IDirectMusicSynth8_Release(&obj->IDirectMusicSynth8_iface);
628 return hr;