Search code examples
ioscore-audioaudiounit

iOS - Audiounit volume balance between channel


I created an AUGraph to play music from iTunes library. I added mixer unit and effect unit to the AUGraph in the following order

FilePlayerUnit->MixerUnit->EffectUnit->OutputUnit

I am trying to change the volume balance between left and right channel. For example by using a UISlider user should be able change the frequency in a particular channel.

Is it possible to do this without modifying my current AUGraph based player with FilePlayer Unit that plays music files from local storage?


Solution

  • You just need to set those properties on the input scope of the desired channel(element).

    float pan = 0;  //  -1  -> 1
    AudioUnitSetParameter (MixerUnit, kMultiChannelMixerParam_Pan, kAudioUnitScope_Input, channel, pan, 0);
    

    Got the above answer in the Core Audio mailing list. Thank you Dave O'Neill.