using System; namespace DeepSpeechClient.Models { /// /// Wrapper of the pointer used for the decoding stream. /// public class DeepSpeechStream : IDisposable { private unsafe IntPtr** _streamingStatePp; /// /// Initializes a new instance of . /// /// Native pointer of the native stream. public unsafe DeepSpeechStream(IntPtr** streamingStatePP) { _streamingStatePp = streamingStatePP; } /// /// Gets the native pointer. /// /// Thrown when the stream has been disposed or not yet initialized. /// Native pointer of the stream. internal unsafe IntPtr** GetNativePointer() { if (_streamingStatePp == null) throw new InvalidOperationException("Cannot use a disposed or uninitialized stream."); return _streamingStatePp; } public unsafe void Dispose() => _streamingStatePp = null; } }