public EnvelopeLookup(PsyGlobal psyGlobal, VorbisInfo info) { _psyGlobal = psyGlobal; var codecSetup = info.CodecSetup; _minEnergy = codecSetup.PsyGlobalParam.PreEchoMinEnergy; _cursor = codecSetup.BlockSizes[1] / 2; _mdctWindow = new float[WindowLength]; _mdctLookup = new MdctLookup(WindowLength); for (var i = 0; i < _mdctWindow.Length; i++) { _mdctWindow[i] = (float)Math.Sin(i / (WindowLength - 1.0) * Math.PI); _mdctWindow[i] *= _mdctWindow[i]; } _bands = new EnvelopeBand[PsyGlobal.EnvelopeBands]; // Magic follows _bands[0] = new EnvelopeBand(2, 4); _bands[1] = new EnvelopeBand(4, 5); _bands[2] = new EnvelopeBand(6, 6); _bands[3] = new EnvelopeBand(9, 8); _bands[4] = new EnvelopeBand(13, 8); _bands[5] = new EnvelopeBand(17, 8); _bands[6] = new EnvelopeBand(22, 8); _filters = Enumerable .Range(0, PsyGlobal.EnvelopeBands * info.Channels) .Select(s => new EnvelopeFilterState()) .ToArray(); _mark = new int[WindowLength]; }
public PsyGlobalLookup(PsyGlobal global) { _psyGlobal = global; AmpMax = NegativeInfinite; }