audio_pause_sound


描述

With this function you can pause any sound that is currently playing. The sound can either be a single instance of a sound (the index for individual sounds being played can be stored in a variable when using the audio_play_sound or audio_play_sound_at functions) or a sound asset, in which case all instances of the given sound will be paused.


语法:

audio_pause_sound(index);


参数 描述
index The index of the sound to pause.


返回:

N/A(无返回值)


例如:

if keyboard_check_pressed(ord("P"))
   {
   global.Pause = !global.Pause;
   if global.Pause
      {
      audio_pause_sound(snd_Waterfall);
      }
   else
      {
      audio_resume_sound(snd_Waterfall);
      }
   }

The above code checks for a press of the keyboard key "P" and if it detects one it sets the global variable "Pause" to true or false and then either pauses the sound indexed in the variable "snd_Waterfall" or it resumes the sound from its paused state.