using ComLight; using System.Runtime.InteropServices; namespace Whisper { /// A buffer with a chunk of audio. /// Note the interface supports both marshaling directions.
/// You can 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, equal to ( length in seconds ) * 16000 int countSamples(); /// Unmanaged pointer to the internal buffer with single-channel float PCM samples @ 16 kHz sample rate. /// 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 with interleaved stereo float PCM samples @ 16 kHz sample rate. /// When the buffer doesn’t have stereo data, the method should return . IntPtr getPcmStereo(); /// Start time of the buffer, relative to the start of the media. /// The value is used to produce timestamps in and fields. void getTime( out TimeSpan time ); } }