ABSTRACT

This chapter discusses audio device callbacks and callback etiquette; frame buffering, managing threads, and inter-thread communication in the context of game audio; and presents a fast and efficient sound engine interface to the rest of the game. Computing the next frame of data takes less time than the period of the callback minus the time spent in copying the read buffer into the output, a completed frame is ready and waiting to receive the next callback. This approach breaks down next frame of data before the callback attempts to read it. Application-driven frame generation leaves the decision to push data into the pipeline, and in the application. This mechanism gives the application more flexibility as it decides to produce many samples it wants to, and varies the amount of samples produced from frame to frame. Application-driven frame generation also precisely controls the data that is used to generate each frame.