Skip to content

Commit

Permalink
Apply default audio to MIDIs
Browse files Browse the repository at this point in the history
At least gives it a MaxDistance and such.
  • Loading branch information
metalgearsloth committed Nov 28, 2023
1 parent 777ab85 commit 59bb28e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Robust.Client/Audio/AudioManager.Public.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ internal void RemoveBufferedAudioSource(int handle)

var audioSource = new AudioSource(this, source, stream);
_audioSources.Add(source, new WeakReference<BaseAudioSource>(audioSource));
ApplyDefaultParams(audioSource);
return audioSource;
}

Expand All @@ -288,9 +289,18 @@ public IBufferedAudioSource CreateBufferedAudioSource(int buffers, bool floatAud

var audioSource = new BufferedAudioSource(this, source, AL.GenBuffers(buffers), floatAudio);
_bufferedAudioSources.Add(source, new WeakReference<BufferedAudioSource>(audioSource));
ApplyDefaultParams(audioSource);
return audioSource;
}

private void ApplyDefaultParams(IAudioSource source)
{
source.MaxDistance = AudioParams.Default.MaxDistance;
source.Pitch = AudioParams.Default.Pitch;
source.ReferenceDistance = AudioParams.Default.ReferenceDistance;
source.RolloffFactor = AudioParams.Default.RolloffFactor;
}

/// <inheritdoc />
public void StopAllAudio()
{
Expand Down

0 comments on commit 59bb28e

Please sign in to comment.