Using MediaPlayback session category in a recording app
Using MediaPlayback session category in a recording app
- Subject: Using MediaPlayback session category in a recording app
- From: Michael Tyson <email@hidden>
- Date: Wed, 08 Aug 2012 11:28:27 +0100
Hi guys,
I want to get your opinion on something we've just discovered.
In short: We can use the MediaPlayback audio session category in a recording app, and it means that more than one app can use the mic at a time, which is great news for multitasking music apps. I want to know if anyone can think of reasons this shouldn't be used all the time, in music apps.
Apple's documentation and sample code all indicate that developers need to use the PlayAndRecord/Record audio session categories if their app records audio. I for one have always done this, without thinking, taking Apple's word for it. But only one app at a time can use said categories - any other app currently using it will have its audio session interrupted, and will be suspended.
This is a poor state of affairs for music apps, which users often want to use in tandem. It's also particularly poor for Audiobus - if you want to use a looper and a guitar amp app at the same time, and they both use PlayAndRecord, then there needs to be a way to allocate that resource between the apps: Extremely messy, as I've discovered during the last few days while implementing that very thing into Audiobus.
We discovered yesterday that all this is wrong: You can actually use the MediaPlayback category perfectly well with an app that records from the microphone. This may be obvious to some, but we had no idea you could do it, and it changes a lot, for music apps: It means they'll all work together perfectly.
The only hitch when using MediaPlayback is that you can't query the kAudioSessionProperty_CurrentHardwareInputNumberChannels session property, but as I mentioned in another thread, this isn't a problem - you just switch into PlayAndRecord to query the property, and switch back, and you only need to do so if no other app is using PlayAndRecord - otherwise, you can query the property regardless of the session category.
So, my question is this:
Can anyone think of a reason MediaPlayback shouldn't be the standard category used in music apps, whether they record audio or not?
We would like to mandate its use for Audiobus-compatible apps, as it will mean all participating apps will work perfectly together with no resource contention. I just want to make sure there's no obvious arguments against it.
Cheers for your time!
Michael
_______________________________________________
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