According to the apple documentation, AudioServices.h should be part of the AudioToolbox framework.
Even though I have added the AudioToolbox framework to my Xcode project, when I #import AudioServices I get the error: AudioServices.h file not found.
This happens whether I type #import "AudioServices.h"
or #import "AudioToolbox/AudioServices.h" .
Just in case, I tried removing and then re-adding the AudioToolbox framework, which had no effect. Could the AudioServices file be corrupted somehow? (If so, does anyone know where I could download another copy?)
I am using XCode 4.2, but as I am converting some old open source code, the project is set to be XCode 3.2-compatible. Could this be the issue?
I'm sure I'm missing something simple. I am totally new to programming... any help appreciated!
-----EDIT (see my comment below)-----
in AudioServices.h, the two functions in question:
extern OSStatus
AudioSessionInitialize( CFRunLoopRef inRunLoop,
CFStringRef inRunLoopMode,
AudioSessionInterruptionListener inInterruptionListener,
void *inClientData)
extern OSStatus
AudioSessionAddPropertyListener( AudioSessionPropertyID inID,
AudioSessionPropertyListener inProc,
void *inClientData)
in SpeakHereController.mm (from sample Apple code), which I am trying to convert to ARC to get it to cooperate better with the other files in my project:
- (void)awakeFromNib
{
// Allocate our singleton instance for the recorder & player object
recorder = new AQRecorder();
player = new AQPlayer();
OSStatus error = AudioSessionInitialize(NULL, NULL, interruptionListener, self);
if (error) printf("ERROR INITIALIZING AUDIO SESSION! %ld\n", error);
else
{
UInt32 category = kAudioSessionCategory_PlayAndRecord;
error = AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(category), &category);
if (error) printf("couldn't set audio category!");
error = AudioSessionAddPropertyListener(kAudioSessionProperty_AudioRouteChange, propListener, self);
if (error) printf("ERROR ADDING AUDIO SESSION PROP LISTENER! %ld\n", error);
UInt32 inputAvailable = 0;
UInt32 size = sizeof(inputAvailable);
// we do not want to allow recording if input is not available
error = AudioSessionGetProperty(kAudioSessionProperty_AudioInputAvailable, &size, &inputAvailable);
if (error) printf("ERROR GETTING INPUT AVAILABILITY! %ld\n", error);
btn_record.enabled = (inputAvailable) ? YES : NO;
// we also need to listen to see if input availability changes
error = AudioSessionAddPropertyListener(kAudioSessionProperty_AudioInputAvailable, propListener, self);
if (error) printf("ERROR ADDING AUDIO SESSION PROP LISTENER! %ld\n", error);
error = AudioSessionSetActive(true);
if (error) printf("AudioSessionSetActive (true) failed");
}