Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

pinyourwings22

macrumors member
Original poster
Alright so I've spent many hours searching on how to use AVAudioPlayer and AVAudioRecorder at the same time(audio player through the speaker), and I am continually pointed to this section of code:
Code:
UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker;
    AudioSessionSetProperty (kAudioSessionProperty_OverrideAudioRoute,sizeof (audioRouteOverride),&audioRouteOverride);

This is supposed to override the audioplayer source to the speaker, which makes perfect sense, but I cannot get xcode to recognize any form of kAudioSessionProperty_OverrideAudioRoute. I keep getting this error: "Use of undeclared identifier 'kAudioSessionOverrideAudioRoute_Speaker' "

I understand what the error is saying, but I what I don't understand is why it doesn't recognize the constant. Any thoughts?
 
yeah I am: <AVFoundation/AVFoundation.h>

But it just now dawned on me to rightclick on kAudioSessionOverrideAudioRoute_Speaker and select 'Jump to Definition', and what do you know, it's in <AudioToolbox/AudioServices.h>

I don't know why I didn't think of that before because I knew it had to be declared somewhere. Thanks for the nudge 🙂
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.