#include <NewAudioEngineTest.h>
◆ CREATE_FUNC()
◆ init()
| bool AudioPerformanceTest::init |
( |
| ) |
|
|
overridevirtual |
在文件 NewAudioEngineTest.cpp 第 776 行定义.
778 if (AudioEngineTestDemo::init())
780 std::vector<std::string> audioFiles = {
781 "audio/SoundEffectsFX009/FX081.mp3",
782 "audio/SoundEffectsFX009/FX082.mp3",
783 "audio/SoundEffectsFX009/FX083.mp3",
784 "audio/SoundEffectsFX009/FX084.mp3",
785 "audio/SoundEffectsFX009/FX085.mp3",
786 "audio/SoundEffectsFX009/FX086.mp3",
787 "audio/SoundEffectsFX009/FX087.mp3",
788 "audio/SoundEffectsFX009/FX088.mp3",
789 "audio/SoundEffectsFX009/FX089.mp3",
790 "audio/SoundEffectsFX009/FX090.mp3"
793 for (
const auto& audioFile : audioFiles)
795 AudioEngine::preload(audioFile);
798 auto& layerSize = this->getContentSize();
800 auto playItem = TextButton::create(
"Start Test", [
this, audioFiles](TextButton* button){
801 button->setEnabled(
false);
802 static_cast<TextButton*
>(getChildByName(
"DisplayButton"))->setEnabled(
true);
805 schedule([audioFiles](
float dt){
806 int index = cocos2d::random(0, (
int)(audioFiles.size()-1));
808 AudioEngine::play2d(audioFiles[index]);
812 playItem->setPosition(layerSize.width * 0.5f, layerSize.height * 2 / 3);
813 playItem->setName(
"PlayButton");
816 auto displayItem = TextButton::create(
"Display Result", [
this, playItem](TextButton* button){
818 AudioEngine::stopAll();
820 playItem->setEnabled(
true);
821 button->setEnabled(
false);
823 displayItem->setEnabled(
false);
824 displayItem->setPosition(layerSize.width * 0.5f, layerSize.height / 3);
825 displayItem->setName(
"DisplayButton");
826 addChild(displayItem);
#define CC_PROFILER_STOP(__name__)
#define CC_PROFILER_DISPLAY_TIMERS()
#define CC_PROFILER_START(__name__)
引用了 CC_PROFILER_DISPLAY_TIMERS, CC_PROFILER_START , 以及 CC_PROFILER_STOP.
◆ subtitle()
| std::string AudioPerformanceTest::subtitle |
( |
| ) |
const |
|
overridevirtual |
◆ title()
| std::string AudioPerformanceTest::title |
( |
| ) |
const |
|
overridevirtual |
该类的文档由以下文件生成:
- /Users/yujizhu/Documents/Git/cocos2d-x-4.0/tests/cpp-tests/Classes/NewAudioEngineTest/NewAudioEngineTest.h
- /Users/yujizhu/Documents/Git/cocos2d-x-4.0/tests/cpp-tests/Classes/NewAudioEngineTest/NewAudioEngineTest.cpp