unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Bass, ExtCtrls, StdCtrls, ComCtrls;
type
TForm1 =
class(TForm)
Timer1: TTimer;
ProgressBars_L: TProgressBar;
ProgressBars_R: TProgressBar;
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Play_Channel : DWORD;
implementation
{$R *.dfm}
Procedure PlayFile(Filename :
String);
begin
BASS_StreamFree(Play_Channel);
Play_Channel:= BASS_StreamCreateFile(false, PChar(Filename), 0, 0, BASS_STREAM_AUTOFREE) ;
BASS_ChannelPlay(Play_Channel l, true);
End;
Procedure Get_VULevel(
var L, R : Integer);
var VUCH : DWORD; L_VU, R_VU : integer;
begin
VUCH := BASS_ChannelGetLevel(Play_Channel);
//from 0 (silent) to 32768 (max)
L_VU := LOWORD(VUCH);
R_VU := HIWORD(VUCH);
if (BASS_ChannelIsActive(Play_Channel) = BASS_ACTIVE_PLAYING)
then
begin
L:= L_VU;
R:= R_VU;
end else
begin
L:= 0;
R:= 0;
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var L, R : integer;
begin
VULevel(L,R);
ProgressBars_L.Position:= R;
ProgressBars_R.Position := L;
end;
end.