Table of Contents

 
Pause
 

Purpose

Pauses or unpauses a clip or all clips

 

Protoype

void CSoundMngr::Pause (bool b_pause, string str_id, exclude ex_list = exclude(), int i_handle_flag = CLIP_ALL, 
                        int i_ex_flag = LIST_IN)
 

Parameters

pause whether to pause (TRUE) or un-pause (FALSE) the clip
id the ID of the sound object to affect
list the list of image objects to exclude or include in function
handle_flag the type of objects in the exclusion list
ex_flag whether to exclude objects not in the list (LIST_OUT) or objects in the list (LIST_IN)
 

Description

This function pauses a clip. When a clip is pause it stops playing, but in order to retstart it from the same point it must be un-paused with this function..

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.

Affecting Multiple Objects

If you want to affect more than one image object at once, then you can use the last two parameters of the function. First you must compile a list (an STL vector) of objects that you want to either exclude or include. If you want to affect all image objects except certain ones, pass those in for ex_list along with the flag LIST_IN. If you want to affect only a certain set of objects, pass those in for ex_list along with the flag LIST_OUT. You should also pass ALL_CLIPS for str_id.

Additionally, you can save time by specifying what types of sound objects reside in the exclusion list. For example, if you are only affecting sfx clips, why bother have the function search through the music clip manager? To tell it this, you use the i_handle_flag parameter. CLIP_SFX and CLIP_MUSIC tell the function to look in either one or the other clip manager, whereas CLIP_ALL tells the function to look in both clip managers. So going back to the previous excample, if you were only affecting sfx clips, then you would use CLIP_SFX.

 

Use

CSoundMngr sound;
// pause one sound object
sound.Pause(true, "my_sound");
// un-pause ALL sound objects except "my_sound"
exclude ex_list;
ex_list.push_back("my_sound");
sound.Pause(false, ALL_CLIPS, ex_list, CLIP_ALL, LIST_IN);
// pause ONLY these three music objects
exclude ex_list;
ex_list.push_back("my_music1");
ex_list.push_back("my_music2");
ex_list.push_back("my_music3");
sound.Pause(true, ALL_CLIPS, ex_list, CLIP_MUSIC, LIST_OUT);
 

Prev: Mute
Next: PlayMusic