program Project1; //
{$mode objfpc} {$H+}
uses
bass, FileCtrl, StdCtrls, Graphics, Controls, Classes, SysUtils, LResources, Forms, Dialogs,
Interfaces;
var
EC : integer; H : HSTREAM; Info : BASS_CHANNELINFO; FloatLen : double;
L_Bytes : QWORD; // length in bytes
L_Seconds : double; // length in seconds
FBitrate : single; //
begin
// File size is 2469 KB = 2,528,256 Bytes = 20,226,048 bits
H := BASS_StreamCreateFile(FALSE, pchar(Utf8Encode('BAILE MINHA MADEIRA.mp3')), 0, 0, BASS_STREAM_DECODE);
//
writeln('H = ', H); // Output: zero
BASS_ChannelGetAttribute(H,BASS_ATTRIB_BITRATE, FBitrate); //
writeln('The bit rate is = ', FBitrate); // Output: 0.000000000E+00
if (H <> 0) then // when H is equal to zero the stream is not opened
begin
L_Bytes := BASS_ChannelGetLength(H, BASS_POS_BYTE); // length in bytes
writeln(L_Bytes); // -1
L_Seconds := BASS_ChannelBytes2Seconds(H, L_Bytes); // convert bytes to seconds
writeln('True, number of seconds = ', L_Seconds); // Output -1
EC := BASS_ErrorGetCode(); write('Error Code = ', EC); // Output
end
else
begin
writeln('False = H is ', H); // False = H is 0
EC := BASS_ErrorGetCode(); writeln('Error Code = ', EC);
writeln(); writeln(); //
end;
BASS_StreamFree(H); // close the stream and free the resources {**}
readln();
end.