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
8c4603c
master
1#pragma once 2#include <whisperWindows.h> 3#include <deque> 4#include <unordered_set> 5 6class AppState ; 7class DebugConsole 8{ 9using eLogLevel = Whisper ::eLogLevel ; 10 11struct Entry 12 { 13eLogLevel level ; 14CStringA message ; 15HRESULT HANDLE hConsole ,CString & tempString )const ; 16 }; 17 18CComAutoCriticalSection critSec ; 19std ::deque < Entry > buffer ; 20CString tempString ; 21CHandle output ; 22 23inline void logSink (eLogLevel lvl ,const char * message ); 24static void __stdcalllogSinkStatic (void * context ,eLogLevel lvl ,const char * message ); 25 26static BOOL __stdcallconsoleHandlerRoutine (DWORD dwCtrlType ); 27 28static DebugConsole * pGlobalInstance ; 29void windowClosed (); 30 31std ::unordered_set < CButton *> checkboxes ; 32 33CStringA tempStringA ; 34void log (eLogLevel lvl ,const char * pszFormat ,va_list args ); 35 36public : 37HRESULT initialize (eLogLevel level = eLogLevel ::Debug ); 38 ~DebugConsole (); 39 40HRESULT show (); 41HRESULT hide (); 42bool isVisible ()const {return output ; } 43 44void addCheckbox (CButton & cb ); 45void removeCheckbox (CButton & cb ); 46 47static void logMessage (eLogLevel lvl ,const char * pszFormat ,va_list args ); 48}; 49 50class ConsoleCheckbox 51{ 52CButton control ; 53DebugConsole * console = nullptr ; 54 55public : 56HRESULT initialize (HWND dialog ,int idc ,AppState & state ); 57void click (); 58 ~ConsoleCheckbox () 59 { 60if (nullptr != console ) 61console -> removeCheckbox (control ); 62 } 63void ensureChecked (); 64};