mirror of
https://github.com/par274/sharpemu.git
synced 2026-07-26 04:39:17 +08:00
79a7437cd8
* [GUI] Added Atrac9 audio decoder and improved GUI with audio preview and controller support * fix: package.lock.json for SharpEmu.CLI to match the other projects * fix: packages.lock.json file to include new dependencies for GUI improvements * rollForward: "disable"
35 lines
1.0 KiB
C#
35 lines
1.0 KiB
C#
#nullable disable
|
|
namespace LibAtrac9
|
|
{
|
|
internal static class Stereo
|
|
{
|
|
public static void ApplyIntensityStereo(Block block)
|
|
{
|
|
if (block.BlockType != BlockType.Stereo) return;
|
|
|
|
int totalUnits = block.QuantizationUnitCount;
|
|
int stereoUnits = block.StereoQuantizationUnit;
|
|
if (stereoUnits >= totalUnits) return;
|
|
|
|
Channel source = block.PrimaryChannel;
|
|
Channel dest = block.SecondaryChannel;
|
|
|
|
for (int i = stereoUnits; i < totalUnits; i++)
|
|
{
|
|
int sign = block.JointStereoSigns[i];
|
|
for (int sb = Tables.QuantUnitToCoeffIndex[i]; sb < Tables.QuantUnitToCoeffIndex[i + 1]; sb++)
|
|
{
|
|
if (sign > 0)
|
|
{
|
|
dest.Spectra[sb] = -source.Spectra[sb];
|
|
}
|
|
else
|
|
{
|
|
dest.Spectra[sb] = source.Spectra[sb];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|