View Full Version : xbass.dll - Music plugin
BLACKFIRE69
03-10-2020, 15:54
XBass - Music plugin
TYPE 01:
type
TXBassCallback = procedure(Const FPct: Integer; Const FDuration, FPosition, FCurMusicFile: WideString);
type
IXBass = Interface(IUnknown)
'{3A515F05-FBAE-4D1E-80A0-808E6FAF3187}'
function FCreate(AHandle: HWND; AFilename: WideString; ASpeed: Single; RepeatOn: Boolean; ACallback: TXBassCallback): Boolean;
function FCreateList(AHandle: HWND; AFolder: WideString; ASpeed: Single; RepeatOn: Boolean; ACallback: TXBassCallback): Boolean;
procedure Play;
procedure Stop;
procedure Pause;
procedure Resume;
function IsPaused: Boolean;
procedure Next;
procedure Prev;
function ChangeDir(const AFolder: WideString): Boolean;
function ChangeFile(const AFilename: WideString): Boolean;
function GetPosition: WideString;
function GetDuration: WideString;
function GetPct: Integer;
function GetCurFile: WideString;
function GetVolume: Integer;
procedure SetVolume(Const Vol: Integer);
procedure SeekForward(Const Sec: Integer);
procedure SeekBackward(Const Sec: Integer);
procedure DoFree;
End;
function InitXBass: IXBass;
external 'InitXBass@files:xbass_f.dll stdcall';
function DeInitXBass: Boolean;
external 'DeInitXBass@files:xbass_f.dll stdcall';
TYPE 02:
type
TXBassCallback = procedure(Const FPct: Integer; Const FDuration, FPosition, FCurMusicFile: WideString);
function xbassCreate(AHandle: HWND; AFilename: WideString; ASpeed: Single; RepeatOn: Boolean; ACallback: TXBassCallback): Boolean;
function xbassCreateList(AHandle: HWND; AFolder: WideString; ASpeed: Single; RepeatOn: Boolean; ACallback: TXBassCallback): Boolean;
procedure xbassPlay;
procedure xbassStop;
procedure xbassPause;
procedure xbassResume;
function xbaseeIsPaused: Boolean;
procedure xbassNext;
procedure xbassPrev;
function xbassChangeDir(const AFolder: WideString): Boolean;
function xbassChangeFile(const AFilename: WideString): Boolean;
function xbassGetPosition: WideString;
function xbassGetDuration: WideString;
function xbassGetPct: Integer;
function xbassGetCurFile: WideString;
function xbassGetVolume: Integer;
procedure xbassSetVolume(Const Vol: Integer);
procedure xbassSeekForward(Const Sec: Integer);
procedure xbassSeekBackward(Const Sec: Integer);
procedure xbassFree;
BLACKFIRE69
04-10-2020, 04:08
xbass - New Update
What's New:
Some improvements.
Added new example.
_
Balaji007
22-10-2020, 04:59
Hi friend
It is a simple doubt. I am trying with your example script. But it was played the song one time only. How repeat the song? Any solutions are available
Hi friend
It is a simple doubt. I am trying with your example script. But it was played the song one time only. How repeat the song? Any solutions are available
It could be. So try the new version (v.2.0) of the xbass.dll. That's all you need.
(xbass.dll v2.0 requires "inno setup enhanced edition")
xbass.dll v2.0
function MusicOpenFile(handle: hwnd; title: widestring; defaultPath: widestring): widestring; external 'MusicOpenFile@files:xbass.dll stdcall';
procedure InitMusic(filename: widestring; RepeatOn: boolean); external 'InitMusic@files:xbass.dll stdcall';
procedure PlayMusic; external 'PlayMusic@files:xbass.dll stdcall';
procedure PauseMusic; external 'PauseMusic@files:xbass.dll stdcall';
procedure ResumeMusic; external 'ResumeMusic@files:xbass.dll stdcall';
procedure StopMusic; external 'StopMusic@files:xbass.dll stdcall';
procedure SetVolume(vol: integer); external 'SetVolume@files:xbass.dll stdcall';
function MusicPct: integer; external 'MusicPct@files:xbass.dll stdcall';
function MusicPosition: widestring; external 'MusicPosition@files:xbass.dll stdcall';
function MusicDuration: widestring; external 'MusicDuration@files:xbass.dll stdcall';
procedure DeInitMusic; external 'DeInitMusic@files:xbass.dll stdcall';
information:
xbass.dll v3.0
Features:
Audio plugins updated.
Supports "*.mp3, *.ogg, *.wav".
Supports seek forward and seek backward.
Added in built-in timer.
Tested in Inno setup 6.x.x Unicode.
function MusicOpenFile(handle: HWND; defaultPath: widestring): widestring;
function XSetTimer(handle: HWND; Interval: longword; lpTimerFunc: longword): Cardinal;
function XKillTimer(handle: HWND; TimerId: Cardinal): boolean;
function XWrap(Callback: TTimerProc; Paramcount: integer): longword;
procedure InitMusic(handle: HWND; filename: widestring; volume: integer; RepeatOn: boolean);
procedure MusicPlay;
procedure MusicPause;
procedure MusicResume;
procedure MusicStop;
procedure MusicSetVolume(vol: integer);
function MusicPct: integer;
function MusicPosition: widestring;
function MusicDuration: widestring;
procedure MusicForward(sec: integer);
procedure MusicBackward(sec: integer);
procedure DeInitMusic;
Details:
BLACKFIRE69
09-03-2023, 03:02
XBass Update Available!
TYPE 01:
type
TXBassCallback = procedure(Const FPct: Integer; Const FDuration, FPosition, FCurMusicFile: WideString);
type
IXBass = Interface(IUnknown)
'{3A515F05-FBAE-4D1E-80A0-808E6FAF3187}'
function FCreate(AHandle: HWND; AFilename: WideString; ASpeed: Single; RepeatOn: Boolean; ACallback: TXBassCallback): Boolean;
function FCreateList(AHandle: HWND; AFolder: WideString; ASpeed: Single; RepeatOn: Boolean; ACallback: TXBassCallback): Boolean;
procedure Play;
procedure Stop;
procedure Pause;
procedure Resume;
function IsPaused: Boolean;
procedure Next;
procedure Prev;
function ChangeDir(const AFolder: WideString): Boolean;
function ChangeFile(const AFilename: WideString): Boolean;
function GetPosition: WideString;
function GetDuration: WideString;
function GetPct: Integer;
function GetCurFile: WideString;
function GetVolume: Integer;
procedure SetVolume(Const Vol: Integer);
procedure SeekForward(Const Sec: Integer);
procedure SeekBackward(Const Sec: Integer);
procedure DoFree;
End;
function InitXBass: IXBass;
external 'InitXBass@files:xbass_f.dll stdcall';
function DeInitXBass: Boolean;
external 'DeInitXBass@files:xbass_f.dll stdcall';
TYPE 02:
type
TXBassCallback = procedure(Const FPct: Integer; Const FDuration, FPosition, FCurMusicFile: WideString);
function xbassCreate(AHandle: HWND; AFilename: WideString; ASpeed: Single; RepeatOn: Boolean; ACallback: TXBassCallback): Boolean;
function xbassCreateList(AHandle: HWND; AFolder: WideString; ASpeed: Single; RepeatOn: Boolean; ACallback: TXBassCallback): Boolean;
procedure xbassPlay;
procedure xbassStop;
procedure xbassPause;
procedure xbassResume;
function xbaseeIsPaused: Boolean;
procedure xbassNext;
procedure xbassPrev;
function xbassChangeDir(const AFolder: WideString): Boolean;
function xbassChangeFile(const AFilename: WideString): Boolean;
function xbassGetPosition: WideString;
function xbassGetDuration: WideString;
function xbassGetPct: Integer;
function xbassGetCurFile: WideString;
function xbassGetVolume: Integer;
procedure xbassSetVolume(Const Vol: Integer);
procedure xbassSeekForward(Const Sec: Integer);
procedure xbassSeekBackward(Const Sec: Integer);
procedure xbassFree;
Can someone share me an example as how to use .ogg files in IXBass which was supported after xBass.dll v3.0?
BLACKFIRE69
14-07-2024, 07:19
Can someone share me an example as how to use .ogg files in IXBass which was supported after xBass.dll v3.0?
it's nothing but you need to have decoders next to the 'XBass.dll'. In this case, they are 'ogg.dll' and 'vorbis*.dll'.
* What's new with this release:
1. Compiled in Delphi XE to reduce the file size.
- FileSize: 4.51 MB --> 497 KB (Saved: 90%)
2. Play through memory.
- Since this build, you can play files through memory, instead of having them on the hard drive.
- However, you need to use 'InnoSetup Enhanced Edition' or 'FXStream' to utilize this feature.
function xbassCreateFromMem(AHandle: HWND; const Buffer: PAnsiChar; const Count, BassType: Cardinal; ASpeed: Single; RepeatOn: Boolean; ACallback: TXBassCallback1): Boolean;
function xbassChangeMem(const Buffer: PAnsiChar; const Count: Cardinal): Boolean;
--------------------------------
type
IXBass = Interface(IUnknown)
'{3A515F05-FBAE-4D1E-80A0-808E6FAF3187}'
...
function FCreateFromMem(AHandle: HWND; const Buffer: PAnsiChar; const Count, BassType: Cardinal; ASpeed: Single; RepeatOn: Boolean; ACallback: TXBassCallback1): Boolean;
function ChangeMem(const Buffer: PAnsiChar; const Count: Cardinal): Boolean;
...
end;
* InnoSetup Enhanced Edition:
procedure InitializeWizard();
var
Buffer: AnsiString;
Count: Cardinal;
begin
//
Count := ExtractTemporaryFileSize('{#MusicFileOnly}');
SetLength(Buffer, Count);
ExtractTemporaryFileToBuffer('{#MusicFileOnly}', CastAnsiStringToInteger(Buffer));
//
ExtractTemporaryFile('ogg.dll');
ExtractTemporaryFile('vorbis.dll');
ExtractTemporaryFile('vorbisenc.dll');
ExtractTemporaryFile('vorbisfile.dll');
CreateOrChange;
PlayNextBtn.Enabled := False;
PlayPrevBtn.Enabled := False;
if not xbassCreateFromMem(WizardForm.Handle,
Buffer,
Count,
C_XBASS_OGG,
1, True, @MusicCallback) then
MsgBox('XBass - error(s) occured while creating.', mbError, MB_OK);
end;
* FXStream:
procedure InitializeWizard();
var
Buffer: AnsiString;
Count: Cardinal;
begin
//
Count := FXUnPckrExtractFileSize('{#MusicFileOnly}');
SetLength(Buffer, Count);
FXUnPckrExtractToBuffer2A('{#MusicFileOnly}', Buffer, Count);
//
ExtractTemporaryFile('ogg.dll');
ExtractTemporaryFile('vorbis.dll');
ExtractTemporaryFile('vorbisenc.dll');
ExtractTemporaryFile('vorbisfile.dll');
CreateOrChange;
PlayNextBtn.Enabled := False;
PlayPrevBtn.Enabled := False;
if not xbassCreateFromMem(WizardForm.Handle,
Buffer,
Count,
C_XBASS_OGG,
1, True, @MusicCallback) then
MsgBox('XBass - error(s) occured while creating.', mbError, MB_OK);
{ CleanUp }
FXUnPckrFree;
end;
.
Hi Blackfire,
With the latest update, it seems that the spectrum is not responding to the music. If it is working as expected, can you please demonstrate it with some example?
BLACKFIRE69
15-08-2024, 08:48
Hi Blackfire,
With the latest update, it seems that the spectrum is not responding to the music. If it is working as expected, can you please demonstrate it with some example?
to function correctly, the 'spectrum' requires the xbass.dll to be compiled with a newer version of Delphi. in the last release, i compiled xbass with an older Delphi version to reduce file size, as newer Delphi versions typically produce larger executables.
here's the same xbass.dll compiled with a newer version of Delphi. the spectrum works as expected with both vanilla InnoSetup and FMXInno.
.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.