-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathhtstts.h
103 lines (71 loc) · 3.14 KB
/
htstts.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// htstts.h : Declaration of the HTSTTS
#pragma once
#pragma warning(disable: 4996)
#include <atlbase.h>
#include <atlcom.h>
using namespace ATL;
#include <spddkhlp.h>
#include <spcollec.h>
#include "resource.h" // main symbols
#include "htssapi_i.h"
#include "common.h"
#include "TTSManager.h"
#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
#endif
/**
* Represents the hts_engine TTS engine SAPI object.
* This is for communication of SAPI with hts_engine and text analysis.
*
**/
class ATL_NO_VTABLE HTSTTS :
public CComObjectRootEx<CComMultiThreadModel>,
public ISpTTSEngine,
public ISpObjectWithToken,
public CComCoClass<HTSTTS, &CLSID_HTSTTS>
//,public IDispatchImpl<IHTSTTS, &IID_IHTSTTS, &LIBID_htssapiLib, /*wMajor =*/ 1, /*wMinor =*/ 0>
{
public:
HTSTTS();
~HTSTTS();
//================= SAPI interface methods //=================
// ISpObjectWithToken
// interface implementation methods
STDMETHODIMP SetObjectToken(ISpObjectToken* pToken);
STDMETHODIMP GetObjectToken(ISpObjectToken** ppToken);
// ISpTTSEngine methods
// interface implementation methods
STDMETHOD(Speak)(DWORD dwSpeakFlags,
REFGUID rguidFormatId, const WAVEFORMATEX* pWaveFormatEx,
const SPVTEXTFRAG* pTextFragList, ISpTTSEngineSite* pOutputSite);
STDMETHOD(GetOutputFormat)(const GUID* pTargetFormatId,
const WAVEFORMATEX* pTargetWaveFormatEx,
GUID* pDesiredFormatId,
WAVEFORMATEX** ppCoMemDesiredWaveFormatEx);
//================= COM stuff ======================
public:
DECLARE_REGISTRY_RESOURCEID(IDR_HTSTTS)
BEGIN_COM_MAP(HTSTTS)
//COM_INTERFACE_ENTRY(IHTSTTS)
//COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(ISpTTSEngine)
COM_INTERFACE_ENTRY(ISpObjectWithToken)
END_COM_MAP()
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct() {
return S_OK;
}
void FinalRelease() {
}
//================= INTERNALS =======================
private:
CComPtr<ISpObjectToken> voiceToken;
htstts::FragmentPropertiesPtr voiceProperties; ///< default properties for synthesis
bool actionAborted;
int actionSkipSentences;
void ResetActions();
void HandleActions(ISpTTSEngineSite* site);
void HandleEventInterests(ISpTTSEngineSite* site);
htstts::FragmentPropertiesPtr AdjustProperties(const SPVSTATE* state, htstts::FragmentPropertiesPtr props);
};
OBJECT_ENTRY_AUTO(__uuidof(HTSTTS), HTSTTS)