17.1 Generating Audio Output
The basic process for generating, and playing audio can be summed up by the following steps.
-
Create and initialize the necessary resources. (Typically, an audio heap, a synthesizer, and a player)
-
Repeatedly make calls to alAudioFrame to generate the audio task lists.
-
Execute these audio task lists on the RSP.
-
Set the output DAC to point to the audio output, with a call to osAiSetNextBuffer
The creation and initialization of the necessary resources is somewhat dependent on your applications needs, but typically you will need to take the following steps.
-
Create an audio heap with a call to alHeapInit
-
Set the hardware output frequency with a call to OsalSetFrequency
-
Create a synthesizer with a call to alInit(). (alInit will require that you have a callback routine to initialize the audio DMA structures)
-
Create message queue for receiving signals that allow you to time your audio processing.
-
Create a player, (such as a sound player or sequence player) to sign into the synthesizer.
-
Initialize the resources assigned for each player that you have created.