Re: Multiple data sources and kAudioStreamPropertyTerminalType
Re: Multiple data sources and kAudioStreamPropertyTerminalType
- Subject: Re: Multiple data sources and kAudioStreamPropertyTerminalType
- From: Jeff Moore <email@hidden>
- Date: Fri, 8 Apr 2005 15:26:57 -0700
I forgot to say that if I was in your shoes, I would let the user
tell your app which device to use using the GUI.
You might provide some feedback in the GUI about what the driver for
each device says about it's terminal type to help guide the user when
picking. But I would definitely let the user choose since they should
know which devices they have that meet your app's criteria. That will
allow your app to work with the largest set of devices possible.
On Apr 8, 2005, at 3:20 PM, Jeff Moore wrote:
What do you mean by "line level"? +4dBu? -10dBV? something else?
kAudioStreamPropertyTerminalType doesn't have anything to say about
this. You might find that this is a less than reliable technique if
you care about what sort of line you are talking to.
The biggest hole in your plan is that
kAudioStreamPropertyTerminalType is not a required property. Quite
often a driver will not provide any value at all, so your scheme
runs the risk of disallowing some valid devices.
Also, after changing kAudioDevicePropertyDataSource, are you
waiting to receive the notification that the value has actually
changed before proceeding to query the other properties? If not,
you should be. Setting the value for a control is an asynchronous
operation that can't be assumed to have completed until the
notification is delivered.
That said, there isn't anything wrong with the algorithm you are
using, provided you account for the asynch nature of setting the
property value and don't really care what kind of line level the
device is talking about.
Probably what you are seeing with the PowerBook is a driver bug
(which you should certainly write up). However on my PowerBook, I
do see this value toggling between line and mic when I switch the
value of the data source control. So it's possible that your code
is getting bit by not handling the setting of the data source
control as an asynchronous operation and is querying the terminal
type property before the HAL has had a chance to update itself with
the new state of the device.
On Apr 8, 2005, at 2:37 PM, Edward Peterlin wrote:
Greetings! I am working on an application and have been trying to
detect the terminal type for audio input devices. The hardware
portion of the application is compatible only with external line-
level input devices, so I have been using the
kAudioStreamPropertyTerminalType to query whether the audio device
has streams with the EXTERNAL_LINE_CONNECTOR terminal type.
For devices that have multiple data sources (such as the "Built-in
Audio" device) I've been trying to do this detection with the
following sequence:
- loop over multiple data sources
- set the kAudioDevicePropertyDataSource to flip data source
for device
- query the kAudioDevicePropertyStreams property of the device
to get input streams for the data source
- loop over streams, checking kAudioStreamPropertyTerminalType
value
This works fine on my G5 tower; the digital in data source
returns SPDIF terminal type, the line-in returns LINE_CONNECTOR.
On a test AlBook 12", however, both the internal microphone and
line-in data sources advertise an INPUT_MICROPHONE terminal type,
so it isn't possible to distinguish which data source is the line
level input.
Does the above procedure seem sane and, if so, any thoughts as to
why it's not functional for the AlBook audio? I'm hoping to avoid
doing searches for a literal "Line" within the data source name
since I expect the data source names may be localized depending on
the user's preferred language setting.
Any help would be greatly appreciated!
regards,
Edward Peterlin
BIOPAC Systems, Inc.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40apple.com
This email sent to email@hidden
--
Jeff Moore
Core Audio
Apple
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
Jeff Moore
Core Audio
Apple
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden