Recent

Author Topic: BASS DLL  (Read 359 times)

Gigatron

  • Full Member
  • ***
  • Posts: 144
  • Amiga Rulez !!
BASS DLL
« on: September 06, 2024, 04:27:24 pm »
Hi,
Yesterday I tried how to call the functions of an external library with lazarus pascal. It was a nightmare !!!
But i found bass.dll from un4seen developpement, and extracted some code part of ay-emulator source from Sergey Bulba.

https://www.un4seen.com/

https://bulba.untergrund.net/progr_e.htm

Modules are here : https://modland.com/pub/modules/

If you want to play .mod, .s3m, .xm, or .it module format you can use this library   just for personnal usage not commercial !
Projet is included in .zip format.

Regards
Sub Quantum Technology ! Ufo Landing : Ezekiel 1-4;

Gigatron

  • Full Member
  • ***
  • Posts: 144
  • Amiga Rulez !!
Re: BASS DLL
« Reply #1 on: September 06, 2024, 06:47:30 pm »
The improved version of the main unit when play button is clicked ;

Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls,
  9.   Buttons, BGRAVirtualScreen, basslight, basscode, BGRABitmap, BGRABitmapTypes;
  10.  
  11. type
  12.  
  13.   { TForm1 }
  14.  
  15.   TForm1 = class(TForm)
  16.     BGRAVirtualScreen1: TBGRAVirtualScreen;
  17.     Button1: TButton;
  18.     Button2: TButton;
  19.     OpenDialog1: TOpenDialog;
  20.     Panel1: TPanel;
  21.     Timer1: TTimer;
  22.     procedure BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
  23.     procedure Button1Click(Sender: TObject);
  24.     procedure Button2Click(Sender: TObject);
  25.     procedure FormCreate(Sender: TObject);
  26.     procedure FormDestroy(Sender: TObject);
  27.     procedure Timer1Timer(Sender: TObject);
  28.  
  29.   private
  30.   public
  31.  
  32.   end;
  33.  
  34. var
  35.   Form1: TForm1;
  36.   // dots related
  37.   off,addq : single;
  38.   // text
  39.   pos_y : integer;
  40.   s_sin : single;
  41.   stopped : boolean;
  42.  
  43. implementation
  44.  
  45. {$R *.lfm}
  46.  
  47. { TForm1 }
  48.  
  49. procedure TForm1.FormCreate(Sender: TObject);
  50. begin
  51.   LoadBASS;
  52.   StartBASS;
  53.   addq :=0.0;
  54.   pos_y :=600;
  55.   stopped := true;
  56. end;
  57.  
  58. procedure TForm1.FormDestroy(Sender: TObject);
  59. begin
  60.    PlayFreeBASS;
  61. end;
  62.  
  63. procedure TForm1.Timer1Timer(Sender: TObject);
  64. begin
  65.      dec(pos_y);
  66.      if(pos_y<-40) then pos_y :=600;
  67.      s_sin := s_sin +0.02;
  68.  
  69.      BGRAVirtualScreen1.RedrawBitmap;
  70. end;
  71.  
  72. procedure TForm1.Button1Click(Sender: TObject);
  73. begin
  74.  
  75.     if stopped then
  76.     begin
  77.     if OpenDialog1.Execute then
  78.     begin
  79.     PlayFreeBASS;
  80.     PlayBASS(PChar(OpenDialog1.FileName),false,0,30);
  81.     stopped :=false;
  82.     addq :=0.01;
  83.     end
  84.     else ShowMessage('Can''t play the file');
  85.     end;
  86. end;
  87.  
  88. procedure TForm1.BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
  89. var
  90.   i,maxdot : integer;
  91.   angle, posx, posy,pos2: single;
  92. begin
  93.        /// dot
  94.       maxdot :=  79 ;
  95.         for  i:=0 to maxdot do
  96.         begin
  97.           angle := 2* Pi / maxdot * i+off*1.4;
  98.           posx := 400 + 180 * Cos(angle + off)+sin(off)*30;
  99.           pos2 := 400 + 180 * -Cos(angle + off)+sin(off)*30;
  100.           posy := 230 + 220 * Sin(angle);
  101.           bitmap.FillRect(round(pos2),round(posy),round(pos2+4),round(posy+4),BGRA(0,195,255),dmSet);
  102.           bitmap.FillRect(round(posx),round(posy),round(posx+4),round(posy+4),BGRA(0,195,255),dmSet);
  103.         end;
  104.         off := off +   addq  ;
  105.  
  106.         bitmap.TextOut(50+80*sin(s_sin*4.0),pos_y,'BASS DLL EXAMPLE ',BGRA(1-pos_y div 5,255,255));
  107. end;
  108.  
  109. procedure TForm1.Button2Click(Sender: TObject);
  110. begin
  111.       PlayFreeBASS;
  112.       stopped := true;
  113.       addq := 0.00  ;
  114.  
  115. end;
  116.  
  117.  
  118. end.
  119.  
Sub Quantum Technology ! Ufo Landing : Ezekiel 1-4;

 

TinyPortal © 2005-2018