-
Notifications
You must be signed in to change notification settings - Fork 1
/
VoiceSetup.cpp
170 lines (126 loc) · 3.82 KB
/
VoiceSetup.cpp
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
// VoiceSetup.cpp : implementation file
//
#include "stdafx.h"
#ifdef _ROBO_READER
#include "RoboMX.h"
#include "VoiceSetup.h"
#include "settings.h"
#include <sapi.h>
#include <sphelper.h>
#include <spuihelp.h>
#include "ini.h"
extern CSettings g_sSettings;
// CVoiceSetup dialog
IMPLEMENT_DYNAMIC(CVoiceSetup, CDialog)
CVoiceSetup::CVoiceSetup(CWnd* pParent /*=NULL*/)
: CDialog(CVoiceSetup::IDD, pParent)
, m_nMaleVoice(0)
, m_strAddMale(_T(""))
, m_nFemVoice(0)
, m_strFemAdd(_T(""))
, m_bDefMale(FALSE)
, m_bSpeakOnly(FALSE)
{
}
CVoiceSetup::~CVoiceSetup()
{
}
void CVoiceSetup::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_MALE_VOICE, m_cbMaleVoice);
DDX_Control(pDX, IDC_MALE_CHAR, m_cbMaleChar);
DDX_Control(pDX, IDC_MALES, m_lbMales);
DDX_Control(pDX, IDC_FEMALE_VOICE, m_cbFemVoice);
DDX_Control(pDX, IDC_FEMALE_CHAR, m_cbFemChar);
DDX_Control(pDX, IDC_FEMALES, m_lbFemales);
}
BEGIN_MESSAGE_MAP(CVoiceSetup, CDialog)
ON_BN_CLICKED(IDC_ADD_MALE, OnBnClickedAddMale)
ON_BN_CLICKED(IDC_REM_MALE, OnBnClickedRemMale)
ON_BN_CLICKED(IDC_ADD_FEM, OnBnClickedAddFem)
ON_BN_CLICKED(IDC_REM_FEM, OnBnClickedRemFem)
ON_BN_CLICKED(IDOK, OnBnClickedOk)
ON_CBN_SELCHANGE(IDC_MALE_VOICE, OnCbnSelchangeMaleVoice)
ON_CBN_SELCHANGE(IDC_FEMALE_VOICE, OnCbnSelchangeFemaleVoice)
END_MESSAGE_MAP()
BOOL CVoiceSetup::OnInitDialog(void)
{
CDialog::OnInitDialog();
HRESULT hr = S_OK;
/*hr = SpEnumTokens(SPCAT_VOICES, NULL, NULL, &cpEnum);
if(SUCCEEDED(hr)){
hr = cpEnum->GetCount(&ulCount);
}
while(SUCCEEDED(hr) && ulCount -- ){
cpVoiceToken.Release();
if(SUCCEEDED(hr))
hr = cpEnum->Next( 1, &cpVoiceToken, NULL );
if(SUCCEEDED(hr))
hr = cpVoice->SetVoice(cpVoiceToken);
if(SUCCEEDED(hr))
hr = cpVoice->Speak( L"How are you?", SPF_DEFAULT, NULL);
m_cbMaleVoice.AddString(
} */
hr = SpInitTokenComboBox(GetDlgItem(IDC_MALE_VOICE)->m_hWnd, SPCAT_VOICES);
if(FAILED(hr)){
AfxMessageBox("Error enumerating voices", MB_ICONSTOP);
}
hr = SpInitTokenComboBox(GetDlgItem(IDC_FEMALE_VOICE)->m_hWnd, SPCAT_VOICES);
if(FAILED(hr)){
AfxMessageBox("Error enumerating voices", MB_ICONSTOP);
}
CFileFind finder;
BOOL bFound = finder.FindFile(g_sSettings.GetWorkingDir() + "\\gfx\\char_*.bmp");
CString strChar, strTmp;
while(finder.FindNextFile()){
strChar = finder.GetFileTitle();
strChar = strChar.Mid(5);
m_cbMaleChar.AddString(strChar);
m_cbFemChar.AddString(strChar);
}
CIni ini;
ini.SetIniFileName(g_sSettings.GetIniFile());
int nCnt = ini.GetValue("Voice", "MaleCount", 0);
for(int i = 0; i < nCnt; i++){
strTmp.Format("Male_%d", i);
m_lbMales.AddString(ini.GetValue("Voice", strTmp, ""));
}
nCnt = ini.GetValue("Voice", "FemaleCount", 0);
for(int i = 0; i < nCnt; i++){
strTmp.Format("Female_%d", i);
m_lbFemales.AddString(ini.GetValue("Voice", strTmp, ""));
}
return TRUE;
}
void CVoiceSetup::OnBnClickedOk()
{
// TODO: Add your control notification handler code here
OnOK();
}
// CVoiceSetup message handlers
void CVoiceSetup::OnBnClickedAddMale()
{
// TODO: Add your control notification handler code here
}
void CVoiceSetup::OnBnClickedRemMale()
{
// TODO: Add your control notification handler code here
}
void CVoiceSetup::OnBnClickedAddFem()
{
// TODO: Add your control notification handler code here
}
void CVoiceSetup::OnBnClickedRemFem()
{
// TODO: Add your control notification handler code here
}
void CVoiceSetup::OnCbnSelchangeMaleVoice()
{
// TODO: Add your control notification handler code here
}
void CVoiceSetup::OnCbnSelchangeFemaleVoice()
{
// TODO: Add your control notification handler code here
}
#endif