From 38754ee9fc967288de4f908e5e23fe875d7d54bf Mon Sep 17 00:00:00 2001 From: VoidX Date: Sat, 9 Mar 2024 18:30:00 +0100 Subject: [PATCH] Code quality --- .../EnhancedAC3Body/AllocationConstants.cs | 27 +++++++++++++++++++ .../EnhancedAC3Body/AllocationParsing.cs | 27 ------------------- Cavern.QuickEQ/Equalization/EQGenerator.cs | 2 +- Cavern/Filters/PhaseSwappableBiquadFilter.cs | 2 +- .../CavernizeGUI/MainWindow.Exporting.cs | 1 - 5 files changed, 29 insertions(+), 30 deletions(-) diff --git a/Cavern.Format/Transcoders/EnhancedAC3Body/AllocationConstants.cs b/Cavern.Format/Transcoders/EnhancedAC3Body/AllocationConstants.cs index d1756303..be5d81e9 100644 --- a/Cavern.Format/Transcoders/EnhancedAC3Body/AllocationConstants.cs +++ b/Cavern.Format/Transcoders/EnhancedAC3Body/AllocationConstants.cs @@ -5,6 +5,33 @@ namespace Cavern.Format.Transcoders { partial class EnhancedAC3Body { partial class Allocation { + /// + /// Reference exponent for decoding others with offsets (absexp). + /// + public int absoluteExponent; + + /// + /// Grouped exponents read from the bitstream (gexp/exps). A 7-bit encoded exponent data contains 3 consecutive exponents. + /// + /// Handling of this array differs from the reference code, + /// the first element is extracted to . + public readonly int[] groupedExponents; + + /// + /// Fully decoded, final exponents, used for shifting mantissas to place (exp). + /// + public readonly int[] exponents; + + /// + /// Exponents mapped for power spectral density. + /// + public readonly int[] psd; + + /// + /// PSD summed for each masked band (bndpsd). + /// + public readonly int[] integratedPSD; + public readonly int[] excite; public readonly int[] mask; public readonly byte[] bap; diff --git a/Cavern.Format/Transcoders/EnhancedAC3Body/AllocationParsing.cs b/Cavern.Format/Transcoders/EnhancedAC3Body/AllocationParsing.cs index 9244de85..ef3c9e14 100644 --- a/Cavern.Format/Transcoders/EnhancedAC3Body/AllocationParsing.cs +++ b/Cavern.Format/Transcoders/EnhancedAC3Body/AllocationParsing.cs @@ -7,33 +7,6 @@ namespace Cavern.Format.Transcoders { partial class EnhancedAC3Body { // Convert bitstream data to allocation data partial class Allocation { - /// - /// Reference exponent for decoding others with offsets (absexp). - /// - public int absoluteExponent; - - /// - /// Grouped exponents read from the bitstream (gexp/exps). A 7-bit encoded exponent data contains 3 consecutive exponents. - /// - /// Handling of this array differs from the reference code, - /// the first element is extracted to . - public readonly int[] groupedExponents; - - /// - /// Fully decoded, final exponents, used for shifting mantissas to place (exp). - /// - public readonly int[] exponents; - - /// - /// Exponents mapped for power spectral density. - /// - public readonly int[] psd; - - /// - /// PSD summed for each masked band (bndpsd). - /// - public readonly int[] integratedPSD; - /// /// Read grouped full-range channel exponent data from the bitstream and decode it. /// diff --git a/Cavern.QuickEQ/Equalization/EQGenerator.cs b/Cavern.QuickEQ/Equalization/EQGenerator.cs index eba40d30..b1ea7fd6 100644 --- a/Cavern.QuickEQ/Equalization/EQGenerator.cs +++ b/Cavern.QuickEQ/Equalization/EQGenerator.cs @@ -205,7 +205,7 @@ public static Equalizer FromCalibration(float[] source) { public static Equalizer FromCalibration(string[] lines) { List bands = new List(); for (int line = 0; line < lines.Length; ++line) { - string[] nums = lines[line].Trim().Split(' ', '\t'); + string[] nums = lines[line].Trim().Split(new char[] { ' ', '\t' }); if (nums.Length > 1 && double.TryParse(nums[0].Replace(',', '.'), NumberStyles.Any, CultureInfo.InvariantCulture, out double freq) && double.TryParse(nums[1].Replace(',', '.'), NumberStyles.Any, CultureInfo.InvariantCulture, out double gain)) { diff --git a/Cavern/Filters/PhaseSwappableBiquadFilter.cs b/Cavern/Filters/PhaseSwappableBiquadFilter.cs index 22aaa019..1a19a2d5 100644 --- a/Cavern/Filters/PhaseSwappableBiquadFilter.cs +++ b/Cavern/Filters/PhaseSwappableBiquadFilter.cs @@ -17,7 +17,7 @@ public bool PhaseSwapped { /// /// State of phase swapping to be used when the filter is reset. /// - protected bool phaseSwapped = false; + protected bool phaseSwapped; /// protected PhaseSwappableBiquadFilter(int sampleRate, double centerFreq) : base(sampleRate, centerFreq) { } diff --git a/CavernSamples/CavernizeGUI/MainWindow.Exporting.cs b/CavernSamples/CavernizeGUI/MainWindow.Exporting.cs index 372367c5..a8abdd14 100644 --- a/CavernSamples/CavernizeGUI/MainWindow.Exporting.cs +++ b/CavernSamples/CavernizeGUI/MainWindow.Exporting.cs @@ -123,7 +123,6 @@ RenderStats WriteRender(Track target, AudioWriter writer, RenderTarget renderTar if (writer != null) { writeCache = new float[blockSize]; } - // TODO: override multichannel process for the fast convolution filter to prevent reallocation bool wasError = false; while (progressor.Rendered < target.Length) {