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

yumbegin work disabling vadaaa0188

master
1.5 KiB59 linesraw
1#pragma once
2
3namespace Whisper
4{
5	struct sCaptureDevice
6	{
7		// The display name is suitable for showing to the user, but might not be unique.
8		const wchar_t* displayName;
9
10		// Endpoint ID for an audio capture device
11		// It uniquely identifies the device on the system, but is not a readable string.
12		const wchar_t* endpoint;
13	};
14
15	using pfnFoundCaptureDevices = HRESULT( __stdcall* )( int len, const sCaptureDevice* buffer, void* pv );
16
17	// Flags for the audio capture
18	enum struct eCaptureFlags : uint32_t
19	{
20		// When the capture device supports stereo, keep stereo PCM samples in addition to mono
21		Stereo = 1,
22		// Don't use voice activity detection (VAD).
23		DisableVAD = 2,
24	};
25
26	// Parameters for audio capture
27	struct sCaptureParams
28	{
29		float minDuration = 2.0f;
30		float maxDuration = 3.0f;
31		float dropStartSilence = 0.25f;
32		float pauseDuration = 0.333f;
33		// After audio is segmented using VAD, as many as this many seconds of
34		// audio will be retained as the input to the next transcription window.
35		float retainDuration = 0.25f;
36		// Flags for the audio capture
37		uint32_t flags = 0;
38	};
39
40	enum struct eCaptureStatus : uint8_t
41	{
42		Listening = 1,
43		Voice = 2,
44		Transcribing = 4,
45		Stalled = 0x80,
46	};
47
48	// Return S_OK to continue, or S_FALSE to stop the capture session
49	using pfnShouldCancel = HRESULT( __stdcall* )( void* pv ) noexcept;
50
51	using pfnCaptureStatus = HRESULT( __stdcall* )( void* pv, eCaptureStatus status ) noexcept;
52
53	struct sCaptureCallbacks
54	{
55		pfnShouldCancel shouldCancel;
56		pfnCaptureStatus captureStatus;
57		void* pv;
58	};
59}