1 /* IDirectMusicBuffer Implementation
3 * Copyright (C) 2003-2004 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 "dmusic_private.h"
22 WINE_DEFAULT_DEBUG_CHANNEL(dmusic
);
24 /* IDirectMusicBufferImpl IUnknown part: */
25 HRESULT WINAPI
IDirectMusicBufferImpl_QueryInterface (LPDIRECTMUSICBUFFER iface
, REFIID riid
, LPVOID
*ppobj
) {
26 IDirectMusicBufferImpl
*This
= (IDirectMusicBufferImpl
*)iface
;
27 TRACE("(%p, (%s, %p)\n",This
,debugstr_dmguid(riid
),ppobj
);
28 if (IsEqualIID (riid
, &IID_IUnknown
)
29 || IsEqualIID (riid
, &IID_IDirectMusicBuffer
)) {
30 IDirectMusicBufferImpl_AddRef(iface
);
34 WARN("(%p, (%s, %p): not found\n",This
,debugstr_dmguid(riid
),ppobj
);
38 ULONG WINAPI
IDirectMusicBufferImpl_AddRef (LPDIRECTMUSICBUFFER iface
) {
39 IDirectMusicBufferImpl
*This
= (IDirectMusicBufferImpl
*)iface
;
40 ULONG refCount
= InterlockedIncrement(&This
->ref
);
42 TRACE("(%p)->(ref before=%lu)\n", This
, refCount
- 1);
49 ULONG WINAPI
IDirectMusicBufferImpl_Release (LPDIRECTMUSICBUFFER iface
) {
50 IDirectMusicBufferImpl
*This
= (IDirectMusicBufferImpl
*)iface
;
51 ULONG refCount
= InterlockedDecrement(&This
->ref
);
53 TRACE("(%p)->(ref before=%lu)\n", This
, refCount
+ 1);
56 HeapFree(GetProcessHeap(), 0, This
);
59 DMUSIC_UnlockModule();
64 /* IDirectMusicBufferImpl IDirectMusicBuffer part: */
65 HRESULT WINAPI
IDirectMusicBufferImpl_Flush (LPDIRECTMUSICBUFFER iface
) {
66 IDirectMusicBufferImpl
*This
= (IDirectMusicBufferImpl
*)iface
;
67 FIXME("(%p): stub\n", This
);
71 HRESULT WINAPI
IDirectMusicBufferImpl_TotalTime (LPDIRECTMUSICBUFFER iface
, LPREFERENCE_TIME prtTime
) {
72 IDirectMusicBufferImpl
*This
= (IDirectMusicBufferImpl
*)iface
;
73 FIXME("(%p, %p): stub\n", This
, prtTime
);
77 HRESULT WINAPI
IDirectMusicBufferImpl_PackStructured (LPDIRECTMUSICBUFFER iface
, REFERENCE_TIME rt
, DWORD dwChannelGroup
, DWORD dwChannelMessage
) {
78 IDirectMusicBufferImpl
*This
= (IDirectMusicBufferImpl
*)iface
;
79 FIXME("(%p, %lli, %ld, %ld): stub\n", This
, rt
, dwChannelGroup
, dwChannelMessage
);
83 HRESULT WINAPI
IDirectMusicBufferImpl_PackUnstructured (LPDIRECTMUSICBUFFER iface
, REFERENCE_TIME rt
, DWORD dwChannelGroup
, DWORD cb
, LPBYTE lpb
) {
84 IDirectMusicBufferImpl
*This
= (IDirectMusicBufferImpl
*)iface
;
85 FIXME("(%p, %lli, %ld, %ld, %p): stub\n", This
, rt
, dwChannelGroup
, cb
, lpb
);
89 HRESULT WINAPI
IDirectMusicBufferImpl_ResetReadPtr (LPDIRECTMUSICBUFFER iface
) {
90 IDirectMusicBufferImpl
*This
= (IDirectMusicBufferImpl
*)iface
;
91 FIXME("(%p): stub\n", This
);
95 HRESULT WINAPI
IDirectMusicBufferImpl_GetNextEvent (LPDIRECTMUSICBUFFER iface
, LPREFERENCE_TIME prt
, LPDWORD pdwChannelGroup
, LPDWORD pdwLength
, LPBYTE
* ppData
) {
96 IDirectMusicBufferImpl
*This
= (IDirectMusicBufferImpl
*)iface
;
97 FIXME("(%p, %p, %p, %p, %p): stub\n", This
, prt
, pdwChannelGroup
, pdwLength
, ppData
);
101 HRESULT WINAPI
IDirectMusicBufferImpl_GetRawBufferPtr (LPDIRECTMUSICBUFFER iface
, LPBYTE
* ppData
) {
102 IDirectMusicBufferImpl
*This
= (IDirectMusicBufferImpl
*)iface
;
103 FIXME("(%p, %p): stub\n", This
, ppData
);
107 HRESULT WINAPI
IDirectMusicBufferImpl_GetStartTime (LPDIRECTMUSICBUFFER iface
, LPREFERENCE_TIME prt
) {
108 IDirectMusicBufferImpl
*This
= (IDirectMusicBufferImpl
*)iface
;
109 FIXME("(%p, %p): stub\n", This
, prt
);
113 HRESULT WINAPI
IDirectMusicBufferImpl_GetUsedBytes (LPDIRECTMUSICBUFFER iface
, LPDWORD pcb
) {
114 IDirectMusicBufferImpl
*This
= (IDirectMusicBufferImpl
*)iface
;
115 FIXME("(%p, %p): stub\n", This
, pcb
);
119 HRESULT WINAPI
IDirectMusicBufferImpl_GetMaxBytes (LPDIRECTMUSICBUFFER iface
, LPDWORD pcb
) {
120 IDirectMusicBufferImpl
*This
= (IDirectMusicBufferImpl
*)iface
;
121 FIXME("(%p, %p): stub\n", This
, pcb
);
125 HRESULT WINAPI
IDirectMusicBufferImpl_GetBufferFormat (LPDIRECTMUSICBUFFER iface
, LPGUID pGuidFormat
) {
126 IDirectMusicBufferImpl
*This
= (IDirectMusicBufferImpl
*)iface
;
127 FIXME("(%p, %p): stub\n", This
, pGuidFormat
);
131 HRESULT WINAPI
IDirectMusicBufferImpl_SetStartTime (LPDIRECTMUSICBUFFER iface
, REFERENCE_TIME rt
) {
132 IDirectMusicBufferImpl
*This
= (IDirectMusicBufferImpl
*)iface
;
133 FIXME("(%p, %lli): stub\n", This
, rt
);
137 HRESULT WINAPI
IDirectMusicBufferImpl_SetUsedBytes (LPDIRECTMUSICBUFFER iface
, DWORD cb
) {
138 IDirectMusicBufferImpl
*This
= (IDirectMusicBufferImpl
*)iface
;
139 FIXME("(%p, %ld): stub\n", This
, cb
);
143 IDirectMusicBufferVtbl DirectMusicBuffer_Vtbl
= {
144 IDirectMusicBufferImpl_QueryInterface
,
145 IDirectMusicBufferImpl_AddRef
,
146 IDirectMusicBufferImpl_Release
,
147 IDirectMusicBufferImpl_Flush
,
148 IDirectMusicBufferImpl_TotalTime
,
149 IDirectMusicBufferImpl_PackStructured
,
150 IDirectMusicBufferImpl_PackUnstructured
,
151 IDirectMusicBufferImpl_ResetReadPtr
,
152 IDirectMusicBufferImpl_GetNextEvent
,
153 IDirectMusicBufferImpl_GetRawBufferPtr
,
154 IDirectMusicBufferImpl_GetStartTime
,
155 IDirectMusicBufferImpl_GetUsedBytes
,
156 IDirectMusicBufferImpl_GetMaxBytes
,
157 IDirectMusicBufferImpl_GetBufferFormat
,
158 IDirectMusicBufferImpl_SetStartTime
,
159 IDirectMusicBufferImpl_SetUsedBytes
162 /* for ClassFactory */
163 HRESULT WINAPI
DMUSIC_CreateDirectMusicBufferImpl (LPCGUID lpcGUID
, LPVOID
* ppobj
, LPUNKNOWN pUnkOuter
) {
164 IDirectMusicBufferImpl
* dmbuff
;
166 dmbuff
= HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirectMusicBufferImpl
));
167 if (NULL
== dmbuff
) {
169 return E_OUTOFMEMORY
;
171 dmbuff
->lpVtbl
= &DirectMusicBuffer_Vtbl
;
172 dmbuff
->ref
= 0; /* will be inited by QueryInterface */
174 return IDirectMusicBufferImpl_QueryInterface ((LPDIRECTMUSICBUFFER
)dmbuff
, lpcGUID
, ppobj
);