Table of Contents

 
PlaySFX
 

Purpose

Plays or stops a clip or all clips

 

Protoype

void CSoundMngr::PlaySFX (bool b_play, string str_sfx, exclude ex_list = exclude(), int i_ex_flag = LIST_IN)
 

Parameters

pause whether to play (TRUE) or stop (FALSE) the clip
sfx the ID of the sfx object to affect
list the list of image objects to exclude or include in function
ex_flag whether to exclude objects not in the list (LIST_OUT) or objects in the list (LIST_IN)
 

Description

This function plays or stops a clip. When a clip is played, play always begins from the beginning of the clip, so don't try to set the clip position before calling this function. When a clip is stopped, the playhead returns to the beginning of the clip.

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.

 

Use

CSoundMngr sound;
// play one sfx object
sound.PlaySFX(true, "my_music");
// stop ALL music objects except "my_sfx"
exclude ex_list;
ex_list.push_back("my_sfx");
sound.PlaySFX(false, ALL_CLIPS, ex_list, LIST_IN);
// play ONLY these sfx music objects
exclude ex_list;
ex_list.push_back("my_sfx1");
ex_list.push_back("my_sfx2");
ex_list.push_back("my_sfx3");
sound.PlaySFX(true, ALL_CLIPS, ex_list, LIST_OUT);
 

Prev: PlayMusic