Table of Contents | ||||||||||
|
||||||||||
SetVolume | ||||||||||
Purpose Sets the volume level of a clip or all clips |
||||||||||
Protoype void CSoundMngr::SetVolume (int i_vol, string str_id, exclude ex_list = exclude(), int i_handle_flag = CLIP_ALL, int i_ex_flag = LIST_IN) |
||||||||||
Parameters
|
||||||||||
Description This function sets the volume level of the given sound object. Volume levels can range from 0-255 (you can also use the predefined values of VOLUME_MIN and VOLUME_MAX, respectively).
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; // change one sound object sound.SetVolume(VOLUME_MAX*0.5f, "my_sound"); // change ALL sound objects except "my_sound" exclude ex_list; ex_list.push_back("my_sound"); sound.SetVolume(VOLUME_MAX*0.5f, ALL_CLIPS, ex_list, CLIP_ALL, LIST_IN); // change 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.SetVolume(VOLUME_MAX*0.5f, ALL_CLIPS, ex_list, CLIP_MUSIC, LIST_OUT); |
||||||||||
|
||||||||||
|