开发者

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, kMultiChannelMixer开发者_如何学JAVAParam_Volume, kAudioUnitScope_Output, AU_OUTPUT_BUS, volume, 0);

Thanks in advance for your help


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."


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


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 ) ;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜