pion
pion

Reputation: 3613

Setting volume on Audio Unit (kAudioUnitSubType_RemoteIO)

How to set volume on Audio Unit specifically on kAudioUnitSubType_RemoteIO ?

I saw something for kAudioUnitSubType_MultiChannelMixer

    status = AudioUnitSetParameter(mixerUnit, kMultiChannelMixerParam_Volume, kAudioUnitScope_Output, AU_OUTPUT_BUS, volume, 0);

Thanks in advance for your help

Upvotes: 5

Views: 9268

Answers (3)

bobobobo
bobobobo

Reputation: 67296

The piece of code you've got there will set the master out volume, yes. Instead of AU_OUTPUT_BUS (undefined constant?), you can just use 0 for the "0th output bus" (kAudioUnitSubType_MultiChannelMixer only have 1 output bus).

If you wanted to set the volume of one particular input bus, you can do so too,

AudioUnitSetParameter( mixerUnit,
  kMultiChannelMixerParam_Volume, kAudioUnitScope_Input, busId, volume, 0 ) ;

Upvotes: 0

水月年华
水月年华

Reputation: 113

if your target is desktop this will help you http://developer.apple.com/audio/audiounits.html with iphone target

result = AudioUnitSetParameter ( yourUnit, kHALOutputParam_Volume, kAudioUnitScope_Output, busNumber, volume, 0); this will set device volume

Upvotes: 1

pion
pion

Reputation: 3613

From Chris Adamson's blog An iPhone Core Audio brain dump

"RemoteIO does not have a gain or volume property. The mixer unit has volume properties on all input buses and its output bus (0). Therefore, setting the mixer’s output volume property could be a de facto volume control, if it’s the last thing before RemoteIO. And it’s somewhat more appealing than manually multiplying all your samples by a volume factor."

Upvotes: 9

Related Questions