diff --git a/CUEPlayer/Output.cs b/CUEPlayer/Output.cs index 081a0f6..6c87bda 100644 --- a/CUEPlayer/Output.cs +++ b/CUEPlayer/Output.cs @@ -1,17 +1,11 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; using System.Diagnostics; -using NAudio.CoreAudioApi; +using System.Windows.Forms; using CUETools.Codecs; using CUETools.Codecs.CoreAudio; -using CUETools.DSP.Resampler; using CUETools.DSP.Mixer; -using CUETools.Processor; +using CUETools.DSP.Resampler; +using NAudio.CoreAudioApi; namespace CUEPlayer { @@ -80,10 +74,10 @@ namespace CUEPlayer { _player = new WasapiOut(_device, NAudio.CoreAudioApi.AudioClientShareMode.Shared, true, delay, new AudioPCMConfig(32, 2, 48000)); SOXResamplerConfig cfg; - cfg.quality = SOXResamplerQuality.Very; - cfg.phase = 50; - cfg.allow_aliasing = false; - cfg.bandwidth = 0; + cfg.Quality = SOXResamplerQuality.Very; + cfg.Phase = 50; + cfg.AllowAliasing = false; + cfg.Bandwidth = 0; _resampler = new SOXResampler(parent.Mixer.PCM, _player.PCM, cfg); resampled = new AudioBuffer(_player.PCM, parent.Mixer.BufferSize * 2 * parent.Mixer.PCM.SampleRate / _player.PCM.SampleRate); } diff --git a/CUETools.DSP.Resampler/SOXResampler.cs b/CUETools.DSP.Resampler/SOXResampler.cs index 6c8eb2e..f08b789 100644 --- a/CUETools.DSP.Resampler/SOXResampler.cs +++ b/CUETools.DSP.Resampler/SOXResampler.cs @@ -21,7 +21,7 @@ namespace CUETools.DSP.Resampler if (inputPCM.ChannelCount != outputPCM.ChannelCount) throw new NotSupportedException(); - if (outputPCM.SampleRate == inputPCM.SampleRate * 4 && config.quality >= SOXResamplerQuality.Medium) + if (outputPCM.SampleRate == inputPCM.SampleRate * 4 && config.Quality >= SOXResamplerQuality.Medium) { this.rate = new rate_t[inputPCM.ChannelCount]; this.shared = new rate_shared_t(); @@ -31,9 +31,9 @@ namespace CUETools.DSP.Resampler for (int i = 0; i < inputPCM.ChannelCount; i++) { rateUp2[i] = new rate_t(inputPCM.SampleRate, inputPCM.SampleRate * 2, sharedUp2, 0.5, - config.quality, -1, config.phase, config.bandwidth, config.allow_aliasing); + config.Quality, -1, config.Phase, config.Bandwidth, config.AllowAliasing); rate[i] = new rate_t(inputPCM.SampleRate * 2, inputPCM.SampleRate * 4, shared, 0.5, - config.quality, -1, 50, 90, true); + config.Quality, -1, 50, 90, true); } } else @@ -44,7 +44,7 @@ namespace CUETools.DSP.Resampler for (int i = 0; i < inputPCM.ChannelCount; i++) { rate[i] = new rate_t(inputPCM.SampleRate, outputPCM.SampleRate, shared, (double)inputPCM.SampleRate / outputPCM.SampleRate, - config.quality, -1, config.phase, config.bandwidth, config.allow_aliasing); + config.Quality, -1, config.Phase, config.Bandwidth, config.AllowAliasing); } } } diff --git a/CUETools.DSP.Resampler/SOXResamplerConfig.cs b/CUETools.DSP.Resampler/SOXResamplerConfig.cs index d605382..89bb3e6 100644 --- a/CUETools.DSP.Resampler/SOXResamplerConfig.cs +++ b/CUETools.DSP.Resampler/SOXResamplerConfig.cs @@ -2,10 +2,10 @@ { public struct SOXResamplerConfig { - public double phase; - public double bandwidth; - public bool allow_aliasing; - public SOXResamplerQuality quality; + public double Phase; + public double Bandwidth; + public bool AllowAliasing; + public SOXResamplerQuality Quality; /*double coef_interp; -- interpolation...*/ } } diff --git a/CUETools/CUETools.TestCodecs/SOXResamplerTest.cs b/CUETools/CUETools.TestCodecs/SOXResamplerTest.cs index 27ec106..a715443 100644 --- a/CUETools/CUETools.TestCodecs/SOXResamplerTest.cs +++ b/CUETools/CUETools.TestCodecs/SOXResamplerTest.cs @@ -1,12 +1,10 @@ -using CUETools.DSP.Resampler; -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; using CUETools.Codecs; -using System; +using CUETools.DSP.Resampler; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace CUETools.TestCodecs { - - /// ///This is a test class for SOXResamplerTest and is intended ///to contain all SOXResamplerTest Unit Tests @@ -14,8 +12,6 @@ namespace CUETools.TestCodecs [TestClass()] public class SOXResamplerTest { - - private TestContext testContextInstance; /// @@ -74,10 +70,10 @@ namespace CUETools.TestCodecs AudioPCMConfig inputPCM = new AudioPCMConfig(32, 1, 44100); AudioPCMConfig outputPCM = new AudioPCMConfig(32, 1, 48000); SOXResamplerConfig cfg; - cfg.quality = SOXResamplerQuality.Very; - cfg.phase = 50; - cfg.allow_aliasing = false; - cfg.bandwidth = 0; + cfg.Quality = SOXResamplerQuality.Very; + cfg.Phase = 50; + cfg.AllowAliasing = false; + cfg.Bandwidth = 0; SOXResampler resampler = new SOXResampler(inputPCM, outputPCM, cfg); AudioBuffer src = new AudioBuffer(inputPCM, 400 * inputPCM.SampleRate / 1000); AudioBuffer dst = new AudioBuffer(outputPCM, src.Size * 3);