Advertisement
Edison007

Play music with bass v2.4.xx

May 17th, 2012
675
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [Setup]
  2. AppName=Play music with bass
  3. AppVerName=Play music with bass v2.4.xx
  4. DefaultDirName={pf}\My Program
  5. DefaultGroupName=My Program
  6.  
  7. [Languages]
  8. Name: "rus"; MessagesFile: "compiler:Languages\Russian.isl"
  9.  
  10. [Files]
  11. Source: "BASS.dll"; DestDir: "{tmp}"; Flags: dontcopy noencryption nocompression
  12. Source: "sound.mp3"; DestDir: "{tmp}"; Flags: dontcopy noencryption nocompression
  13.  
  14. [Icons]
  15. Name: "{group}\Unistall;"; IconFilename: "{app}\unins000.exe"; Filename: "{app}\unins000.exe"
  16.  
  17. [Code]
  18. const
  19.   BASS_SAMPLE_LOOP = 4;
  20.  
  21. var
  22.   mp3Handle: HWND;
  23.   mp3Name: String;
  24.  
  25. function BASS_Init(device: Integer; freq, flags: DWORD; win: hwnd; CLSID: Integer): Boolean; external 'BASS_Init@files:BASS.dll stdcall delayload';
  26. function BASS_StreamCreateFile(mem: BOOL; f: PAnsiChar; offset1: DWORD; offset2: DWORD; length1: DWORD; length2: DWORD; flags: DWORD): DWORD; external 'BASS_StreamCreateFile@files:BASS.dll stdcall delayload';
  27. function BASS_Start: Boolean; external 'BASS_Start@files:BASS.dll stdcall delayload';
  28. function BASS_ChannelPlay(handle: DWORD; restart: BOOL): Boolean; external 'BASS_ChannelPlay@files:BASS.dll stdcall delayload';
  29. function BASS_Stop: Boolean; external 'BASS_Stop@files:BASS.dll stdcall delayload';
  30. function BASS_Free: Boolean; external 'BASS_Free@files:BASS.dll stdcall delayload';
  31.  
  32. function InitializeSetup(): Boolean;
  33. begin
  34.   ExtractTemporaryFile('BASS.dll');
  35.   ExtractTemporaryFile('sound.mp3');
  36.   mp3Name := ExpandConstant('{tmp}\sound.mp3');
  37.   BASS_Init(-1, 44100, 0, 0, 0);
  38.   mp3Handle := BASS_StreamCreateFile(FALSE, PAnsiChar(mp3Name), 0, 0, 0, 0, BASS_SAMPLE_LOOP);
  39.   BASS_Start();
  40.   BASS_ChannelPlay(mp3Handle, False);
  41.   Result := True;
  42. end;
  43.  
  44. procedure DeinitializeSetup();
  45. begin
  46.   BASS_Stop();
  47.   BASS_Free();
  48. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement