FileForums

FileForums (https://fileforums.com/index.php)
-   Conversion Tutorials (https://fileforums.com/forumdisplay.php?f=55)
-   -   xbass.dll - Music plugin (https://fileforums.com/showthread.php?t=103859)

BLACKFIRE69 03-10-2020 15:54

xbass.dll - Music plugin
 
2 Attachment(s)
XBass - Music plugin

Code:

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';


Code:

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
 
2 Attachment(s)
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

Ele 20-01-2021 06:23

xbass.dll v2.0
 
2 Attachment(s)
Quote:

Originally Posted by Balaji007 (Post 488453)
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
Quote:

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:

Ele 22-01-2021 11:16

xbass.dll v3.0
 
2 Attachment(s)
xbass.dll v3.0

Features:
Quote:

  • 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.


Quote:

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
 
2 Attachment(s)
XBass Update Available!


Code:

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';


Code:

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;


Fak Eid 03-07-2024 14:09

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

XBass_f v4.1
 
3 Attachment(s)
Quote:

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.

Code:

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:

Code:

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:

Code:

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;


.

Fak Eid 01-08-2024 08:12

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

3 Attachment(s)
Quote:

Originally Posted by Fak Eid (Post 505167)
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.


.


All times are GMT -7. The time now is 01:07.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
FileForums @ https://fileforums.com