Registriert seit: 22. Okt 2003
Ort: Berlin
661 Beiträge
Delphi 7 Enterprise
|
Was Sie hören und Equalizer
25. Jan 2007, 13:32
Wie könnte man folgendes Beispiel aus der Bassdll dahin gehend abändern, dass alles was man gerade hört, berücksichtigt wird.
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
p1: BASS_CHANNELINFO;
begin
If OpenDialog1.Execute then begin
// free both MOD and stream, it must be one of them! :)
BASS_MusicFree(chan);
BASS_StreamFree(chan);
chan := BASS_StreamCreateFile(FALSE, PChar(OpenDialog1.FileName), 0, 0, BASS_SAMPLE_FX or BASS_SAMPLE_LOOP);
if (chan = 0) then
chan := BASS_MusicLoad(FALSE, PChar(OpenDialog1.FileName), 0, 0, BASS_MUSIC_LOOP or BASS_MUSIC_RAMP or BASS_SAMPLE_FX,0);
if (chan = 0) then
begin
// not a WAV/MP3 or MOD
Button1.Caption := 'Can''t play the file! Please select another.';
Exit;
end;
if (p1.flags and BASS_SAMPLE_8BITS) > 0 then
begin
// not 16-bit stereo
Button1.Caption := '16-bit stereo sources only. Please select another.';
BASS_MusicFree(chan);
BASS_StreamFree(chan);
Exit;
end;
Button1.Caption := OpenDialog1.FileName;
fx[1] := BASS_ChannelSetFX(chan, BASS_FX_PARAMEQ, 1);
fx[2] := BASS_ChannelSetFX(chan, BASS_FX_PARAMEQ, 1);
fx[3] := BASS_ChannelSetFX(chan, BASS_FX_PARAMEQ, 1);
fx[4] := BASS_ChannelSetFX(chan, BASS_FX_REVERB, 1);
// Set equalizer to flat and reverb off to start
p.fGain := 0;
p.fBandwidth := 18;
p.fCenter := 125;
BASS_FXSetParameters(fx[1], @p);
p.fCenter := 1000;
BASS_FXSetParameters(fx[2], @p);
p.fCenter := 8000;
BASS_FXSetParameters(fx[3], @p);
BASS_FXGetParameters(fx[4], @pR);
pR.fReverbMix := -96;
pR.fReverbTime := 1200;
pR.fHighFreqRTRatio := 0.1;
BASS_FXSetParameters(fx[4], @pR);
// play both MOD and stream, it must be one of them! :)
BASS_ChannelPlay(chan, False);
end;
end;
procedure TForm1.TrackBar1Change(Sender: TObject);
begin
BASS_FXGetParameters(fx[1], @p);
p.fgain := 15-TrackBar1.position;
BASS_FXSetParameters(fx[1], @p);
end;
procedure TForm1.TrackBar2Change(Sender: TObject);
begin
BASS_FXGetParameters(fx[2], @p);
p.fgain := 15-TrackBar2.position;
BASS_FXSetParameters(fx[2], @p);
end;
procedure TForm1.TrackBar3Change(Sender: TObject);
begin
BASS_FXGetParameters(fx[3], @p);
p.fgain := 15-TrackBar3.position;
BASS_FXSetParameters(fx[3], @p);
end;
[edit=SirThornberry]Delphi-Tag korrigiert - Mfg, SirThornberry[/edit]
|
|
Zitat
|