summaryrefslogtreecommitdiffstats
path: root/WhisperNet/Internal/iContext.cs
blob: 010c139afb300b07d0f60d50d7ee693209c4f697 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using ComLight;
using System.Runtime.InteropServices;
using Whisper.Internals;

namespace Whisper.Internal
{
    /// <summary>Stateful context, contains methods to transcribe audio</summary>
    [ComInterface( "b9956374-3b18-4943-90f2-2ab18a404537", eMarshalDirection.ToManaged ), CustomConventions( typeof( NativeLogger ) )]
	public interface iContext: IDisposable
	{
		/// <summary>Run the entire model: PCM -> log mel spectrogram -> encoder -> decoder -> text</summary>
		void runFull( [In] ref sFullParams @params, iAudioBuffer buffer );

		/// <summary>Run the entire model, streaming audio from the provided reader object</summary>
		void runStreamed( [In] ref sFullParams @params, [In] ref sProgressSink progressSink, iAudioReader reader );

		/// <summary>Continuously process audio from microphone or a similar capture device</summary>
		void runCapture( [In] ref sFullParams @params, [In] ref sCaptureCallbacks callbacks, iAudioCapture reader );

		/// <summary>Get text results out of the context</summary>
		[RetValIndex( 1 )]
		iTranscribeResult getResults( eResultFlags flags );

		/// <summary>Try to detect speaker by comparing channels of the stereo PCM data</summary>
		[RetValIndex( 1 )]
		eSpeakerChannel detectSpeaker( [In] ref sTimeInterval interval );

		/// <summary>Get the model which was used to create this context</summary>
		[RetValIndex]
		iModel getModel();

		/// <summary>Full the default parameters of the model, for the specified sampling strategy</summary>
		[RetValIndex( 1 )]
		sFullParams fullDefaultParams( eSamplingStrategy strategy );

		/// <summary>Print timing data</summary>
		void timingsPrint();
		/// <summary>Reset timing data</summary>
		void timingsReset();
	}
}