Table of Contents

Class AudioObject

Namespace
NAudio.MacOS.CoreAudio
Assembly
NAudio.MacOS.dll

Provides the base class for the Core Audio HAL audio objects.

AudioObjects all have a set of properties that describe and manipulate their state. Changing the value of a property is always considered asynchronous.

The class of an AudioObject determines the basic functionality of the object in terms of what functions will operate on it as well as the set of properties that can be expected to be implemented by the object. The set of available classes for objects is limited to those defined here. There are no other classes. The set of classes is arranged in a hierarchy such that one class inherits the properties/routines of its super class.

The base class for all AudioObjects is the class AudioObject. As such, each AudioObject will provide basic properties such as its class, its human readable name, and the other AudioObjects it contains. Other important classes include AudioSystemObject, AudioDevice, and AudioStream.

The AudioObjects in the HAL are arranged in a containment hierarchy. The root of the hierarchy is the one and only instance of the AudioSystemObject class. The properties of the AudioSystemObject describe the process global settings such as the various default devices and the notification run loop. The AudioSystemObject also contains all the AudioDevices that are available.

Instances of the AudioDevice class encapsulate individual audio devices. An AudioDevice serves as the basic unit of IO. It provides a single IO cycle, a timing source based on it, and all the buffers synchronized to it. The IO cycle presents all the synchronized buffers to the client in the same call out along with time stamps that specify the current time, when the input data was acquired and when the output data will be presented.

AudioDevices contain instances of the AudioStream class. An AudioStream represents a single buffer of data for transferring across the user/kernel boundary. As such, AudioStreams are the gatekeepers of format information. Each has its own format and list of available formats. AudioStreams can provide data in any format, including encoded formats and non-audio formats. If the format is a linear PCM format, the data will always be presented as 32 bit, native endian floating point. All conversions to and from the true physical format of the hardware is handled by the device's driver.

Both AudioDevices and AudioStreams can contain instances of the AudioControl class or its many subclasses. An AudioControl provides properties that describe/manipulate a particular aspect of the object such as gain, mute, data source selection, etc. Many common controls are also also available as properties on the AudioDevice or AudioStream.

public abstract class AudioObject : IEquatable<AudioObject>, IEqualityOperators<AudioObject, AudioObject, bool>
Inheritance
AudioObject
Implements
Derived
Inherited Members

Properties

BaseClassID

Gets the actual ID of the base class of this class, as reported by the native code.

public uint BaseClassID { get; }

Property Value

uint

ClassID

Gets the actual ID of this class, as reported by the native code.

public uint ClassID { get; }

Property Value

uint

FirmwareVersion

Gets the manufacturer's firmware version of this audio object.

public string FirmwareVersion { get; }

Property Value

string

Remarks

This is purely an informational value.

Manufacturer

Gets the manufacturer of this audio object.

public string Manufacturer { get; }

Property Value

string

ModelName

Gets the manufacturer's model name of this audio object.

public string ModelName { get; }

Property Value

string

Name

Gets the name of this audio object.

public string Name { get; }

Property Value

string

OwnedObjects

An array of AudioObjects that represent all the AudioObjects owned by this object.

public AudioObject[] OwnedObjects { get; }

Property Value

AudioObject[]

Owner

An AudioObject that identifies the AudioObject that owns this AudioObject. Note that all AudioObjects are owned by some other AudioObject.
The only exception is the AudioSystemObject, for which the value of this property is null.

public AudioObject Owner { get; }

Property Value

AudioObject

SerialNumber

Gets the manufacturer's serial number of this audio object.

public string SerialNumber { get; }

Property Value

string

Remarks

This is purely an informational value.

Methods

Equals(AudioObject)

Determines whether the current and another Core Audio object are pointing to the same Core Audio object.

public bool Equals(AudioObject obj)

Parameters

obj AudioObject

The other Core Audio object to compare against.

Returns

bool

A value whether the obj is non-null and the instances are pointing to the same Core Audio object.

Equals(object)

Determines whether the specified object is equal to the current object.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

GetHashCode()

Retrieves a hash code for this Core Audio object instance.

public override int GetHashCode()

Returns

int

A hash code.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

Operators

operator ==(AudioObject, AudioObject)

Determines whether two AudioObject instances are pointing to the same Core Audio object.

public static bool operator ==(AudioObject object1, AudioObject object2)

Parameters

object1 AudioObject

The first object.

object2 AudioObject

The second object.

Returns

bool

A value whether the two objects are both non-null and are pointing to the same Core Audio object.

Remarks

Note that this operator tests whether the wrapped interop objects are the same; as such, you could have two AudioObject instances that are different in .NET (the test ReferenceEquals(object, object) is false) but both are targeting the same natively wrapped object. This is actually valid, because these classes are just wrapping the objects, and as such they have the exact same effects even if two different wrapper references are created.

operator !=(AudioObject, AudioObject)

Determines whether two AudioObject instances are pointing to a different Core Audio object.

public static bool operator !=(AudioObject object1, AudioObject object2)

Parameters

object1 AudioObject

The first object.

object2 AudioObject

The second object.

Returns

bool

A value whether the two objects are both non-null and are pointing to a different Core Audio object.

Remarks

This operator is the negation of the operator ==(AudioObject, AudioObject) operator.
See that operator's remarks section for more information on how this operator is behaving.