![]() ![]() Other method - to change the global level of volume. In this case all sounds will be stored in memory that approaches not always (audio groups do not work for stream playing). This can be done in many ways.įor example, possible to create different audio groups - one for music, one for effects and set the volume to a whole group. Any playing of a sound in game shall consider this setup. Let's imagine that there is a menu where the user can adjust the sound volume. Can you explain the script and obj_sound_enable for each row? Sorry, but I still don't understand your code. See small example with slider and sound on/off button. Or if you have slider in sound preferences then you can set any volume (for example, 0.5 for 50% of maximum volume). So, for enable/disable sounds you need change this variable from 0 to 1 or from 1 to 0 (like global.volume_sfx = !global.volume_sfx). Variable global.volume_sfx must contain value from 0 (no sound) to 1 (full volume). This code gets volume from settings ( var vol = global.volume_sfx) and plays all sounds with this volume. Then call it when you need play any sound. When I need stop all sounds, I do: audio_stop_all() Ĭreate new script with name play_sound with first code. Var s = audio_play_sound(snd, 50, loop) // Start soundĪudio_sound_gain(s, vol, 0) // Set volume for this sound Var loop = false // need loop sound or not Var snd = argument // name of sound which need play, passed to the script If vol = 0 exit // if volume is 0 then not need play, exit Var vol = global.volume_sfx // global.volume_sfx must contain volume (0.1) Usually I do something like this: /// play_sound(sound, ) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |