private void ButtonInit_Click(object sender, EventArgs e) { DlgInit dlg = new DlgInit(); if (DialogResult.OK == dlg.ShowDialog(this)) { string strLibPath = null; string strSerialNO = null; int iErr = 0; dlg.GetData(out strLibPath, out strSerialNO); if (bInitialed) { iErr = Jtts.jTTS_End(); } iErr = Jtts.jTTS_Init(strLibPath, strSerialNO); if (Jtts.ERR_NONE == iErr || Jtts.ERR_ALREADYINIT == iErr) { bInitialed = true; MessageBox.Show("初始化成功!"); } else { JttsErrMsg(iErr); } } dlg.Dispose(); }
public FrmMain() { InitializeComponent(); int iErr = Jtts.jTTS_Init(null, null); if (Jtts.ERR_NONE == iErr || Jtts.ERR_ALREADYINIT == iErr) { bInitialed = true; MessageBox.Show("初始化成功"); } else { JttsErrMsg(iErr); } Jtts.JTTS_CONFIG config = new InfoQuick.SinoVoice.Tts.Jtts.JTTS_CONFIG(); iErr = Jtts.jTTS_Get(out config); config.nCodePage = (ushort)Encoding.Default.CodePage; Jtts.jTTS_Set(ref config); }