Miles Sound System SDK 7.2a

AIL_set_sample_loop_block

The function AIL_set_sample_loop_block arranges for a sub-block of a sample to be looped.

void AIL_set_sample_loop_block(
  HSAMPLE S,
  S32 loop_start_offset,
  S32 loop_end_offset
);

In Parameters

S
indicates the sample to loop.
loop_start_offset
should be set to the offset of where looping should begin. If the sample is compressed, this offset is specified in "compressed" bytes.
loop_end_offset
should be set to the offset of where looping should end. If the sample is compressed, this offset is specified in "compressed" bytes.

Discussion

By default, looping a sound will loop the entire buffer. This function allows you to loop a smaller sub-section of the buffer.

If the sample data is compressed, then the offsets passed to this function is in "compressed" bytes.

A value of zero for loop_start_offset indicates the beginning of the sample, and a value of -1 for loop_end_offset indicates the end of the sample, regardless of its actual length.

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.

To loop a stream, you must use AIL_set_stream_loop_block rather than calling AIL_set_sample_loop_block on the stream's underlying HSAMPLE.


Group: Digital Audio Services
Related Functions: AIL_sample_loop_block, AIL_set_sample_loop_block, AIL_set_sample_loop_count, AIL_set_sample_position, AIL_set_stream_loop_block, AIL_set_stream_position
Related Basic Types: HSAMPLE, S32, void
Related FAQs: I'm getting a glitch when I loop an MP3 or ADPCM file - what can I do?, What MP3 encoder should I use?

For technical support, e-mail Miles3@radgametools.com
© Copyright 1991-2007 RAD Game Tools, Inc. All Rights Reserved.