Add non-streaming speech recognition examples for MFC (#212)

This commit is contained in:
Fangjun Kuang
2023-07-14 17:00:14 +08:00
committed by GitHub
parent bebc1f1398
commit 0abd7ce881
22 changed files with 1153 additions and 63 deletions

View File

@@ -1,10 +1,11 @@
// StreamingSpeechRecognitionDlg.cpp : implementation file
//
// clang-format off
#include "pch.h"
#include "framework.h"
#include "afxdialogex.h"
// clang-format on
#include "StreamingSpeechRecognitionDlg.h"
@@ -15,7 +16,6 @@
#include "StreamingSpeechRecognition.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
@@ -223,6 +223,7 @@ void CStreamingSpeechRecognitionDlg::InitMicrophone() {
// exit(-1);
AppendLineToMultilineEditCtrl("No default input device found!");
my_btn_.EnableWindow(FALSE);
return;
}
AppendLineToMultilineEditCtrl(std::string("Selected device ") +
Pa_GetDeviceInfo(default_device)->name);
@@ -309,7 +310,6 @@ void CStreamingSpeechRecognitionDlg::InitRecognizer() {
msg += "\r\n";
msg += "That's it!\r\n";
AppendLineToMultilineEditCtrl(msg);
return;
}
@@ -398,8 +398,6 @@ void CStreamingSpeechRecognitionDlg::AppendTextToEditCtrl(
// put the selection at the end of text
my_text_.SetSel(nLength, nLength);
// replace the selection
CString str;
str.Format(_T("%s"), s.c_str());
std::wstring wstr = Utf8ToUtf16(s);