BLADERUNNER: Fixed panning of speech
Cleanup of other sound pannings
This commit is contained in:
parent
b8966ff1ad
commit
d4e7e957b0
10 changed files with 21 additions and 22 deletions
|
@ -1142,17 +1142,16 @@ int Actor::getGoal() const {
|
|||
void Actor::speechPlay(int sentenceId, bool voiceOver) {
|
||||
Common::String name = Common::String::format( "%02d-%04d%s.AUD", _id, sentenceId, _vm->_languageCode.c_str());
|
||||
|
||||
int balance = 0;
|
||||
int pan = 0;
|
||||
if (!voiceOver && _id != BladeRunnerEngine::kActorVoiceOver) {
|
||||
Vector3 screenPosition = _vm->_view->calculateScreenPosition(_position);
|
||||
balance = (127 * (2 * screenPosition.x - 640)) / 640;
|
||||
balance = CLIP<int>(balance, -127, 127);
|
||||
pan = (75 * (2 * CLIP<int>(screenPosition.x, 0, 640) - 640)) / 640; // map [0..640] to [-75..75]
|
||||
}
|
||||
|
||||
_vm->_subtitles->getInGameSubsText(_id, sentenceId);
|
||||
_vm->_subtitles->show();
|
||||
|
||||
_vm->_audioSpeech->playSpeech(name, balance);
|
||||
_vm->_audioSpeech->playSpeech(name, pan);
|
||||
}
|
||||
|
||||
void Actor::speechStop() {
|
||||
|
@ -1215,12 +1214,12 @@ void Actor::acquireCluesByRelations() {
|
|||
|
||||
int Actor::soundVolume() const {
|
||||
float dist = distanceFromView(_vm->_view);
|
||||
return 35.0f * CLIP(1.0f - (dist / 1200.0f), 0.0f, 1.0f);
|
||||
return (35 * CLIP<int>(100 - (dist / 12), 0, 100)) / 100; // map [0..1200] to [35..0]
|
||||
}
|
||||
|
||||
int Actor::soundBalance() const {
|
||||
int Actor::soundPan() const {
|
||||
Vector3 screenPosition = _vm->_view->calculateScreenPosition(_position);
|
||||
return 35.0f * (CLIP(screenPosition.x / 640.0f, 0.0f, 1.0f) * 2.0f - 1.0f);
|
||||
return (35 * (2 * CLIP<int>(screenPosition.x, 0, 640) - 640)) / 640; // map [0..640] to [-35..35]
|
||||
}
|
||||
|
||||
bool Actor::isObstacleBetween(const Vector3 &target) {
|
||||
|
|
|
@ -255,7 +255,7 @@ public:
|
|||
void acquireCluesByRelations();
|
||||
|
||||
int soundVolume() const;
|
||||
int soundBalance() const;
|
||||
int soundPan() const;
|
||||
|
||||
bool isObstacleBetween(const Vector3 &target);
|
||||
|
||||
|
|
|
@ -287,7 +287,7 @@ void ActorCombat::hitAttempt() {
|
|||
sentenceId += 900;
|
||||
}
|
||||
|
||||
_vm->_audioSpeech->playSpeechLine(_enemyId, sentenceId, 75, enemy->soundBalance(), 99);
|
||||
_vm->_audioSpeech->playSpeechLine(_enemyId, sentenceId, 75, enemy->soundPan(), 99);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@ void AudioMixer::tick() {
|
|||
channel->volumeDelta = 0.0f;
|
||||
}
|
||||
|
||||
_vm->_mixer->setChannelVolume(channel->handle, channel->volume * 255 / 100);
|
||||
_vm->_mixer->setChannelVolume(channel->handle, (channel->volume * Audio::Mixer::kMaxChannelVolume) / 100); // map [0..100] to [0..kMaxChannelVolume]
|
||||
|
||||
if (channel->volume <= 0.0f) {
|
||||
stop(i, 0);
|
||||
|
@ -185,7 +185,7 @@ void AudioMixer::tick() {
|
|||
channel->panDelta = 0.0f;
|
||||
}
|
||||
|
||||
_vm->_mixer->setChannelBalance(channel->handle, channel->pan * 127 / 100);
|
||||
_vm->_mixer->setChannelBalance(channel->handle, (channel->pan * 127) / 100); // map [-100..100] to [-127..127]
|
||||
}
|
||||
|
||||
if (!_vm->_mixer->isSoundHandleActive(channel->handle) || channel->stream->endOfStream()) {
|
||||
|
|
|
@ -124,9 +124,9 @@ bool AudioSpeech::isPlaying() const {
|
|||
}
|
||||
|
||||
bool AudioSpeech::playSpeechLine(int actorId, int sentenceId, int volume, int a4, int priority) {
|
||||
int balance = _vm->_actors[actorId]->soundBalance();
|
||||
int pan = _vm->_actors[actorId]->soundPan();
|
||||
Common::String name = Common::String::format("%02d-%04d%s.AUD", actorId, sentenceId, _vm->_languageCode.c_str());
|
||||
return _vm->_audioPlayer->playAud(name, _speechVolume * volume / 100, balance, balance, priority, kAudioPlayerOverrideVolume, Audio::Mixer::kSpeechSoundType);
|
||||
return _vm->_audioPlayer->playAud(name, _speechVolume * volume / 100, pan, pan, priority, kAudioPlayerOverrideVolume, Audio::Mixer::kSpeechSoundType);
|
||||
}
|
||||
|
||||
void AudioSpeech::setVolume(int volume) {
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
AudioSpeech(BladeRunnerEngine *vm);
|
||||
~AudioSpeech();
|
||||
|
||||
bool playSpeech(const Common::String &name, int balance = 0);
|
||||
bool playSpeech(const Common::String &name, int pan = 0);
|
||||
void stopSpeech();
|
||||
bool isPlaying() const;
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ BladeRunnerEngine::BladeRunnerEngine(OSystem *syst, const ADGameDescription *des
|
|||
|
||||
_walkSoundId = -1;
|
||||
_walkSoundVolume = 0;
|
||||
_walkSoundBalance = 0;
|
||||
_walkSoundPan = 0;
|
||||
|
||||
_crimesDatabase = nullptr;
|
||||
|
||||
|
@ -955,7 +955,7 @@ void BladeRunnerEngine::gameTick() {
|
|||
_mouse->draw(_surfaceFront, p.x, p.y);
|
||||
|
||||
if (_walkSoundId >= 0) {
|
||||
_audioPlayer->playAud(_gameInfo->getSfxTrack(_walkSoundId), _walkSoundVolume, _walkSoundBalance, _walkSoundBalance, 50, 0);
|
||||
_audioPlayer->playAud(_gameInfo->getSfxTrack(_walkSoundId), _walkSoundVolume, _walkSoundPan, _walkSoundPan, 50, 0);
|
||||
_walkSoundId = -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -202,7 +202,7 @@ public:
|
|||
|
||||
int _walkSoundId;
|
||||
int _walkSoundVolume;
|
||||
int _walkSoundBalance;
|
||||
int _walkSoundPan;
|
||||
int _runningActorId;
|
||||
|
||||
int _mouseClickTimeLast;
|
||||
|
|
|
@ -54,7 +54,7 @@ void ItemPickup::setup(int animationId, int screenX, int screenY) {
|
|||
_screenRect.top = _screenY - 40;
|
||||
_screenRect.bottom = _screenY + 40;
|
||||
|
||||
int pan = (150 * _screenX - 48000) / 640;
|
||||
int pan = (75 * (2 * _screenX - 640)) / 640; // map [0..640] to [-75..75]
|
||||
_vm->_audioPlayer->playAud(_vm->_gameInfo->getSfxTrack(335), 80, pan, pan, 50, 0);
|
||||
|
||||
_timeLast = _vm->_time->currentSystem();
|
||||
|
|
|
@ -963,7 +963,7 @@ void ScriptBase::Sound_Left_Footstep_Walk(int actorId) {
|
|||
|
||||
_vm->_walkSoundId = _vm->_scene->_set->getWalkboxSoundWalkLeft(walkboxId);
|
||||
_vm->_walkSoundVolume = _vm->_actors[actorId]->soundVolume();
|
||||
_vm->_walkSoundBalance = _vm->_actors[actorId]->soundBalance();
|
||||
_vm->_walkSoundPan = _vm->_actors[actorId]->soundPan();
|
||||
}
|
||||
|
||||
void ScriptBase::Sound_Right_Footstep_Walk(int actorId) {
|
||||
|
@ -975,7 +975,7 @@ void ScriptBase::Sound_Right_Footstep_Walk(int actorId) {
|
|||
|
||||
_vm->_walkSoundId = _vm->_scene->_set->getWalkboxSoundWalkRight(walkboxId);
|
||||
_vm->_walkSoundVolume = _vm->_actors[actorId]->soundVolume();
|
||||
_vm->_walkSoundBalance = _vm->_actors[actorId]->soundBalance();
|
||||
_vm->_walkSoundPan = _vm->_actors[actorId]->soundPan();
|
||||
}
|
||||
|
||||
void ScriptBase::Sound_Left_Footstep_Run(int actorId) {
|
||||
|
@ -987,7 +987,7 @@ void ScriptBase::Sound_Left_Footstep_Run(int actorId) {
|
|||
|
||||
_vm->_walkSoundId = _vm->_scene->_set->getWalkboxSoundRunLeft(walkboxId);
|
||||
_vm->_walkSoundVolume = _vm->_actors[actorId]->soundVolume();
|
||||
_vm->_walkSoundBalance = _vm->_actors[actorId]->soundBalance();
|
||||
_vm->_walkSoundPan = _vm->_actors[actorId]->soundPan();
|
||||
}
|
||||
|
||||
void ScriptBase::Sound_Right_Footstep_Run(int actorId) {
|
||||
|
@ -999,7 +999,7 @@ void ScriptBase::Sound_Right_Footstep_Run(int actorId) {
|
|||
|
||||
_vm->_walkSoundId = _vm->_scene->_set->getWalkboxSoundRunRight(walkboxId);
|
||||
_vm->_walkSoundVolume = _vm->_actors[actorId]->soundVolume();
|
||||
_vm->_walkSoundBalance = _vm->_actors[actorId]->soundBalance();
|
||||
_vm->_walkSoundPan = _vm->_actors[actorId]->soundPan();
|
||||
}
|
||||
|
||||
// ScriptBase::Sound_Walk_Shuffle_Stop
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue