Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
SpRecognition.cs
Package: speech.rar [view]
Upload User: cookies0
Upload Date: 2022-07-28
Package Size: 284k
Code Size: 2k
Category:
Speech/Voice recognition/combine
Development Platform:
Visual C++
- using System;
- using System.Collections.Generic;
- using System.Text;
- using SpeechLib;
- using System.Windows.Forms;
- namespace tryreco
- {
- class SpRecognition
- {
- private static SpRecognition _Instance = null;
- private SpeechLib.ISpeechRecoGrammar isrg;
- private SpeechLib.SpSharedRecoContextClass ssrContex = null;
- private System.Windows.Forms.Control cDisplay; //fan:用来显示语音转化后的文本
- public System.Windows.Forms.TextBox textbox; //fan:增加textbox在SpRecognition 类
- public SpRecognition()
- {
- ssrContex = new SpSharedRecoContextClass();
- isrg = ssrContex.CreateGrammar(1);
- SpeechLib._ISpeechRecoContextEvents_RecognitionEventHandler recHandle =
- new _ISpeechRecoContextEvents_RecognitionEventHandler(ContexRecognition);
- ssrContex.Recognition += recHandle;
- }
- public void BeginRec(Control tbResult)
- {
- isrg.DictationSetState(SpeechRuleState.SGDSActive);
- cDisplay = tbResult;
- // cDisplay.Text = "dddddddddd"; //测试,可以成功在textbox1那里显示出来
- }
- public static SpRecognition instance()
- {
- if (_Instance == null)
- _Instance = new SpRecognition();
- return _Instance;
- }
- public void CloseRec()
- {
- isrg.DictationSetState(SpeechRuleState.SGDSInactive);
- }
- private void ContexRecognition(int iIndex, object obj, SpeechLib.SpeechRecognitionType type, SpeechLib.ISpeechRecoResult result)
- {
- cDisplay.Text += result.PhraseInfo.GetText(0, -1, true);
- }
- public void MessageBegin()//弹出开始提示
- {
- textbox = new TextBox();
- textbox.Text = "Notice :this time ,it Begin recoginse";
- MessageBox.Show(textbox.Text);
- }
- public void MessageEnd() //弹出停止提示
- {
- textbox = new TextBox();
- textbox.Text = "Notice :this time ,it End recoginse";
- MessageBox.Show(textbox.Text);
- }
- }
- }