Table of Contents

Class ExtendedAudioFileWriter

Namespace
NAudio.Wave
Assembly
NAudio.MacOS.dll

Provides a writer that can create audio files.
Uses the Audio Toolbox framework Extended Audio File Services API to write the file.

public class ExtendedAudioFileWriter : ExtendedAudioFileServicesWriter, IAsyncDisposable, IDisposable
Inheritance
ExtendedAudioFileWriter
Implements
Inherited Members

Methods

CreateToFilePath(string, ExtendedAudioFileWriterSettings, bool)

Constructs a new instance of the ExtendedAudioFileWriter class, providing the file path where the new produced file will be located to.

public static ExtendedAudioFileWriter CreateToFilePath(string filePath, ExtendedAudioFileWriterSettings settings, bool overwriteIfExists = false)

Parameters

filePath string

The path of the file to write

settings ExtendedAudioFileWriterSettings

Settings for the writer to use.

overwriteIfExists bool

If the file is existing, when specified to true, it overwrites the file instead of throwing an exception.

Returns

ExtendedAudioFileWriter

A new instance of the ExtendedAudioFileWriter class.

Exceptions

ArgumentException

The specified settings object does not define the minimal requirements for writing a file.

ArgumentNullException

filePath and/or settings are null.

CreateToStream(Stream, ExtendedAudioFileWriterSettings)

Constructs a new instance of the ExtendedAudioFileWriter class, providing the data stream where the encoded data will be placed to.

public static ExtendedAudioFileWriter CreateToStream(Stream writeableStream, ExtendedAudioFileWriterSettings settings)

Parameters

writeableStream Stream

The data stream where to write data to

settings ExtendedAudioFileWriterSettings

Settings for the writer to use.

Returns

ExtendedAudioFileWriter

A new instance of the ExtendedAudioFileWriter class.

Remarks

The native API requires that all the basic Stream implementations are functional - that is, the stream must be able to be read, written and sought. If you want to write to a stream that is not that capable, use an intermediate MemoryStream instance to make sure the writer can work with it, then copy the data written to it to your target stream.

Exceptions

ArgumentException

The specified settings object does not define the minimal requirements for writing a file.

-or-

The stream is not writeable, seekable and readable.

ArgumentNullException

writeableStream and/or settings are null.

CreateToURL(Uri, ExtendedAudioFileWriterSettings, bool)

Constructs a new instance of the ExtendedAudioFileWriter class, providing the URL where the new produced file will be located to.

public static ExtendedAudioFileWriter CreateToURL(Uri url, ExtendedAudioFileWriterSettings settings, bool overwriteIfExists = false)

Parameters

url Uri

The URL of the file to write

settings ExtendedAudioFileWriterSettings

Settings for the writer to use.

overwriteIfExists bool

If the file is existing, when specified to true, it overwrites the file instead of throwing an exception.

Returns

ExtendedAudioFileWriter

A new instance of the ExtendedAudioFileWriter class.

Exceptions

ArgumentException

The specified settings object does not define the minimal requirements for writing a file.

ArgumentNullException

url and/or settings are null.