audio_resume_sound

使用此函数,您可以恢复当前暂停的任何声音(使用函数audio_pause_sound())。 声音可以是声音的单个实例(当使用audio_play_sound()audio_play_sound_at()函数时,播放的单个声音的索引可以存储在变量中),也可以是声音资源,在这种情况下将重新启动给定声音的所有实例。

 

语法:

audio_resume_sound(index);

参数类型描述
indexSound Asset or Sound Instance ID or Audio Queue ID恢复声音的索引。

 

返回:

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);
    }
}

上述代码检查是否按下键盘键"P",如果检测到一个,则将全局变量"暂停"设置为true或假,然后暂停变量"snd_Waterfall"中索引的声音,或者从其暂停状态恢复声音。