kAudioSessionProperty_OverrideAudioRoute undeclared

Discussion in 'iOS Programming' started by pinyourwings22, Jun 13, 2011.

  1. pinyourwings22 macrumors member

    Joined:
    Aug 20, 2008
    Location:
    Ohio
    #1
    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?
     
  2. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #2
    Simple question: Are you #include or #importing a .h file that is supposed to define it?

    B
     
  3. pinyourwings22, Jun 13, 2011
    Last edited: Jun 13, 2011

    pinyourwings22 thread starter macrumors member

    Joined:
    Aug 20, 2008
    Location:
    Ohio
    #3
    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 :)
     

Share This Page