Re: Proper API for selecting devices
Re: Proper API for selecting devices
- Subject: Re: Proper API for selecting devices
- From: Rolf Nilsson <email@hidden>
- Date: Thu, 2 Dec 2004 15:22:43 +0100
Hi,
Some more questions about kAudioDevicePropertyDataSource:
> From: Jeff Moore <email@hidden>
> Subject: Re: Proper API for selecting devices
>
> Here's what I wrote the last time. It still answers the question.
>
> > The HAL provides the list of available devices through the
> > kAudioHardwarePropertyDevices property. Then for each device, you
can
> > query the kAudioDevicePropertyDataSource family of properties to
> > access the input source (e.g. line in or internal mic on my PB).
Should this be done before one is actually starting using the device?
CAAudioHardwareDevice theDevice(theInputDeviceID);
if (theDevice.DataSourceControlIsSettable(kAudioDeviceSectionInput))
theDevice.SetCurrentDataSourceByID(kAudioDeviceSectionInput,
theInputDataSourceID);
i.e. before the SetupAUHAL() etc as in the ComplexThru example?
I've tried both and it seems to work on a PowerBook for selecting
between the Mic and Line-in
but the same thing crashes when a user tries it with a Digidesign
ProTools interface.
Is there anything special with Digidesign or am I doing it wrong?
I've uploaded a modified version of the ComplexThru example here:
http://www.ronimusic.com/download/CmplxPlayThru.sit
In the original example there are popup menus for selecting the device,
I've just added a couple of popup menus for selecting the data source
as well a combined menu for the
available devices/sources.
It contains the test application and also the source code as an XCode
project (it should build right out of the box )
Thankful for any comments what might be wrong?
Rolf Nilsson
> >
> > The Audacity guy is right when he says that the model on Mac OS X is
> > different than it is on Windows (probably Linux too, but I don't
> > really know) where the input sources for the hardware are treated
in a
> > flat fashion. Mac OS X presents a more hierarchic model where the
> > source is accessed through the hardware it is attached to.
>
> I should also point out that CD audio is not accessed through an audio
> device on Mac OS X. It is accessed through the file system, so you'll
> never find that source.
>
> The HALLab sample code (/Developer/Examples/CoreAudio/HAL/HALLab) has
> code that illustrates how to access the data source properties on a
> device. If you are having problems with the control, please post a
more
> directed question about it and I'll be happy to help you out.
>
> On Nov 19, 2004, at 5:54 AM, Rolf Nilsson wrote:
>
> >
> > Hi,
> >
> > I have exactly the same problem with my application.
> > I have recently added a drop down list for selecting in and output
> > devices.
> > Essential the same code as in the ComplexPlayThru example which
works
> > fine on my dual G4 running OS X10.2.8 or 10.3.6
> >
> > On computers that have a built in microphone only this device is
> > found, not the physical line-input. At least this is what users
> > reports.
> >
> > So how should we detect all devices?
> >
> > A workaround is to add an item in the drop down selection list that
> > just select the "default device" as set up in the system preferences
> > sound panel
> > (same as wavemapper/midimapper under Windows)
> >
> > Rolf NIlsson
> >
> >
> > >
> > > I've been trying to use the open source "Audacity" app to record
on
> > my
> > > Mac (both G5 dual 1GHz and 600MHz G3 iBook), but it inserts all
sorts
> > > of clicks and noise when it records, even though the freeware
"Audio
> > > In" application records just fine.
> > >
> > > Audacity has a drop-down list of devices to use for input, but
under
> > OS
> > > X this list doesn't do anything. You have to go into preferences
to
> > > choose the device, and even then you don't have the option to
select
> > > the "mic in" or "line in" mode like you can from Apple's System
> > > Preferences.
> > >
> > > I e-mailed the Audacity list, and I got the response below. The
> > > response made me think that perhaps there would be someone on this
> > list
> > > that would know the proper way to get a list of inputs for the
> > various
> > > devices that are available for audio in. Then the Audacity guys
> > could
> > > add that into the code and select devices properly.
> > >
> > > Let me know if you have suggestions, and/or send them to:
> > > email@hidden.
> > >
> > > Thanks!
> > >
> > > >
> > > > There is an odd confusuion in the way OS X does audio I/O.
Whilst
> > you
> > > > can select between different audio input devices (sound cards,
USB
> > > > etc) there is no functional API for programs to change which
input
> > is
> > > > used on a given device (CD, line, mic on a single card). This is
> > set
> > > > from a drop-down list on the toolbar when audacity is run on
other
> > > > OSes.
> > > >
> > > >> But even if we have to choose the device in the Preference
menu,
> > it
> > > >> appears that Audacity doesn't currently get a full list of
what is
> > > >> available, and thus may be trying to grab from the wrong
source.
> > > > I'm guessing you should be setting the device to the Onkyo in
the
> > > > audacity preferences, and then you will get the line or mic
input,
> > > > dependant on the setting in Mac OS. Not very elegant, but as I
say,
> > > > the interface is not consistent with other OSes (where the
device
> > and
> > > > source choices are independant).
> > > >
> > > > Richard Ash
> > >
> > >
> >
> > _______________________________________________
> > 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
>
>
>
>
> ------------------------------
>
> _______________________________________________
> Coreaudio-api mailing list
> email@hidden
> http://lists.apple.com/mailman/listinfo/coreaudio-api
>
> End of Coreaudio-api Digest, Vol 1, Issue 80
> ********************************************
_______________________________________________
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