To work with the MusicPlayer API you only need to add the AudioToolBox
framework to your project and then import the AudioToolbox.h in your project:
#import <AudioToolbox/AudioToolbox.h>
If you look at that file you will see that it #includes all the necessary bits for working with AUGraphs etc. If you need to do something additional, like recording or access to the AUGraph output then you will need to import additional frameworks.
I posted a demo project for someone else which uses the MusicPlayer API - you may find that of use.
Update:
AudioToolbox is sort of a convenience "Swiss Army Knife for Audio" type thing. If you look in AudioToolbox.h it is linking to MusicPlayer.h and that is linking to some Core Audio + Audio Unit stuff. MusicDeviceMIDIEvent
is defined in MusicPlayer.h so if you have included the AudioToolBox Framework in your build settings,
I have the "LoadPresetDemo" example here. For audio it only contains the AudioToolbox and the AVFoundation. As a reality check I removed the AVFoundation link, compiled and fixed the errors which resulted - which all pertain to setting up an Audio Session and output sample rate, etc. then I compiled and ran it in the Simulator and it runs fine. I think Apple included all of that to demo how to handle an audio app entering and leaving the background (see endInterruptionWithFlags
method).
Anyway... If you have linked to the AudioToolBox and imported AudioToolbox.h then I have no idea what is going wrong ... ;-)
#define AUDIO_TOOLBOX_VERSION 1060
#include <Availability.h>
#include <TargetConditionals.h>
#if !defined(__COREAUDIO_USE_FLAT_INCLUDES__)
#include <AudioToolbox/AudioFile.h>
#include <AudioToolbox/AudioFileStream.h>
#include <AudioToolbox/AudioFormat.h>
#include <AudioToolbox/AudioQueue.h>
#include <AudioToolbox/AudioServices.h>
#include <AudioToolbox/AUGraph.h>
#include <AudioToolbox/AudioConverter.h>
#include <AudioToolbox/ExtendedAudioFile.h>
#include <AudioToolbox/MusicPlayer.h>
#include <AudioToolbox/CAFFile.h>
#if !TARGET_OS_IPHONE
#include <AudioToolbox/AudioFileComponent.h>
#include <AudioToolbox/AudioUnitUtilities.h>
#include <AudioToolbox/AUMIDIController.h>
#include <AudioToolbox/CoreAudioClock.h>
#endif
#else
#include <AudioConverter.h>
#include <AudioFile.h>
#include <AudioFileComponent.h>
#include <AudioFileStream.h>
#include <AudioFormat.h>
#include <AudioQueue.h>
#include <AudioUnitUtilities.h>
#include <AUGraph.h>
#include <AUMIDIController.h>
#include <CAFFile.h>
#include <CoreAudioClock.h>
#include <ExtendedAudioFile.h>
#include <MusicPlayer.h>
#include <AudioServices.h>
#endif
// MusicPlayer.h
#include <Availability.h>
#if !defined(__COREAUDIO_USE_FLAT_INCLUDES__)
#include <CoreAudio/CoreAudioTypes.h>
#include <AudioUnit/AUComponent.h>
#else
#include <CoreAudioTypes.h>
#include <AUComponent.h>
#endif