Delphi with Multimedia library Bass.dll play MP3 [1]

Source: Internet
Author: User

Recently to write a small program, used to MP3 playback; Because of the need for very complex control and function, think of Bass.dll.

I used to think Bass.dll was a library of Windows, and then I knew it was a third party: http://www.un4seen.com/.

Bass.dll has been updated, now the latest version is 2.411, download address: Http://us2.un4seen.com/files/bass24.zip

Before use in Delphi, there are three steps to be done:

1, copy Bass.dll to the system can identify the folder, such as: Windows\System32, Windows, Windows\System, can also be the system or user's environment variable Path designated any directory, but also in the program when the current directory, It's OK to put a folder in the program and then specify the path in it.

2, for Delphi write the header file Bass.pas in a directory (for example: C:\Program Files\codegear\rad studio\6.0\imports\bass24).

3, then from Delphi menu-> Tools-> Options-> library-win32-> Library path-> then Add this directory (example).

Well, write a few tests: unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;
type
  TForm1 = class(TForm)
   procedure FormCreate(Sender: TObject);
  end;
var
  Form1: TForm1;
implementation
{$R *.dfm}
uses Bass;
procedure TForm1.FormCreate(Sender: TObject);
begin
  ShowMessageFmt('%x', [BASSVERSION]);   {204}
  ShowMessageFmt('%x', [BASS_GetVersion]); {2040101}
  if HiWord(BASS_GetVersion) <> BASSVERSION then
   ShowMessage('当前 Bass.dll 版本不可用')
  else
   ShowMessage('OK!');
end;
end.
Program Description:

Before using the Bass, it is generally necessary to verify the version (because different versions feature a difference);

The Bass_getversion function can get the version number of the Bass.dll in the system, which is: $2040101 (hexadecimal number);

Bassversion is a constant in Bass.pas, representing the version of the Bass.pas file, here is $204;

As long as the major version number (for example, 2.4) is unified, we can use the HiWord function to

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.