【已解决】问一个声音问题,如何用setVolume控制音量?

问各位大大一个新手问题,我看API这么写的:
static void setVolume (int audioID,float volume )
static
设置一个音频实例的音量大小。

参数
audioID 一个play2d函数返回的音频ID。
volume 音量值(范围从0.0到1.0)。

那么我的问题是,这个audioID是什么,如何得到呢?

static int play2d(const std::string& filePath, bool loop = false, float volume = 1.0f, const AudioProfile *profile = nullptr);

看下它的注释,还有返回值。

ps:感觉返回值这个变量改为audioid就好了,return ret;没前者明显。

啊哈哈你好!按照你的思路我这么写:
var shootID = cc.audioEngine.play2d(res.shoot_sd);//设置一个声音res.shoot_sd的audioID
cc.audioEngine.setVolume(shootID,0.5);//让这个声音变为0.5

但是程序在这里输出报错了:
Uncaught TypeError: cc.audioEngine.play2d is not a function

请问是什么原因呢?

。。。。。没找到函数啊,音效模块没加啊。

不好意思版主,我好久没上论坛了,不过还有个问题,音效模块怎么加呢?

请问这个问题解决了吗,我也遇到了这个问题