internal static extern AudioFileStatus AudioFileOpenWithCallbacks( IntPtr userData, [NotNull] NativeCallbacks.AudioFileReadCallback readCallback, [CanBeNull] NativeCallbacks.AudioFileWriteCallback writeCallback, [NotNull] NativeCallbacks.AudioFileGetSizeCallback getSizeCallback, [CanBeNull] NativeCallbacks.AudioFileSetSizeCallback setSizeCallback, AudioFileType fileType, [NotNull] out AudioFileHandle handle);
internal static extern AudioFileStatus AudioFileOpenWithCallbacks( IntPtr userData, NativeCallbacks.AudioFileReadCallback readCallback, NativeCallbacks.AudioFileWriteCallback?writeCallback, NativeCallbacks.AudioFileGetSizeCallback getSizeCallback, NativeCallbacks.AudioFileSetSizeCallback?setSizeCallback, AudioFileType fileType, out AudioFileHandle handle);
internal static extern AudioFileStatus AudioFileInitializeWithCallbacks( IntPtr userData, [NotNull] NativeCallbacks.AudioFileReadCallback readCallback, [NotNull] NativeCallbacks.AudioFileWriteCallback writeCallback, [NotNull] NativeCallbacks.AudioFileGetSizeCallback getSizeCallback, [NotNull] NativeCallbacks.AudioFileSetSizeCallback setSizeCallback, AudioFileType fileType, ref AudioStreamBasicDescription description, uint flags, [NotNull] out AudioFileHandle handle);
internal AudioFile(AudioFileType fileType, [NotNull] Stream stream) { // This constructor is for reading _readCallback = ReadCallback; _getSizeCallback = GetSizeCallback; _stream = stream; _endOfData = stream.Length; SafeNativeMethods.AudioFileOpenWithCallbacks(IntPtr.Zero, _readCallback, null, _getSizeCallback, null, fileType, out var handle); Handle = handle; }
internal AudioFile(AudioStreamBasicDescription description, AudioFileType fileType, [NotNull] Stream stream) { // This constructor is for writing _readCallback = ReadCallback; _getSizeCallback = GetSizeCallback; _writeCallback = WriteCallback; _setSizeCallback = SetSizeCallback; _stream = stream; SafeNativeMethods.AudioFileInitializeWithCallbacks(IntPtr.Zero, _readCallback, _writeCallback, _getSizeCallback, _setSizeCallback, fileType, ref description, 0, out var handle); Handle = handle; }