Table of Contents

 
Mute
 

Purpose

Mutes or unmutes a clip or all clips

 

Protoype

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

Parameters

mute whether to mute (TRUE) or un-mute (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 mutes a clip. When a clip is muted it continues to play, it's volume level is just decreased to 0.

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;
// mute one sound object
sound.Mute(true, "my_sound");
// un-mute ALL sound objects except "my_sound"
exclude ex_list;
ex_list.push_back("my_sound");
sound.Mute(false, ALL_CLIPS, ex_list, CLIP_ALL, LIST_IN);
// mute 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.Mute(true, ALL_CLIPS, ex_list, CLIP_MUSIC, LIST_OUT);
 

Prev: LoadSFX
Next: Pause