Class CoreAudioIOProcedure
Provides the base type for creating I/O procedures and registering them to the HAL.
From this, an input source and an output sink of audio data can be created.
This is the type that the CoreAudioPlayer and CoreAudioRecorder classes will use to provide/acquire audio data.
public abstract class CoreAudioIOProcedure : SafeHandle, IDisposable
- Inheritance
-
CoreAudioIOProcedure
- Implements
- Inherited Members
Constructors
CoreAudioIOProcedure(AudioDevice)
Allows consumers of the type to initialize the I/O procedure.
protected CoreAudioIOProcedure(AudioDevice dev)
Parameters
devAudioDeviceThe AudioDevice to create the I/O procedure for.
Exceptions
- ArgumentNullException
The provided audio device was null.
Properties
Device
Gets the AudioDevice that the IO procedure ID was created for.
public AudioDevice Device { get; }
Property Value
IsInvalid
Gets a value whether this IO procedure is invalid.
public override sealed bool IsInvalid { get; }
Property Value
IsRunning
Gets a value whether I/O transactions are performed between the IOProcedure(nint, nint, nint, nint, nint) and the physical audio device.
public bool IsRunning { get; }
Property Value
Methods
IOProcedure(nint, nint, nint, nint, nint)
Provides the method that is called automatically by the HAL IO thread as needed.
Data can be retrieved from this, as well as providing data to this.
protected abstract void IOProcedure(nint inNow, nint inInputData, nint inInputTime, nint outOutputData, nint inOutputTime)
Parameters
inNownintAn AudioTimeStamp pointer that indicates the IO cycle started. Note that this time includes any scheduling latency that may have been incurred waking the thread on which IO is being done.
inInputDatanintAn AudioBufferList pointer containing the input data for the current IO cycle. For streams that are disabled, the AudioBuffer’s mData field will be NULL but the mDataByteSize field will still say how much data would have been there if it was enabled. Note that the contents of this structure should never be modified.
inInputTimenintAn AudioTimeStamp pointer that indicates the time at which the first frame in the data was acquired from the hardware. If the device has no input streams, the time stamp will be zeroed out.
outOutputDatanintAn AudioBufferList pointer in which the output data for the current IO cycle is to be placed. On entry, each AudioBuffer’s mDataByteSize field indicates the maximum amount of data that can be placed in the buffer and the buffer’s memory has been zeroed out. For formats where the number of bytes per packet can vary (as with AC-3, for example), the client has to fill out on exit each mDataByteSize field in each AudioBuffer with the amount of data that was put in the buffer. Otherwise, the mDataByteSize field should not be changed. For streams that are disabled, the AudioBuffer’s mData field will be NULL but the mDataByteSize field will still say how much data would have been there if it was enabled. Except as noted above, the contents of this structure should not other wise be modified.
inOutputTimenintAn AudioTimeStamp pointer that indicates the time at which the first frame in the data will be passed to the hardware. If the device has no output streams, the time stamp will be zeroed out.
- See Also
ReleaseHandle()
Release the I/O procedure and all the required interoperation objects that it needs to communicate over .NET.
protected override sealed bool ReleaseHandle()
Returns
- bool
A value whether the I/O procedure was freed sucessfully.
Start()
Starts IO.
public void Start()
Stop()
Stops IO.
public void Stop()
Remarks
This can be called from the IO procedure, especially if playback happens and your source of audio data has no more data to provide.