Skip to content

Commit

Permalink
Automatic merge of T1.5.1-515-g868d5abc9 and 11 pull requests
Browse files Browse the repository at this point in the history
- Pull request #757 at 98dd1a7: Unify RailDriver code implementations
- Pull request #799 at dc03850: Consolidated wind simulation
- Pull request #821 at cc3af66: Adds suppression of safety valves
- Pull request #831 at 61bbf43: poor mans switch panel on tablet
- Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters
- Pull request #841 at 410a585: https://blueprints.launchpad.net/or/+spec/animating-trainset-windows
- Pull request #844 at 3f42c30: Animate axles separately
- Pull request #846 at 98f1c45: Initialize cars before restore
- Pull request #851 at d3e8c3e: New Triple Valve Features
- Pull request #853 at c8f02ad: Notify out of focus
- Pull request #854 at 027fac8: fix: Updating manual to match PR 647
  • Loading branch information
openrails-bot committed Jul 22, 2023
13 parents bfb6163 + 868d5ab + 98dd1a7 + dc03850 + cc3af66 + 61bbf43 + d00beb9 + 410a585 + 3f42c30 + 98f1c45 + d3e8c3e + c8f02ad + 027fac8 commit 9cc2394
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions Source/RunActivity/Viewer3D/Sound.cs
Expand Up @@ -1420,19 +1420,28 @@ private void SetFreqAndVolume()
volume *= Interpolate(x, MSTSStream.VolumeCurves[i]);
}

var wag = (MSTSWagon)SoundSource.Viewer.Camera.AttachedCar;
var soundHeardInternallyCorrection = Math.Min(wag.SoundHeardInternallyCorrection[0] + wag.SoundHeardInternallyCorrection[1], 1);
if (SoundSource.IsExternal && SoundSource.Viewer.Camera.Style != Camera.Styles.External && !SoundSource.IsUnattenuated)
if (SoundSource.Viewer.Camera.Style != Camera.Styles.External)
{
if (wag == null || wag.ExternalSoundPassThruPercent == -1)
volume *= Program.Viewer.Settings.ExternalSoundPassThruPercent * 0.01f + (1 - Program.Viewer.Settings.ExternalSoundPassThruPercent * 0.01f) * soundHeardInternallyCorrection;
else volume *= wag.ExternalSoundPassThruPercent * 0.01f + (1 - wag.ExternalSoundPassThruPercent * 0.01f) * soundHeardInternallyCorrection;
var wag = (MSTSWagon)SoundSource.Viewer.Camera.AttachedCar;
var soundHeardInternallyCorrection = Math.Min(wag.SoundHeardInternallyCorrection[0] + wag.SoundHeardInternallyCorrection[1], 1);
if (SoundSource.IsExternal && !SoundSource.IsUnattenuated)
{
if (wag == null || wag.ExternalSoundPassThruPercent == -1)
volume *= Program.Viewer.Settings.ExternalSoundPassThruPercent * 0.01f + (1 - Program.Viewer.Settings.ExternalSoundPassThruPercent * 0.01f) * soundHeardInternallyCorrection;
else volume *= wag.ExternalSoundPassThruPercent * 0.01f + (1 - wag.ExternalSoundPassThruPercent * 0.01f) * soundHeardInternallyCorrection;
}

if (SoundSource.IsInternalTrackSound)
{
if (wag?.TrackSoundPassThruPercent != -1)
volume *= wag.TrackSoundPassThruPercent * 0.01f + (1 - wag.TrackSoundPassThruPercent * 0.01f) * soundHeardInternallyCorrection;
}
}

if (SoundSource.IsInternalTrackSound && SoundSource.Viewer.Camera.Style != Camera.Styles.External)
{
if (wag?.TrackSoundPassThruPercent != -1)
volume *= wag.TrackSoundPassThruPercent * 0.01f + (1 - wag.TrackSoundPassThruPercent * 0.01f) * soundHeardInternallyCorrection;
if (((MSTSWagon)SoundSource.Viewer.Camera.AttachedCar)?.TrackSoundPassThruPercent != -1)
volume *= ((MSTSWagon)SoundSource.Viewer.Camera.AttachedCar).TrackSoundPassThruPercent * 0.01f;
}

ALSoundSource.Volume = volume;
Expand Down

0 comments on commit 9cc2394

Please sign in to comment.