BASS.NET API for the Un4seen BASS Audio LibraryBASS_BFX_PEAKEQ ClassBASS.NET API for the Un4seen BASS Audio Library
Used with BASS_ChannelSetFX(Int32, BASSFXType, Int32), BASS_FXSetParameters(Int32, Object) and BASS_FXGetParameters(Int32, Object) to retrieve and set the parameters of the DSP effect Peaking equalizer.
Inheritance Hierarchy

SystemObject
  Un4seen.Bass.AddOn.FxBASS_BFX_PEAKEQ

Namespace: Un4seen.Bass.AddOn.Fx
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.12.0
Syntax

[SerializableAttribute]
[StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public sealed class BASS_BFX_PEAKEQ

The BASS_BFX_PEAKEQ type exposes the following members.

Constructors

  NameDescription
Public methodBASS_BFX_PEAKEQ
Default constructor.
Public methodBASS_BFX_PEAKEQ(Int32, Single, Single, Single, Single)
Constructor already setting the members
Public methodBASS_BFX_PEAKEQ(Int32, Single, Single, Single, Single, BASSFXChan)
Constructor already setting the members
Top
Fields

  NameDescription
Public fieldfBandwidth
Bandwidth in octaves (0.1...4...n), Q is not in use (fBandwidth has priority over fQ). Default = 1 (0=not in use).

In most cases users should use the minimum of 0.5 octave.

The bandwidth in octaves (between -3 dB frequencies for BPF and notch or between midpoint (dBgain/2) gain frequencies for peaking EQ).

Public fieldfCenter
Center frequency in Hz (1Hz...nHz). Default = 1000 (max. is 1/2 of the samplerate).
Public fieldfGain
Gain in dB (-15...0...+15). Default 0dB.
Public fieldfQ
EE kinda definition of Q (0.1...1...n), if bandwidth is not in use. Default = 0.0 (0=not in use).
Public fieldlBand
Number of bands (0...n), more bands means more memory and cpu usage. Default = 0.
Public fieldlChannel
A BASSFXChan flag to define on which channels to apply the effect.

Default: -1 (BASS_BFX_CHANALL) - all channels.

Top
Examples

Setting up a multi-band EQ:
VB
Private _fxEQ As Integer
...
Dim stream As Integer = Bass.BASS_StreamCreateFile("test.mp3", 0L.ToUInt32(), 0L.ToUInt32(), BASSFlag.BASS_SAMPLE_FLOAT)
SetBFX_EQ(stream)
...
' increase the treble by +6bB
UpdateFX(2, 6F)
...

Private Sub SetBFX_EQ(channel As Integer)
  ' set peaking equalizer effect with no bands
  _fxEQ = Bass.BASS_ChannelSetFX(channel, BASSFXType.BASS_FX_BFX_PEAKEQ, 0)

  ' setup the EQ bands
  Dim eq As New BASS_BFX_PEAKEQ()
  eq.fQ = 0F
  eq.fBandwidth = 2.5F
  eq.lChannel = BASSFXChan.BASS_BFX_CHANALL

  ' create 1st band for bass
  eq.lBand = 0
  eq.fCenter = 125F
  Bass.BASS_FXSetParameters(_fxEQ, eq)
  UpdateFX(0, 0F)

  ' create 2nd band for mid
  eq.lBand = 1
  eq.fCenter = 1000F
  Bass.BASS_FXSetParameters(_fxEQ, eq)
  UpdateFX(1, 0F)

  ' create 3rd band for treble
  eq.lBand = 2
  eq.fCenter = 8000F
  Bass.BASS_FXSetParameters(_fxEQ, eq)
  UpdateFX(2, 0F)
End Sub

Private Sub UpdateFX(band As Integer, gain As Single)
  Dim eq As New BASS_BFX_PEAKEQ()
  ' get values of the selected band
  eq.lBand = band
  Bass.BASS_FXGetParameters(_fxEQ, eq)
  eq.fGain = gain
  Bass.BASS_FXSetParameters(_fxEQ, eq)
End Sub
private int _fxEQ;
...
int stream = Bass.BASS_StreamCreateFile("test.mp3", 0L, 0L, BASSFlag.BASS_SAMPLE_FLOAT);
SetBFX_EQ(stream);
...
// increase the treble by +6bB
UpdateFX(2, 6f);
...

private void SetBFX_EQ(int channel)
{
  // set peaking equalizer effect with no bands
  _fxEQ = Bass.BASS_ChannelSetFX(channel, BASSFXType.BASS_FX_BFX_PEAKEQ, 0);

  // setup the EQ bands
  BASS_BFX_PEAKEQ eq = new BASS_BFX_PEAKEQ();
  eq.fQ = 0f;
  eq.fBandwidth = 2.5f;
  eq.lChannel = BASSFXChan.BASS_BFX_CHANALL;

  // create 1st band for bass
  eq.lBand = 0;
  eq.fCenter = 125f;
  Bass.BASS_FXSetParameters(_fxEQ, eq);
  UpdateFX(0, 0f);

  // create 2nd band for mid
  eq.lBand = 1;
  eq.fCenter = 1000f;
  Bass.BASS_FXSetParameters(_fxEQ, eq);
  UpdateFX(1, 0f);

  // create 3rd band for treble
  eq.lBand = 2;
  eq.fCenter = 8000f;
  Bass.BASS_FXSetParameters(_fxEQ, eq);
  UpdateFX(2, 0f);
}

private void UpdateFX(int band, float gain)
{
  BASS_BFX_PEAKEQ eq = new BASS_BFX_PEAKEQ();
  // get values of the selected band
  eq.lBand = band;
  Bass.BASS_FXGetParameters(_fxEQ, eq);
  eq.fGain = gain;
  Bass.BASS_FXSetParameters(_fxEQ, eq);
}
See Also

Reference