mirror of https://github.com/axmolengine/axmol.git
fix a bug in SimpleAudioEngine.cpp on bada platform
use float value to change volume
This commit is contained in:
parent
5a411277fb
commit
4848dc9c46
|
@ -397,7 +397,7 @@ void SimpleAudioEngine::setBackgroundMusicVolume(float volume)
|
||||||
|
|
||||||
if (s_pBackPlayer != NULL)
|
if (s_pBackPlayer != NULL)
|
||||||
{
|
{
|
||||||
s_pBackPlayer->SetVolume(ceil(volume));
|
s_pBackPlayer->SetVolume(ceil(volume*99));
|
||||||
}
|
}
|
||||||
s_fBackgroundMusicVolume = volume;
|
s_fBackgroundMusicVolume = volume;
|
||||||
}
|
}
|
||||||
|
@ -423,7 +423,7 @@ void SimpleAudioEngine::setEffectsVolume(float volume)
|
||||||
{
|
{
|
||||||
if (it->second != NULL)
|
if (it->second != NULL)
|
||||||
{
|
{
|
||||||
it->second->SetVolume(ceil(volume));
|
it->second->SetVolume(ceil(volume*99));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s_fEffectsVolume = volume;
|
s_fEffectsVolume = volume;
|
||||||
|
@ -446,13 +446,7 @@ unsigned int SimpleAudioEngine::playEffect(const char* pszFilePath, bool bLoop/*
|
||||||
AppLog("CCAudioOut instance must not be NULL, id = %d", p->first);
|
AppLog("CCAudioOut instance must not be NULL, id = %d", p->first);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
p->second->SetVolume((int) (s_fEffectsVolume * 99));
|
p->second->SetVolume(ceil(s_fEffectsVolume * 99));
|
||||||
int volume = p->second->GetVolume();
|
|
||||||
|
|
||||||
if (s_fEffectsVolume > 0.0f && volume == 0)
|
|
||||||
{
|
|
||||||
p->second->SetVolume(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (AUDIOOUT_STATE_PLAYING == p->second->GetState())
|
if (AUDIOOUT_STATE_PLAYING == p->second->GetState())
|
||||||
{
|
{
|
||||||
|
|
|
@ -151,19 +151,19 @@ void CocosDenshionTest::menuCallback(CCObject * pSender)
|
||||||
break;
|
break;
|
||||||
// add bakcground music volume
|
// add bakcground music volume
|
||||||
case 10:
|
case 10:
|
||||||
SimpleAudioEngine::sharedEngine()->setBackgroundMusicVolume(SimpleAudioEngine::sharedEngine()->getBackgroundMusicVolume() + 0.1);
|
SimpleAudioEngine::sharedEngine()->setBackgroundMusicVolume(SimpleAudioEngine::sharedEngine()->getBackgroundMusicVolume() + 0.1f);
|
||||||
break;
|
break;
|
||||||
// sub backgroud music volume
|
// sub backgroud music volume
|
||||||
case 11:
|
case 11:
|
||||||
SimpleAudioEngine::sharedEngine()->setBackgroundMusicVolume(SimpleAudioEngine::sharedEngine()->getBackgroundMusicVolume() - 0.1);
|
SimpleAudioEngine::sharedEngine()->setBackgroundMusicVolume(SimpleAudioEngine::sharedEngine()->getBackgroundMusicVolume() - 0.1f);
|
||||||
break;
|
break;
|
||||||
// add effects volume
|
// add effects volume
|
||||||
case 12:
|
case 12:
|
||||||
SimpleAudioEngine::sharedEngine()->setEffectsVolume(SimpleAudioEngine::sharedEngine()->getEffectsVolume() + 0.1);
|
SimpleAudioEngine::sharedEngine()->setEffectsVolume(SimpleAudioEngine::sharedEngine()->getEffectsVolume() + 0.1f);
|
||||||
break;
|
break;
|
||||||
// sub effects volume
|
// sub effects volume
|
||||||
case 13:
|
case 13:
|
||||||
SimpleAudioEngine::sharedEngine()->setEffectsVolume(SimpleAudioEngine::sharedEngine()->getEffectsVolume() - 0.1);
|
SimpleAudioEngine::sharedEngine()->setEffectsVolume(SimpleAudioEngine::sharedEngine()->getEffectsVolume() - 0.1f);
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
SimpleAudioEngine::sharedEngine()->pauseEffect(m_nSoundId);
|
SimpleAudioEngine::sharedEngine()->pauseEffect(m_nSoundId);
|
||||||
|
|
Loading…
Reference in New Issue