-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add non-streaming speech recognition examples for MFC (#212)
- Loading branch information
1 parent
bebc1f1
commit 0abd7ce
Showing
22 changed files
with
1,153 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
mfc-examples/NonStreamingSpeechRecognition/NonStreamingSpeechRecognition.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
|
||
// NonStreamingSpeechRecognition.cpp : Defines the class behaviors for the | ||
// application. | ||
// | ||
|
||
// clang-format off | ||
#include "pch.h" | ||
#include "framework.h" | ||
#include "NonStreamingSpeechRecognitionDlg.h" | ||
#include "NonStreamingSpeechRecognition.h" | ||
// clang-format on | ||
|
||
#ifdef _DEBUG | ||
#define new DEBUG_NEW | ||
#endif | ||
|
||
// CNonStreamingSpeechRecognitionApp | ||
|
||
BEGIN_MESSAGE_MAP(CNonStreamingSpeechRecognitionApp, CWinApp) | ||
ON_COMMAND(ID_HELP, &CWinApp::OnHelp) | ||
END_MESSAGE_MAP() | ||
|
||
// CNonStreamingSpeechRecognitionApp construction | ||
|
||
CNonStreamingSpeechRecognitionApp::CNonStreamingSpeechRecognitionApp() { | ||
// TODO: add construction code here, | ||
// Place all significant initialization in InitInstance | ||
} | ||
|
||
// The one and only CNonStreamingSpeechRecognitionApp object | ||
|
||
CNonStreamingSpeechRecognitionApp theApp; | ||
|
||
// CNonStreamingSpeechRecognitionApp initialization | ||
|
||
BOOL CNonStreamingSpeechRecognitionApp::InitInstance() { | ||
CWinApp::InitInstance(); | ||
|
||
// Create the shell manager, in case the dialog contains | ||
// any shell tree view or shell list view controls. | ||
CShellManager *pShellManager = new CShellManager; | ||
|
||
// Activate "Windows Native" visual manager for enabling themes in MFC | ||
// controls | ||
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows)); | ||
|
||
// Standard initialization | ||
// If you are not using these features and wish to reduce the size | ||
// of your final executable, you should remove from the following | ||
// the specific initialization routines you do not need | ||
// Change the registry key under which our settings are stored | ||
// TODO: You should modify this string to be something appropriate | ||
// such as the name of your company or organization | ||
SetRegistryKey(_T("Local AppWizard-Generated Applications")); | ||
|
||
CNonStreamingSpeechRecognitionDlg dlg; | ||
m_pMainWnd = &dlg; | ||
INT_PTR nResponse = dlg.DoModal(); | ||
if (nResponse == IDOK) { | ||
// TODO: Place code here to handle when the dialog is | ||
// dismissed with OK | ||
} else if (nResponse == IDCANCEL) { | ||
// TODO: Place code here to handle when the dialog is | ||
// dismissed with Cancel | ||
} else if (nResponse == -1) { | ||
TRACE(traceAppMsg, 0, | ||
"Warning: dialog creation failed, so application is terminating " | ||
"unexpectedly.\n"); | ||
TRACE(traceAppMsg, 0, | ||
"Warning: if you are using MFC controls on the dialog, you cannot " | ||
"#define _AFX_NO_MFC_CONTROLS_IN_DIALOGS.\n"); | ||
} | ||
|
||
// Delete the shell manager created above. | ||
if (pShellManager != nullptr) { | ||
delete pShellManager; | ||
} | ||
|
||
#if !defined(_AFXDLL) && !defined(_AFX_NO_MFC_CONTROLS_IN_DIALOGS) | ||
ControlBarCleanUp(); | ||
#endif | ||
|
||
// Since the dialog has been closed, return FALSE so that we exit the | ||
// application, rather than start the application's message pump. | ||
return FALSE; | ||
} |
31 changes: 31 additions & 0 deletions
31
mfc-examples/NonStreamingSpeechRecognition/NonStreamingSpeechRecognition.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
// NonStreamingSpeechRecognition.h : main header file for the PROJECT_NAME | ||
// application | ||
// | ||
|
||
#pragma once | ||
|
||
#ifndef __AFXWIN_H__ | ||
#error "include 'pch.h' before including this file for PCH" | ||
#endif | ||
|
||
#include "resource.h" // main symbols | ||
|
||
// CNonStreamingSpeechRecognitionApp: | ||
// See NonStreamingSpeechRecognition.cpp for the implementation of this class | ||
// | ||
|
||
class CNonStreamingSpeechRecognitionApp : public CWinApp { | ||
public: | ||
CNonStreamingSpeechRecognitionApp(); | ||
|
||
// Overrides | ||
public: | ||
virtual BOOL InitInstance(); | ||
|
||
// Implementation | ||
|
||
DECLARE_MESSAGE_MAP() | ||
}; | ||
|
||
extern CNonStreamingSpeechRecognitionApp theApp; |
Binary file added
BIN
+10.1 KB
mfc-examples/NonStreamingSpeechRecognition/NonStreamingSpeechRecognition.rc
Binary file not shown.
219 changes: 219 additions & 0 deletions
219
mfc-examples/NonStreamingSpeechRecognition/NonStreamingSpeechRecognition.vcxproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,219 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup Label="ProjectConfigurations"> | ||
<ProjectConfiguration Include="Debug|Win32"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>Win32</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|Win32"> | ||
<Configuration>Release</Configuration> | ||
<Platform>Win32</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Debug|x64"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>x64</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|x64"> | ||
<Configuration>Release</Configuration> | ||
<Platform>x64</Platform> | ||
</ProjectConfiguration> | ||
</ItemGroup> | ||
<PropertyGroup Label="Globals"> | ||
<VCProjectVersion>17.0</VCProjectVersion> | ||
<ProjectGuid>{0298EE00-7AF2-4A66-9D5F-AA0D92AC871D}</ProjectGuid> | ||
<Keyword>MFCProj</Keyword> | ||
<RootNamespace>NonStreamingSpeechRecognition</RootNamespace> | ||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<UseDebugLibraries>true</UseDebugLibraries> | ||
<PlatformToolset>v143</PlatformToolset> | ||
<CharacterSet>Unicode</CharacterSet> | ||
<UseOfMfc>Static</UseOfMfc> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<UseDebugLibraries>false</UseDebugLibraries> | ||
<PlatformToolset>v143</PlatformToolset> | ||
<WholeProgramOptimization>true</WholeProgramOptimization> | ||
<CharacterSet>Unicode</CharacterSet> | ||
<UseOfMfc>Static</UseOfMfc> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<UseDebugLibraries>true</UseDebugLibraries> | ||
<PlatformToolset>v143</PlatformToolset> | ||
<CharacterSet>Unicode</CharacterSet> | ||
<UseOfMfc>Static</UseOfMfc> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<UseDebugLibraries>false</UseDebugLibraries> | ||
<PlatformToolset>v143</PlatformToolset> | ||
<WholeProgramOptimization>true</WholeProgramOptimization> | ||
<CharacterSet>Unicode</CharacterSet> | ||
<UseOfMfc>Static</UseOfMfc> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
<ImportGroup Label="ExtensionSettings"> | ||
</ImportGroup> | ||
<ImportGroup Label="Shared"> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
<Import Project="sherpa-onnx-deps.props" /> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
<Import Project="sherpa-onnx-deps.props" /> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
<Import Project="sherpa-onnx-deps.props" /> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
<Import Project="sherpa-onnx-deps.props" /> | ||
</ImportGroup> | ||
<PropertyGroup Label="UserMacros" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<LinkIncremental>false</LinkIncremental> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<LinkIncremental>true</LinkIncremental> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<LinkIncremental>true</LinkIncremental> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<LinkIncremental>false</LinkIncremental> | ||
</PropertyGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<ClCompile> | ||
<PrecompiledHeader>Use</PrecompiledHeader> | ||
<WarningLevel>Level3</WarningLevel> | ||
<FunctionLevelLinking>true</FunctionLevelLinking> | ||
<IntrinsicFunctions>true</IntrinsicFunctions> | ||
<SDLCheck>true</SDLCheck> | ||
<PreprocessorDefinitions>_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Windows</SubSystem> | ||
<EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
<OptimizeReferences>true</OptimizeReferences> | ||
</Link> | ||
<Midl> | ||
<MkTypLibCompatible>false</MkTypLibCompatible> | ||
<ValidateAllParameters>true</ValidateAllParameters> | ||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
</Midl> | ||
<ResourceCompile> | ||
<Culture>0x0409</Culture> | ||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
</ResourceCompile> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<ClCompile> | ||
<PrecompiledHeader>Use</PrecompiledHeader> | ||
<WarningLevel>Level3</WarningLevel> | ||
<SDLCheck>true</SDLCheck> | ||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Windows</SubSystem> | ||
</Link> | ||
<Midl> | ||
<MkTypLibCompatible>false</MkTypLibCompatible> | ||
<ValidateAllParameters>true</ValidateAllParameters> | ||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
</Midl> | ||
<ResourceCompile> | ||
<Culture>0x0409</Culture> | ||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
</ResourceCompile> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<ClCompile> | ||
<PrecompiledHeader>Use</PrecompiledHeader> | ||
<WarningLevel>Level3</WarningLevel> | ||
<SDLCheck>true</SDLCheck> | ||
<PreprocessorDefinitions>_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Windows</SubSystem> | ||
</Link> | ||
<Midl> | ||
<MkTypLibCompatible>false</MkTypLibCompatible> | ||
<ValidateAllParameters>true</ValidateAllParameters> | ||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
</Midl> | ||
<ResourceCompile> | ||
<Culture>0x0409</Culture> | ||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
</ResourceCompile> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<ClCompile> | ||
<PrecompiledHeader>Use</PrecompiledHeader> | ||
<WarningLevel>Level3</WarningLevel> | ||
<FunctionLevelLinking>true</FunctionLevelLinking> | ||
<IntrinsicFunctions>true</IntrinsicFunctions> | ||
<SDLCheck>true</SDLCheck> | ||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Windows</SubSystem> | ||
<EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
<OptimizeReferences>true</OptimizeReferences> | ||
</Link> | ||
<Midl> | ||
<MkTypLibCompatible>false</MkTypLibCompatible> | ||
<ValidateAllParameters>true</ValidateAllParameters> | ||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
</Midl> | ||
<ResourceCompile> | ||
<Culture>0x0409</Culture> | ||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
</ResourceCompile> | ||
</ItemDefinitionGroup> | ||
<ItemGroup> | ||
<ClInclude Include="framework.h" /> | ||
<ClInclude Include="NonStreamingSpeechRecognition.h" /> | ||
<ClInclude Include="NonStreamingSpeechRecognitionDlg.h" /> | ||
<ClInclude Include="pch.h" /> | ||
<ClInclude Include="Resource.h" /> | ||
<ClInclude Include="targetver.h" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClCompile Include="NonStreamingSpeechRecognition.cpp" /> | ||
<ClCompile Include="NonStreamingSpeechRecognitionDlg.cpp" /> | ||
<ClCompile Include="pch.cpp"> | ||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader> | ||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> | ||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> | ||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> | ||
</ClCompile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ResourceCompile Include="NonStreamingSpeechRecognition.rc" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="res\NonStreamingSpeechRecognition.rc2" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Image Include="res\NonStreamingSpeechRecognition.ico" /> | ||
</ItemGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
<ImportGroup Label="ExtensionTargets"> | ||
</ImportGroup> | ||
</Project> |
Oops, something went wrong.