Esempio n. 1
0
        public TrackGain(int sampleRate, int sampleSize)
        {
            if (!ReplayGain.IsSupportedFormat(sampleRate, sampleSize))
            {
                throw new NotSupportedException("Unsupported format. Supported sample sizes are 16, 24.");
            }

            this.freqIndex = ReplayGain.FreqInfos.IndexOf(i => i.SampleRate == sampleRate);

            this.sampleSize = sampleSize;
            this.gainData   = new GainData();

            this.lInPreBuf = new double[ReplayGain.MAX_ORDER * 2];
            this.lStepBuf  = new double[ReplayGain.MAX_SAMPLES_PER_WINDOW + ReplayGain.MAX_ORDER];
            this.lOutBuf   = new double[ReplayGain.MAX_SAMPLES_PER_WINDOW + ReplayGain.MAX_ORDER];
            this.rInPreBuf = new double[ReplayGain.MAX_ORDER * 2];
            this.rStepBuf  = new double[ReplayGain.MAX_SAMPLES_PER_WINDOW + ReplayGain.MAX_ORDER];
            this.rOutBuf   = new double[ReplayGain.MAX_SAMPLES_PER_WINDOW + ReplayGain.MAX_ORDER];

            this.sampleWindow = (int)Math.Ceiling(sampleRate * ReplayGain.RMS_WINDOW_TIME);

            this.lInPre = new CPtr <double>(lInPreBuf, ReplayGain.MAX_ORDER);
            this.lStep  = new CPtr <double>(lStepBuf, ReplayGain.MAX_ORDER);
            this.lOut   = new CPtr <double>(lOutBuf, ReplayGain.MAX_ORDER);
            this.rInPre = new CPtr <double>(rInPreBuf, ReplayGain.MAX_ORDER);
            this.rStep  = new CPtr <double>(rStepBuf, ReplayGain.MAX_ORDER);
            this.rOut   = new CPtr <double>(rOutBuf, ReplayGain.MAX_ORDER);
        }
Esempio n. 2
0
 /// <summary>
 /// Returns the normalization gain for the track in decibels.
 /// </summary>
 public double GetGain()
 {
     return(ReplayGain.AnalyzeResult(this.gainData.Accum));
 }