mirror of https://github.com/axmolengine/axmol.git
Fix #516
This commit is contained in:
parent
a5f0a2decb
commit
782dc062d3
|
@ -236,7 +236,7 @@ bool AudioControlTest::init()
|
||||||
_playOverLabel->setPosition(Vec2(layerSize/2) + Vec2(0, 30));
|
_playOverLabel->setPosition(Vec2(layerSize/2) + Vec2(0, 30));
|
||||||
_playOverLabel->setVisible(false);
|
_playOverLabel->setVisible(false);
|
||||||
addChild(_playOverLabel, 99999);
|
addChild(_playOverLabel, 99999);
|
||||||
|
|
||||||
auto playItem = TextButton::create("play", [&](TextButton* button){
|
auto playItem = TextButton::create("play", [&](TextButton* button){
|
||||||
if (_audioID == AudioEngine::INVALID_AUDIO_ID) {
|
if (_audioID == AudioEngine::INVALID_AUDIO_ID) {
|
||||||
_audioID = AudioEngine::play2d("background.mp3", _loopEnabled, _volume);
|
_audioID = AudioEngine::play2d("background.mp3", _loopEnabled, _volume);
|
||||||
|
@ -903,23 +903,20 @@ std::string AudioPerformanceTest::subtitle() const
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool AudioSwitchStateTest::init()
|
void AudioSwitchStateTest::onEnter()
|
||||||
{
|
{
|
||||||
if (AudioEngineTestDemo::init())
|
AudioEngineTestDemo::onEnter();
|
||||||
{
|
|
||||||
schedule([](float dt){
|
//
|
||||||
|
// !!!Notes:
|
||||||
AudioEngine::uncacheAll();
|
// a. No special reason, but we must play the tests audio at onEnter for this test suite only.
|
||||||
AudioEngine::preload("audio/SoundEffectsFX009/FX081.mp3");
|
// b. The latst audio test scene will stop all audio players,
|
||||||
AudioEngine::play2d("audio/SoundEffectsFX009/FX082.mp3");
|
// so if play any sound at init funciton, you can't herer
|
||||||
AudioEngine::play2d("audio/LuckyDay.mp3");
|
// c. Please refer to AudioEngineTestDemo::onExit
|
||||||
|
//
|
||||||
}, 0.01f, "AudioSwitchStateTest");
|
AudioEngine::preload("audio/SoundEffectsFX009/FX081.mp3");
|
||||||
|
AudioEngine::play2d("audio/SoundEffectsFX009/FX082.mp3");
|
||||||
return true;
|
AudioEngine::play2d("audio/LuckyDay.mp3");
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string AudioSwitchStateTest::title() const
|
std::string AudioSwitchStateTest::title() const
|
||||||
|
@ -934,15 +931,18 @@ std::string AudioSwitchStateTest::subtitle() const
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool AudioSmallFileTest::init()
|
void AudioSmallFileTest::onEnter()
|
||||||
{
|
{
|
||||||
if (AudioEngineTestDemo::init())
|
AudioEngineTestDemo::onEnter();
|
||||||
{
|
|
||||||
AudioEngine::play2d("audio/SmallFile.mp3");
|
//
|
||||||
return true;
|
// !!!Notes:
|
||||||
}
|
// a. No special reason, but we must play the tests audio at onEnter for this test suite only.
|
||||||
|
// b. The latst audio test scene will stop all audio players,
|
||||||
return false;
|
// so if play any sound at init funciton, you can't hear it
|
||||||
|
// c. Please refer to AudioEngineTestDemo::onExit
|
||||||
|
//
|
||||||
|
AudioEngine::play2d("audio/SmallFile.mp3");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string AudioSmallFileTest::title() const
|
std::string AudioSmallFileTest::title() const
|
||||||
|
@ -960,9 +960,14 @@ void AudioSmallFile2Test::onEnter()
|
||||||
{
|
{
|
||||||
AudioEngineTestDemo::onEnter();
|
AudioEngineTestDemo::onEnter();
|
||||||
|
|
||||||
schedule([](float dt){
|
//
|
||||||
AudioEngine::play2d("audio/SmallFile2.mp3");
|
// !!!Notes:
|
||||||
}, 0.08f, "smallfile2");
|
// a. No special reason, but we must play the tests audio at onEnter for this test suite only.
|
||||||
|
// b. The latst audio test scene will stop all audio players,
|
||||||
|
// so if play any sound at init funciton, you can't hear it
|
||||||
|
// c. Please refer to AudioEngineTestDemo::onExit
|
||||||
|
//
|
||||||
|
AudioEngine::play2d("audio/SmallFile2.mp3");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string AudioSmallFile2Test::title() const
|
std::string AudioSmallFile2Test::title() const
|
||||||
|
@ -980,9 +985,14 @@ void AudioSmallFile3Test::onEnter()
|
||||||
{
|
{
|
||||||
AudioEngineTestDemo::onEnter();
|
AudioEngineTestDemo::onEnter();
|
||||||
|
|
||||||
schedule([](float dt){
|
//
|
||||||
AudioEngine::play2d("audio/SmallFile3.mp3");
|
// !!!Notes:
|
||||||
}, 0.5f, "smallfile3");
|
// a. No special reason, but we must play the tests audio at onEnter for this test suite only.
|
||||||
|
// b. The latst audio test scene will stop all audio players,
|
||||||
|
// so if play any sound at init funciton, you can't hear it
|
||||||
|
// c. Please refer to AudioEngineTestDemo::onExit
|
||||||
|
//
|
||||||
|
AudioEngine::play2d("audio/SmallFile3.mp3");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string AudioSmallFile3Test::title() const
|
std::string AudioSmallFile3Test::title() const
|
||||||
|
|
|
@ -223,8 +223,7 @@ class AudioSwitchStateTest : public AudioEngineTestDemo
|
||||||
public:
|
public:
|
||||||
CREATE_FUNC(AudioSwitchStateTest);
|
CREATE_FUNC(AudioSwitchStateTest);
|
||||||
|
|
||||||
virtual bool init() override;
|
void onEnter() override;
|
||||||
|
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
};
|
};
|
||||||
|
@ -234,7 +233,7 @@ class AudioSmallFileTest : public AudioEngineTestDemo
|
||||||
public:
|
public:
|
||||||
CREATE_FUNC(AudioSmallFileTest);
|
CREATE_FUNC(AudioSmallFileTest);
|
||||||
|
|
||||||
virtual bool init() override;
|
void onEnter() override;
|
||||||
|
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
|
|
Loading…
Reference in New Issue