private void InitEq(ref int chHandle, float fGain = 0.0f) { if (_eqConfig == null) { _eqConfig = new EqConfig(); } // set peaking equalizer effect with no bands _fx = Bass.ChannelSetFX(chHandle, EffectType.PeakEQ, 0); // BASS_ChannelSetFX(chan, BASS_FX_BFX_PEAKEQ, 0); _eq.fGain = fGain; _eq.fQ = EqConstants.fQ; _eq.fBandwidth = EqConstants.fBandwidth; _eq.lChannel = FXChannelFlags.All; // create 1st band for bass _eq.lBand = 0; _eq.fCenter = EqConstants.fCenter_Bass; Bass.FXSetParameters(_fx, _handle.AddrOfPinnedObject()); // create 2nd band for mid _eq.lBand = 1; _eq.fCenter = EqConstants.fCenter_Mid; Bass.FXSetParameters(_fx, _handle.AddrOfPinnedObject()); // create 3rd band for treble _eq.lBand = 2; _eq.fCenter = EqConstants.fCenter_Treble; Bass.FXSetParameters(_fx, _handle.AddrOfPinnedObject()); UpdateFxConfiguration(_eqConfig); }
private void UpdateFxConfiguration(EqConfig eqConfig) { for (int band = 0; band < 3; ++band) { _eq.lBand = band; Bass.FXGetParameters(_fx, _handle.AddrOfPinnedObject()); _eq.fGain = eqConfig[band]; Bass.FXSetParameters(_fx, _handle.AddrOfPinnedObject()); } }