2012-05-03 23:05:51 +02:00
|
|
|
/*
|
|
|
|
* IDirectMusicSynth8 Implementation
|
2003-04-08 23:42:00 +02:00
|
|
|
*
|
2004-01-20 01:21:40 +01:00
|
|
|
* Copyright (C) 2003-2004 Rok Mandeljc
|
2012-09-21 15:44:37 +02:00
|
|
|
* Copyright (C) 2012 Christian Costa
|
2003-04-08 23:42:00 +02:00
|
|
|
*
|
2007-05-30 12:54:07 +02:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2003-04-08 23:42:00 +02:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2007-05-30 12:54:07 +02:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2003-04-08 23:42:00 +02:00
|
|
|
*
|
2007-05-30 12:54:07 +02:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2003-04-08 23:42:00 +02:00
|
|
|
*/
|
|
|
|
|
2012-05-03 23:05:51 +02:00
|
|
|
#define COBJMACROS
|
|
|
|
|
2012-11-17 22:48:01 +01:00
|
|
|
#define NONAMELESSUNION
|
|
|
|
#define NONAMELESSSTRUCT
|
2012-05-03 23:05:51 +02:00
|
|
|
#include "objbase.h"
|
|
|
|
#include "initguid.h"
|
|
|
|
#include "dmksctrl.h"
|
|
|
|
|
2003-07-22 00:10:14 +02:00
|
|
|
#include "dmsynth_private.h"
|
2003-04-08 23:42:00 +02:00
|
|
|
|
2003-08-23 01:53:27 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dmsynth);
|
2003-04-08 23:42:00 +02:00
|
|
|
|
2012-04-30 11:43:17 +02:00
|
|
|
static inline IDirectMusicSynth8Impl *impl_from_IDirectMusicSynth8(IDirectMusicSynth8 *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, IDirectMusicSynth8Impl, IDirectMusicSynth8_iface);
|
|
|
|
}
|
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
/* IDirectMusicSynth8Impl IUnknown part: */
|
2020-01-26 21:51:35 +01:00
|
|
|
static HRESULT WINAPI IDirectMusicSynth8Impl_QueryInterface(IDirectMusicSynth8 *iface, REFIID riid,
|
|
|
|
void **ret_iface)
|
2012-04-30 11:43:17 +02:00
|
|
|
{
|
2012-05-11 08:18:42 +02:00
|
|
|
IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
|
2012-04-30 11:43:17 +02:00
|
|
|
|
2012-05-11 08:18:42 +02:00
|
|
|
TRACE("(%p)->(%s, %p)\n", iface, debugstr_dmguid(riid), ret_iface);
|
2003-04-08 23:42:00 +02:00
|
|
|
|
2012-05-11 08:18:42 +02:00
|
|
|
if (IsEqualIID (riid, &IID_IUnknown) ||
|
|
|
|
IsEqualIID (riid, &IID_IDirectMusicSynth) ||
|
|
|
|
IsEqualIID (riid, &IID_IDirectMusicSynth8))
|
|
|
|
{
|
|
|
|
IUnknown_AddRef(iface);
|
|
|
|
*ret_iface = iface;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
else if (IsEqualIID(riid, &IID_IKsControl))
|
|
|
|
{
|
|
|
|
IUnknown_AddRef(iface);
|
|
|
|
*ret_iface = &This->IKsControl_iface;
|
|
|
|
return S_OK;
|
2012-05-03 23:05:51 +02:00
|
|
|
}
|
|
|
|
|
2012-05-11 08:18:42 +02:00
|
|
|
*ret_iface = NULL;
|
|
|
|
|
|
|
|
WARN("(%p)->(%s, %p): not found\n", iface, debugstr_dmguid(riid), ret_iface);
|
|
|
|
|
|
|
|
return E_NOINTERFACE;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2020-01-26 21:51:35 +01:00
|
|
|
static ULONG WINAPI IDirectMusicSynth8Impl_AddRef(IDirectMusicSynth8 *iface)
|
2012-04-30 11:43:17 +02:00
|
|
|
{
|
2012-05-10 07:53:34 +02:00
|
|
|
IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
|
|
|
|
ULONG ref = InterlockedIncrement(&This->ref);
|
2005-01-14 17:02:20 +01:00
|
|
|
|
2022-02-04 22:35:56 +01:00
|
|
|
TRACE("(%p): new ref = %lu\n", This, ref);
|
2005-01-14 17:02:20 +01:00
|
|
|
|
2012-05-10 07:53:34 +02:00
|
|
|
return ref;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2020-01-26 21:51:35 +01:00
|
|
|
static ULONG WINAPI IDirectMusicSynth8Impl_Release(IDirectMusicSynth8 *iface)
|
2012-04-30 11:43:17 +02:00
|
|
|
{
|
2012-05-10 07:53:34 +02:00
|
|
|
IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
|
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
2005-01-14 17:02:20 +01:00
|
|
|
|
2022-02-04 22:35:56 +01:00
|
|
|
TRACE("(%p): new ref = %lu\n", This, ref);
|
2005-01-14 17:02:20 +01:00
|
|
|
|
2012-05-10 07:53:34 +02:00
|
|
|
if (!ref) {
|
2022-01-19 18:48:49 +01:00
|
|
|
if (This->latency_clock)
|
|
|
|
IReferenceClock_Release(This->latency_clock);
|
2012-05-10 07:53:34 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
2016-07-19 09:53:07 +02:00
|
|
|
DMSYNTH_UnlockModule();
|
2012-05-10 07:53:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return ref;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
/* IDirectMusicSynth8Impl IDirectMusicSynth part: */
|
2022-02-08 00:51:59 +01:00
|
|
|
static HRESULT WINAPI IDirectMusicSynth8Impl_Open(IDirectMusicSynth8 *iface, DMUS_PORTPARAMS *params)
|
2012-04-30 11:43:17 +02:00
|
|
|
{
|
|
|
|
IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
|
2022-02-08 00:51:59 +01:00
|
|
|
BOOL modified = FALSE;
|
|
|
|
const DMUS_PORTPARAMS def = {
|
|
|
|
.dwValidParams = DMUS_PORTPARAMS_VOICES|DMUS_PORTPARAMS_CHANNELGROUPS|
|
|
|
|
DMUS_PORTPARAMS_AUDIOCHANNELS|DMUS_PORTPARAMS_SAMPLERATE|DMUS_PORTPARAMS_EFFECTS|
|
|
|
|
DMUS_PORTPARAMS_SHARE|DMUS_PORTPARAMS_FEATURES,
|
|
|
|
.dwSize = sizeof(def), .dwVoices = 32, .dwChannelGroups = 2, .dwAudioChannels = 2,
|
|
|
|
.dwSampleRate = 22050, .dwEffectFlags = DMUS_EFFECT_REVERB
|
|
|
|
};
|
|
|
|
|
|
|
|
TRACE("(%p, %p)\n", This, params);
|
|
|
|
|
|
|
|
if (This->open)
|
|
|
|
return DMUS_E_ALREADYOPEN;
|
|
|
|
if (params && params->dwSize < sizeof(DMUS_PORTPARAMS7))
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
This->open = TRUE;
|
|
|
|
|
|
|
|
if (!params) {
|
|
|
|
memcpy(&This->params, &def, sizeof(This->params));
|
|
|
|
return S_OK;
|
|
|
|
}
|
2012-04-30 11:43:17 +02:00
|
|
|
|
2022-02-08 00:51:59 +01:00
|
|
|
if (params->dwValidParams & DMUS_PORTPARAMS_VOICES && params->dwVoices) {
|
|
|
|
if (params->dwVoices > This->caps.dwMaxVoices) {
|
|
|
|
modified = TRUE;
|
|
|
|
params->dwVoices = This->caps.dwMaxVoices;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
params->dwVoices = def.dwVoices;
|
|
|
|
|
|
|
|
if (params->dwValidParams & DMUS_PORTPARAMS_CHANNELGROUPS && params->dwChannelGroups) {
|
|
|
|
if (params->dwChannelGroups > This->caps.dwMaxChannelGroups) {
|
|
|
|
modified = TRUE;
|
|
|
|
params->dwChannelGroups = This->caps.dwMaxChannelGroups;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
params->dwChannelGroups = def.dwChannelGroups;
|
|
|
|
|
|
|
|
if (params->dwValidParams & DMUS_PORTPARAMS_AUDIOCHANNELS && params->dwAudioChannels) {
|
|
|
|
if (params->dwAudioChannels > This->caps.dwMaxAudioChannels) {
|
|
|
|
modified = TRUE;
|
|
|
|
params->dwAudioChannels = This->caps.dwMaxAudioChannels;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
params->dwAudioChannels = def.dwAudioChannels;
|
|
|
|
|
|
|
|
if (params->dwValidParams & DMUS_PORTPARAMS_SAMPLERATE && params->dwSampleRate) {
|
|
|
|
if (params->dwSampleRate > 96000) {
|
|
|
|
modified = TRUE;
|
|
|
|
params->dwSampleRate = 96000;
|
|
|
|
} else if (params->dwSampleRate < 11025) {
|
|
|
|
modified = TRUE;
|
|
|
|
params->dwSampleRate = 11025;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
params->dwSampleRate = def.dwSampleRate;
|
|
|
|
|
|
|
|
if (params->dwValidParams & DMUS_PORTPARAMS_EFFECTS && params->dwEffectFlags != def.dwEffectFlags)
|
|
|
|
modified = TRUE;
|
|
|
|
params->dwEffectFlags = def.dwEffectFlags;
|
|
|
|
|
|
|
|
if (params->dwValidParams & DMUS_PORTPARAMS_SHARE && params->fShare)
|
|
|
|
modified = TRUE;
|
|
|
|
params->fShare = FALSE;
|
|
|
|
|
|
|
|
if (params->dwSize >= sizeof(params)) {
|
|
|
|
if (params->dwValidParams & DMUS_PORTPARAMS_FEATURES && params->dwFeatures) {
|
|
|
|
if (params->dwFeatures & ~(DMUS_PORT_FEATURE_AUDIOPATH|DMUS_PORT_FEATURE_STREAMING)) {
|
|
|
|
modified = TRUE;
|
|
|
|
params->dwFeatures &= DMUS_PORT_FEATURE_AUDIOPATH|DMUS_PORT_FEATURE_STREAMING;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
params->dwFeatures = def.dwFeatures;
|
|
|
|
params->dwValidParams = def.dwValidParams;
|
|
|
|
} else
|
|
|
|
params->dwValidParams = def.dwValidParams & ~DMUS_PORTPARAMS_FEATURES;
|
|
|
|
|
|
|
|
memcpy(&This->params, params, min(params->dwSize, sizeof(This->params)));
|
|
|
|
|
|
|
|
return modified ? S_FALSE : S_OK;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2020-01-26 21:51:35 +01:00
|
|
|
static HRESULT WINAPI IDirectMusicSynth8Impl_Close(IDirectMusicSynth8 *iface)
|
2012-04-30 11:43:17 +02:00
|
|
|
{
|
|
|
|
IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
|
|
|
|
|
2022-02-08 00:51:59 +01:00
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
|
|
|
if (!This->open)
|
|
|
|
return DMUS_E_ALREADYCLOSED;
|
|
|
|
|
|
|
|
This->open = FALSE;
|
2012-04-30 11:43:17 +02:00
|
|
|
|
|
|
|
return S_OK;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2020-01-26 21:51:35 +01:00
|
|
|
static HRESULT WINAPI IDirectMusicSynth8Impl_SetNumChannelGroups(IDirectMusicSynth8 *iface,
|
|
|
|
DWORD groups)
|
2012-04-30 11:43:17 +02:00
|
|
|
{
|
|
|
|
IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
|
|
|
|
|
2022-02-04 22:35:56 +01:00
|
|
|
FIXME("(%p, %ld): stub\n", This, groups);
|
2012-04-30 11:43:17 +02:00
|
|
|
|
|
|
|
return S_OK;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2020-01-26 21:51:35 +01:00
|
|
|
static HRESULT WINAPI IDirectMusicSynth8Impl_Download(IDirectMusicSynth8 *iface, HANDLE *hDownload,
|
|
|
|
void *data, BOOL *free)
|
2012-04-30 11:43:17 +02:00
|
|
|
{
|
|
|
|
IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
|
2013-01-07 22:17:30 +01:00
|
|
|
LPBYTE buffer = data;
|
2012-12-24 09:46:45 +01:00
|
|
|
DMUS_DOWNLOADINFO *info = (DMUS_DOWNLOADINFO*)buffer;
|
|
|
|
ULONG *offsets = ((DMUS_OFFSETTABLE*)(buffer + sizeof(DMUS_DOWNLOADINFO)))->ulOffsetTable;
|
|
|
|
LPBYTE object = buffer + sizeof(DMUS_DOWNLOADINFO) + info->dwNumOffsetTableEntries * sizeof(ULONG);
|
2012-04-30 11:43:17 +02:00
|
|
|
|
|
|
|
FIXME("(%p)->(%p, %p, %p): stub\n", This, hDownload, data, free);
|
|
|
|
|
2012-12-24 09:46:45 +01:00
|
|
|
/* FIXME: Currently we only dump data which is very useful to known how native dmusic behave and debug builtin dmusic */
|
|
|
|
|
2013-01-07 22:17:30 +01:00
|
|
|
if (!hDownload || !free)
|
2012-05-14 08:11:55 +02:00
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
if (TRACE_ON(dmsynth))
|
|
|
|
{
|
|
|
|
TRACE("Dump DMUS_DOWNLOADINFO struct:\n");
|
2022-02-04 22:35:56 +01:00
|
|
|
TRACE(" - dwDLType = %lu\n", info->dwDLType);
|
|
|
|
TRACE(" - dwDLId = %lu\n", info->dwDLId);
|
|
|
|
TRACE(" - dwNumOffsetTableEntries = %lu\n", info->dwNumOffsetTableEntries);
|
|
|
|
TRACE(" - cbSize = %lu\n", info->cbSize);
|
2012-05-14 08:11:55 +02:00
|
|
|
}
|
|
|
|
|
2016-05-29 12:42:45 +02:00
|
|
|
/* The struct should have at least one offset corresponding to the download object itself */
|
2012-12-24 09:46:45 +01:00
|
|
|
if (!info->dwNumOffsetTableEntries)
|
|
|
|
{
|
|
|
|
FIXME("Offset table is empty\n");
|
|
|
|
return DMUS_E_BADOFFSETTABLE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* First offset should point to the download object */
|
|
|
|
if ((buffer + offsets[0]) != object)
|
|
|
|
{
|
|
|
|
FIXME("Object is not at the beginning\n");
|
|
|
|
return DMUS_E_BADOFFSETTABLE;
|
|
|
|
}
|
|
|
|
|
2012-05-14 08:11:55 +02:00
|
|
|
if (info->dwDLType == DMUS_DOWNLOADINFO_INSTRUMENT)
|
|
|
|
{
|
|
|
|
FIXME("Download type DMUS_DOWNLOADINFO_INSTRUMENT not yet supported\n");
|
|
|
|
}
|
|
|
|
else if (info->dwDLType == DMUS_DOWNLOADINFO_WAVE)
|
|
|
|
{
|
2012-12-24 09:46:45 +01:00
|
|
|
DMUS_WAVE *wave = (DMUS_WAVE*)object;
|
|
|
|
DMUS_WAVEDATA *wave_data;
|
|
|
|
|
|
|
|
TRACE("Processing download type DMUS_DOWNLOADINFO_WAVE\n");
|
|
|
|
|
|
|
|
if (TRACE_ON(dmsynth))
|
|
|
|
{
|
|
|
|
TRACE("Dump DMUS_WAVE struct\n");
|
2022-02-04 22:35:56 +01:00
|
|
|
TRACE(" - ulFirstExtCkIdx = %lu\n", wave->ulFirstExtCkIdx);
|
|
|
|
TRACE(" - ulCopyrightIdx = %lu\n", wave->ulCopyrightIdx);
|
|
|
|
TRACE(" - ulWaveDataIdx = %lu\n", wave->ulWaveDataIdx);
|
2012-12-24 09:46:45 +01:00
|
|
|
TRACE(" - WaveformatEx:\n");
|
|
|
|
TRACE(" - wFormatTag = %u\n", wave->WaveformatEx.wFormatTag);
|
|
|
|
TRACE(" - nChannels = %u\n", wave->WaveformatEx.nChannels);
|
2022-02-04 22:35:56 +01:00
|
|
|
TRACE(" - nSamplesPerSec = %lu\n", wave->WaveformatEx.nSamplesPerSec);
|
|
|
|
TRACE(" - nAvgBytesPerSec = %lu\n", wave->WaveformatEx.nAvgBytesPerSec);
|
2012-12-24 09:46:45 +01:00
|
|
|
TRACE(" - nBlockAlign = %u\n", wave->WaveformatEx.nBlockAlign);
|
|
|
|
TRACE(" - wBitsPerSample = %u\n", wave->WaveformatEx.wBitsPerSample);
|
|
|
|
TRACE(" - cbSize = %u\n", wave->WaveformatEx.cbSize);
|
|
|
|
|
|
|
|
if (wave->ulCopyrightIdx)
|
|
|
|
{
|
|
|
|
DMUS_COPYRIGHT *copyright = (DMUS_COPYRIGHT*)(buffer + offsets[wave->ulCopyrightIdx]);
|
|
|
|
TRACE("Copyright = '%s'\n", (char*)copyright->byCopyright);
|
|
|
|
}
|
|
|
|
|
|
|
|
wave_data = (DMUS_WAVEDATA*)(buffer + offsets[wave->ulWaveDataIdx]);
|
2022-02-04 22:35:56 +01:00
|
|
|
TRACE("Found %lu bytes of wave data\n", wave_data->cbSize);
|
2012-12-24 09:46:45 +01:00
|
|
|
}
|
2012-05-14 08:11:55 +02:00
|
|
|
}
|
|
|
|
else if (info->dwDLType == DMUS_DOWNLOADINFO_INSTRUMENT2)
|
|
|
|
{
|
2012-12-24 09:46:45 +01:00
|
|
|
DMUS_INSTRUMENT *instrument = (DMUS_INSTRUMENT*)object;
|
|
|
|
ULONG nb_regions = 0;
|
|
|
|
|
|
|
|
TRACE("Processing download type DMUS_DOWNLOADINFO_INSTRUMENT2\n");
|
|
|
|
|
|
|
|
if (TRACE_ON(dmsynth))
|
|
|
|
{
|
|
|
|
TRACE("Dump DMUS_INSTRUMENT struct\n");
|
2022-02-04 22:35:56 +01:00
|
|
|
TRACE(" - ulPatch = %lu\n", instrument->ulPatch);
|
|
|
|
TRACE(" - ulFirstRegionIdx = %lu\n", instrument->ulFirstRegionIdx);
|
|
|
|
TRACE(" - ulGlobalArtIdx = %lu\n", instrument->ulGlobalArtIdx);
|
|
|
|
TRACE(" - ulFirstExtCkIdx = %lu\n", instrument->ulFirstExtCkIdx);
|
|
|
|
TRACE(" - ulCopyrightIdx = %lu\n", instrument->ulCopyrightIdx);
|
|
|
|
TRACE(" - ulFlags = %lu\n", instrument->ulFlags);
|
2012-12-24 09:46:45 +01:00
|
|
|
|
|
|
|
if (instrument->ulCopyrightIdx)
|
|
|
|
{
|
|
|
|
DMUS_COPYRIGHT *copyright = (DMUS_COPYRIGHT*)(buffer + offsets[instrument->ulCopyrightIdx]);
|
|
|
|
TRACE("Copyright = '%s'\n", (char*)copyright->byCopyright);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (instrument->ulFirstRegionIdx)
|
|
|
|
{
|
|
|
|
ULONG region_idx = instrument->ulFirstRegionIdx;
|
|
|
|
|
|
|
|
while (region_idx)
|
|
|
|
{
|
|
|
|
DMUS_REGION *region = (DMUS_REGION*)(buffer + offsets[region_idx]);
|
|
|
|
|
|
|
|
region_idx = region->ulNextRegionIdx;
|
|
|
|
nb_regions++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-04 22:35:56 +01:00
|
|
|
TRACE("Number of regions = %lu\n", nb_regions);
|
2012-05-14 08:11:55 +02:00
|
|
|
}
|
|
|
|
else if (info->dwDLType == DMUS_DOWNLOADINFO_WAVEARTICULATION)
|
|
|
|
{
|
|
|
|
FIXME("Download type DMUS_DOWNLOADINFO_WAVEARTICULATION not yet supported\n");
|
|
|
|
}
|
|
|
|
else if (info->dwDLType == DMUS_DOWNLOADINFO_STREAMINGWAVE)
|
|
|
|
{
|
|
|
|
FIXME("Download type DMUS_DOWNLOADINFO_STREAMINGWAVE not yet supported\n");
|
|
|
|
}
|
|
|
|
else if (info->dwDLType == DMUS_DOWNLOADINFO_ONESHOTWAVE)
|
|
|
|
{
|
|
|
|
FIXME("Download type DMUS_DOWNLOADINFO_ONESHOTWAVE not yet supported\n");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-02-04 22:35:56 +01:00
|
|
|
WARN("Unknown download type %lu\n", info->dwDLType);
|
2012-05-14 08:11:55 +02:00
|
|
|
return DMUS_E_UNKNOWNDOWNLOAD;
|
|
|
|
}
|
|
|
|
|
2012-04-30 11:43:17 +02:00
|
|
|
return S_OK;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2020-01-26 21:51:35 +01:00
|
|
|
static HRESULT WINAPI IDirectMusicSynth8Impl_Unload(IDirectMusicSynth8 *iface, HANDLE hDownload,
|
|
|
|
HRESULT (CALLBACK *lpFreeHandle)(HANDLE,HANDLE), HANDLE hUserData)
|
2012-04-30 11:43:17 +02:00
|
|
|
{
|
|
|
|
IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
|
|
|
|
|
|
|
|
FIXME("(%p)->(%p, %p, %p): stub\n", This, hDownload, lpFreeHandle, hUserData);
|
|
|
|
|
|
|
|
return S_OK;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2020-01-26 21:51:35 +01:00
|
|
|
static HRESULT WINAPI IDirectMusicSynth8Impl_PlayBuffer(IDirectMusicSynth8 *iface,
|
|
|
|
REFERENCE_TIME rt, BYTE *buffer, DWORD size)
|
2012-04-30 11:43:17 +02:00
|
|
|
{
|
|
|
|
IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
|
|
|
|
|
2022-02-04 22:35:56 +01:00
|
|
|
FIXME("(%p, 0x%s, %p, %lu): stub\n", This, wine_dbgstr_longlong(rt), buffer, size);
|
2012-04-30 11:43:17 +02:00
|
|
|
|
|
|
|
return S_OK;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2020-01-26 21:51:35 +01:00
|
|
|
static HRESULT WINAPI IDirectMusicSynth8Impl_GetRunningStats(IDirectMusicSynth8 *iface,
|
|
|
|
DMUS_SYNTHSTATS *stats)
|
2012-04-30 11:43:17 +02:00
|
|
|
{
|
|
|
|
IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
|
|
|
|
|
|
|
|
FIXME("(%p)->(%p): stub\n", This, stats);
|
|
|
|
|
|
|
|
return S_OK;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2020-01-26 21:51:35 +01:00
|
|
|
static HRESULT WINAPI IDirectMusicSynth8Impl_GetPortCaps(IDirectMusicSynth8 *iface,
|
|
|
|
DMUS_PORTCAPS *caps)
|
2012-04-30 11:43:17 +02:00
|
|
|
{
|
|
|
|
IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, caps);
|
|
|
|
|
2022-01-25 23:11:24 +01:00
|
|
|
if (!caps || caps->dwSize < sizeof(*caps))
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2022-01-19 18:48:49 +01:00
|
|
|
*caps = This->caps;
|
2012-04-30 11:43:17 +02:00
|
|
|
|
|
|
|
return S_OK;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2020-01-26 21:51:35 +01:00
|
|
|
static HRESULT WINAPI IDirectMusicSynth8Impl_SetMasterClock(IDirectMusicSynth8 *iface,
|
|
|
|
IReferenceClock *clock)
|
2012-04-30 11:43:17 +02:00
|
|
|
{
|
|
|
|
IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
|
|
|
|
|
2022-01-20 21:20:20 +01:00
|
|
|
TRACE("(%p)->(%p)\n", This, clock);
|
2012-04-30 11:43:17 +02:00
|
|
|
|
2022-01-20 21:20:20 +01:00
|
|
|
if (!This->sink)
|
|
|
|
return DMUS_E_NOSYNTHSINK;
|
|
|
|
|
|
|
|
return IDirectMusicSynthSink_SetMasterClock(This->sink, clock);
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2020-01-26 21:51:35 +01:00
|
|
|
static HRESULT WINAPI IDirectMusicSynth8Impl_GetLatencyClock(IDirectMusicSynth8 *iface,
|
|
|
|
IReferenceClock **clock)
|
2012-04-30 11:43:17 +02:00
|
|
|
{
|
|
|
|
IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
|
|
|
|
|
2012-05-03 23:05:33 +02:00
|
|
|
TRACE("(%p)->(%p)\n", iface, clock);
|
|
|
|
|
|
|
|
if (!clock)
|
|
|
|
return E_POINTER;
|
|
|
|
|
2022-01-19 18:48:47 +01:00
|
|
|
if (!This->sink)
|
2012-05-03 23:05:33 +02:00
|
|
|
return DMUS_E_NOSYNTHSINK;
|
2012-04-30 11:43:17 +02:00
|
|
|
|
2022-01-19 18:48:49 +01:00
|
|
|
*clock = This->latency_clock;
|
|
|
|
IReferenceClock_AddRef(This->latency_clock);
|
2012-04-30 11:43:17 +02:00
|
|
|
|
|
|
|
return S_OK;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2020-01-26 21:51:35 +01:00
|
|
|
static HRESULT WINAPI IDirectMusicSynth8Impl_Activate(IDirectMusicSynth8 *iface, BOOL enable)
|
2012-04-30 11:43:17 +02:00
|
|
|
{
|
|
|
|
IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
|
2022-01-19 18:48:48 +01:00
|
|
|
HRESULT hr;
|
2012-04-30 11:43:17 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%d)\n", This, enable);
|
|
|
|
|
2022-01-19 18:48:48 +01:00
|
|
|
if (!This->sink)
|
|
|
|
return DMUS_E_NOSYNTHSINK;
|
|
|
|
|
|
|
|
if (enable == This->active) {
|
|
|
|
if (enable)
|
|
|
|
return DMUS_E_SYNTHACTIVE;
|
|
|
|
else
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((hr = IDirectMusicSynthSink_Activate(This->sink, enable)) != S_OK) {
|
|
|
|
if (hr == DMUS_E_SYNTHACTIVE || hr == S_FALSE)
|
|
|
|
WARN("Synth and sink active state out of sync. Fixing.\n");
|
|
|
|
else
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
This->active = enable;
|
2012-04-30 11:43:17 +02:00
|
|
|
|
|
|
|
return S_OK;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2020-01-26 21:51:35 +01:00
|
|
|
static HRESULT WINAPI IDirectMusicSynth8Impl_SetSynthSink(IDirectMusicSynth8 *iface,
|
2022-01-19 18:48:47 +01:00
|
|
|
IDirectMusicSynthSink *sink)
|
2012-04-30 11:43:17 +02:00
|
|
|
{
|
|
|
|
IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
|
2022-01-19 18:48:50 +01:00
|
|
|
HRESULT hr;
|
2012-04-30 11:43:17 +02:00
|
|
|
|
2022-01-19 18:48:47 +01:00
|
|
|
TRACE("(%p)->(%p)\n", iface, sink);
|
2012-04-30 11:43:17 +02:00
|
|
|
|
2022-01-19 18:48:50 +01:00
|
|
|
if (sink == This->sink)
|
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
if (!sink || This->sink) {
|
|
|
|
/* Disconnect the sink */
|
|
|
|
if (This->latency_clock)
|
|
|
|
IReferenceClock_Release(This->latency_clock);
|
|
|
|
IDirectMusicSynthSink_Release(This->sink);
|
|
|
|
}
|
2012-04-30 11:43:17 +02:00
|
|
|
|
2022-01-19 18:48:50 +01:00
|
|
|
This->sink = sink;
|
|
|
|
if (!sink)
|
|
|
|
return S_OK;
|
2012-05-03 23:05:33 +02:00
|
|
|
|
2022-01-19 18:48:50 +01:00
|
|
|
IDirectMusicSynthSink_AddRef(This->sink);
|
|
|
|
if (FAILED(hr = IDirectMusicSynthSink_Init(sink, (IDirectMusicSynth *)iface)))
|
|
|
|
return hr;
|
|
|
|
return IDirectMusicSynthSink_GetLatencyClock(sink, &This->latency_clock);
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2020-01-26 21:51:35 +01:00
|
|
|
static HRESULT WINAPI IDirectMusicSynth8Impl_Render(IDirectMusicSynth8 *iface, short *buffer,
|
|
|
|
DWORD length, LONGLONG position)
|
2012-04-30 11:43:17 +02:00
|
|
|
{
|
|
|
|
IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
|
|
|
|
|
2022-02-04 22:35:56 +01:00
|
|
|
FIXME("(%p, %p, %ld, 0x%s): stub\n", This, buffer, length, wine_dbgstr_longlong(position));
|
2012-04-30 11:43:17 +02:00
|
|
|
|
|
|
|
return S_OK;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2020-01-26 21:51:35 +01:00
|
|
|
static HRESULT WINAPI IDirectMusicSynth8Impl_SetChannelPriority(IDirectMusicSynth8 *iface,
|
|
|
|
DWORD channel_group, DWORD channel, DWORD priority)
|
2012-04-30 11:43:17 +02:00
|
|
|
{
|
|
|
|
/* IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface); */
|
|
|
|
|
|
|
|
/* Silenced because of too many messages - 1000 groups * 16 channels ;=) */
|
|
|
|
/* FIXME("(%p)->(%ld, %ld, %ld): stub\n", This, channel_group, channel, priority); */
|
|
|
|
|
|
|
|
return S_OK;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2020-01-26 21:51:35 +01:00
|
|
|
static HRESULT WINAPI IDirectMusicSynth8Impl_GetChannelPriority(IDirectMusicSynth8 *iface,
|
|
|
|
DWORD channel_group, DWORD channel, DWORD *priority)
|
2012-04-30 11:43:17 +02:00
|
|
|
{
|
|
|
|
IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
|
|
|
|
|
2022-02-04 22:35:56 +01:00
|
|
|
FIXME("(%p, %ld, %ld, %p): stub\n", This, channel_group, channel, priority);
|
2012-04-30 11:43:17 +02:00
|
|
|
|
|
|
|
return S_OK;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2020-01-26 21:51:35 +01:00
|
|
|
static HRESULT WINAPI IDirectMusicSynth8Impl_GetFormat(IDirectMusicSynth8 *iface,
|
2022-02-22 00:49:56 +01:00
|
|
|
WAVEFORMATEX *format, DWORD *size)
|
2012-04-30 11:43:17 +02:00
|
|
|
{
|
|
|
|
IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
|
2022-02-22 00:49:56 +01:00
|
|
|
WAVEFORMATEX fmt;
|
2012-04-30 11:43:17 +02:00
|
|
|
|
2022-02-22 00:49:56 +01:00
|
|
|
TRACE("(%p, %p, %p)\n", This, format, size);
|
|
|
|
|
|
|
|
if (!size)
|
|
|
|
return E_POINTER;
|
|
|
|
if (!This->open)
|
|
|
|
return DMUS_E_SYNTHNOTCONFIGURED;
|
|
|
|
|
|
|
|
if (format) {
|
|
|
|
fmt.wFormatTag = WAVE_FORMAT_PCM;
|
|
|
|
fmt.nChannels = This->params.dwAudioChannels;
|
|
|
|
fmt.nSamplesPerSec = This->params.dwSampleRate;
|
|
|
|
fmt.wBitsPerSample = 16;
|
|
|
|
fmt.nBlockAlign = This->params.dwAudioChannels * fmt.wBitsPerSample / 8;
|
|
|
|
fmt.nAvgBytesPerSec = This->params.dwSampleRate * fmt.nBlockAlign;
|
|
|
|
fmt.cbSize = 0;
|
|
|
|
memcpy(format, &fmt, min(*size, sizeof(fmt)));
|
|
|
|
}
|
|
|
|
*size = sizeof(fmt);
|
2012-04-30 11:43:17 +02:00
|
|
|
|
|
|
|
return S_OK;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2020-01-26 21:51:35 +01:00
|
|
|
static HRESULT WINAPI IDirectMusicSynth8Impl_GetAppend(IDirectMusicSynth8 *iface, DWORD *append)
|
2012-04-30 11:43:17 +02:00
|
|
|
{
|
2012-05-14 08:11:46 +02:00
|
|
|
TRACE("(%p)->(%p)\n", iface, append);
|
2012-04-30 11:43:17 +02:00
|
|
|
|
2012-05-14 08:11:46 +02:00
|
|
|
/* We don't need extra space at the end of buffers passed to us for now */
|
|
|
|
*append = 0;
|
2012-04-30 11:43:17 +02:00
|
|
|
|
|
|
|
return S_OK;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
/* IDirectMusicSynth8Impl IDirectMusicSynth8 part: */
|
2020-01-26 21:51:35 +01:00
|
|
|
static HRESULT WINAPI IDirectMusicSynth8Impl_PlayVoice(IDirectMusicSynth8 *iface,
|
|
|
|
REFERENCE_TIME ref_time, DWORD voice_id, DWORD channel_group, DWORD channel, DWORD dwDLId,
|
|
|
|
LONG prPitch, LONG vrVolume, SAMPLE_TIME stVoiceStart, SAMPLE_TIME stLoopStart,
|
|
|
|
SAMPLE_TIME stLoopEnd)
|
2012-04-30 11:43:17 +02:00
|
|
|
{
|
|
|
|
IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
|
|
|
|
|
2022-02-04 22:35:56 +01:00
|
|
|
FIXME("(%p, 0x%s, %ld, %ld, %ld, %ld, %li, %li, 0x%s, 0x%s, 0x%s): stub\n",
|
2012-04-30 11:43:17 +02:00
|
|
|
This, wine_dbgstr_longlong(ref_time), voice_id, channel_group, channel, dwDLId, prPitch, vrVolume,
|
|
|
|
wine_dbgstr_longlong(stVoiceStart), wine_dbgstr_longlong(stLoopStart), wine_dbgstr_longlong(stLoopEnd));
|
|
|
|
|
|
|
|
return S_OK;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2020-01-26 21:51:35 +01:00
|
|
|
static HRESULT WINAPI IDirectMusicSynth8Impl_StopVoice(IDirectMusicSynth8 *iface,
|
|
|
|
REFERENCE_TIME ref_time, DWORD voice_id)
|
2012-04-30 11:43:17 +02:00
|
|
|
{
|
|
|
|
IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
|
|
|
|
|
2022-02-04 22:35:56 +01:00
|
|
|
FIXME("(%p, 0x%s, %ld): stub\n", This, wine_dbgstr_longlong(ref_time), voice_id);
|
2012-04-30 11:43:17 +02:00
|
|
|
|
|
|
|
return S_OK;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2020-01-26 21:51:35 +01:00
|
|
|
static HRESULT WINAPI IDirectMusicSynth8Impl_GetVoiceState(IDirectMusicSynth8 *iface,
|
|
|
|
DWORD dwVoice[], DWORD cbVoice, DMUS_VOICE_STATE dwVoiceState[])
|
2012-04-30 11:43:17 +02:00
|
|
|
{
|
|
|
|
IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
|
|
|
|
|
2022-02-04 22:35:56 +01:00
|
|
|
FIXME("(%p, %p, %ld, %p): stub\n", This, dwVoice, cbVoice, dwVoiceState);
|
2012-04-30 11:43:17 +02:00
|
|
|
|
|
|
|
return S_OK;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2020-01-26 21:51:35 +01:00
|
|
|
static HRESULT WINAPI IDirectMusicSynth8Impl_Refresh(IDirectMusicSynth8 *iface, DWORD download_id,
|
|
|
|
DWORD flags)
|
2012-04-30 11:43:17 +02:00
|
|
|
{
|
|
|
|
IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
|
|
|
|
|
2022-02-04 22:35:56 +01:00
|
|
|
FIXME("(%p, %ld, %ld): stub\n", This, download_id, flags);
|
2012-04-30 11:43:17 +02:00
|
|
|
|
|
|
|
return S_OK;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2020-01-26 21:51:35 +01:00
|
|
|
static HRESULT WINAPI IDirectMusicSynth8Impl_AssignChannelToBuses(IDirectMusicSynth8 *iface,
|
|
|
|
DWORD channel_group, DWORD channel, DWORD *pdwBuses, DWORD cBuses)
|
2012-04-30 11:43:17 +02:00
|
|
|
{
|
|
|
|
IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
|
|
|
|
|
2022-02-04 22:35:56 +01:00
|
|
|
FIXME("(%p, %ld, %ld, %p, %ld): stub\n", This, channel_group, channel, pdwBuses, cBuses);
|
2012-04-30 11:43:17 +02:00
|
|
|
|
|
|
|
return S_OK;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2005-06-01 21:57:42 +02:00
|
|
|
static const IDirectMusicSynth8Vtbl DirectMusicSynth8_Vtbl = {
|
2003-04-08 23:42:00 +02:00
|
|
|
IDirectMusicSynth8Impl_QueryInterface,
|
|
|
|
IDirectMusicSynth8Impl_AddRef,
|
|
|
|
IDirectMusicSynth8Impl_Release,
|
|
|
|
IDirectMusicSynth8Impl_Open,
|
|
|
|
IDirectMusicSynth8Impl_Close,
|
|
|
|
IDirectMusicSynth8Impl_SetNumChannelGroups,
|
|
|
|
IDirectMusicSynth8Impl_Download,
|
|
|
|
IDirectMusicSynth8Impl_Unload,
|
|
|
|
IDirectMusicSynth8Impl_PlayBuffer,
|
|
|
|
IDirectMusicSynth8Impl_GetRunningStats,
|
|
|
|
IDirectMusicSynth8Impl_GetPortCaps,
|
|
|
|
IDirectMusicSynth8Impl_SetMasterClock,
|
|
|
|
IDirectMusicSynth8Impl_GetLatencyClock,
|
|
|
|
IDirectMusicSynth8Impl_Activate,
|
|
|
|
IDirectMusicSynth8Impl_SetSynthSink,
|
|
|
|
IDirectMusicSynth8Impl_Render,
|
|
|
|
IDirectMusicSynth8Impl_SetChannelPriority,
|
|
|
|
IDirectMusicSynth8Impl_GetChannelPriority,
|
|
|
|
IDirectMusicSynth8Impl_GetFormat,
|
|
|
|
IDirectMusicSynth8Impl_GetAppend,
|
|
|
|
IDirectMusicSynth8Impl_PlayVoice,
|
|
|
|
IDirectMusicSynth8Impl_StopVoice,
|
|
|
|
IDirectMusicSynth8Impl_GetVoiceState,
|
|
|
|
IDirectMusicSynth8Impl_Refresh,
|
|
|
|
IDirectMusicSynth8Impl_AssignChannelToBuses
|
|
|
|
};
|
|
|
|
|
2012-05-03 23:05:51 +02:00
|
|
|
static inline IDirectMusicSynth8Impl *impl_from_IKsControl(IKsControl *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, IDirectMusicSynth8Impl, IKsControl_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DMSynthImpl_IKsControl_QueryInterface(IKsControl* iface, REFIID riid, LPVOID *ppobj)
|
|
|
|
{
|
|
|
|
IDirectMusicSynth8Impl *This = impl_from_IKsControl(iface);
|
|
|
|
|
|
|
|
return IDirectMusicSynth8Impl_QueryInterface(&This->IDirectMusicSynth8_iface, riid, ppobj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI DMSynthImpl_IKsControl_AddRef(IKsControl* iface)
|
|
|
|
{
|
|
|
|
IDirectMusicSynth8Impl *This = impl_from_IKsControl(iface);
|
|
|
|
|
|
|
|
return IDirectMusicSynth8Impl_AddRef(&This->IDirectMusicSynth8_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI DMSynthImpl_IKsControl_Release(IKsControl* iface)
|
|
|
|
{
|
|
|
|
IDirectMusicSynth8Impl *This = impl_from_IKsControl(iface);
|
|
|
|
|
|
|
|
return IDirectMusicSynth8Impl_Release(&This->IDirectMusicSynth8_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DMSynthImpl_IKsControl_KsProperty(IKsControl* iface, PKSPROPERTY Property, ULONG PropertyLength, LPVOID PropertyData,
|
|
|
|
ULONG DataLength, ULONG* BytesReturned)
|
|
|
|
{
|
2022-02-04 22:35:56 +01:00
|
|
|
TRACE("(%p, %p, %lu, %p, %lu, %p)\n", iface, Property, PropertyLength, PropertyData, DataLength, BytesReturned);
|
2012-05-03 23:05:51 +02:00
|
|
|
|
2022-02-04 22:35:56 +01:00
|
|
|
TRACE("Property = %s - %lu - %lu\n", debugstr_guid(&Property->u.s.Set), Property->u.s.Id, Property->u.s.Flags);
|
2012-09-21 15:44:37 +02:00
|
|
|
|
2012-11-17 22:48:01 +01:00
|
|
|
if (Property->u.s.Flags != KSPROPERTY_TYPE_GET)
|
2012-09-21 15:44:37 +02:00
|
|
|
{
|
2022-02-04 22:35:56 +01:00
|
|
|
FIXME("Property flags %lu not yet supported\n", Property->u.s.Flags);
|
2012-09-21 15:44:37 +02:00
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (DataLength < sizeof(DWORD))
|
2014-10-07 07:36:48 +02:00
|
|
|
return E_NOT_SUFFICIENT_BUFFER;
|
2012-09-21 15:44:37 +02:00
|
|
|
|
2012-11-17 22:48:01 +01:00
|
|
|
if (IsEqualGUID(&Property->u.s.Set, &GUID_DMUS_PROP_INSTRUMENT2))
|
2012-09-21 15:44:37 +02:00
|
|
|
{
|
|
|
|
*(DWORD*)PropertyData = TRUE;
|
|
|
|
*BytesReturned = sizeof(DWORD);
|
|
|
|
}
|
2012-11-17 22:48:01 +01:00
|
|
|
else if (IsEqualGUID(&Property->u.s.Set, &GUID_DMUS_PROP_DLS2))
|
2012-09-21 15:44:37 +02:00
|
|
|
{
|
|
|
|
*(DWORD*)PropertyData = TRUE;
|
|
|
|
*BytesReturned = sizeof(DWORD);
|
|
|
|
}
|
2012-11-17 22:48:01 +01:00
|
|
|
else if (IsEqualGUID(&Property->u.s.Set, &GUID_DMUS_PROP_GM_Hardware))
|
2012-09-21 15:44:37 +02:00
|
|
|
{
|
|
|
|
*(DWORD*)PropertyData = FALSE;
|
|
|
|
*BytesReturned = sizeof(DWORD);
|
|
|
|
}
|
2012-11-17 22:48:01 +01:00
|
|
|
else if (IsEqualGUID(&Property->u.s.Set, &GUID_DMUS_PROP_GS_Hardware))
|
2012-09-21 15:44:37 +02:00
|
|
|
{
|
|
|
|
*(DWORD*)PropertyData = FALSE;
|
|
|
|
*BytesReturned = sizeof(DWORD);
|
|
|
|
}
|
2012-11-17 22:48:01 +01:00
|
|
|
else if (IsEqualGUID(&Property->u.s.Set, &GUID_DMUS_PROP_XG_Hardware))
|
2012-09-21 15:44:37 +02:00
|
|
|
{
|
|
|
|
*(DWORD*)PropertyData = FALSE;
|
|
|
|
*BytesReturned = sizeof(DWORD);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-17 22:48:01 +01:00
|
|
|
FIXME("Unknown property %s\n", debugstr_guid(&Property->u.s.Set));
|
2012-09-21 15:44:37 +02:00
|
|
|
*(DWORD*)PropertyData = FALSE;
|
|
|
|
*BytesReturned = sizeof(DWORD);
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2012-05-03 23:05:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DMSynthImpl_IKsControl_KsMethod(IKsControl* iface, PKSMETHOD Method, ULONG MethodLength, LPVOID MethodData,
|
|
|
|
ULONG DataLength, ULONG* BytesReturned)
|
|
|
|
{
|
2022-02-04 22:35:56 +01:00
|
|
|
FIXME("(%p, %p, %lu, %p, %lu, %p): stub\n", iface, Method, MethodLength, MethodData, DataLength, BytesReturned);
|
2012-05-03 23:05:51 +02:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DMSynthImpl_IKsControl_KsEvent(IKsControl* iface, PKSEVENT Event, ULONG EventLength, LPVOID EventData,
|
|
|
|
ULONG DataLength, ULONG* BytesReturned)
|
|
|
|
{
|
2022-02-04 22:35:56 +01:00
|
|
|
FIXME("(%p, %p, %lu, %p, %lu, %p): stub\n", iface, Event, EventLength, EventData, DataLength, BytesReturned);
|
2012-05-03 23:05:51 +02:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const IKsControlVtbl DMSynthImpl_IKsControl_Vtbl = {
|
|
|
|
DMSynthImpl_IKsControl_QueryInterface,
|
|
|
|
DMSynthImpl_IKsControl_AddRef,
|
|
|
|
DMSynthImpl_IKsControl_Release,
|
|
|
|
DMSynthImpl_IKsControl_KsProperty,
|
|
|
|
DMSynthImpl_IKsControl_KsMethod,
|
|
|
|
DMSynthImpl_IKsControl_KsEvent
|
|
|
|
};
|
|
|
|
|
2003-07-22 00:10:14 +02:00
|
|
|
/* for ClassFactory */
|
2016-07-19 09:50:58 +02:00
|
|
|
HRESULT WINAPI DMUSIC_CreateDirectMusicSynthImpl(REFIID riid, void **ppobj)
|
2015-06-25 11:13:43 +02:00
|
|
|
{
|
|
|
|
IDirectMusicSynth8Impl *obj;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2016-07-19 09:50:58 +02:00
|
|
|
TRACE("(%s, %p)\n", debugstr_guid(riid), ppobj);
|
2015-06-25 11:13:43 +02:00
|
|
|
|
|
|
|
obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*obj));
|
|
|
|
if (NULL == obj) {
|
|
|
|
*ppobj = NULL;
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
obj->IDirectMusicSynth8_iface.lpVtbl = &DirectMusicSynth8_Vtbl;
|
|
|
|
obj->IKsControl_iface.lpVtbl = &DMSynthImpl_IKsControl_Vtbl;
|
|
|
|
obj->ref = 1;
|
|
|
|
/* fill in caps */
|
2022-01-19 18:48:49 +01:00
|
|
|
obj->caps.dwSize = sizeof(DMUS_PORTCAPS);
|
|
|
|
obj->caps.dwFlags = DMUS_PC_DLS | DMUS_PC_SOFTWARESYNTH | DMUS_PC_DIRECTSOUND | DMUS_PC_DLS2 | DMUS_PC_AUDIOPATH | DMUS_PC_WAVE;
|
|
|
|
obj->caps.guidPort = CLSID_DirectMusicSynth;
|
|
|
|
obj->caps.dwClass = DMUS_PC_OUTPUTCLASS;
|
|
|
|
obj->caps.dwType = DMUS_PORT_USER_MODE_SYNTH;
|
|
|
|
obj->caps.dwMemorySize = DMUS_PC_SYSTEMMEMORY;
|
|
|
|
obj->caps.dwMaxChannelGroups = 1000;
|
|
|
|
obj->caps.dwMaxVoices = 1000;
|
|
|
|
obj->caps.dwMaxAudioChannels = 2;
|
|
|
|
obj->caps.dwEffectFlags = DMUS_EFFECT_REVERB;
|
|
|
|
lstrcpyW(obj->caps.wszDescription, L"Microsoft Synthesizer");
|
2015-06-25 11:13:43 +02:00
|
|
|
|
2016-07-19 09:53:07 +02:00
|
|
|
DMSYNTH_LockModule();
|
2015-06-25 11:13:43 +02:00
|
|
|
hr = IDirectMusicSynth8_QueryInterface(&obj->IDirectMusicSynth8_iface, riid, ppobj);
|
|
|
|
IDirectMusicSynth8_Release(&obj->IDirectMusicSynth8_iface);
|
2016-07-19 09:53:07 +02:00
|
|
|
|
2015-06-25 11:13:43 +02:00
|
|
|
return hr;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|