2003-07-22 00:10:14 +02:00
|
|
|
/* IDirectMusic8 Implementation
|
2003-03-21 01:42:38 +01:00
|
|
|
*
|
2004-01-20 01:21:40 +01:00
|
|
|
* Copyright (C) 2003-2004 Rok Mandeljc
|
2003-03-21 01:42:38 +01: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-03-21 01:42:38 +01: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-03-21 01:42:38 +01: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-03-21 01:42:38 +01:00
|
|
|
*/
|
2012-03-29 08:52:45 +02:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2003-03-21 01:42:38 +01:00
|
|
|
#include "dmusic_private.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
|
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
/* IDirectMusic8Impl IUnknown part: */
|
2006-06-10 11:57:22 +02:00
|
|
|
static HRESULT WINAPI IDirectMusic8Impl_QueryInterface (LPDIRECTMUSIC8 iface, REFIID riid, LPVOID *ppobj) {
|
2004-09-06 22:34:29 +02:00
|
|
|
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
|
2004-02-25 02:30:03 +01:00
|
|
|
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
|
2003-04-08 23:42:00 +02:00
|
|
|
|
2003-08-23 01:53:27 +02:00
|
|
|
if (IsEqualIID (riid, &IID_IUnknown) ||
|
2004-01-20 01:21:40 +01:00
|
|
|
IsEqualIID (riid, &IID_IDirectMusic) ||
|
2003-08-23 01:53:27 +02:00
|
|
|
IsEqualIID (riid, &IID_IDirectMusic2) ||
|
|
|
|
IsEqualIID (riid, &IID_IDirectMusic8)) {
|
2006-06-10 11:57:22 +02:00
|
|
|
IUnknown_AddRef(iface);
|
2003-04-08 23:42:00 +02:00
|
|
|
*ppobj = This;
|
2003-06-07 02:39:18 +02:00
|
|
|
return S_OK;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
2003-08-23 01:53:27 +02:00
|
|
|
|
2004-02-25 02:30:03 +01:00
|
|
|
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
|
2003-04-08 23:42:00 +02:00
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
2006-06-10 11:57:22 +02:00
|
|
|
static ULONG WINAPI IDirectMusic8Impl_AddRef (LPDIRECTMUSIC8 iface) {
|
2004-09-06 22:34:29 +02:00
|
|
|
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
|
2005-01-14 17:02:20 +01:00
|
|
|
ULONG refCount = InterlockedIncrement(&This->ref);
|
|
|
|
|
2006-10-12 21:34:50 +02:00
|
|
|
TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
|
2005-01-14 17:02:20 +01:00
|
|
|
|
2005-01-26 20:41:43 +01:00
|
|
|
DMUSIC_LockModule();
|
|
|
|
|
2005-01-14 17:02:20 +01:00
|
|
|
return refCount;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2006-06-10 11:57:22 +02:00
|
|
|
static ULONG WINAPI IDirectMusic8Impl_Release (LPDIRECTMUSIC8 iface) {
|
2004-09-06 22:34:29 +02:00
|
|
|
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
|
2005-01-14 17:02:20 +01:00
|
|
|
ULONG refCount = InterlockedDecrement(&This->ref);
|
|
|
|
|
2006-10-12 21:34:50 +02:00
|
|
|
TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
|
2005-01-14 17:02:20 +01:00
|
|
|
|
|
|
|
if (!refCount) {
|
2012-01-22 15:10:28 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, This->ppPorts);
|
2003-04-08 23:42:00 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
|
|
|
}
|
2005-01-26 20:41:43 +01:00
|
|
|
|
|
|
|
DMUSIC_UnlockModule();
|
|
|
|
|
2005-01-14 17:02:20 +01:00
|
|
|
return refCount;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
/* IDirectMusic8Impl IDirectMusic part: */
|
2012-03-29 08:52:45 +02:00
|
|
|
static HRESULT WINAPI IDirectMusic8Impl_EnumPort(LPDIRECTMUSIC8 iface, DWORD index, LPDMUS_PORTCAPS port_caps)
|
|
|
|
{
|
|
|
|
IDirectMusic8Impl *This = (IDirectMusic8Impl*)iface;
|
|
|
|
ULONG nb_midi_out;
|
|
|
|
ULONG nb_midi_in;
|
|
|
|
const WCHAR emulated[] = {' ','[','E','m','u','l','a','t','e','d',']',0};
|
|
|
|
|
|
|
|
TRACE("(%p, %d, %p)\n", This, index, port_caps);
|
|
|
|
|
|
|
|
if (!port_caps)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
/* NOTE: It seems some native versions get the rest of devices through dmusic32.EnumLegacyDevices...*sigh*...which is undocumented */
|
|
|
|
|
|
|
|
/* NOTE: Should we enum wave devices ? Native does not seem to */
|
|
|
|
|
|
|
|
/* Fill common port caps for winmm ports */
|
|
|
|
port_caps->dwType = DMUS_PORT_WINMM_DRIVER;
|
|
|
|
port_caps->dwMemorySize = 0;
|
|
|
|
port_caps->dwMaxChannelGroups = 1;
|
|
|
|
port_caps->dwMaxVoices = 0;
|
|
|
|
port_caps->dwMaxAudioChannels = 0;
|
|
|
|
port_caps->dwEffectFlags = DMUS_EFFECT_NONE;
|
|
|
|
/* Fake port GUID */
|
|
|
|
port_caps->guidPort = IID_IUnknown;
|
|
|
|
port_caps->guidPort.Data1 = index + 1;
|
|
|
|
|
|
|
|
nb_midi_out = midiOutGetNumDevs();
|
|
|
|
|
|
|
|
if (index == 0)
|
|
|
|
{
|
|
|
|
MIDIOUTCAPSW caps;
|
|
|
|
midiOutGetDevCapsW(MIDI_MAPPER, &caps, sizeof(caps));
|
|
|
|
strcpyW(port_caps->wszDescription, caps.szPname);
|
|
|
|
strcatW(port_caps->wszDescription, emulated);
|
|
|
|
port_caps->dwFlags = DMUS_PC_SHAREABLE;
|
|
|
|
port_caps->dwClass = DMUS_PC_OUTPUTCLASS;
|
|
|
|
TRACE("Enumerating port: %s\n", debugstr_w(port_caps->wszDescription));
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (index < (nb_midi_out + 1))
|
|
|
|
{
|
|
|
|
MIDIOUTCAPSW caps;
|
|
|
|
midiOutGetDevCapsW(index - 1, &caps, sizeof(caps));
|
|
|
|
strcpyW(port_caps->wszDescription, caps.szPname);
|
|
|
|
strcatW(port_caps->wszDescription, emulated);
|
|
|
|
port_caps->dwFlags = DMUS_PC_SHAREABLE | DMUS_PC_EXTERNAL;
|
|
|
|
port_caps->dwClass = DMUS_PC_OUTPUTCLASS;
|
|
|
|
TRACE("Enumerating port: %s\n", debugstr_w(port_caps->wszDescription));
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nb_midi_in = midiInGetNumDevs();
|
|
|
|
|
|
|
|
if (index < (nb_midi_in + nb_midi_out + 1))
|
|
|
|
{
|
|
|
|
MIDIINCAPSW caps;
|
|
|
|
midiInGetDevCapsW(index - nb_midi_out - 1, &caps, sizeof(caps));
|
|
|
|
strcpyW(port_caps->wszDescription, caps.szPname);
|
|
|
|
strcatW(port_caps->wszDescription, emulated);
|
|
|
|
port_caps->dwFlags = DMUS_PC_EXTERNAL;
|
|
|
|
port_caps->dwClass = DMUS_PC_INPUTCLASS;
|
|
|
|
TRACE("Enumerating port: %s\n", debugstr_w(port_caps->wszDescription));
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (index == (nb_midi_in + nb_midi_out + 1))
|
|
|
|
{
|
2012-03-29 08:52:54 +02:00
|
|
|
IDirectMusicSynth8* synth = NULL;
|
|
|
|
HRESULT hr;
|
|
|
|
hr = CoCreateInstance(&CLSID_DirectMusicSynth, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicSynth8, (void**)&synth);
|
|
|
|
if (SUCCEEDED(hr))
|
2012-04-05 20:00:16 +02:00
|
|
|
hr = IDirectMusicSynth8_GetPortCaps(synth, port_caps);
|
2012-03-29 08:52:54 +02:00
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
TRACE("Enumerating port: %s\n", debugstr_w(port_caps->wszDescription));
|
|
|
|
if (synth)
|
|
|
|
IDirectMusicSynth8_Release(synth);
|
|
|
|
return hr;
|
2012-03-29 08:52:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return S_FALSE;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2006-06-10 11:57:22 +02:00
|
|
|
static HRESULT WINAPI IDirectMusic8Impl_CreateMusicBuffer (LPDIRECTMUSIC8 iface, LPDMUS_BUFFERDESC pBufferDesc, LPDIRECTMUSICBUFFER** ppBuffer, LPUNKNOWN pUnkOuter) {
|
2004-09-06 22:34:29 +02:00
|
|
|
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
|
2008-12-22 14:19:30 +01:00
|
|
|
|
|
|
|
TRACE("(%p, %p, %p, %p)\n", This, pBufferDesc, ppBuffer, pUnkOuter);
|
|
|
|
|
|
|
|
if (pUnkOuter)
|
|
|
|
return CLASS_E_NOAGGREGATION;
|
|
|
|
|
|
|
|
if (!pBufferDesc || !ppBuffer)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
return DMUSIC_CreateDirectMusicBufferImpl(&IID_IDirectMusicBuffer, (LPVOID)ppBuffer, NULL);
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2012-04-10 22:30:38 +02:00
|
|
|
static HRESULT WINAPI IDirectMusic8Impl_CreatePort(LPDIRECTMUSIC8 iface, REFCLSID rclsidPort, LPDMUS_PORTPARAMS pPortParams, LPDIRECTMUSICPORT* ppPort, LPUNKNOWN pUnkOuter)
|
|
|
|
{
|
2004-09-06 22:34:29 +02:00
|
|
|
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
|
2012-03-30 15:38:20 +02:00
|
|
|
int i;
|
2003-06-07 02:39:18 +02:00
|
|
|
DMUS_PORTCAPS PortCaps;
|
2005-11-29 10:43:18 +01:00
|
|
|
IDirectMusicPort* pNewPort = NULL;
|
2012-03-30 15:38:20 +02:00
|
|
|
HRESULT hr;
|
|
|
|
GUID default_port;
|
|
|
|
const GUID *request_port = rclsidPort;
|
|
|
|
|
|
|
|
TRACE("(%p, %s, %p, %p, %p)\n", This, debugstr_dmguid(rclsidPort), pPortParams, ppPort, pUnkOuter);
|
|
|
|
|
2012-04-10 22:30:29 +02:00
|
|
|
if (TRACE_ON(dmusic))
|
|
|
|
dump_DMUS_PORTPARAMS(pPortParams);
|
|
|
|
|
2012-04-10 22:30:38 +02:00
|
|
|
if (!rclsidPort)
|
|
|
|
return E_POINTER;
|
|
|
|
if (!pPortParams)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
if (!ppPort)
|
2012-03-30 15:38:20 +02:00
|
|
|
return E_POINTER;
|
2012-04-10 22:30:38 +02:00
|
|
|
if (pUnkOuter)
|
|
|
|
return CLASS_E_NOAGGREGATION;
|
|
|
|
|
|
|
|
if (TRACE_ON(dmusic))
|
|
|
|
dump_DMUS_PORTPARAMS(pPortParams);
|
2003-07-22 00:10:14 +02:00
|
|
|
|
2005-11-29 10:43:18 +01:00
|
|
|
ZeroMemory(&PortCaps, sizeof(DMUS_PORTCAPS));
|
|
|
|
PortCaps.dwSize = sizeof(DMUS_PORTCAPS);
|
|
|
|
|
2012-03-30 15:38:20 +02:00
|
|
|
if(IsEqualGUID(request_port, &GUID_NULL)){
|
|
|
|
hr = IDirectMusic8_GetDefaultPort(iface, &default_port);
|
|
|
|
if(FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
request_port = &default_port;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; S_FALSE != IDirectMusic8Impl_EnumPort(iface, i, &PortCaps); i++) {
|
|
|
|
if (IsEqualCLSID (request_port, &PortCaps.guidPort)) {
|
2005-11-29 10:43:18 +01:00
|
|
|
hr = DMUSIC_CreateDirectMusicPortImpl(&IID_IDirectMusicPort, (LPVOID*) &pNewPort, (LPUNKNOWN) This, pPortParams, &PortCaps);
|
|
|
|
if (FAILED(hr)) {
|
2012-03-30 15:38:20 +02:00
|
|
|
*ppPort = NULL;
|
2005-11-29 10:43:18 +01:00
|
|
|
return hr;
|
2003-06-27 21:43:13 +02:00
|
|
|
}
|
|
|
|
This->nrofports++;
|
2005-11-29 10:43:18 +01:00
|
|
|
if (!This->ppPorts) This->ppPorts = HeapAlloc(GetProcessHeap(), 0, sizeof(LPDIRECTMUSICPORT) * This->nrofports);
|
2012-03-30 15:38:20 +02:00
|
|
|
else This->ppPorts = HeapReAlloc(GetProcessHeap(), 0, This->ppPorts, sizeof(LPDIRECTMUSICPORT) * This->nrofports);
|
2006-10-27 18:47:25 +02:00
|
|
|
This->ppPorts[This->nrofports - 1] = pNewPort;
|
2007-12-08 16:33:51 +01:00
|
|
|
*ppPort = pNewPort;
|
2012-03-30 15:38:20 +02:00
|
|
|
return S_OK;
|
2003-06-07 02:39:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return E_NOINTERFACE;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2006-06-10 11:57:22 +02:00
|
|
|
static HRESULT WINAPI IDirectMusic8Impl_EnumMasterClock (LPDIRECTMUSIC8 iface, DWORD dwIndex, LPDMUS_CLOCKINFO lpClockInfo) {
|
2004-09-06 22:34:29 +02:00
|
|
|
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
|
2006-10-12 21:34:50 +02:00
|
|
|
FIXME("(%p, %d, %p): stub\n", This, dwIndex, lpClockInfo);
|
2003-07-22 00:10:14 +02:00
|
|
|
return S_FALSE;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2006-06-10 11:57:22 +02:00
|
|
|
static HRESULT WINAPI IDirectMusic8Impl_GetMasterClock (LPDIRECTMUSIC8 iface, LPGUID pguidClock, IReferenceClock** ppReferenceClock) {
|
2004-09-06 22:34:29 +02:00
|
|
|
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
|
2003-06-07 02:39:18 +02:00
|
|
|
|
2003-07-22 00:10:14 +02:00
|
|
|
TRACE("(%p, %p, %p)\n", This, pguidClock, ppReferenceClock);
|
|
|
|
if (pguidClock)
|
|
|
|
*pguidClock = This->pMasterClock->pClockInfo.guidClock;
|
|
|
|
if(ppReferenceClock)
|
|
|
|
*ppReferenceClock = (IReferenceClock *)This->pMasterClock;
|
2003-06-07 02:39:18 +02:00
|
|
|
|
|
|
|
return S_OK;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2006-06-10 11:57:22 +02:00
|
|
|
static HRESULT WINAPI IDirectMusic8Impl_SetMasterClock (LPDIRECTMUSIC8 iface, REFGUID rguidClock) {
|
2004-09-06 22:34:29 +02:00
|
|
|
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
|
2004-02-25 02:30:03 +01:00
|
|
|
FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidClock));
|
2003-06-07 02:39:18 +02:00
|
|
|
return S_OK;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2006-06-10 11:57:22 +02:00
|
|
|
static HRESULT WINAPI IDirectMusic8Impl_Activate (LPDIRECTMUSIC8 iface, BOOL fEnable) {
|
2004-09-06 22:34:29 +02:00
|
|
|
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
|
2003-06-07 02:39:18 +02:00
|
|
|
int i;
|
|
|
|
|
|
|
|
FIXME("(%p, %d): stub\n", This, fEnable);
|
2004-01-20 01:21:40 +01:00
|
|
|
for (i = 0; i < This->nrofports; i++) {
|
2012-03-30 01:08:48 +02:00
|
|
|
IDirectMusicPort_Activate(This->ppPorts[i], fEnable);
|
2003-06-07 02:39:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2006-06-10 11:57:22 +02:00
|
|
|
static HRESULT WINAPI IDirectMusic8Impl_GetDefaultPort (LPDIRECTMUSIC8 iface, LPGUID pguidPort) {
|
2004-09-06 22:34:29 +02:00
|
|
|
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
|
2003-06-07 02:39:18 +02:00
|
|
|
HKEY hkGUID;
|
|
|
|
DWORD returnTypeGUID, sizeOfReturnBuffer = 50;
|
|
|
|
char returnBuffer[51];
|
|
|
|
GUID defaultPortGUID;
|
2003-06-27 21:43:13 +02:00
|
|
|
WCHAR buff[51];
|
2003-06-07 02:39:18 +02:00
|
|
|
|
|
|
|
TRACE("(%p, %p)\n", This, pguidPort);
|
2003-06-27 21:43:13 +02:00
|
|
|
if ((RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\DirectMusic\\Defaults" , 0, KEY_READ, &hkGUID) != ERROR_SUCCESS) ||
|
2005-07-07 14:08:42 +02:00
|
|
|
(RegQueryValueExA(hkGUID, "DefaultOutputPort", NULL, &returnTypeGUID, (LPBYTE)returnBuffer, &sizeOfReturnBuffer) != ERROR_SUCCESS))
|
2003-06-07 02:39:18 +02:00
|
|
|
{
|
|
|
|
WARN(": registry entry missing\n" );
|
|
|
|
*pguidPort = CLSID_DirectMusicSynth;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
/* FIXME: Check return types to ensure we're interpreting data right */
|
2003-06-27 21:43:13 +02:00
|
|
|
MultiByteToWideChar(CP_ACP, 0, returnBuffer, -1, buff, sizeof(buff) / sizeof(WCHAR));
|
2004-01-23 21:57:26 +01:00
|
|
|
CLSIDFromString(buff, &defaultPortGUID);
|
2003-06-07 02:39:18 +02:00
|
|
|
*pguidPort = defaultPortGUID;
|
|
|
|
|
|
|
|
return S_OK;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2006-06-10 11:57:22 +02:00
|
|
|
static HRESULT WINAPI IDirectMusic8Impl_SetDirectSound (LPDIRECTMUSIC8 iface, LPDIRECTSOUND pDirectSound, HWND hWnd) {
|
2004-09-06 22:34:29 +02:00
|
|
|
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
|
2003-06-07 02:39:18 +02:00
|
|
|
FIXME("(%p, %p, %p): stub\n", This, pDirectSound, hWnd);
|
|
|
|
return S_OK;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2006-06-10 11:57:22 +02:00
|
|
|
static HRESULT WINAPI IDirectMusic8Impl_SetExternalMasterClock (LPDIRECTMUSIC8 iface, IReferenceClock* pClock) {
|
2004-09-06 22:34:29 +02:00
|
|
|
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
|
2003-06-07 02:39:18 +02:00
|
|
|
FIXME("(%p, %p): stub\n", This, pClock);
|
|
|
|
return S_OK;
|
2003-04-08 23:42:00 +02:00
|
|
|
}
|
|
|
|
|
2005-06-01 21:57:42 +02:00
|
|
|
static const IDirectMusic8Vtbl DirectMusic8_Vtbl = {
|
2003-04-08 23:42:00 +02:00
|
|
|
IDirectMusic8Impl_QueryInterface,
|
|
|
|
IDirectMusic8Impl_AddRef,
|
|
|
|
IDirectMusic8Impl_Release,
|
|
|
|
IDirectMusic8Impl_EnumPort,
|
|
|
|
IDirectMusic8Impl_CreateMusicBuffer,
|
|
|
|
IDirectMusic8Impl_CreatePort,
|
|
|
|
IDirectMusic8Impl_EnumMasterClock,
|
|
|
|
IDirectMusic8Impl_GetMasterClock,
|
|
|
|
IDirectMusic8Impl_SetMasterClock,
|
|
|
|
IDirectMusic8Impl_Activate,
|
|
|
|
IDirectMusic8Impl_GetDefaultPort,
|
|
|
|
IDirectMusic8Impl_SetDirectSound,
|
|
|
|
IDirectMusic8Impl_SetExternalMasterClock
|
|
|
|
};
|
|
|
|
|
2003-07-22 00:10:14 +02:00
|
|
|
/* for ClassFactory */
|
2004-01-20 01:21:40 +01:00
|
|
|
HRESULT WINAPI DMUSIC_CreateDirectMusicImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
|
2003-07-22 00:10:14 +02:00
|
|
|
IDirectMusic8Impl *dmusic;
|
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
TRACE("(%p,%p,%p)\n",lpcGUID, ppobj, pUnkOuter);
|
|
|
|
|
|
|
|
dmusic = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusic8Impl));
|
|
|
|
if (NULL == dmusic) {
|
2008-11-02 00:24:00 +01:00
|
|
|
*ppobj = NULL;
|
2004-01-20 01:21:40 +01:00
|
|
|
return E_OUTOFMEMORY;
|
2003-07-22 00:10:14 +02:00
|
|
|
}
|
2004-01-20 01:21:40 +01:00
|
|
|
dmusic->lpVtbl = &DirectMusic8_Vtbl;
|
|
|
|
dmusic->ref = 0; /* will be inited with QueryInterface */
|
|
|
|
dmusic->pMasterClock = NULL;
|
|
|
|
dmusic->ppPorts = NULL;
|
|
|
|
dmusic->nrofports = 0;
|
|
|
|
DMUSIC_CreateReferenceClockImpl (&IID_IReferenceClock, (LPVOID*)&dmusic->pMasterClock, NULL);
|
2003-07-22 00:10:14 +02:00
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
return IDirectMusic8Impl_QueryInterface ((LPDIRECTMUSIC8)dmusic, lpcGUID, ppobj);
|
2003-07-22 00:10:14 +02:00
|
|
|
}
|