Example #1
0
void Area::playAmbientSound(Common::UString sound) {
	stopAmbientSound();

	// TODO Day/Night
	if (sound.empty())
		sound = _ambientDay;

	if (sound.empty())
		return;

	_ambientSound = playSound(sound, Sound::kSoundTypeSFX, true, _ambientDayVol);
}
bool CAutoMusicPlayerBase::ChangeMusicMsg(CChangeMusicMsg *msg) {
	if (_isEnabled && msg->_action == MUSIC_STOP) {
		_isEnabled = false;
		stopAmbientSound(_transition, -1);
	}

	if (!msg->_filename.empty()) {
		_filename = msg->_filename;

		if (_isEnabled) {
			stopAmbientSound(_transition, -1);
			playAmbientSound(_filename, _volumeMode, _initialMute, true, 0,
				Audio::Mixer::kMusicSoundType);
		}
	}

	if (!_isEnabled && msg->_action == MUSIC_START) {
		_isEnabled = true;
		playAmbientSound(_filename, _volumeMode, _initialMute, true, 0,
			Audio::Mixer::kMusicSoundType);
	}

	return true;
}
bool CSeasonalMusicPlayer::ChangeMusicMsg(CChangeMusicMsg *msg) {
	if (_isEnabled && msg->_action == MUSIC_STOP) {
		_isEnabled = false;
		stopAmbientSound(_transition, -1);
	}

	if (!msg->_filename.empty()) {
		if (_isSummer) {
			setAmbientSoundVolume(VOL_MUTE, 2, 0);
			setAmbientSoundVolume(VOL_QUIET, 2, 1);
		} else if (_isAutumn) {
			setAmbientSoundVolume(VOL_MUTE, 2, 1);
			setAmbientSoundVolume(VOL_QUIET, 2, 2);
		} else if (_isWinter) {
			setAmbientSoundVolume(VOL_MUTE, 2, 2);
			setAmbientSoundVolume(VOL_QUIET, 2, 3);
		} else if (_isSpring) {
			setAmbientSoundVolume(VOL_MUTE, 2, 3);
			setAmbientSoundVolume(VOL_QUIET, 2, 0);
		}
	}

	if (!_isEnabled && msg->_action == MUSIC_START) {
		_isEnabled = true;
		loadSound(TRANSLATE("c#64.wav", "c#47.wav"));
		loadSound(TRANSLATE("c#63.wav", "c#46.wav"));
		loadSound(TRANSLATE("c#65.wav", "c#48.wav"));
		loadSound(TRANSLATE("c#62.wav", "c#47.wav"));
		playAmbientSound(TRANSLATE("c#64.wav", "c#47.wav"), _springMode, _isSpring, true, 0);
		playAmbientSound(TRANSLATE("c#63.wav", "c#46.wav"), _summerMode, _isSummer, true, 1);
		playAmbientSound(TRANSLATE("c#65.wav", "c#48.wav"), _autumnMode, _isAutumn, true, 2);
		playAmbientSound(TRANSLATE("c#62.wav", "c#47.wav"), _winterMode, _isWinter, true, 3);
	}

	return true;
}
Example #4
0
void Area::stopSound() {
	stopAmbientMusic();
	stopAmbientSound();
}