Overview
AFDevice contains the Core Audio properties for a sound card.
Tasks
Creating Instances
Properties
Sources
Formats
Sampling Rates
Instance Methods
initWithDeviceID:isInput:
Initializes the AFDevice object with an AudioDeviceID and a flag if it is an input sound card.
You usually do not create and initialize this object yourself. Instead, let AFManager create the AFDevice objects.
- (id)initWithDeviceID:(AudioDeviceID)devID isInput:(Boolean)isInput
Parameters
devID
the Core Audio
AudioDeviceID for the sound card,
isInput
true if it is an
input device.
Return Value
An initialized AFDevice object or nil if the object could not be created.
deviceID
Returns the core Audio AudioDeviceID for the device.
- (AudioDeviceID)deviceID
Return Value
The AudioDeviceID for the device.
format
Returns an AFFormat for the device. The AFFormat specifies the number of channels and the bit depth.
- (AFFormat*)format
Return Value
Current AFFormat for the device.
formats
Returns an array of permissible AFFormats for the device. The AFFormat specifies the number of channels and the bit depth.
- (NSArray*)formats
Return Value
An array of formats which the device can use.
isInput
Returns true if receiver is an input device.
- (Boolean)isInput
Return Value
True if the receiver is an input device.
locationID
Unique bus identifier that the device is connected to. See also -uniqueName.
- (NSString*)locationID
Return Value
Location ID that the device is attached to.
name
Returns the Core Audio name of the device.
- (NSString*)name
Return Value
Name of the device.
physicalFormat
Returns the current physical AudioStreamBasicDescription (e.g., bits, sampling rate) for the receiver.
- (AudioStreamBasicDescription*)physicalFormat
Return Value
The current physical AudioStremBasicDescription for the receiver.
samplingRate
Returns the sampling rate that the device is using.
- (float)samplingRate
Return Value
Current sampling rate of the device.
samplingRates
Returns the sampling rates that the device can using.
- (NSArray*)samplingRates
Return Value
An array that contains floating point NSNumbers, each number is a sampling rate that the device can use.
selectFormat:
Selects a format. The format should be one of the items of the permissible formats.
- (Boolean)selectFormat:(AFFormat*)format
Parameters
format
Return Value
True if the selection succeeds.
selectSource:
Selects a source from its name. The name should be one of the titles in the source menu.
- (Boolean)selectSource:(NSString*)sourceName
Parameters
sourceName
the name of a
source.
Return Value
True if the selection succeeds.
selectSsamplingRate:
Selects a new sampling rate. The sampling rate must be one of the rates that are returned from -samplingRates.
- (Boolean)selectSamplingRate:(float)samplingRate
Parameters
samplingRate
a new sampling
rate.
Return Value
True if the selection succeeds.
source
Returns the name of the selected source of the device. Returns @"" if the device has only one source.
- (NSString*)source
Return Value
Name of the selected source.
sourceMenu
Returns a menu. The title of an item in the menu contains the name of a source, and the tag of that item is the Core Audio sourceID (kAudioDevicePropertyDataSource).
- (NSMenu*)sourceMenu
Return Value
Menu containing source information.
streamFormat
Returns the current AudioStreamBasicDescription for the receiver's stream.
- (AudioStreamBasicDescription*)streamFormat
Return Value
The current AudioStremBasicDescription for the receiver's stream.
uniqueName
Two external sound cards from the same manufacturer can have the same name. uniqueName includes the bus the device is connected to. With the uniqueName, you can identify the unique device each time your application launches.
- (NSString*)uniqueName
Return Value
Unique name of the device.