Re: Monitoring input level
Re: Monitoring input level
- Subject: Re: Monitoring input level
- From: Jeff Moore <email@hidden>
- Date: Wed, 21 Jun 2006 12:11:33 -0700
I can answer your first question. The general recommendation for all
applications is to use AUHAL to talk to the hardware regardless of
whether it is aggregated or not. The main reason why is that AUHAL
does all the dirty work of being a proper HAL client, which can be a
bit onerous as there are a lot of things to think about given all the
various ways a device can appear in the HAL.
On Jun 21, 2006, at 11:38 AM, Neil Clayton wrote:
OK. I've taken a look at AMS ... I didn't even know you could do
that! Learning as I go.
So now I have an aggregate, with inputs from the Edirol, and
outputs to the Built in Audio. I've plugged this into the AU Lab,
and sure enough, it passes through as I'd expect.
Question 1)
Is the recommended solution still to use a single AUHAL (with
mixer) to the sampling of the level? (just using aggregates
instead of single devices).
Part 2)
In answer to two other questions regarding setting the volume on
the mixer. Yes, I do do this. I'm using code gleaned from
MatrixMixerTest, which does:
- (void) setVolumes {
OSStatus err = AudioUnitSetParameter(mixerUnit,
kMatrixMixerParam_Enable, kAudioUnitScope_Input, 0, 1, 0);
checkErr(err);
err = AudioUnitSetParameter(mixerUnit, kMatrixMixerParam_Enable,
kAudioUnitScope_Output, 0, 1, 0);
checkErr(err);
// Set global volume
err = AudioUnitSetParameter(mixerUnit, kMatrixMixerParam_Volume,
kAudioUnitScope_Global, 0, 1, 0);
checkErr(err);
// Set master volume
err = AudioUnitSetParameter(mixerUnit, kMatrixMixerParam_Volume,
kAudioUnitScope_Global, 0xFFFFFFFF, 1, 0);
checkErr(err);
// Set input and output volumes
err = AudioUnitSetParameter(mixerUnit, kMatrixMixerParam_Volume,
kAudioUnitScope_Input, 0, 1, 0);
checkErr(err);
err = AudioUnitSetParameter(mixerUnit, kMatrixMixerParam_Volume,
kAudioUnitScope_Output, 0, 1, 0);
checkErr(err);
}
On 20 Jun 2006, at 22:26, Jeff Moore wrote:
On Jun 20, 2006, at 2:09 PM, Neil Clayton wrote:
Actually, you might be leading me somewhere useful anyway. I'm
wanting to do this so that people can use whatever device they
have. Obviously, people may well be using USB microphones and
wot not (it's actually for a screen capturing app, with voiceover
support).
If it's not going to work for USB devices, then .... I'll have
to use some other approach anyway.
Indeed.
Would this other approach happen to be something like the
ComplexPlayThru example? Where an Input AUHAL is used to capture
data to a ring buffer, and that data is pumped into an AUGraph?
That is one way to do it. In it's plainest, simplest form, it's
even easy to code up. However, you have the issue of
synchronization to deal with. With two clocks in the picture, you
have to compensate for the differences in how fast they are
running relative to each other or risk over/underflowing your ring
buffer if you run long enough.
Or something completely different?
Aggregate devices are the more complete solution to the problem as
you don't have to worry about the synchronization as the HAL will
do that work for you. To use aggregate devices, you either have to
rely on the user constructing one for you to use using AMS or you
can build them programatically.
For building them programatically, there was a fairly thorough
discussion of how to do it on this list back a few months. You
should be able to find the thread in the list archives.
--
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