Beispiel #1
0
        private void InitEq(ref int chHandle, float fGain = 0.0f)
        {
            _eqConfig = new EqualizerConfig();

            // set peaking equalizer effect with no bands
            _fxHandle = Bass.ChannelSetFX(chHandle, EffectType.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(_fxHandle, _eqHandle.AddrOfPinnedObject());

            // create 2nd band for mid
            _eq.lBand   = 1;
            _eq.fCenter = EqConstants.fCenter_Mid;
            Bass.FXSetParameters(_fxHandle, _eqHandle.AddrOfPinnedObject());

            // create 3rd band for treble
            _eq.lBand   = 2;
            _eq.fCenter = EqConstants.fCenter_Treble;
            Bass.FXSetParameters(_fxHandle, _eqHandle.AddrOfPinnedObject());

            UpdateFxConfiguration(_eqConfig);
        }
Beispiel #2
0
        private void UpdateFxConfiguration(EqualizerConfig eqConfig)
        {
            int band = 0;

            foreach (double value in eqConfig)
            {
                _eq.lBand = band;
                Bass.FXGetParameters(_fxHandle, _eqHandle.AddrOfPinnedObject());
                _eq.fGain = (float)value;
                Bass.FXSetParameters(_fxHandle, _eqHandle.AddrOfPinnedObject());
                ++band;
            }
        }