Skip to content

Commit 16cf00c

Browse files
committed
Don't calculate positioning for interior sounds, clean up unsused data
1 parent 52d5886 commit 16cf00c

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

Source/RunActivity/Viewer3D/ALSoundHelper.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -650,9 +650,6 @@ public void InitPosition()
650650
{
651651
OpenAL.alSourcei(SoundSourceID, OpenAL.AL_SOURCE_RELATIVE, OpenAL.AL_FALSE);
652652
OpenAL.alSourcef(SoundSourceID, OpenAL.AL_DOPPLER_FACTOR, 1);
653-
654-
if (Car != null && !Car.SoundSourceIDs.Contains(SoundSourceID))
655-
Car.SoundSourceIDs.Add(SoundSourceID);
656653
}
657654
}
658655

@@ -676,9 +673,6 @@ public void HardDeactivate()
676673
{
677674
if (SoundSourceID != -1)
678675
{
679-
if (Car != null)
680-
Car.SoundSourceIDs.Remove(SoundSourceID);
681-
682676
Stop();
683677
OpenAL.alDeleteSources(1, ref SoundSourceID);
684678
SoundSourceID = -1;

Source/RunActivity/Viewer3D/RollingStock/TrainCarViewer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ internal virtual void LoadForPlayer() { }
6464

6565
public void UpdateSoundPosition()
6666
{
67-
if (Car.SoundSourceIDs.Count == 0 || Viewer.Camera == null)
67+
if (Viewer.Camera == null)
6868
return;
6969

7070
if (Car.Train != null)

Source/RunActivity/Viewer3D/Sound.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,8 +1040,8 @@ public override bool Update()
10401040
{
10411041
foreach (SoundStream stream in SoundStreams)
10421042
{
1043-
// For train cars, calculate the position and velocity of the sound
1044-
if (CarViewer != null)
1043+
// For train cars, calculate the position and velocity of exterior sounds
1044+
if (CarViewer != null && !Ignore3D)
10451045
{
10461046
// Convert position offset into train-car space offset
10471047
Vector3 pos = stream.MSTSStream.Position;
@@ -1060,7 +1060,7 @@ public override bool Update()
10601060

10611061
stream.Update(position, CarViewer.Velocity);
10621062
}
1063-
else // Don't try to update position if CarViewer is missing
1063+
else // Interior sounds ignore 3D position, do not try to update 3D position
10641064
stream.Update();
10651065
needsFrequentUpdate |= stream.NeedsFrequentUpdate;
10661066
}

0 commit comments

Comments
 (0)