Mac Developer Library

Developer

IOAudioPort Class Reference

Options
Deployment Target:

On This Page
Language:

IOAudioPort

Inheritance


  • IOAudioPort

Conforms To


Not Applicable

Import Statement


Not Applicable

Objective-C

@import Kernel;

Availability


Available in OS X v10.1 and later.

Represents a logical or physical port or functional unit in an audio device.

An IOAudioPort represents an element in the signal chain in the audio device. It may contain one or more controls (represented by IOAudioControl) by which different attributes of the port may be represented and adjusted.

IOAudioPort objects are connected up in the IORegistry in the IOAudioPlane to represent the signal chain of the device. They may be connected to other IOAudioPorts as well as IOAudioEngines to indicate they either feed into or are fed by one of the audio engines (i.e. they provide input to or take output from the computer).

  • Adds a newly created IOAudioControl instance to the port.

    Declaration

    C++

    virtual IOReturn addAudioControl( IOAudioControl *control);

    Parameters

    control

    A newly created IOAudioControl instance that should belong to this port.

    Return Value

    Returns true on successfully staring the IOAudioControl.

    Discussion

    This method is responsible for starting the new IOAudioControl and adding it to the internal audioControls array.

  • Called to shut down all of the audio controls for this port.

    Declaration

    C++

    virtual void deactivateAudioControls();

    Discussion

    This will stop all of the audio controls and release them so that the instances may be freed. This is called from the free() method.

  • Frees all of the resources allocated by the IOAudioPort.

    Declaration

    C++

    virtual void free();

    Discussion

    Do not call this directly. This is called automatically by the system when the instance's refcount goes to 0. To decrement the refcount, call release() on the object.

  • Initializes a newly allocated IOAudioPort instance with the given attributes

    Declaration

    C++

    virtual bool initWithAttributes( UInt32 portType, const char *portName = 0, UInt32 subType = 0, OSDictionary *properties = 0);

    Parameters

    portType

    A readable string representing the type of port. Common port types are defined in IOAudioTypes.h and are prefixed with 'kIOAudioPortType'. Please provide feedback if there are other common port types that should be included.

    portName

    A readable string representing the name of the port. For example: 'Internal Speaker', 'Line Out'. This field is optional, but useful for providing information to the application/user.

    subType

    Developer defined readable string representing a subtype for the port. (optional)

    properties

    Standard property list passed to the init of any new IOService. This dictionary gets stored in the registry for this instance. (optional)

    Return Value

    Returns true on success.

    Discussion

    The properties parameter is passed on the superclass' init(). The portType, subType and properties parameters are optional, however portType is recommended.

  • Called to start a newly created IOAudioPort.

    Declaration

    C++

    virtual bool start( IOService *provider);

    Parameters

    provider

    The IOAudioDevice that owns this port

    Return Value

    Returns true on success

    Discussion

    This is called automatically by IOAudioDevice when attachAudioPort() is called.

  • Called when the IOAudioDevice is stopping when it is no longer available.

    Declaration

    C++

    virtual void stop( IOService *provider);

    Parameters

    provider

    The IOAudioDevice that owns this port

    Discussion

    This method calls deactivateAudioControls() to shut down all of the controls associated with this port.

  • Allocates a new IOAudioPort instance with the given attributes

    Declaration

    C++

    static IOAudioPort *withAttributes( UInt32 portType, const char *portName = 0, UInt32 subType = 0, OSDictionary *properties = 0);

    Parameters

    portType

    A readable string representing the type of port. Common port types are defined in IOAudioTypes.h and are prefixed with 'kIOAudioPortType'. Please provide feedback if there are other common port types that should be included.

    portName

    A readable string representing the name of the port. For example: 'Internal Speaker', 'Line Out'. This field is optional, but useful for providing information to the application/user.

    subType

    Developer defined readable string representing a subtype for the port. (optional)

    properties

    Standard property list passed to the init of any new IOService. This dictionary gets stored in the registry for this instance. (optional)

    Return Value

    Returns the newly allocated and initialized IOAudioPort instance.

    Discussion

    This static method allocates a new IOAudioPort and calls initWithAttributes() on it with the parameters passed in to it.