Re: Reduce Audio Time Latency
Re: Reduce Audio Time Latency
- Subject: Re: Reduce Audio Time Latency
- From: William Stewart <email@hidden>
- Date: Mon, 28 Sep 2009 11:01:20 -0700
On Sep 24, 2009, at 11:39 PM, Ravneet Kaur wrote:
Hi
I am working on CoreAudio API to play an audio file(.wav) and
change the frequency and volume of the sound file based on the value
specified by the user.
I am using the following two API:
AudioUnitSetParameter(*theUnit, kAudioUnitParameterUnit_Hertz,
kAudioUnitScope_Output, 0, (Float32)100, 0);
AudioUnitSetParameter(*theUnit, kAudioUnitParameterUnit_LinearGain,
kAudioUnitScope_Output, 0, (Float32)90, 0);
Your code is wrong here.
When you call AudioUnitSetParameter, you need to provide the parameter
ID (not a parameter unit type). You also have to set the parameter
value in the range of the paramter itself.
So, you don't describe which audio unit you are trying to operate on.
However, you can see the valid parameter range, etc, of *any* audio
unit by using auval. For example, for the output unit (AUHAL - same is
true for the default otuptut unit):
auval -v auou ahal appl
...
# # # 1 Global Scope Parameters:
Parameter ID:14
Name: Volume
Parameter Type: Linear Gain
Values: Minimum = 0.000000, Default = 1.000000, Maximum = 1.000000
Flags: Readable, Writable
-parameter PASS
...
If you then look in <AudioUnit/AudioUnitParameters.h>, you will see
this:
enum {
// Global, LinearGain, 0->1, 1
kHALOutputParam_Volume = 14
};
The "14" here is the parameter ID for the volume parameter on AUHAL.
That parameter is expressed in a linear scale, where 0 is silence, and
1 is unity gain (its a mulitply)
The parameter information for ANY audio unit can be retrieved using
public API - see ParameterInfo, etc, in <AudioUnit/
AudioUnitProperties.h>
Bill
_______________________________________________
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