| Miles Sound System SDK 7.2a |
The function AIL_set_sample_position adjusts the playback position of a sample.
void AIL_set_sample_position( HSAMPLE S, U32 pos ); |
By means of this function, it is possible to instantaneously change the location from which sample data is being played. The change will take effect as soon as the next block of audio data from the sample is merged into the hardware buffer.
If the sample data is compressed, then the offset passed to this function is in "compressed" bytes.
The granularity of the seek position that you specified is based on the size of a sample for uncompressed data, or the ADPCM block size for ADPCM data.
You can use the AIL_set_sample_ms_position function to set a new sample position based on milliseconds.
Not all compressed file types support seeking to arbitrarily-precise locations in MSS. If your application cannot tolerate approximations in seeking operations, it's best to stick with MP3 data and review the I'm getting a glitch when I loop an MP3 or ADPCM file - what can I do? FAQ carefully.)
Any calls to AIL_set_sample_position, AIL_set_stream_position, or AIL_set_sample_loop_block with MP3 source data should specify offsets that lie on frame boundaries. This helps us avoid mistakenly interpreting intraframe data as a valid frame boundary. The loop boundaries displayed by the Miles Sound Player are suitable for passing directly to AIL_set_sample_position, AIL_set_stream_position, or AIL_set_sample_loop_block. Note that MSS considers offset 0 to be the first byte after any ID3v2 tag or other metadata at the beginning of an MP3 file! Frame offsets reported by other MP3 editors will most likely be relative to the beginning of the entire file, making them unsuitable for use with the Miles API.
Group:
Digital Audio Services
Related Functions:
AIL_sample_granularity, AIL_sample_ms_position, AIL_sample_position, AIL_set_sample_loop_block, AIL_set_sample_ms_position, AIL_set_sample_position, AIL_set_stream_position, AIL_start_sample
Related Basic Types:
HSAMPLE, U32, void
Related FAQs:
I'm getting a glitch when I loop an MP3 or ADPCM file - what can I do?
For technical support, e-mail Miles3@radgametools.com
© Copyright 1991-2007 RAD Game Tools, Inc. All Rights Reserved.