Miles Sound System SDK 7.2a

AIL_set_sample_loop_count

The function AIL_set_sample_loop_count arranges for a sample to be restarted immediately upon completion, for a total of two or more iterations.

void AIL_set_sample_loop_count(
  HSAMPLE S,
  S32 loop_count
);

In Parameters

S
indicates the sample to loop.
loop_count
should be set to the desired number of iterations.

Discussion

A loop_count value of 1 results in a single iteration, with no looping. This is the default loop count value, as initialized by AIL_init_sample.

A loop_count value of 0 creates an infinite loop, which can be interrupted by calling AIL_stop_sample, AIL_end_sample, or by calling AIL_set_sample_loop_count to establish a different loop count.

loop_count values of 2 or more cause the sample to be played a total of 2 or more times. The current number of iterations remaining may be monitored with AIL_sample_loop_count.

To loop a low-level streaming ("double-buffered") sample, it is necessary to trap the end-of-file condition (zero bytes read) and seek back to the file's beginning to re-execute the read call. The AIL_set_sample_loop_count function is not applicable to low-level streaming samples, since it can be used only when the entire sample is resident in memory. If used, it will cause only the currently playing buffer to loop, which is not likely to be the desired result. For more information about low-level streaming, refer to the AIL_sample_buffer_available function description. Note that the high-level streaming API handles looping for you!

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

Example files that use this function: SSTEST.C, EXAMMS.CPP


Group: Digital Audio Services
Related Functions: AIL_end_sample, AIL_init_sample, AIL_sample_buffer_available, AIL_sample_loop_block, AIL_sample_loop_count, AIL_set_sample_loop_block, AIL_set_sample_loop_count, AIL_set_stream_loop_count, AIL_stop_sample
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.