v1.5.7.0 (Summer Update)
This commit is contained in:
@@ -137,22 +137,10 @@ namespace Barotrauma.Sounds
|
||||
{
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
outBuffer[i] = FloatToShort(inBuffer[i]);
|
||||
outBuffer[i] = ToolBox.FloatToShortAudioSample(inBuffer[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static protected short FloatToShort(float fVal)
|
||||
{
|
||||
int temp = (int)(32767 * fVal);
|
||||
if (temp > short.MaxValue) temp = short.MaxValue;
|
||||
else if (temp < short.MinValue) temp = short.MinValue;
|
||||
return (short)temp;
|
||||
}
|
||||
static protected float ShortToFloat(short shortVal)
|
||||
{
|
||||
return shortVal / 32767f;
|
||||
}
|
||||
|
||||
public abstract int FillStreamBuffer(int samplePos, short[] buffer);
|
||||
|
||||
public abstract float GetAmplitudeAtPlaybackPos(int playbackPos);
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace Barotrauma.Sounds
|
||||
float finalGain = gain * GameSettings.CurrentConfig.Audio.VoiceChatVolume * client.VoiceVolume;
|
||||
for (int i = 0; i < readSamples; i++)
|
||||
{
|
||||
float fVal = ShortToFloat(buffer[i]);
|
||||
float fVal = ToolBox.ShortAudioSampleToFloat(buffer[i]);
|
||||
|
||||
if (finalGain > 1.0f) //TODO: take distance into account?
|
||||
{
|
||||
@@ -128,7 +128,7 @@ namespace Barotrauma.Sounds
|
||||
fVal = Math.Clamp(filter.Process(fVal) * PostRadioFilterBoost, -1f, 1f);
|
||||
}
|
||||
}
|
||||
buffer[i] = FloatToShort(fVal);
|
||||
buffer[i] = ToolBox.FloatToShortAudioSample(fVal);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user