Recently I want to write a small Program MP3 playback is used. Because of the complicated control and functions, I think of Bass. dll.
Previously I thought that bass. dll is the Windows system comes with the library, and later I know that the original is a third-party: http://www.un4seen.com /.
Bass. dll has been updated, and the latest version is 2.411,: http://us2.un4seen.com/files/bass24.zip
There are three steps to do before using in Delphi:
1. Copy bass. DLL to a folder that can be recognized by the system, such as Windows \ system32, windows, WINDOWS \ SYSTEM, or any directory specified by the system or user's environment variable path, you can also put it in the current directory during Program Creation, put a folder and specify a path in the program.
2. Place the header file bass. PAS for Delphi in a directory (for example, c: \ Program Files \ codegear \ rad studio \ 6.0 \ imports \ bass24 ).
3, and then from the Delphi menu-> Tools-> options-> Library-Win32-> library path-> and then add this directory (example ).
Okay. Write a few tests:
Unit unit1; interfaceuses 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 ('current bass. dll version disusable ') else showmessage (' OK! '); End.
Program description:
Before using bass, you generally need to verify the version (because different versions have different functions );
The bass_getversion function can obtain the version number of Bass. dll in the system. Here is: $2040101 (hexadecimal number );
Bassversion is a constant in bass. Pas, indicating the version of the Bass. Pas file. Here it is $204;
As long as the main version number (such as 2.4) is consistent, we can use the hiword function from
In the returned values of the bass_getversion function, the major version number is compared with the bassversion number.
Let's take a look at the functions provided by bass for us:
Bytes