Judgment Play||doc135619

September 20, 2022

Format

 TdAudioEngine:isPlaying(nSoundId) 

Description

Determine whether the sound effect corresponding to the sound effect ID is playing


Precautions

To determine whether a sound effect is playing, you must first obtain the id number of the sound effect. So this function should be matched with the playback function of the sound effectplay3dSoundorplay2dSoundto use.


Parameters

Variable name type Description
nSoundId int sound effectId

Value Returned

type Description
boolean whether to play


Code Samples

local TdAudioEngine = TdAudioEngine.Instance()
local soundID = TdAudioEngine:play2dSound("asset/Audio/Sound/click.mp3", true)
print(TdAudioEngine:isPlaying(soundID))
end