Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Core Audio (Audio Units) audio session and MPVolumeView

I work on a VOIP app. I use Core Audio Audio Units for playing and recording audio. I need to be able to manipulate sound volume and output devices. I am trying to use MPVolumeView to set sound volume and choose output devices.

My problem is: When I start using(start playout and capture for RemoteIO Audio Unit) Audio Units it seems MPVolumeView no longer control volume of my session but instead it controls system wide sound preferences. At the same time hardware buttons control volume of sounds played by Audio Units. Also when I start using Audio Units MPVolumeView start showing button to change output devices but before that it doesn't.

It seems that MPVolumeView controls sound volume for some system wide audio session but when I start using Audio Units another app wide (or even Audio Unit wide) audio session is created and used to play sound.

So the question is how to make MPVolumeView control sound volume for my Core Audio audio session?

I would appreciate any hints on why this happens. I've spent almost all day googling and I see that some people have related problems but none got any hints :(. I can also post more details if needed.

like image 461
user1264176 Avatar asked Nov 02 '22 13:11

user1264176


1 Answers

Confirmed as a bug by Apple engineer.

In more details - MPVolumeView should be tied to a specific audio route (in more broad sense, like audio route + audio category + mode etc.), and it is for a couple of most common routes (e.g. headphones + play category + default mode) but not to all custom routes you can create.

So basically when one creates some custom route MPVolumeView still tries to control it's last (workable) or default route.

like image 179
user1264176 Avatar answered Nov 13 '22 15:11

user1264176