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.
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
));
41 *ppDM
= (LPDIRECTMUSIC
)NULL
;
45 dmusic
->lpVtbl
= &DirectMusic_Vtbl
;
48 *ppDM
= (LPDIRECTMUSIC
)dmusic
;
51 WARN("No interface found\n");
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
);
67 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppobj
);
71 ULONG WINAPI
IDirectMusicImpl_AddRef (LPDIRECTMUSIC iface
)
73 ICOM_THIS(IDirectMusicImpl
,iface
);
74 TRACE("(%p) : AddRef from %ld\n", This
, 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
);
85 HeapFree(GetProcessHeap(), 0, This
);
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};
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
);
112 FIXME("partial-stub (only first port supported)\n");
116 HRESULT WINAPI
IDirectMusicImpl_CreateMusicBuffer (LPDIRECTMUSIC iface
, LPDMUS_BUFFERDESC pBufferDesc
, LPDIRECTMUSICBUFFER
** ppBuffer
, LPUNKNOWN pUnkOuter
)
122 HRESULT WINAPI
IDirectMusicImpl_CreatePort (LPDIRECTMUSIC iface
, REFCLSID rclsidPort
, LPDMUS_PORTPARAMS pPortParams
, LPDIRECTMUSICPORT
* ppPort
, LPUNKNOWN pUnkOuter
)
128 HRESULT WINAPI
IDirectMusicImpl_EnumMasterClock (LPDIRECTMUSIC iface
, DWORD dwIndex
, LPDMUS_CLOCKINFO lpClockInfo
)
134 HRESULT WINAPI
IDirectMusicImpl_GetMasterClock (LPDIRECTMUSIC iface
, LPGUID pguidClock
, IReferenceClock
** ppReferenceClock
)
140 HRESULT WINAPI
IDirectMusicImpl_SetMasterClock (LPDIRECTMUSIC iface
, REFGUID rguidClock
)
146 HRESULT WINAPI
IDirectMusicImpl_Activate (LPDIRECTMUSIC iface
, BOOL fEnable
)
152 HRESULT WINAPI
IDirectMusicImpl_GetDefaultPort (LPDIRECTMUSIC iface
, LPGUID pguidPort
)
158 HRESULT WINAPI
IDirectMusicImpl_SetDirectSound (LPDIRECTMUSIC iface
, LPDIRECTSOUND pDirectSound
, HWND hWnd
)
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