Table of Contents

 
Reserve
 

Purpose

Reserves or frees the current clip channel

 

Protoype

void CSoundMngr::Reserve (string str_id, bool b_reserve)
 

Parameters

id the ID of the sound object to reserve
reserve whether to reserve (TRUE) of free (FALSE) the clip channel
 

Description

This function reserves the channel that the clip is currenty playing on. When you reserve a channel it's like creating an extra-high priority for the clip. If all channels become full, reserved channels are never bumped to make way for new clips. When a channel is reserved you can play and stop clips on the same channel without losing the channel when a clip is stopped. Caution: Be sure to free any reserved channels that you no longer need. If all channels end up being reserved and another sound has to play, it will not be able to.

NOTE: This is a channel function, which means it can be used for both music and sfx objects. The function itself will handle distinguishing between the two.

NOTE: Since this function reserves the channel the clip is currently using, that means in order to reserve a channel the clip must first be playing. This is not true of freeing a channel, however.

 

Use

CSoundMngr sound;
// reserve channel
sound.Reserve("my_sound", true);
// free channel
sound.Reserve("my_sound", false);
 

Prev: RemoveSFX