2 * Speech API (SAPI) automation implementation.
4 * Copyright 2019 Jactry Zeng for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
31 #include "wine/debug.h"
33 #include "sapi_private.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(sapi
);
39 ISpeechFileStream ISpeechFileStream_iface
;
40 ISpStream ISpStream_iface
;
44 static inline struct file_stream
*impl_from_ISpeechFileStream(ISpeechFileStream
*iface
)
46 return CONTAINING_RECORD(iface
, struct file_stream
, ISpeechFileStream_iface
);
49 static inline struct file_stream
*impl_from_ISpStream(ISpStream
*iface
)
51 return CONTAINING_RECORD(iface
, struct file_stream
, ISpStream_iface
);
54 /* ISpeechFileStream interface */
55 static HRESULT WINAPI
file_stream_QueryInterface(ISpeechFileStream
*iface
, REFIID iid
, void **obj
)
57 struct file_stream
*This
= impl_from_ISpeechFileStream(iface
);
59 TRACE("(%p, %s, %p).\n", iface
, debugstr_guid(iid
), obj
);
61 if (IsEqualIID(iid
, &IID_IUnknown
) ||
62 IsEqualIID(iid
, &IID_IDispatch
) ||
63 IsEqualIID(iid
, &IID_ISpeechBaseStream
) ||
64 IsEqualIID(iid
, &IID_ISpeechFileStream
))
65 *obj
= &This
->ISpeechFileStream_iface
;
66 else if (IsEqualIID(iid
, &IID_ISpStream
))
67 *obj
= &This
->ISpStream_iface
;
71 FIXME("interface %s not implemented.\n", debugstr_guid(iid
));
75 IUnknown_AddRef((IUnknown
*)*obj
);
79 static ULONG WINAPI
file_stream_AddRef(ISpeechFileStream
*iface
)
81 struct file_stream
*This
= impl_from_ISpeechFileStream(iface
);
82 ULONG ref
= InterlockedIncrement(&This
->ref
);
84 TRACE("(%p): ref=%lu.\n", iface
, ref
);
89 static ULONG WINAPI
file_stream_Release(ISpeechFileStream
*iface
)
91 struct file_stream
*This
= impl_from_ISpeechFileStream(iface
);
92 ULONG ref
= InterlockedDecrement(&This
->ref
);
94 TRACE("(%p): ref=%lu.\n", iface
, ref
);
104 static HRESULT WINAPI
file_stream_GetTypeInfoCount(ISpeechFileStream
*iface
, UINT
*info
)
106 FIXME("(%p, %p): stub.\n", iface
, info
);
111 static HRESULT WINAPI
file_stream_GetTypeInfo(ISpeechFileStream
*iface
, UINT info
, LCID lcid
,
112 ITypeInfo
**type_info
)
114 FIXME("(%p, %u, %lu, %p): stub.\n", iface
, info
, lcid
, type_info
);
119 static HRESULT WINAPI
file_stream_GetIDsOfNames(ISpeechFileStream
*iface
, REFIID riid
, LPOLESTR
*names
,
120 UINT count
, LCID lcid
, DISPID
*dispid
)
122 FIXME("(%p, %s, %p, %u, %lu, %p): stub.\n", iface
, debugstr_guid(riid
), names
, count
, lcid
, dispid
);
127 static HRESULT WINAPI
file_stream_Invoke(ISpeechFileStream
*iface
, DISPID dispid
, REFIID riid
, LCID lcid
,
128 WORD flags
, DISPPARAMS
*params
, VARIANT
*result
,
129 EXCEPINFO
*excepinfo
, UINT
*argerr
)
131 FIXME("(%p, %ld, %s, %#lx, %#x, %p, %p, %p, %p): stub.\n", iface
, dispid
, debugstr_guid(riid
),
132 lcid
, flags
, params
, result
, excepinfo
, argerr
);
137 static HRESULT WINAPI
file_stream_get_Format(ISpeechFileStream
*iface
, ISpeechAudioFormat
**format
)
139 FIXME("(%p, %p): stub.\n", iface
, format
);
144 static HRESULT WINAPI
file_stream_putref_Format(ISpeechFileStream
*iface
, ISpeechAudioFormat
*format
)
146 FIXME("(%p, %p): stub.\n", iface
, format
);
151 static HRESULT WINAPI
file_stream_Read(ISpeechFileStream
*iface
, VARIANT
*buffer
, LONG written
, LONG
*read
)
153 FIXME("(%p, %p, %ld, %p): stub.\n", iface
, buffer
, written
, read
);
158 static HRESULT WINAPI
file_stream_Write(ISpeechFileStream
*iface
, VARIANT buffer
, LONG
*written
)
160 FIXME("(%p, %s, %p): stub.\n", iface
, debugstr_variant(&buffer
), written
);
165 static HRESULT WINAPI
file_stream_Seek(ISpeechFileStream
*iface
, VARIANT position
, SpeechStreamSeekPositionType origin
,
168 FIXME("(%p, %s, %d, %p): stub.\n", iface
, debugstr_variant(&position
), origin
, pos
);
173 static HRESULT WINAPI
file_stream_Open(ISpeechFileStream
*iface
, BSTR filename
, SpeechStreamFileMode mode
, VARIANT_BOOL events
)
175 FIXME("(%p, %s, %d, %d): stub.\n", iface
, debugstr_w(filename
), mode
, events
);
180 static HRESULT WINAPI
file_stream_Close(ISpeechFileStream
*iface
)
182 FIXME("(%p): stub.\n", iface
);
187 const static ISpeechFileStreamVtbl file_stream_vtbl
=
189 file_stream_QueryInterface
,
192 file_stream_GetTypeInfoCount
,
193 file_stream_GetTypeInfo
,
194 file_stream_GetIDsOfNames
,
196 file_stream_get_Format
,
197 file_stream_putref_Format
,
205 /* ISpStream interface */
206 static HRESULT WINAPI
spstream_QueryInterface(ISpStream
*iface
, REFIID iid
, void **obj
)
208 struct file_stream
*This
= impl_from_ISpStream(iface
);
210 TRACE("(%p, %s, %p).\n", iface
, debugstr_guid(iid
), obj
);
212 return ISpeechFileStream_QueryInterface(&This
->ISpeechFileStream_iface
, iid
, obj
);
215 static ULONG WINAPI
spstream_AddRef(ISpStream
*iface
)
217 struct file_stream
*This
= impl_from_ISpStream(iface
);
219 TRACE("(%p).\n", iface
);
221 return ISpeechFileStream_AddRef(&This
->ISpeechFileStream_iface
);
224 static ULONG WINAPI
spstream_Release(ISpStream
*iface
)
226 struct file_stream
*This
= impl_from_ISpStream(iface
);
228 TRACE("(%p).\n", iface
);
230 return ISpeechFileStream_Release(&This
->ISpeechFileStream_iface
);
233 static HRESULT WINAPI
spstream_Read(ISpStream
*iface
, void *pv
, ULONG cb
, ULONG
*read
)
235 FIXME("(%p, %p, %ld, %p): stub.\n", iface
, pv
, cb
, read
);
240 static HRESULT WINAPI
spstream_Write(ISpStream
*iface
, const void *pv
, ULONG cb
, ULONG
*written
)
242 FIXME("(%p, %p, %ld, %p): stub.\n", iface
, pv
, cb
, written
);
247 static HRESULT WINAPI
spstream_Seek(ISpStream
*iface
, LARGE_INTEGER mode
, DWORD origin
, ULARGE_INTEGER
*position
)
249 FIXME("(%p, %s, %ld, %p): stub.\n", iface
, wine_dbgstr_longlong(mode
.QuadPart
), origin
, position
);
254 static HRESULT WINAPI
spstream_SetSize(ISpStream
*iface
, ULARGE_INTEGER size
)
256 FIXME("(%p, %s): stub.\n", iface
, wine_dbgstr_longlong(size
.QuadPart
));
261 static HRESULT WINAPI
spstream_CopyTo(ISpStream
*iface
, IStream
*stream
, ULARGE_INTEGER cb
,
262 ULARGE_INTEGER
*read
, ULARGE_INTEGER
*written
)
264 FIXME("(%p, %p, %s, %p, %p): stub.\n", iface
, stream
, wine_dbgstr_longlong(cb
.QuadPart
),
270 static HRESULT WINAPI
spstream_Commit(ISpStream
*iface
, DWORD flag
)
272 FIXME("(%p, %ld): stub.\n", iface
, flag
);
277 static HRESULT WINAPI
spstream_Revert(ISpStream
*iface
)
279 FIXME("(%p): stub.\n", iface
);
284 static HRESULT WINAPI
spstream_LockRegion(ISpStream
*iface
, ULARGE_INTEGER offset
, ULARGE_INTEGER cb
, DWORD type
)
286 FIXME("(%p, %s, %s, %ld): stub.\n", iface
, wine_dbgstr_longlong(offset
.QuadPart
),
287 wine_dbgstr_longlong(cb
.QuadPart
), type
);
292 static HRESULT WINAPI
spstream_UnlockRegion(ISpStream
*iface
, ULARGE_INTEGER offset
, ULARGE_INTEGER cb
, DWORD type
)
294 FIXME("(%p, %s, %s, %ld): stub.\n", iface
, wine_dbgstr_longlong(offset
.QuadPart
),
295 wine_dbgstr_longlong(cb
.QuadPart
), type
);
300 static HRESULT WINAPI
spstream_Stat(ISpStream
*iface
, STATSTG
*statstg
, DWORD flag
)
302 FIXME("(%p, %p, %ld): stub.\n", iface
, statstg
, flag
);
307 static HRESULT WINAPI
spstream_Clone(ISpStream
*iface
, IStream
**stream
)
309 FIXME("(%p, %p): stub.\n", iface
, stream
);
314 static HRESULT WINAPI
spstream_GetFormat(ISpStream
*iface
, GUID
*format
, WAVEFORMATEX
**wave
)
316 FIXME("(%p, %p, %p): stub.\n", iface
, format
, wave
);
321 static HRESULT WINAPI
spstream_SetBaseStream(ISpStream
*iface
, IStream
*stream
, REFGUID format
,
322 const WAVEFORMATEX
*wave
)
324 FIXME("(%p, %p, %s, %p): stub.\n", iface
, stream
, debugstr_guid(format
), wave
);
329 static HRESULT WINAPI
spstream_GetBaseStream(ISpStream
*iface
, IStream
**stream
)
331 FIXME("(%p, %p): stub.\n", iface
, stream
);
336 static HRESULT WINAPI
spstream_BindToFile(ISpStream
*iface
, LPCWSTR filename
, SPFILEMODE mode
,
337 const GUID
*format
, const WAVEFORMATEX
* wave
,
340 FIXME("(%p, %s, %d, %s, %p, %s): stub.\n", iface
, debugstr_w(filename
), mode
, debugstr_guid(format
),
341 wave
, wine_dbgstr_longlong(interest
));
346 static HRESULT WINAPI
spstream_Close(ISpStream
*iface
)
348 FIXME("(%p): stub.\n", iface
);
353 const static ISpStreamVtbl spstream_vtbl
=
355 spstream_QueryInterface
,
366 spstream_UnlockRegion
,
370 spstream_SetBaseStream
,
371 spstream_GetBaseStream
,
376 HRESULT
file_stream_create(IUnknown
*outer
, REFIID iid
, void **obj
)
378 struct file_stream
*This
= heap_alloc(sizeof(*This
));
381 if (!This
) return E_OUTOFMEMORY
;
382 This
->ISpeechFileStream_iface
.lpVtbl
= &file_stream_vtbl
;
383 This
->ISpStream_iface
.lpVtbl
= &spstream_vtbl
;
386 hr
= ISpeechFileStream_QueryInterface(&This
->ISpeechFileStream_iface
, iid
, obj
);
388 ISpeechFileStream_Release(&This
->ISpeechFileStream_iface
);