Table of Contents

Class CoreAudioFunctions

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

Exposes utility methods, some of them are wrapping native functions.

public static class CoreAudioFunctions
Inheritance
CoreAudioFunctions
Inherited Members

Properties

CurrentHostTime

Gets the current host time.

public static ulong CurrentHostTime { get; }

Property Value

ulong

A ulong containing the current host time.

HostClockFrequency

Gets the number of ticks per second in the host time base.

public static double HostClockFrequency { get; }

Property Value

double

A double containing the number of ticks per second in the host time base.

HostClockMinimumTimeDelta

Gets the smallest number of ticks that two succeeding host time values will ever differ by.

public static uint HostClockMinimumTimeDelta { get; }

Property Value

uint

A uint containing the smallest number of ticks that two succeeding values will ever differ.

Methods

ConvertHostTimeToSeconds(ulong)

Given a specified host time, it converts the time to an equivalent value in seconds.

public static double ConvertHostTimeToSeconds(ulong hostTime)

Parameters

hostTime ulong

The host time to convert.

Returns

double

The converted host time value in seconds.

ConvertHostTimeToTimeSpan(ulong)

Given a specified host time, it converts the time to an equivalent TimeSpan instance.

public static TimeSpan ConvertHostTimeToTimeSpan(ulong hostTime)

Parameters

hostTime ulong

The host time to convert.

Returns

TimeSpan

The converted TimeSpan, whose value derived from the specified hostTime parameter value.

GetCurrentDeviceTime(AudioDevice, AudioObjectPropertyScope)

Gets the current time of the specified audio device, if running.

public static double GetCurrentDeviceTime(AudioDevice device, AudioObjectPropertyScope scope)

Parameters

device AudioDevice

The audio device to get it's time.

scope AudioObjectPropertyScope

The the audio device time to query for (Input/Output).

Returns

double

The current time of the audio device, in seconds

Exceptions

ArgumentNullException

device is null.

InvalidOperationException

The specified audio device does not have at least one I/O procedure running.

GetCurrentDeviceTime(AudioDevice, WaveFormat)

Gets the current time of the specified audio device, if running.

public static double GetCurrentDeviceTime(AudioDevice device, WaveFormat intermediateFormat)

Parameters

device AudioDevice

The audio device to get it's time.

intermediateFormat WaveFormat

The currently used virtual format of the audio device.

Returns

double

The current time of the audio device, in seconds

Exceptions

ArgumentNullException

device and/or intermediateFormat are null.

InvalidOperationException

The specified audio device does not have at least one I/O procedure running.

IsNonInterleavedStream(AudioStream)

Queries the current native virtual audio format of the specified AudioStream and gets a value whether the currently used HAL virtual format is non-interleaved.
What is a non-interleaved audio format?
All the audio data processed and produced by NAudio IWaveProvider instances are grouped as interleaved samples.
An interleaved sample contains all the sampled values for each channel.
A non-interleaved sample contains a single sampled value for a single channel.
This important distinction is existing in HAL and is used in top-notch professional audio devices and aggregate devices, and as such when writing a custom CoreAudioIOProcedure this is only way to know about this distinction.

public static bool IsNonInterleavedStream(AudioStream stream)

Parameters

stream AudioStream

The AudioStream whose virtual format is to be queried.

Returns

bool

A value whether the current format used by the stream is non-interleaved.

Exceptions

ArgumentNullException

stream is null.

IsNonMixableStream(AudioStream)

Queries the current native virtual audio format of the specified AudioStream and gets a value whether the currently used HAL virtual format is non-mixable.

public static bool IsNonMixableStream(AudioStream stream)

Parameters

stream AudioStream

The AudioStream whose virtual format is to be queried.

Returns

bool

A value whether the current format used by the stream is non-mixable.

Exceptions

ArgumentNullException

stream is null.