I call the following to change the vol. This maybe called because either the user pressed the hardware vol button or moved a UISlider
status = AudioUnitSetParameter(multiChannelMixerAU, kMultiChannelMixerParam_Volume,
kAudioUnitScope_Output, 0, value, 0);
status = AudioSessionAddPropertyListener(kAudioSessionProperty_CurrentHardwareOutputVolume,
audioSessionHardwareVolumeCallback, (__bridge void *)(self));
///////////////////////////////////////////////////////////////////////////////
void audioSessionHardwareVolumeCallback(void *inClientData, AudioSessionPropertyID inID,
UInt32 inDataSize,
const void *inData) {
// __bridge , we want to make sure the object we are holding onto does not go out of scope in our function
SCIAudioSessionController *audioSessionController = (__bridge SCIAudioSessionController *)inClientData;
AudioUnitParameterValue volume; // Float32
UInt32 dataSize = sizeof(AudioUnitParameterValue);
AudioSessionGetProperty (
kAudioSessionProperty_CurrentHardwareOutputVolume,
&dataSize,
&volume
);
//SCILog(@"volume = %f", volume);
[audioSessionController.delegate changeVolume:volume];
}
I hope this helps
Andy
I forgot to add that Core Audio seems to have the correct values. That is, after setting the input value I want, I can call
OSStatus result = AudioUnitGetParameter (
mixerUnit,
kMultiChannelMixerParam_Volume,
kAudioUnitScope_Input,
i,
&V
);
and receive the correct value. It's just that the actual sound coming out of the speakers is always full-strength.
Bob
_______________________________________________
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