(sorta) implemented EnumPorts.
[wine/multimedia.git] / dlls / dmusic / dmusic.c
blobe6f1e2b0379497507fc92b3b7385201927574b17
1 /* IDirectMusic Implementation
3 * Copyright (C) 2003 Rok Mandeljc
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Library General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #include "windef.h"
21 #include "winbase.h"
22 #include "winuser.h"
23 #include "wingdi.h"
24 #include "wine/debug.h"
26 #include "dmusic_private.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
30 /* for ClassFactory */
31 HRESULT WINAPI DMUSIC_CreateDirectMusic (LPCGUID lpcGUID, LPDIRECTMUSIC *ppDM, LPUNKNOWN pUnkOuter)
33 IDirectMusicImpl *dmusic;
35 TRACE("(%p,%p,%p)\n",lpcGUID, ppDM, pUnkOuter);
38 dmusic = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicImpl));
39 if (NULL == dmusic)
41 *ppDM = (LPDIRECTMUSIC)NULL;
42 return E_OUTOFMEMORY;
45 dmusic->lpVtbl = &DirectMusic_Vtbl;
46 dmusic->ref = 1;
48 *ppDM = (LPDIRECTMUSIC)dmusic;
49 return S_OK;
51 WARN("No interface found\n");
52 return E_NOINTERFACE;
55 /* IDirectMusic IUnknown parts follow: */
56 HRESULT WINAPI IDirectMusicImpl_QueryInterface (LPDIRECTMUSIC iface, REFIID riid, LPVOID *ppobj)
58 ICOM_THIS(IDirectMusicImpl,iface);
60 if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectMusic))
62 IDirectMusicImpl_AddRef(iface);
63 *ppobj = This;
64 return DS_OK;
67 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
68 return E_NOINTERFACE;
71 ULONG WINAPI IDirectMusicImpl_AddRef (LPDIRECTMUSIC iface)
73 ICOM_THIS(IDirectMusicImpl,iface);
74 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
75 return ++(This->ref);
78 ULONG WINAPI IDirectMusicImpl_Release (LPDIRECTMUSIC iface)
80 ICOM_THIS(IDirectMusicImpl,iface);
81 ULONG ref = --This->ref;
82 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
83 if (ref == 0)
85 HeapFree(GetProcessHeap(), 0, This);
87 return ref;
90 /* IDirectMusic Interface follow: */
91 HRESULT WINAPI IDirectMusicImpl_EnumPort (LPDIRECTMUSIC iface, DWORD dwIndex, LPDMUS_PORTCAPS pPortCaps)
93 /* FIXME: this is only for making DXCapsViewer display something */
94 static const WCHAR name_WINE_SYNTHESIZER[] = {'W','i','n','e',' ','S','y','n','t','h','e','s','i','z','e','r',0};
96 if (dwIndex == 0)
98 pPortCaps->dwSize = sizeof(DMUS_PORTCAPS);
99 pPortCaps->dwFlags = DMUS_PC_DLS | DMUS_PC_SOFTWARESYNTH | DMUS_PC_DIRECTSOUND | DMUS_PC_DLS2 | DMUS_PC_AUDIOPATH | DMUS_PC_WAVE;
100 /*pPortCaps->guidPort;*/ /* FIXME */
101 pPortCaps->dwClass = DMUS_PC_OUTPUTCLASS;
102 pPortCaps->dwType = DMUS_PORT_WINMM_DRIVER;
103 pPortCaps->dwMemorySize = DMUS_PC_SYSTEMMEMORY;
104 pPortCaps->dwMaxChannelGroups = 1000;
105 pPortCaps->dwMaxVoices = 1000;
106 pPortCaps->dwMaxAudioChannels = -1;
107 pPortCaps->dwEffectFlags = DMUS_EFFECT_REVERB | DMUS_EFFECT_CHORUS | DMUS_EFFECT_DELAY;
108 wsprintfW(pPortCaps->wszDescription, name_WINE_SYNTHESIZER);
109 return S_OK;
112 FIXME("partial-stub (only first port supported)\n");
113 return S_FALSE;
116 HRESULT WINAPI IDirectMusicImpl_CreateMusicBuffer (LPDIRECTMUSIC iface, LPDMUS_BUFFERDESC pBufferDesc, LPDIRECTMUSICBUFFER** ppBuffer, LPUNKNOWN pUnkOuter)
118 FIXME("stub\n");
119 return DS_OK;
122 HRESULT WINAPI IDirectMusicImpl_CreatePort (LPDIRECTMUSIC iface, REFCLSID rclsidPort, LPDMUS_PORTPARAMS pPortParams, LPDIRECTMUSICPORT* ppPort, LPUNKNOWN pUnkOuter)
124 FIXME("stub\n");
125 return DS_OK;
128 HRESULT WINAPI IDirectMusicImpl_EnumMasterClock (LPDIRECTMUSIC iface, DWORD dwIndex, LPDMUS_CLOCKINFO lpClockInfo)
130 FIXME("stub\n");
131 return DS_OK;
134 HRESULT WINAPI IDirectMusicImpl_GetMasterClock (LPDIRECTMUSIC iface, LPGUID pguidClock, IReferenceClock** ppReferenceClock)
136 FIXME("stub\n");
137 return DS_OK;
140 HRESULT WINAPI IDirectMusicImpl_SetMasterClock (LPDIRECTMUSIC iface, REFGUID rguidClock)
142 FIXME("stub\n");
143 return DS_OK;
146 HRESULT WINAPI IDirectMusicImpl_Activate (LPDIRECTMUSIC iface, BOOL fEnable)
148 FIXME("stub\n");
149 return DS_OK;
152 HRESULT WINAPI IDirectMusicImpl_GetDefaultPort (LPDIRECTMUSIC iface, LPGUID pguidPort)
154 FIXME("stub\n");
155 return DS_OK;
158 HRESULT WINAPI IDirectMusicImpl_SetDirectSound (LPDIRECTMUSIC iface, LPDIRECTSOUND pDirectSound, HWND hWnd)
160 FIXME("stub\n");
161 return DS_OK;
164 ICOM_VTABLE(IDirectMusic) DirectMusic_Vtbl =
166 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
167 IDirectMusicImpl_QueryInterface,
168 IDirectMusicImpl_AddRef,
169 IDirectMusicImpl_Release,
170 IDirectMusicImpl_EnumPort,
171 IDirectMusicImpl_CreateMusicBuffer,
172 IDirectMusicImpl_CreatePort,
173 IDirectMusicImpl_EnumMasterClock,
174 IDirectMusicImpl_GetMasterClock,
175 IDirectMusicImpl_SetMasterClock,
176 IDirectMusicImpl_Activate,
177 IDirectMusicImpl_GetDefaultPort,
178 IDirectMusicImpl_SetDirectSound