/// <summary>
 ///
 /// </summary>
 /// <param name="owner">音频设备必须在主线程初始化,需要UI控件引用。</param>
 /// <param name="config"></param>
 /// <param name="recog_grammar"></param>
 /// <param name="recog_params"></param>
 public LocalAudioIsrEngine(IWin32Window owner, IsrConfig config, string recog_grammar, string recog_params = null)
     : base(config, recog_grammar, recog_params ?? "sub=iat,ssm=1,auf=audio/L16;rate=16000,aue=speex,ent=sms16k,rst=plain")
 {
     this.owner     = owner;
     wis            = new WaveIn(owner.Handle);
     wis.WaveFormat = new WaveFormat(16000, 16, 1);
 }
Exemple #2
0
        /// <summary>
        /// 构造函数,初始化引擎,开Session
        /// </summary>
        /// <param name="config">初始化引擎的参数</param>
        /// <param name="sessionParameters">开session的参数</param>
        public IsrClient(IsrConfig config, string recog_grammar, string recog_params)
        {
            this.recog_grammar = recog_grammar;
            this.recog_params  = recog_params;

            IsrInterop.Init(config);
        }
Exemple #3
0
        protected IsrEngine(IsrConfig config, string recog_grammar, string recog_params)
        {
            this.client = new IsrClient(config, recog_grammar, recog_params);

            bw = new BackgroundWorker();
            bw.WorkerReportsProgress      = true;
            bw.WorkerSupportsCancellation = true;
            bw.DoWork             += new DoWorkEventHandler(bw_DoWork);
            bw.ProgressChanged    += new ProgressChangedEventHandler(bw_ProgressChanged);
            bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
        }
Exemple #4
0
        public MainForm()
        {
            InitializeComponent();

            this.config          = new IsrConfig();
            config.ServerUrl     = "dev.voicecloud.cn";
            config.ApplicationId = "518fcbd0";
            config.Timeout       = 10000;
            isr = new AudioFileIsrEngine(config,
                                         "builtin:grammar/../search/location.abnf?language=zh-cn");

            btnAudioFile.Click += btnAudioFile_Click;
            InitLocalSR();
        }
Exemple #5
0
        /// <summary>
        /// QISRInit应当在应用程序初始化时仅调用一次。
        /// </summary>
        /// <param name="config"></param>
        public static void Init(IsrConfig config)
        {
            MspErrors result = QISRInit(config.ToString());

            switch (result)
            {
            case MspErrors.MSP_SUCCESS:    //成功
                break;

            case MspErrors.MSP_ERROR_CONFIG_INITIALIZE:
                throw new Exception("初始化ISR的config实例时出现错误。");

            default:
                throw new Exception("QISR初始化失败,错误代码: " + result);
            }
        }
 public AudioFileIsrEngine(IsrConfig config, string recog_grammar)
     : base(config, recog_grammar, "sub=iat,ssm=1,auf=audio/L16;rate=16000,aue=speex,ent=sms16k,rst=plain")
 {
 }
Exemple #7
0
 public NetworkAudioIsrEngine(IsrConfig config, string recog_grammar, string recog_params = null)
     : base(config, recog_grammar, recog_params ?? "sub=iat,ssm=1,auf=audio/L16;rate=16000,aue=speex,ent=sms16k,rst=plain")
 {
 }