From 8c4603c73675958efc960fbd4bb599a2909d106a Mon Sep 17 00:00:00 2001 From: Konstantin Date: Mon, 16 Jan 2023 14:52:43 +0100 Subject: Source codes --- WhisperNet/API/iAudioBuffer.cs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 WhisperNet/API/iAudioBuffer.cs (limited to 'WhisperNet/API/iAudioBuffer.cs') diff --git a/WhisperNet/API/iAudioBuffer.cs b/WhisperNet/API/iAudioBuffer.cs new file mode 100644 index 0000000..1b35621 --- /dev/null +++ b/WhisperNet/API/iAudioBuffer.cs @@ -0,0 +1,27 @@ +using ComLight; +using System.Runtime.InteropServices; + +namespace Whisper +{ + /// A buffer with a chunk of audio. + /// Note the interface supports both marshaling directions.
+ /// I have not tested, but you should be able to implement this interface in C#, to supply PCM audio data to the native code
+ [ComInterface( "013583aa-c9eb-42bc-83db-633c2c317051", eMarshalDirection.BothWays )] + public interface iAudioBuffer: IDisposable + { + /// Count of samples in the buffer + int countSamples(); + + /// Unmanaged pointer to the internal buffer containing single-channel FP32 samples. + /// If you implementing this interface in C# and your audio data is on the managed heap, use to make sure it doesn't move.
+ /// Or better yet, move the data to unmanaged buffer allocated with or method.
+ IntPtr getPcmMono(); + + /// Unmanaged pointer to the internal buffer containing stereo FP32 samples. + /// When the buffer doesn’t have stereo data, the method gonna return . + IntPtr getPcmStereo(); + + /// Start time of the buffer, relative to the start of the media + void getTime( out TimeSpan time ); + } +} \ No newline at end of file -- cgit v1.2.3