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
24 #define NONAMELESSUNION
25 #define NONAMELESSSTRUCT
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
,
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
);
55 else if (IsEqualIID(riid
, &IID_IKsControl
))
57 IUnknown_AddRef(iface
);
58 *ret_iface
= &This
->IKsControl_iface
;
64 WARN("(%p)->(%s, %p): not found\n", iface
, debugstr_dmguid(riid
), ret_iface
);
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 = %lu\n", This
, 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 = %lu\n", This
, ref
);
87 if (This
->latency_clock
)
88 IReferenceClock_Release(This
->latency_clock
);
89 HeapFree(GetProcessHeap(), 0, This
);
90 DMSYNTH_UnlockModule();
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
);
107 static HRESULT WINAPI
IDirectMusicSynth8Impl_Close(IDirectMusicSynth8
*iface
)
109 IDirectMusicSynth8Impl
*This
= impl_from_IDirectMusicSynth8(iface
);
111 FIXME("(%p)->(): stub\n", This
);
116 static HRESULT WINAPI
IDirectMusicSynth8Impl_SetNumChannelGroups(IDirectMusicSynth8
*iface
,
119 IDirectMusicSynth8Impl
*This
= impl_from_IDirectMusicSynth8(iface
);
121 FIXME("(%p, %ld): stub\n", This
, groups
);
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
)
142 if (TRACE_ON(dmsynth
))
144 TRACE("Dump DMUS_DOWNLOADINFO struct:\n");
145 TRACE(" - dwDLType = %lu\n", info
->dwDLType
);
146 TRACE(" - dwDLId = %lu\n", info
->dwDLId
);
147 TRACE(" - dwNumOffsetTableEntries = %lu\n", info
->dwNumOffsetTableEntries
);
148 TRACE(" - cbSize = %lu\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 = %lu\n", wave
->ulFirstExtCkIdx
);
180 TRACE(" - ulCopyrightIdx = %lu\n", wave
->ulCopyrightIdx
);
181 TRACE(" - ulWaveDataIdx = %lu\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 = %lu\n", wave
->WaveformatEx
.nSamplesPerSec
);
186 TRACE(" - nAvgBytesPerSec = %lu\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 %lu 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 = %lu\n", instrument
->ulPatch
);
212 TRACE(" - ulFirstRegionIdx = %lu\n", instrument
->ulFirstRegionIdx
);
213 TRACE(" - ulGlobalArtIdx = %lu\n", instrument
->ulGlobalArtIdx
);
214 TRACE(" - ulFirstExtCkIdx = %lu\n", instrument
->ulFirstExtCkIdx
);
215 TRACE(" - ulCopyrightIdx = %lu\n", instrument
->ulCopyrightIdx
);
216 TRACE(" - ulFlags = %lu\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
;
231 DMUS_REGION
*region
= (DMUS_REGION
*)(buffer
+ offsets
[region_idx
]);
233 region_idx
= region
->ulNextRegionIdx
;
238 TRACE("Number of regions = %lu\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");
254 WARN("Unknown download type %lu\n", info
->dwDLType
);
255 return DMUS_E_UNKNOWNDOWNLOAD
;
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
);
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, %lu): stub\n", This
, wine_dbgstr_longlong(rt
), buffer
, size
);
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
);
291 static HRESULT WINAPI
IDirectMusicSynth8Impl_GetPortCaps(IDirectMusicSynth8
*iface
,
294 IDirectMusicSynth8Impl
*This
= impl_from_IDirectMusicSynth8(iface
);
296 TRACE("(%p)->(%p)\n", This
, caps
);
298 if (!caps
|| caps
->dwSize
< sizeof(*caps
))
306 static HRESULT WINAPI
IDirectMusicSynth8Impl_SetMasterClock(IDirectMusicSynth8
*iface
,
307 IReferenceClock
*clock
)
309 IDirectMusicSynth8Impl
*This
= impl_from_IDirectMusicSynth8(iface
);
311 TRACE("(%p)->(%p)\n", This
, clock
);
314 return DMUS_E_NOSYNTHSINK
;
316 return IDirectMusicSynthSink_SetMasterClock(This
->sink
, clock
);
319 static HRESULT WINAPI
IDirectMusicSynth8Impl_GetLatencyClock(IDirectMusicSynth8
*iface
,
320 IReferenceClock
**clock
)
322 IDirectMusicSynth8Impl
*This
= impl_from_IDirectMusicSynth8(iface
);
324 TRACE("(%p)->(%p)\n", iface
, clock
);
330 return DMUS_E_NOSYNTHSINK
;
332 *clock
= This
->latency_clock
;
333 IReferenceClock_AddRef(This
->latency_clock
);
338 static HRESULT WINAPI
IDirectMusicSynth8Impl_Activate(IDirectMusicSynth8
*iface
, BOOL enable
)
340 IDirectMusicSynth8Impl
*This
= impl_from_IDirectMusicSynth8(iface
);
343 TRACE("(%p)->(%d)\n", This
, enable
);
346 return DMUS_E_NOSYNTHSINK
;
348 if (enable
== This
->active
) {
350 return DMUS_E_SYNTHACTIVE
;
355 if ((hr
= IDirectMusicSynthSink_Activate(This
->sink
, enable
)) != S_OK
) {
356 if (hr
== DMUS_E_SYNTHACTIVE
|| hr
== S_FALSE
)
357 WARN("Synth and sink active state out of sync. Fixing.\n");
362 This
->active
= enable
;
367 static HRESULT WINAPI
IDirectMusicSynth8Impl_SetSynthSink(IDirectMusicSynth8
*iface
,
368 IDirectMusicSynthSink
*sink
)
370 IDirectMusicSynth8Impl
*This
= impl_from_IDirectMusicSynth8(iface
);
373 TRACE("(%p)->(%p)\n", iface
, sink
);
375 if (sink
== This
->sink
)
378 if (!sink
|| This
->sink
) {
379 /* Disconnect the sink */
380 if (This
->latency_clock
)
381 IReferenceClock_Release(This
->latency_clock
);
382 IDirectMusicSynthSink_Release(This
->sink
);
389 IDirectMusicSynthSink_AddRef(This
->sink
);
390 if (FAILED(hr
= IDirectMusicSynthSink_Init(sink
, (IDirectMusicSynth
*)iface
)))
392 return IDirectMusicSynthSink_GetLatencyClock(sink
, &This
->latency_clock
);
395 static HRESULT WINAPI
IDirectMusicSynth8Impl_Render(IDirectMusicSynth8
*iface
, short *buffer
,
396 DWORD length
, LONGLONG position
)
398 IDirectMusicSynth8Impl
*This
= impl_from_IDirectMusicSynth8(iface
);
400 FIXME("(%p, %p, %ld, 0x%s): stub\n", This
, buffer
, length
, wine_dbgstr_longlong(position
));
405 static HRESULT WINAPI
IDirectMusicSynth8Impl_SetChannelPriority(IDirectMusicSynth8
*iface
,
406 DWORD channel_group
, DWORD channel
, DWORD priority
)
408 /* IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface); */
410 /* Silenced because of too many messages - 1000 groups * 16 channels ;=) */
411 /* FIXME("(%p)->(%ld, %ld, %ld): stub\n", This, channel_group, channel, priority); */
416 static HRESULT WINAPI
IDirectMusicSynth8Impl_GetChannelPriority(IDirectMusicSynth8
*iface
,
417 DWORD channel_group
, DWORD channel
, DWORD
*priority
)
419 IDirectMusicSynth8Impl
*This
= impl_from_IDirectMusicSynth8(iface
);
421 FIXME("(%p, %ld, %ld, %p): stub\n", This
, channel_group
, channel
, priority
);
426 static HRESULT WINAPI
IDirectMusicSynth8Impl_GetFormat(IDirectMusicSynth8
*iface
,
427 WAVEFORMATEX
*wave_format
, DWORD
*wave_format_size
)
429 IDirectMusicSynth8Impl
*This
= impl_from_IDirectMusicSynth8(iface
);
431 FIXME("(%p)->(%p, %p): stub\n", This
, wave_format
, wave_format_size
);
436 static HRESULT WINAPI
IDirectMusicSynth8Impl_GetAppend(IDirectMusicSynth8
*iface
, DWORD
*append
)
438 TRACE("(%p)->(%p)\n", iface
, append
);
440 /* We don't need extra space at the end of buffers passed to us for now */
446 /* IDirectMusicSynth8Impl IDirectMusicSynth8 part: */
447 static HRESULT WINAPI
IDirectMusicSynth8Impl_PlayVoice(IDirectMusicSynth8
*iface
,
448 REFERENCE_TIME ref_time
, DWORD voice_id
, DWORD channel_group
, DWORD channel
, DWORD dwDLId
,
449 LONG prPitch
, LONG vrVolume
, SAMPLE_TIME stVoiceStart
, SAMPLE_TIME stLoopStart
,
450 SAMPLE_TIME stLoopEnd
)
452 IDirectMusicSynth8Impl
*This
= impl_from_IDirectMusicSynth8(iface
);
454 FIXME("(%p, 0x%s, %ld, %ld, %ld, %ld, %li, %li, 0x%s, 0x%s, 0x%s): stub\n",
455 This
, wine_dbgstr_longlong(ref_time
), voice_id
, channel_group
, channel
, dwDLId
, prPitch
, vrVolume
,
456 wine_dbgstr_longlong(stVoiceStart
), wine_dbgstr_longlong(stLoopStart
), wine_dbgstr_longlong(stLoopEnd
));
461 static HRESULT WINAPI
IDirectMusicSynth8Impl_StopVoice(IDirectMusicSynth8
*iface
,
462 REFERENCE_TIME ref_time
, DWORD voice_id
)
464 IDirectMusicSynth8Impl
*This
= impl_from_IDirectMusicSynth8(iface
);
466 FIXME("(%p, 0x%s, %ld): stub\n", This
, wine_dbgstr_longlong(ref_time
), voice_id
);
471 static HRESULT WINAPI
IDirectMusicSynth8Impl_GetVoiceState(IDirectMusicSynth8
*iface
,
472 DWORD dwVoice
[], DWORD cbVoice
, DMUS_VOICE_STATE dwVoiceState
[])
474 IDirectMusicSynth8Impl
*This
= impl_from_IDirectMusicSynth8(iface
);
476 FIXME("(%p, %p, %ld, %p): stub\n", This
, dwVoice
, cbVoice
, dwVoiceState
);
481 static HRESULT WINAPI
IDirectMusicSynth8Impl_Refresh(IDirectMusicSynth8
*iface
, DWORD download_id
,
484 IDirectMusicSynth8Impl
*This
= impl_from_IDirectMusicSynth8(iface
);
486 FIXME("(%p, %ld, %ld): stub\n", This
, download_id
, flags
);
491 static HRESULT WINAPI
IDirectMusicSynth8Impl_AssignChannelToBuses(IDirectMusicSynth8
*iface
,
492 DWORD channel_group
, DWORD channel
, DWORD
*pdwBuses
, DWORD cBuses
)
494 IDirectMusicSynth8Impl
*This
= impl_from_IDirectMusicSynth8(iface
);
496 FIXME("(%p, %ld, %ld, %p, %ld): stub\n", This
, channel_group
, channel
, pdwBuses
, cBuses
);
501 static const IDirectMusicSynth8Vtbl DirectMusicSynth8_Vtbl
= {
502 IDirectMusicSynth8Impl_QueryInterface
,
503 IDirectMusicSynth8Impl_AddRef
,
504 IDirectMusicSynth8Impl_Release
,
505 IDirectMusicSynth8Impl_Open
,
506 IDirectMusicSynth8Impl_Close
,
507 IDirectMusicSynth8Impl_SetNumChannelGroups
,
508 IDirectMusicSynth8Impl_Download
,
509 IDirectMusicSynth8Impl_Unload
,
510 IDirectMusicSynth8Impl_PlayBuffer
,
511 IDirectMusicSynth8Impl_GetRunningStats
,
512 IDirectMusicSynth8Impl_GetPortCaps
,
513 IDirectMusicSynth8Impl_SetMasterClock
,
514 IDirectMusicSynth8Impl_GetLatencyClock
,
515 IDirectMusicSynth8Impl_Activate
,
516 IDirectMusicSynth8Impl_SetSynthSink
,
517 IDirectMusicSynth8Impl_Render
,
518 IDirectMusicSynth8Impl_SetChannelPriority
,
519 IDirectMusicSynth8Impl_GetChannelPriority
,
520 IDirectMusicSynth8Impl_GetFormat
,
521 IDirectMusicSynth8Impl_GetAppend
,
522 IDirectMusicSynth8Impl_PlayVoice
,
523 IDirectMusicSynth8Impl_StopVoice
,
524 IDirectMusicSynth8Impl_GetVoiceState
,
525 IDirectMusicSynth8Impl_Refresh
,
526 IDirectMusicSynth8Impl_AssignChannelToBuses
529 static inline IDirectMusicSynth8Impl
*impl_from_IKsControl(IKsControl
*iface
)
531 return CONTAINING_RECORD(iface
, IDirectMusicSynth8Impl
, IKsControl_iface
);
534 static HRESULT WINAPI
DMSynthImpl_IKsControl_QueryInterface(IKsControl
* iface
, REFIID riid
, LPVOID
*ppobj
)
536 IDirectMusicSynth8Impl
*This
= impl_from_IKsControl(iface
);
538 return IDirectMusicSynth8Impl_QueryInterface(&This
->IDirectMusicSynth8_iface
, riid
, ppobj
);
541 static ULONG WINAPI
DMSynthImpl_IKsControl_AddRef(IKsControl
* iface
)
543 IDirectMusicSynth8Impl
*This
= impl_from_IKsControl(iface
);
545 return IDirectMusicSynth8Impl_AddRef(&This
->IDirectMusicSynth8_iface
);
548 static ULONG WINAPI
DMSynthImpl_IKsControl_Release(IKsControl
* iface
)
550 IDirectMusicSynth8Impl
*This
= impl_from_IKsControl(iface
);
552 return IDirectMusicSynth8Impl_Release(&This
->IDirectMusicSynth8_iface
);
555 static HRESULT WINAPI
DMSynthImpl_IKsControl_KsProperty(IKsControl
* iface
, PKSPROPERTY Property
, ULONG PropertyLength
, LPVOID PropertyData
,
556 ULONG DataLength
, ULONG
* BytesReturned
)
558 TRACE("(%p, %p, %lu, %p, %lu, %p)\n", iface
, Property
, PropertyLength
, PropertyData
, DataLength
, BytesReturned
);
560 TRACE("Property = %s - %lu - %lu\n", debugstr_guid(&Property
->u
.s
.Set
), Property
->u
.s
.Id
, Property
->u
.s
.Flags
);
562 if (Property
->u
.s
.Flags
!= KSPROPERTY_TYPE_GET
)
564 FIXME("Property flags %lu not yet supported\n", Property
->u
.s
.Flags
);
568 if (DataLength
< sizeof(DWORD
))
569 return E_NOT_SUFFICIENT_BUFFER
;
571 if (IsEqualGUID(&Property
->u
.s
.Set
, &GUID_DMUS_PROP_INSTRUMENT2
))
573 *(DWORD
*)PropertyData
= TRUE
;
574 *BytesReturned
= sizeof(DWORD
);
576 else if (IsEqualGUID(&Property
->u
.s
.Set
, &GUID_DMUS_PROP_DLS2
))
578 *(DWORD
*)PropertyData
= TRUE
;
579 *BytesReturned
= sizeof(DWORD
);
581 else if (IsEqualGUID(&Property
->u
.s
.Set
, &GUID_DMUS_PROP_GM_Hardware
))
583 *(DWORD
*)PropertyData
= FALSE
;
584 *BytesReturned
= sizeof(DWORD
);
586 else if (IsEqualGUID(&Property
->u
.s
.Set
, &GUID_DMUS_PROP_GS_Hardware
))
588 *(DWORD
*)PropertyData
= FALSE
;
589 *BytesReturned
= sizeof(DWORD
);
591 else if (IsEqualGUID(&Property
->u
.s
.Set
, &GUID_DMUS_PROP_XG_Hardware
))
593 *(DWORD
*)PropertyData
= FALSE
;
594 *BytesReturned
= sizeof(DWORD
);
598 FIXME("Unknown property %s\n", debugstr_guid(&Property
->u
.s
.Set
));
599 *(DWORD
*)PropertyData
= FALSE
;
600 *BytesReturned
= sizeof(DWORD
);
606 static HRESULT WINAPI
DMSynthImpl_IKsControl_KsMethod(IKsControl
* iface
, PKSMETHOD Method
, ULONG MethodLength
, LPVOID MethodData
,
607 ULONG DataLength
, ULONG
* BytesReturned
)
609 FIXME("(%p, %p, %lu, %p, %lu, %p): stub\n", iface
, Method
, MethodLength
, MethodData
, DataLength
, BytesReturned
);
614 static HRESULT WINAPI
DMSynthImpl_IKsControl_KsEvent(IKsControl
* iface
, PKSEVENT Event
, ULONG EventLength
, LPVOID EventData
,
615 ULONG DataLength
, ULONG
* BytesReturned
)
617 FIXME("(%p, %p, %lu, %p, %lu, %p): stub\n", iface
, Event
, EventLength
, EventData
, DataLength
, BytesReturned
);
623 static const IKsControlVtbl DMSynthImpl_IKsControl_Vtbl
= {
624 DMSynthImpl_IKsControl_QueryInterface
,
625 DMSynthImpl_IKsControl_AddRef
,
626 DMSynthImpl_IKsControl_Release
,
627 DMSynthImpl_IKsControl_KsProperty
,
628 DMSynthImpl_IKsControl_KsMethod
,
629 DMSynthImpl_IKsControl_KsEvent
632 /* for ClassFactory */
633 HRESULT WINAPI
DMUSIC_CreateDirectMusicSynthImpl(REFIID riid
, void **ppobj
)
635 IDirectMusicSynth8Impl
*obj
;
638 TRACE("(%s, %p)\n", debugstr_guid(riid
), ppobj
);
640 obj
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*obj
));
643 return E_OUTOFMEMORY
;
645 obj
->IDirectMusicSynth8_iface
.lpVtbl
= &DirectMusicSynth8_Vtbl
;
646 obj
->IKsControl_iface
.lpVtbl
= &DMSynthImpl_IKsControl_Vtbl
;
649 obj
->caps
.dwSize
= sizeof(DMUS_PORTCAPS
);
650 obj
->caps
.dwFlags
= DMUS_PC_DLS
| DMUS_PC_SOFTWARESYNTH
| DMUS_PC_DIRECTSOUND
| DMUS_PC_DLS2
| DMUS_PC_AUDIOPATH
| DMUS_PC_WAVE
;
651 obj
->caps
.guidPort
= CLSID_DirectMusicSynth
;
652 obj
->caps
.dwClass
= DMUS_PC_OUTPUTCLASS
;
653 obj
->caps
.dwType
= DMUS_PORT_USER_MODE_SYNTH
;
654 obj
->caps
.dwMemorySize
= DMUS_PC_SYSTEMMEMORY
;
655 obj
->caps
.dwMaxChannelGroups
= 1000;
656 obj
->caps
.dwMaxVoices
= 1000;
657 obj
->caps
.dwMaxAudioChannels
= 2;
658 obj
->caps
.dwEffectFlags
= DMUS_EFFECT_REVERB
;
659 lstrcpyW(obj
->caps
.wszDescription
, L
"Microsoft Synthesizer");
661 DMSYNTH_LockModule();
662 hr
= IDirectMusicSynth8_QueryInterface(&obj
->IDirectMusicSynth8_iface
, riid
, ppobj
);
663 IDirectMusicSynth8_Release(&obj
->IDirectMusicSynth8_iface
);