The UMSAudioDeviceMClass class is a metaclass that defines the class methods for children of the UMSAudioDevice base class. In particular, UMSAudioDeviceMClass specifies creation methods for UMSAudioDevice objects.
The metaclass provides a method to construct a specific audio device based on an application-specified audio alias and data in the configuration file. This allows an application to be ported to a new audio device merely by altering the data under the audio alias in the configuration file. This is the preferred construction technique for applications.
To learn more about the UMSAudioDeviceMClass class, see:
For introductory information, see MetaClass Objects.
To avoid name collision on defines, integer values have been captured as enumeration lists. The set of valid values from an enumerated list can vary with the application. The detailed method descriptions describe the valid or possible values for the specific use. The enumerated lists that are defined for this object are listed as follows:
enum ReturnCode { Success, Failure, FatalUMSError, NoConfigObject, AliasNotFound, PropertyNotFound, InvalidClassName, NotAChild, DeviceNotAvail, MemoryError };
This method returns an instantiated child of the UMSAudioDevice class as determined by the alias parameter. The AudioDevice object is returned in the open state based upon the mode and flags parameters. The particular child returned depends upon interaction with a UMSConfig object.
This method also returns three strings that contain the aliases for the devices formats, inputs, and outputs. These strings can be used to query the configuration file and determine the set of audio formats and the input and output connections that are supported for the device.
For certain Error Codes, more specific information can be obtained from the error_string parameter.
AudioDeviceMClass make_by_alias methods use an audio device alias to choose the audio device object to instantiate. When audio device choices do not exist, this mechanism can seem overly complex. However, the device alias mechanism enables an application to migrate to different physical audio devices with no recompilation. It also enables programmers to categorize the applications and the way these applications use an audio device and to route certain usages to certain devices.
When an application requests an audio device, whether directly through the AudioDeviceMClass or indirectly through a media_handler object, it does so with an audio device alias of the following form:
Audio.<ApplicationClass>.<ApplicationName>.<Usage>
After the AudioDeviceMClass object has successfully used the seek_alias method of the Config object, it attempts to instantiate the device based upon the properties contained by that alias:
Audio: device_path "/dev/acpa0" CLASS_UMSAudioDevice "UMSACPADevice" audio_formats_alias "UMSACPAFormats" audio_inputs_alias "UMSACPAInputs" audio_outputs_alias "UMSACPAOutputs" *NEXT: device_path "/dev/acpa1" CLASS_UMSAudioDevice "UMSACPADevice" audio_formats_alias "UMSACPAFormats" audio_inputs_alias "UMSACPAInputs" audio_outputs_alias "UMSACPAOutputs"
Note: Once it is determined that the value of the CLASS_UMSAudioDevice property is a valid class name and a child of the UMSAudioDevice class, an object of that class is instantiated. If the subsequent open call succeeds, the object is returned in the open state. Otherwise, the object is freed and the seek_next method is used to search for other devices. If no device can be successfully opened, DeviceNotAvail is returned as the ErrorCode.
For introductory information, see MetaClass Objects.