More info on A2ML can be found on the Team WAM interactive audio project page: http://wam.inrialpes.fr/iaudio
While all audio objects can be created programmatically, it is strongly discouraged to do so. The A2ML format should be used to describe the audio hierarchy and interactions, and audio objects of the API should be accessed only in specific cases where the complex parameter animation behavior of these objects can't be described straight into the A2ML document.
Here is the basic scenario for ARIA usage:
// ------------------------------------------------------------- // App inits // ------------------------------------------------------------- [AMSoundManager createSoundManager]; NSError *myerror; [AMSoundManager loadA2ML:@"myfile.xml" error:&myerror]; // ... // ------------------------------------------------------------- // Main code // ------------------------------------------------------------- AMScheduler *scheduler = [AMSoundManager getScheduler]; [scheduler start]; // do things... // ------------------------------------------------------------- // App terminates // ------------------------------------------------------------- [AMSoundManager releaseSoundManager]; // ...
This is the most basic usage of this API: it loads an A2ML document, and starts the scheduler.
Now, if you need to send events to the scheduler, here is how it is done:
NSNotificationCenter *notificationCenter = [AMSoundManager getNotificationCenter]; [notificationCenter postNotificationName:@"example.myevent" object:self];
Listening in your program for internally generated audio events, like when a cue ended, works in a similar way:
NSNotificationCenter *notificationCenter = [AMSoundManager getNotificationCenter]; [notificationCenter addObserver:self selector:@selector(mycallback) name:@"mycueid.end" object:nil];
This way, each time the cue with the ID "mycueid" ends, the method "mycallback" will be called. Here is a list of some internal events you can listen to:
For special cases where you might need advanced interaction with the audio objects described in the A2ML document, you can access them programmatically and access/modify their properties directly, for example:
AMCue *mycue = [AMSoundManager getObjectFromID:@"mycueid"]; mycue.loopCount = 2; // change loop count value