Exemplo n.º 1
0
bool ActionAttenuate::execute() {
	ScriptingEffect *fx = _engine->getScriptManager()->getSideFX(_key);
	if (fx && fx->getType() == ScriptingEffect::SCRIPTING_EFFECT_AUDIO) {
		MusicNodeBASE *mus = (MusicNodeBASE *)fx;
		mus->setVolume(255 * (10000 - abs(_attenuation)) / 10000 );
	}
	return true;
}
Exemplo n.º 2
0
bool ActionCrossfade::execute() {
	if (_keyOne) {
		ScriptingEffect *fx = _engine->getScriptManager()->getSideFX(_keyOne);
		if (fx && fx->getType() == ScriptingEffect::SCRIPTING_EFFECT_AUDIO) {
			MusicNodeBASE *mus = (MusicNodeBASE *)fx;
			if (_oneStartVolume >= 0)
				mus->setVolume((_oneStartVolume * 255) / 100);

			mus->setFade(_timeInMillis, (_oneEndVolume * 255) / 100);
		}
	}

	if (_keyTwo) {
		ScriptingEffect *fx = _engine->getScriptManager()->getSideFX(_keyTwo);
		if (fx && fx->getType() == ScriptingEffect::SCRIPTING_EFFECT_AUDIO) {
			MusicNodeBASE *mus = (MusicNodeBASE *)fx;
			if (_twoStartVolume >= 0)
				mus->setVolume((_twoStartVolume * 255) / 100);

			mus->setFade(_timeInMillis, (_twoEndVolume * 255) / 100);
		}
	}
	return true;
}