Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 
#1

Equalizer mit Bass will nicht..

  Alt 19. Nov 2008, 05:42
Hab ja schon viel mit Bass gemacht aber der EQ will einfach nicht.

Delphi-Quellcode:
type
  BASS_FXPARAMEQ = record
    fCenter: FLOAT;
    fBandwidth: FLOAT;
    fGain: FLOAT;
  end;

  TBand = Record
    par: BASS_FXPARAMEQ;
    hnd: HFX;
  end;
BassInit
Delphi-Quellcode:
function BassInit: BOOL;
begin

  if gnBassInitDone = False then
  begin
    BASS_SetConfig(BASS_CONFIG_FLOATDSP, 1);
    gnBassInitDone := BASS_Init(1, 44100, 0, MainWindow(0), nil);

    if not BASS_RecordInit(0) then
    begin
      BASS_RecordFree;
      BASS_Free();
      halt;
    end;

    BASS_GetInfo(BassInfoParam);
    if BassInfoParam.dsver >= 8 then
      FDX8EffectReady := true;
  end;

  Result := gnBassInitDone;

end;
Taste ONOFF
Delphi-Quellcode:
 
         ID_ONOFF:
          begin
            if not EQenable then
              SetupEqualizer
            else
            BassResetEQ(gnAudioChannel);
Delphi-Quellcode:
procedure SetupEqualizer;
var
  K: Integer;
  nChecked: Boolean;
begin
  With SkinEngine do
  begin
    nChecked := GetCheckButtonStatus(GetMainItem(ID_ONOFF));
    for K := low(EQBand) to high(EQBand) do
      BassInitEQ(gnAudioChannel, K,
        GetTrackValue(GetMainItem(K + ID_EQU_FIRST)), integer(nChecked));
  end;
end;
Delphi-Quellcode:
procedure BassInitEQ(UseChannel: HSTREAM; Item: Integer; Percent: float;
  Checked:Integer);
begin

  if not FDX8EffectReady then
    exit;

  if UseChannel <> 0 then
  begin
    if Checked = 0 then
    begin
      if EQBand[Item].hnd <> 0 then
      begin
        BASS_ChannelRemoveFX(UseChannel, EQBand[Item].hnd);
        EQBand[Item].hnd := 0;
      end else
      begin
          EQBand[Item].hnd := BASS_ChannelSetFX(UseChannel, BASS_FX_DX8_PARAMEQ, 1);
          EQBand[Item].par.fBandwidth := 18;
          EQBand[Item].par.fCenter := Float(PAnsiChar(ParseThis('80,170,310,600,1000,3000,6000,10000,12000,14000', ',' ,Item, 1)));
          EQBand[Item].par.fGain := 0;

          BASS_FXSetParameters(EQBand[Item].hnd, @EQBand[Item].par);
      end;
    end;
  end;
  EQenable := True;

end;
Delphi-Quellcode:
procedure BassResetEQ(UseChannel: HSTREAM);
var
  i: integer;
begin
  if not FDX8EffectReady then
    exit;
  
  for i := low(EQBand) to high(EQBand) do
  begin
    BASS_ChannelRemoveFX(UseChannel, EQBand[i].hnd);
  end;

  EQEnable := False;

end;
Delphi-Quellcode:
procedure BassUpdateEQ(UseChannel: HSTREAM; Item: Integer; Percent: Integer;
  Checked:Integer);
var
  gain: Integer;
  i: Integer;
begin
  if not FDX8EffectReady then
    exit;

  gain := trunc(Percent / 3.3333) - 15;

  for i := low(EQBand) to high(EQBand) do
    if i <> Item then
      EQBand[Item].par.fgain := 0;

  if UseChannel <> 0 then
  begin
    BASS_FXGetParameters(EQBand[Item-1].hnd, @EQBand[Item-1].par);
    EQBand[Item-1].par.fgain := gain;
    BASS_FXSetParameters(EQBand[Item-1].hnd, @EQBand[Item-1].par);
  end;

end;
Maximale Value = 100
umgerechnet auf MinValue -15, MaxValue 15
gain := trunc(Percent / 3.3333) - 15;

kann machen was ich will der Ton ändert sich nicht.
Woran kann das liegen ?
Sieht jemand einen Fehler ?

Also Musik läuft

gruss Emil
Miniaturansicht angehängter Grafiken
hmm_212.jpg  
  Mit Zitat antworten Zitat