yum-archive/TaSTT-Whisper
High-performance GPGPU inference of OpenAI's Whisper automatic speech recognition (ASR) model
git clone https://git.yummers.dev/yum-archive/TaSTT-Whisper
c4cf795
master
1#include "stdafx.h" 2#include "AppState.h" 3#include "Utils/miscUtils.h" 4#include "LoadModelDlg.h" 5#include "TranscribeDlg.h" 6#include "CaptureDlg.h" 7 8static HRESULT dialogLoadModel (AppState & appState ) 9{ 10LoadModelDlg loadDialog {appState }; 11HRESULT hr = loadDialog .show (); 12if (FAILED (hr ) ) 13 { 14reportFatalError ("Error loading the model" ,hr ); 15return hr ; 16 } 17appState .automaticallyLoadModel = false; 18return hr ; 19} 20 21static HRESULT dialogTranscribe (AppState & appState ) 22{ 23TranscribeDlg dialog {appState }; 24return dialog .show (); 25} 26 27static HRESULT dialogCapture (AppState & appState ) 28{ 29CaptureDlg dialog {appState }; 30return dialog .show (); 31} 32 33using pfnDialog = HRESULT (* )(AppState & appState ); 34static const std::array < pfnDialog ,4 > s_dialogs = 35{ 36nullptr ,// S_OK 37& dialogLoadModel ,// SCREEN_MODEL 38& dialogTranscribe ,// SCREEN_TRANSCRIBE 39& dialogCapture ,// SCREEN_CAPTURE 40}; 41 42int __stdcallwWinMain (HINSTANCE hInstance ,HINSTANCE hPrevInstance ,LPWSTR lpCmdLine ,int nCmdShow ) 43{ 44AppState appState ; 45HRESULT hr = appState .startup (); 46if (FAILED (hr ) ) 47return hr ; 48 49appState .findModelSource (); 50 51hr = SCREEN_MODEL ; 52while ( true ) 53 { 54pfnDialog pfn = s_dialogs [hr ]; 55if (nullptr == pfn ) 56return S_OK ; 57hr = pfn (appState ); 58if (FAILED (hr ) ) 59return hr ; 60if (hr == SCREEN_MODEL ) 61appState .model = nullptr ; 62 } 63}