Exemplo n.º 1
0
        public Resampler(ResamplingQuality quality, int channels, double sampleRateRatio)
        {
            Quality  = quality;
            Channels = channels;
            Ratio    = sampleRateRatio;

            QualityRecipe qr = QualityRecipe.SOXR_HQ;
            QualityFlags  qf = QualityFlags.SOXR_ROLLOFF_SMALL;

            switch (quality)
            {
            case ResamplingQuality.VeryLow:
                qr = QualityRecipe.SOXR_QQ; break;

            case ResamplingQuality.Low:
                qr = QualityRecipe.SOXR_LQ; break;

            case ResamplingQuality.Medium:
                qr = QualityRecipe.SOXR_MQ; break;

            case ResamplingQuality.High:
                qr = QualityRecipe.SOXR_HQ; break;

            case ResamplingQuality.VeryHigh:
                qr = QualityRecipe.SOXR_VHQ; break;

            case ResamplingQuality.VariableRate:
                qr = QualityRecipe.SOXR_HQ; qf = QualityFlags.SOXR_VR; break;
            }

            double inputRate  = 1;
            double outputRate = sampleRateRatio;

            if (qf == QualityFlags.SOXR_VR)
            {
                // set max variable rate
                inputRate  = 10.0;
                outputRate = 1.0;
            }

            _soxr = new SoxResampler(inputRate, outputRate, channels, qr, qf);
        }
Exemplo n.º 2
0
 public bool CheckRatio(double sampleRateRatio)
 {
     return(SoxResampler.CheckRatio(sampleRateRatio));
 }