diff --git a/core/e2dtool.h b/core/e2dtool.h index 11d6d0bf..6fda3223 100644 --- a/core/e2dtool.h +++ b/core/e2dtool.h @@ -25,7 +25,6 @@ namespace e2d { - // 随机数产生器 class Random { @@ -71,6 +70,7 @@ namespace e2d // 音乐 class Music + : public Ref { public: Music(); @@ -89,7 +89,7 @@ namespace e2d // 播放 bool Play( - int loop_count = 0 + int loop_count = 0 /* 播放循环次数 (-1 为循环播放) */ ); // 暂停 @@ -112,7 +112,7 @@ namespace e2d // 设置音量 bool SetVolume( - float volume /* 1.0 为原始音量 */ + float volume /* 1 为原始音量, 大于 1 为放大音量, 0 为最小音量 */ ); // 获取 IXAudio2SourceVoice 对象 @@ -146,7 +146,7 @@ namespace e2d // 播放音乐 bool Play( const String& file_path, /* 音乐文件路径 */ - int loop_count = 0 /* 重复播放次数,设置 -1 为循环播放 */ + int loop_count = 0 /* 播放循环次数 (-1 为循环播放) */ ); // 暂停音乐 @@ -177,7 +177,7 @@ namespace e2d // 播放音乐 bool Play( const Resource& res, /* 音乐资源 */ - int loop_count = 0 /* 重复播放次数,设置 -1 为循环播放 */ + int loop_count = 0 /* 播放循环次数 (-1 为循环播放) */ ); // 暂停音乐 diff --git a/core/tools/Player.cpp b/core/tools/Player.cpp index 9a83b101..e6bd1f69 100644 --- a/core/tools/Player.cpp +++ b/core/tools/Player.cpp @@ -29,7 +29,7 @@ bool e2d::Player::Load(const String & file_path) } else { - delete music; + music->Release(); } } return false; @@ -109,7 +109,7 @@ bool e2d::Player::Load(const Resource& res) } else { - delete music; + music->Release(); } } return false; @@ -198,7 +198,7 @@ void e2d::Player::ClearCache() for (const auto& pair : musics_) { - delete pair.second; + pair.second->Release(); } musics_.clear(); }