Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
df5be5812f | ||
|
bc392e55df | ||
|
fffc3ed193 |
@@ -228,7 +228,6 @@ namespace ARMeilleure.Instructions
|
|||||||
|
|
||||||
switch (context.Fpcr.GetRoundingMode())
|
switch (context.Fpcr.GetRoundingMode())
|
||||||
{
|
{
|
||||||
default:
|
|
||||||
case FPRoundingMode.ToNearest:
|
case FPRoundingMode.ToNearest:
|
||||||
roundUp = (error > 0.5d || (error == 0.5d && (intMant & 1u) == 1u));
|
roundUp = (error > 0.5d || (error == 0.5d && (intMant & 1u) == 1u));
|
||||||
overflowToInf = true;
|
overflowToInf = true;
|
||||||
@@ -248,6 +247,9 @@ namespace ARMeilleure.Instructions
|
|||||||
roundUp = false;
|
roundUp = false;
|
||||||
overflowToInf = false;
|
overflowToInf = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new ArgumentException($"Invalid rounding mode \"{context.Fpcr.GetRoundingMode()}\".");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (roundUp)
|
if (roundUp)
|
||||||
@@ -412,7 +414,6 @@ namespace ARMeilleure.Instructions
|
|||||||
|
|
||||||
switch (context.Fpcr.GetRoundingMode())
|
switch (context.Fpcr.GetRoundingMode())
|
||||||
{
|
{
|
||||||
default:
|
|
||||||
case FPRoundingMode.ToNearest:
|
case FPRoundingMode.ToNearest:
|
||||||
roundUp = (error > 0.5d || (error == 0.5d && (intMant & 1u) == 1u));
|
roundUp = (error > 0.5d || (error == 0.5d && (intMant & 1u) == 1u));
|
||||||
overflowToInf = true;
|
overflowToInf = true;
|
||||||
@@ -432,6 +433,9 @@ namespace ARMeilleure.Instructions
|
|||||||
roundUp = false;
|
roundUp = false;
|
||||||
overflowToInf = false;
|
overflowToInf = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new ArgumentException($"Invalid rounding mode \"{context.Fpcr.GetRoundingMode()}\".");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (roundUp)
|
if (roundUp)
|
||||||
@@ -585,7 +589,6 @@ namespace ARMeilleure.Instructions
|
|||||||
|
|
||||||
switch (context.Fpcr.GetRoundingMode())
|
switch (context.Fpcr.GetRoundingMode())
|
||||||
{
|
{
|
||||||
default:
|
|
||||||
case FPRoundingMode.ToNearest:
|
case FPRoundingMode.ToNearest:
|
||||||
roundUp = (error > 0.5d || (error == 0.5d && (intMant & 1u) == 1u));
|
roundUp = (error > 0.5d || (error == 0.5d && (intMant & 1u) == 1u));
|
||||||
overflowToInf = true;
|
overflowToInf = true;
|
||||||
@@ -605,6 +608,9 @@ namespace ARMeilleure.Instructions
|
|||||||
roundUp = false;
|
roundUp = false;
|
||||||
overflowToInf = false;
|
overflowToInf = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new ArgumentException($"Invalid rounding mode \"{context.Fpcr.GetRoundingMode()}\".");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (roundUp)
|
if (roundUp)
|
||||||
@@ -1433,11 +1439,24 @@ namespace ARMeilleure.Instructions
|
|||||||
|
|
||||||
switch (fpcr.GetRoundingMode())
|
switch (fpcr.GetRoundingMode())
|
||||||
{
|
{
|
||||||
|
case FPRoundingMode.ToNearest:
|
||||||
|
overflowToInf = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FPRoundingMode.TowardsPlusInfinity:
|
||||||
|
overflowToInf = !sign;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FPRoundingMode.TowardsMinusInfinity:
|
||||||
|
overflowToInf = sign;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FPRoundingMode.TowardsZero:
|
||||||
|
overflowToInf = false;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
case FPRoundingMode.ToNearest: overflowToInf = true; break;
|
throw new ArgumentException($"Invalid rounding mode \"{fpcr.GetRoundingMode()}\".");
|
||||||
case FPRoundingMode.TowardsPlusInfinity: overflowToInf = !sign; break;
|
|
||||||
case FPRoundingMode.TowardsMinusInfinity: overflowToInf = sign; break;
|
|
||||||
case FPRoundingMode.TowardsZero: overflowToInf = false; break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result = overflowToInf ? FPInfinity(sign) : FPMaxNormal(sign);
|
result = overflowToInf ? FPInfinity(sign) : FPMaxNormal(sign);
|
||||||
@@ -2845,11 +2864,24 @@ namespace ARMeilleure.Instructions
|
|||||||
|
|
||||||
switch (fpcr.GetRoundingMode())
|
switch (fpcr.GetRoundingMode())
|
||||||
{
|
{
|
||||||
|
case FPRoundingMode.ToNearest:
|
||||||
|
overflowToInf = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FPRoundingMode.TowardsPlusInfinity:
|
||||||
|
overflowToInf = !sign;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FPRoundingMode.TowardsMinusInfinity:
|
||||||
|
overflowToInf = sign;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FPRoundingMode.TowardsZero:
|
||||||
|
overflowToInf = false;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
case FPRoundingMode.ToNearest: overflowToInf = true; break;
|
throw new ArgumentException($"Invalid rounding mode \"{fpcr.GetRoundingMode()}\".");
|
||||||
case FPRoundingMode.TowardsPlusInfinity: overflowToInf = !sign; break;
|
|
||||||
case FPRoundingMode.TowardsMinusInfinity: overflowToInf = sign; break;
|
|
||||||
case FPRoundingMode.TowardsZero: overflowToInf = false; break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result = overflowToInf ? FPInfinity(sign) : FPMaxNormal(sign);
|
result = overflowToInf ? FPInfinity(sign) : FPMaxNormal(sign);
|
||||||
|
@@ -18,7 +18,7 @@ namespace Ryujinx.Audio.Backends.OpenAL
|
|||||||
private readonly ManualResetEvent _pauseEvent;
|
private readonly ManualResetEvent _pauseEvent;
|
||||||
private readonly ConcurrentDictionary<OpenALHardwareDeviceSession, byte> _sessions;
|
private readonly ConcurrentDictionary<OpenALHardwareDeviceSession, byte> _sessions;
|
||||||
private bool _stillRunning;
|
private bool _stillRunning;
|
||||||
private Thread _updaterThread;
|
private readonly Thread _updaterThread;
|
||||||
|
|
||||||
public OpenALHardwareDeviceDriver()
|
public OpenALHardwareDeviceDriver()
|
||||||
{
|
{
|
||||||
@@ -73,7 +73,7 @@ namespace Ryujinx.Audio.Backends.OpenAL
|
|||||||
throw new ArgumentException($"{channelCount}");
|
throw new ArgumentException($"{channelCount}");
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenALHardwareDeviceSession session = new OpenALHardwareDeviceSession(this, memoryManager, sampleFormat, sampleRate, channelCount, volume);
|
OpenALHardwareDeviceSession session = new(this, memoryManager, sampleFormat, sampleRate, channelCount, volume);
|
||||||
|
|
||||||
_sessions.TryAdd(session, 0);
|
_sessions.TryAdd(session, 0);
|
||||||
|
|
||||||
@@ -123,6 +123,7 @@ namespace Ryujinx.Audio.Backends.OpenAL
|
|||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
Dispose(true);
|
Dispose(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -10,11 +10,11 @@ namespace Ryujinx.Audio.Backends.OpenAL
|
|||||||
{
|
{
|
||||||
class OpenALHardwareDeviceSession : HardwareDeviceSessionOutputBase
|
class OpenALHardwareDeviceSession : HardwareDeviceSessionOutputBase
|
||||||
{
|
{
|
||||||
private OpenALHardwareDeviceDriver _driver;
|
private readonly OpenALHardwareDeviceDriver _driver;
|
||||||
private int _sourceId;
|
private readonly int _sourceId;
|
||||||
private ALFormat _targetFormat;
|
private readonly ALFormat _targetFormat;
|
||||||
private bool _isActive;
|
private bool _isActive;
|
||||||
private Queue<OpenALAudioBuffer> _queuedBuffers;
|
private readonly Queue<OpenALAudioBuffer> _queuedBuffers;
|
||||||
private ulong _playedSampleCount;
|
private ulong _playedSampleCount;
|
||||||
|
|
||||||
private readonly object _lock = new();
|
private readonly object _lock = new();
|
||||||
@@ -32,23 +32,17 @@ namespace Ryujinx.Audio.Backends.OpenAL
|
|||||||
|
|
||||||
private ALFormat GetALFormat()
|
private ALFormat GetALFormat()
|
||||||
{
|
{
|
||||||
switch (RequestedSampleFormat)
|
return RequestedSampleFormat switch
|
||||||
{
|
{
|
||||||
case SampleFormat.PcmInt16:
|
SampleFormat.PcmInt16 => RequestedChannelCount switch
|
||||||
switch (RequestedChannelCount)
|
|
||||||
{
|
{
|
||||||
case 1:
|
1 => ALFormat.Mono16,
|
||||||
return ALFormat.Mono16;
|
2 => ALFormat.Stereo16,
|
||||||
case 2:
|
6 => ALFormat.Multi51Chn16Ext,
|
||||||
return ALFormat.Stereo16;
|
_ => throw new NotImplementedException($"Unsupported channel config {RequestedChannelCount}"),
|
||||||
case 6:
|
},
|
||||||
return ALFormat.Multi51Chn16Ext;
|
_ => throw new NotImplementedException($"Unsupported sample format {RequestedSampleFormat}"),
|
||||||
default:
|
};
|
||||||
throw new NotImplementedException($"Unsupported channel config {RequestedChannelCount}");
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
throw new NotImplementedException($"Unsupported sample format {RequestedSampleFormat}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void PrepareToClose() { }
|
public override void PrepareToClose() { }
|
||||||
@@ -69,7 +63,7 @@ namespace Ryujinx.Audio.Backends.OpenAL
|
|||||||
{
|
{
|
||||||
lock (_lock)
|
lock (_lock)
|
||||||
{
|
{
|
||||||
OpenALAudioBuffer driverBuffer = new OpenALAudioBuffer
|
OpenALAudioBuffer driverBuffer = new()
|
||||||
{
|
{
|
||||||
DriverIdentifier = buffer.DataPointer,
|
DriverIdentifier = buffer.DataPointer,
|
||||||
BufferId = AL.GenBuffer(),
|
BufferId = AL.GenBuffer(),
|
||||||
|
@@ -164,7 +164,7 @@ namespace Ryujinx.Audio
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The default coefficients used for standard 5.1 surround to stereo downmixing.
|
/// The default coefficients used for standard 5.1 surround to stereo downmixing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static float[] DefaultSurroundToStereoCoefficients = new float[4]
|
public static readonly float[] DefaultSurroundToStereoCoefficients = new float[4]
|
||||||
{
|
{
|
||||||
1.0f,
|
1.0f,
|
||||||
0.707f,
|
0.707f,
|
||||||
|
Reference in New Issue
Block a user