| Miles Sound System SDK 7.2a |
The function AIL_stream_position reports the current playback position of a stream.
S32 AIL_stream_position( HSTREAM stream ); |
The offset in bytes of the next sample point to be fetched, relative to the beginning of the stream.
The granularity of the reported position offset depends on the hardware buffer latency, but it will always reflect an address which has not yet been reached by the playback mechanism.
The Miles Sound System digital audio mixer operates on the application's audio data in small chunks, called blocks. Part of the system's responsibility is to poll the hardware buffers in the background to determine when the next block of audio data from the application should be processed and copied into an empty hardware half-buffer. As an example, consider a hardware driver which is configured to play 16-bit audio at 20,000 Hz with a pair of 1,000-byte half-buffers. The driver's data rate is 40,000 bytes per second, implying a half-buffer playback rate of 40,000 / 1,000, or 40 buffer transitions per second.
At a rate of 40 times per second, then, a sample block equivalent to one half-buffer's worth of data is fetched from the application's sample data buffer at the current playback position. The samples are resampled if necessary to conform to the driver's hardware rate, converted between 8-bit and 16-bit formats where appropriate, mathematically scaled for volume and panpot control, algebraically added to data from other active samples, clipped, and copied into the driver's empty half-buffer to be played as soon as the other half-buffer finishes playing.
AIL_stream_position reports the location of the beginning of the next application data block to be fetched and processed by this mechanism.
Example files that use this function: Streamer.C
Group:
Digital Audio Streaming Services
Related Functions:
AIL_set_stream_position, AIL_stream_ms_position, AIL_stream_position
Related Basic Types:
HSTREAM, S32
For technical support, e-mail Miles3@radgametools.com
© Copyright 1991-2007 RAD Game Tools, Inc. All Rights Reserved.