How to get benefits of native Audio Device

Howdy

I am looking for some help getting a native iOSAudioIODevice running. Is there anyway to do this using audioDeviceManager?

Can I do this all from a Juce project, or must I create a project / files in XCode to get the native functionality.

 

I have not done much native iOS work, so really coming at this from a juce-centric view.


I've tried...

AudioIODevice* iosDevice = AudioIODeviceType::createAudioIODeviceType_iOSAudio()->createDevice

...but 1) I can't seem to use iOSAudioIODevice*

and of course 2) a normal AudioIODevice doesn't have something like getSessionProperty method.

 

So what can I do to create, and use the extra functionality of a native IOSAudioIODevice?

 

Thanks for any help.

On iOS there's no other type of AudioIODevice object. Just open a normal device and try dynamic_casting it to an iOSAudioIODevice if you need to.

I'm curious - what extra functionality this would open up?

I swear I've tried the dynamic cast, but I will again, thank you.

As for extra funcitonality, I'm trying to detect the headset, as talked about in this thread:

http://www.juce.com/forum/topic/possible-detect-headset

 

Part of my problem, and this is maybe a very basic thing, forgive me, but I can't even do

iOSAudioIODevice* iosDevice = anything

I get an error 'Unknown type name iOSAudioIODevice'....do I need to include the native file somewhere? I have included the frameworks needed.

 

Again I am coming at this very fresh, I've got a standalone app running but trying to convert it to iOS, and I'm quite new to that.

You don't need iOSAudioIODevice to detect the headset. AVAudioSession (as mentioned in the other thread) contains everything you need:

http://stackoverflow.com/questions/16187757/detect-if-headset-is-plugged-in-ios-5

AVAudioSession being an ObjectiveC interface, you need to write ObjC+ code to access it (and your source file needs a ".mm" extension).

Thanks again, daveb.

I'm going to dive into the apple documentation then for AVAudioSession a bit.

Back to Juce, I'm working out how I go about incorporating an mm file like that into a project. I'd love to just go through some sample code but I've not found much.

Currently, I've created the file via X-code (I created an Objective C class, then renamed file to *.mm).
I've got a class and function in it that compiles fine, call it iosSpecial, and it inherits from NSObject (default behavior when creating file in xcode).
I then changed my Main.cpp file to Main.mm, so I can include my new iosSpecial.h file (so far, so good).


Is that the correct technique for doing this? I'm learning a bit about it by reading this article:
http://philjordan.eu/article/mixing-objective-c-c++-and-objective-c++
I think I understand that I will need to wrap my Objective-C calls in C++ functions, then I should be good.

Does my understanding seem sound? I'm in really new territory here.

For the record - dissecting the article I linked, figuring out which files to make *.mm, and figuring out where they all need to live, I was able to get notification about the headset.

 

Glory be - thank yall so much for the help!!!

 

Still curious about my original question - how do I actually use the added functionality of an iOSAudioIODevice? Must the file I call it in be an mm not a cpp file?