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
ad097a7
master
1using Whisper . Internal ; 2 3namespace Whisper 4{ 5/// <summary>Implement this abstract class to provide callbacks for audio capture method</summary> 6public abstract class CaptureCallbacks 7{ 8/// <summary>Override this method to support cancellation</summary> 9protected virtual bool shouldCancel ( Context sender ) { return false ; } 10 11/// <summary>Override this method to get notified about status changes</summary> 12protected virtual void captureStatusChanged ( Context sender , eCaptureStatus status ) { } 13 14internal pfnShouldCancel cancel ( Context sender ) 15{ 16const int S_OK = 0 ; 17const int S_FALSE = 1 ; 18return delegate ( IntPtr pv ) 19{ 20try 21{ 22return shouldCancel ( sender ) ? S_FALSE : S_OK ; 23} 24catch ( Exception ex ) 25{ 26NativeLogger . captureException ( ex ); 27return ex . HResult ; 28} 29}; 30} 31 32internal pfnCaptureStatus status ( Context sender ) 33{ 34return delegate ( IntPtr pv , eCaptureStatus status ) 35{ 36try 37{ 38captureStatusChanged ( sender , status ); 39return 0 ; 40} 41catch ( Exception ex ) 42{ 43NativeLogger . captureException ( ex ); 44return ex . HResult ; 45} 46}; 47} 48} 49}