AudioSource Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
A derived class from AudioFile that exposes virtual methods that can be hooked into (for reading and writing).
public abstract class AudioSource : AudioToolbox.AudioFile
type AudioSource = class
inherit AudioFile
- Inheritance
Remarks
AudioSource is an abstract class that derives from AudioFile that allows developers to hook up into the reading and writing stages of the AudioFile. This can be used for example to read from an in-memory audio file, or to write to an in-memory buffer.
When you write data into the AudioSource using any of the methods from AudioFile, instead of writing the encoded data into a file, the data is sent to the Read(Int64, Int32, IntPtr, Int32) abstract method.
To use this class, you must create a class that derives from AudioSource and override the Read(Int64, Int32, IntPtr, Int32), Write(Int64, Int32, IntPtr, Int32) methods and the Size property.
Constructors
| Name | Description |
|---|---|
| AudioSource() |
Constructor used when creating subclasses |
| AudioSource(AudioFileType, AudioStreamBasicDescription) |
Create a new AudioSource instance, with the specified file type and format. |
| AudioSource(AudioFileType) |
Create a new AudioSource instance, with the specified file type. |
Properties
| Name | Description |
|---|---|
| AlbumArtwork |
Gets the album artwork for the audio file. (Inherited from AudioFile) |
| AudioFormats |
Returns a list of the supported audio formats. (Inherited from AudioFile) |
| BitRate |
Audio file bit rate. (Inherited from AudioFile) |
| ChannelLayout |
Gets the channel layout of the audio file. (Inherited from AudioFile) |
| ChunkIDs |
Gets an array of four-character codes that describe the kind of each chunk in the audio file. (Inherited from AudioFile) |
| DataFormat |
Gets the AudioStreamBasicDescription, if present, that describes the format of the audio data. (Inherited from AudioFile) |
| DataOffset |
Gets the offset, in bytes, to the beginning of the audio data in the audio file. (Inherited from AudioFile) |
| DataPacketCount |
Gets the number of audio data packets in the audio file. (Inherited from AudioFile) |
| DeferSizeUpdates |
Gets or sets a boolean value that controls whether the updating of file size information in the header will be deferred until the file is read, optimized, or closed. The default, which is safer, is |
| EstimatedDuration |
Gets the estimated duration, in seconds, of the audio data in the file. (Inherited from AudioFile) |
| FileType |
Audio file type. (Inherited from AudioFile) |
| Handle | (Inherited from DisposableObject) |
| ID3Tag |
Gets a byte array that contains the ID3Tag for the audio data. (Inherited from AudioFile) |
| InfoDictionary |
Gets the dictionary that contains audio file metadata. (Inherited from AudioFile) |
| IsOptimized |
Gets a Boolean value that tells whether the audio file has been optimized and is ready to receive sound data. (Inherited from AudioFile) |
| Length |
Audio file size, in bytes. (Inherited from AudioFile) |
| MagicCookie |
The magic cookie for this file. (Inherited from AudioFile) |
| MarkerList |
Gets the AudioFileMarkerList that contains the markers for the audio file. (Inherited from AudioFile) |
| MaximumPacketSize |
Gets the maximum audio packet size. (Inherited from AudioFile) |
| Owns | (Inherited from DisposableObject) |
| PacketSizeUpperBound |
Gets the theoretical upper bound for the audio packet size for audio data in the file. (Inherited from AudioFile) |
| PacketTableInfo |
Gets or sets the AudioFilePacketTableInfo structure that describes the audio file packet table. (Inherited from AudioFile) |
| PacketTableInfoStatus |
Gets the status of the audio packet table.. (Inherited from AudioFile) |
| RegionList |
Gets a list of all the audio regions in the audio file. (Inherited from AudioFile) |
| ReserveDuration |
Gets the amount of recording time to reserve in the audio file. (Inherited from AudioFile) |
| Size |
Used to set or get the size of the audio stream. |
| StreamBasicDescription |
The audio basic description, as determined by decoding the file. (Inherited from AudioFile) |
| StreamBasicDescriptionStatus |
Gets the status of the stream's basic description. (Inherited from AudioFile) |
Methods
| Name | Description |
|---|---|
| ByteToPacket(Int64, Int32, Boolean) |
Converts a position on a stream to its packet location. (Inherited from AudioFile) |
| ClearHandle() | (Inherited from DisposableObject) |
| CountUserData(AudioFileChunkType) |
Get the number of user data for the specified chunk type. (Inherited from AudioFile) |
| CountUserData(UInt32) |
Get the number of user data for the specified chunk type. (Inherited from AudioFile) |
| Dispose() | (Inherited from DisposableObject) |
| Dispose(Boolean) |
Releases the resources used by the AudioSource object. |
| Equals(Object) | (Inherited from DisposableObject) |
| FrameToPacket(Int64, Int32) |
Converts an audio frame into a packet offset. (Inherited from AudioFile) |
| GetCheckedHandle() | (Inherited from DisposableObject) |
| GetHashCode() | (Inherited from DisposableObject) |
| GetProperty(AudioFileProperty, Int32, IntPtr) |
Returns the value of the specified audio property, stores it in |
| GetProperty(AudioFileProperty, Int32) |
Returns the value of the specified audio property, and stores the number of bytes allocated to store it in |
| GetPropertyInfo(AudioFileProperty, Int32, Boolean, AudioFileError) |
Returns the value of the specified audio property, and stores the number of bytes allocated to store it in |
| GetPropertyInfo(AudioFileProperty, Int32, Boolean) |
Returns the value of the specified audio property, and stores the number of bytes allocated to store it in |
| GetPropertyInfo(AudioFileProperty, Int32, Int32, AudioFileError) |
Obsolete.
Returns the value of the specified audio property, and stores the number of bytes allocated to store it in |
| GetPropertyInfo(AudioFileProperty, Int32, Int32) |
Obsolete.
Returns the value of the specified audio property, and stores the number of bytes allocated to store it in |
| GetUserData(AudioFileChunkType, Int32, Int32, IntPtr) |
Get part of the data of a chunk in a file. (Inherited from AudioFile) |
| GetUserData(AudioFileChunkType, Int32, Int64, Byte[], Int32) |
Get part of the data of a chunk in a file. (Inherited from AudioFile) |
| GetUserData(AudioFileChunkType, Int32, Int64, Int32, IntPtr) |
Get part of the data of a chunk in a file. (Inherited from AudioFile) |
| GetUserData(Int32, Int32, Int32, IntPtr) |
Get part of the data of a chunk in a file. (Inherited from AudioFile) |
| GetUserData(UInt32, Int32, Int64, Byte[], Int32) |
Get part of the data of a chunk in a file. (Inherited from AudioFile) |
| GetUserData(UInt32, Int32, Int64, Int32, IntPtr) |
Get part of the data of a chunk in a file. (Inherited from AudioFile) |
| GetUserDataSize(AudioFileChunkType, Int32, UInt64) |
Get the 64-bit size of the specified user data. (Inherited from AudioFile) |
| GetUserDataSize(AudioFileChunkType, Int32) |
Get the size of the specified user data. (Inherited from AudioFile) |
| GetUserDataSize(UInt32, Int32, UInt64) |
Get the 64-bit size of the specified user data. (Inherited from AudioFile) |
| GetUserDataSize(UInt32, Int32) |
Get the size of the specified user data. (Inherited from AudioFile) |
| Initialize(AudioFileType, AudioStreamBasicDescription) |
Initialize the audio source with the specified file type and format. |
| InitializeHandle(NativeHandle) | (Inherited from DisposableObject) |
| IsPropertyWritable(AudioFileProperty) |
Checks whether the property value is settable. (Inherited from AudioFile) |
| Open(AudioFileType) |
Open the audio source for reading and/or writing. |
| Optimize() |
Optimizes the audio file, thus preparing it to receive audio data. (Inherited from AudioFile) |
| PacketToByte(Int64, Boolean) |
Returns the byte offset for the |
| PacketToFrame(Int64) |
Returns the frame number for the specified |
| Read(Int64, Byte[], Int32, Int32, Boolean) |
Reads |
| Read(Int64, Int32, IntPtr, Int32) |
Callback invoked to read encoded audio data. |
| ReadFixedPackets(Boolean, Int64, Int32, Byte[], Int32, Int32, AudioFileError) |
Reads |
| ReadFixedPackets(Boolean, Int64, Int32, Byte[], Int32, Int32) |
Reads |
| ReadFixedPackets(Int64, Int32, Byte[], AudioFileError) |
Reads |
| ReadFixedPackets(Int64, Int32, Byte[]) |
Reads |
| ReadPacketData(Boolean, Int64, Int32, Byte[], Int32, Int32, AudioFileError) |
Reads packets of audio data from an audio file. (Inherited from AudioFile) |
| ReadPacketData(Boolean, Int64, Int32, Byte[], Int32, Int32, AudioFileError) |
Reads packets of audio data from an audio file. (Inherited from AudioFile) |
| ReadPacketData(Boolean, Int64, Int32, Byte[], Int32, Int32) |
Reads packets of audio data from an audio file. (Inherited from AudioFile) |
| ReadPacketData(Boolean, Int64, Int32, Byte[], Int32, Int32) |
Reads packets of audio data from an audio file. (Inherited from AudioFile) |
| ReadPacketData(Boolean, Int64, Int32, IntPtr, Int32, AudioFileError, AudioStreamPacketDescription[]) |
Reads packets of audio data from an audio file. (Inherited from AudioFile) |
| ReadPacketData(Boolean, Int64, Int32, IntPtr, Int32, AudioFileError) |
Reads packets of audio data from an audio file. (Inherited from AudioFile) |
| ReadPacketData(Boolean, Int64, Int32, IntPtr, Int32) |
Reads packets of audio data from an audio file. (Inherited from AudioFile) |
| ReadPacketData(Int64, Int32, Byte[], AudioFileError) |
Reads packets of audio data from an audio file. (Inherited from AudioFile) |
| ReadPacketData(Int64, Int32, Byte[]) |
Reads packets of audio data from an audio file. (Inherited from AudioFile) |
| RemoveUserData(AudioFileChunkType, Int32) |
Removes the specified chunk of user data. (Inherited from AudioFile) |
| RemoveUserData(Int32, Int32) |
Obsolete.
Removes the chunk of user data at the specified |
| SetProperty(AudioFileProperty, Int32, IntPtr) |
Sets the value of the specified |
| SetUserData(AudioFileChunkType, Int32, Byte[]) |
Set the data of a chunk in a file. (Inherited from AudioFile) |
| SetUserData(Int32, Int32, Int32, IntPtr) |
Obsolete.
Sets the value at the specified |
| Write(Int64, Byte[], Int32, Int32, Boolean, AudioFileError) |
Writes a block of data to the audio file. (Inherited from AudioFile) |
| Write(Int64, Byte[], Int32, Int32, Boolean, Int32) |
Obsolete.
Writes a block of data to the audio file. (Inherited from AudioFile) |
| Write(Int64, Byte[], Int32, Int32, Boolean) |
Writes a block of data to the audio file. (Inherited from AudioFile) |
| Write(Int64, Int32, IntPtr, Int32) |
Callback used to write audio data into the audio stream. |
| WritePackets(Boolean, AudioStreamPacketDescription[], AudioStreamPacketDependencyDescription[], Int64, Int32, Byte[], Int32, Int32) |
Writes audio packets to the file. (Inherited from AudioFile) |
| WritePackets(Boolean, AudioStreamPacketDescription[], AudioStreamPacketDependencyDescription[], Int64, Int32, IntPtr, Int32) |
Writes audio packets to the file. (Inherited from AudioFile) |
| WritePackets(Boolean, Int32, AudioStreamPacketDescription[], Int64, Int32, IntPtr) |
Write audio packets to the audio file. (Inherited from AudioFile) |
| WritePackets(Boolean, Int64, AudioStreamPacketDescription[], Byte[], Int32, Int32, AudioFileError) |
Write audio packets to the audio file. (Inherited from AudioFile) |
| WritePackets(Boolean, Int64, AudioStreamPacketDescription[], Byte[], Int32, Int32, Int32) |
Obsolete.
Write audio packets to the audio file. (Inherited from AudioFile) |
| WritePackets(Boolean, Int64, AudioStreamPacketDescription[], Byte[], Int32, Int32) |
Write audio packets to the audio file. (Inherited from AudioFile) |
| WritePackets(Boolean, Int64, AudioStreamPacketDescription[], IntPtr, Int32, AudioFileError) |
Write audio packets to the audio file. (Inherited from AudioFile) |
| WritePackets(Boolean, Int64, AudioStreamPacketDescription[], IntPtr, Int32, Int32) |
Obsolete.
Write audio packets to the audio file. (Inherited from AudioFile) |
| WritePackets(Boolean, Int64, AudioStreamPacketDescription[], IntPtr, Int32) |
Write audio packets to the audio file. (Inherited from AudioFile) |
| WritePackets(Boolean, Int64, Int32, IntPtr, Int32) |
Write audio packets to the audio file. (Inherited from AudioFile) |
Extension Methods
| Name | Description |
|---|---|
| GetHandle(INativeObject) | |
| GetNonNullHandle(INativeObject, String) | |