bool EffectCompressor::InitPass1() { mMax=0.0; if (!mNormalize) DisableSecondPass(); // Find the maximum block length required for any track size_t maxlen = 0; SelectedTrackListOfKindIterator iter(Track::Wave, mTracks); WaveTrack *track = (WaveTrack *) iter.First(); while (track) { maxlen = std::max(maxlen, track->GetMaxBlockSize()); //Iterate to the next track track = (WaveTrack *) iter.Next(); } if(mFollow1!=NULL) { delete[] mFollow1; mFollow1 = NULL; } if(mFollow2!=NULL) { delete[] mFollow2; mFollow2 = NULL; } // Allocate buffers for the envelope if(maxlen > 0) { mFollow1 = new float[maxlen]; mFollow2 = new float[maxlen]; } mFollowLen = maxlen; return true; }
bool EffectBassTreble::InitPass1() { mMax=0.0; // Integer format tracks require headroom to avoid clipping // when saved between passes (bug 619) if (mbNormalize) // don't need to calculate this if only doing one pass. { // Up to (gain + 6dB) headroom required for treble boost (experimental). mPreGain = (dB_treble > 0)? (dB_treble + 6.0) : 0.0; if (dB_bass >= 0) { mPreGain = (mPreGain > dB_bass)? mPreGain : dB_bass; } else { // Up to 6 dB headroom reaquired for bass cut (experimental) mPreGain = (mPreGain > 6.0)? mPreGain : 6.0; } mPreGain = (exp (log(10.0) * mPreGain / 20)); // to linear } else { mPreGain = 1.0; // Unity gain } if (!mbNormalize) DisableSecondPass(); return true; }
bool EffectCompressor::InitPass1() { mMax=0.0; if (!mNormalize) DisableSecondPass(); // Find the maximum block length required for any track size_t maxlen = 0; SelectedTrackListOfKindIterator iter(Track::Wave, inputTracks()); WaveTrack *track = (WaveTrack *) iter.First(); while (track) { maxlen = std::max(maxlen, track->GetMaxBlockSize()); //Iterate to the next track track = (WaveTrack *) iter.Next(); } mFollow1.reset(); mFollow2.reset(); // Allocate buffers for the envelope if(maxlen > 0) { mFollow1.reinit(maxlen); mFollow2.reinit(maxlen); } mFollowLen = maxlen; return true; }