Jump to content






- - - - -

Played 6 File [*. Xm] with Delphi.

Posted by X-88, 30 May 2012 · 1,459 views

B) Not for the Expert, just for amateur programmers. B)

~~~~~~~~~~~~~~~~~~~~~~~~~~BeGiN~~~~~~~~~~~~~~~~~~~~~~~~~~~

unit Unit1;

interface

uses
   Forms, uFMOD, Sfx, Sfx2, Sfx3, Sfx4, Sfx5, Sfx6, Classes, Controls, StdCtrls;

type
  TForm1 = class(TForm)
Label1: TLabel;
procedure FormActivate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure FormCreate(Sender: TObject);
  private
   { By : X-88 }
  public
{ hmm.... }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormActivate(Sender: TObject);
begin
   uFMOD_SetVolume(256);
   uFMOD_PlaySong(@SfxData, SfxSize, XM_MEMORY);
   Label1.Caption := 'Title : '+uFMOD.uFMOD_GetTitle;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
   uFMOD_StopSong;
end;

procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
if (Key = '1') then
begin
   uFMOD_StopSong;
   uFMOD_PlaySong(@SfxData, SfxSize, XM_MEMORY);
   Label1.Caption := 'Title : '+uFMOD.uFMOD_GetTitle;
end
else
if (Key = '2') then
begin
   uFMOD_StopSong;
   uFMOD_PlaySong(@Sfx2Data, Sfx2Size, XM_MEMORY);
   Label1.Caption := 'Title : '+uFMOD.uFMOD_GetTitle;
end
else
if (Key = '3') then
begin
   uFMOD_StopSong;
   uFMOD_PlaySong(@Sfx3Data, Sfx3Size, XM_MEMORY);
   Label1.Caption := 'Title : '+uFMOD.uFMOD_GetTitle;

end
else
if (Key = '4') then
begin
   uFMOD_StopSong;
   uFMOD_PlaySong(@Sfx4Data, Sfx4Size, XM_MEMORY);
   Label1.Caption := 'Title : '+uFMOD.uFMOD_GetTitle;
end
else
if (Key = '5') then
begin
   uFMOD_StopSong;
   uFMOD_PlaySong(@Sfx5Data, Sfx5Size, XM_MEMORY);
   Label1.Caption := 'Title : '+uFMOD.uFMOD_GetTitle;
end
else
if (Key = '6') then
begin
   uFMOD_StopSong;
   uFMOD_PlaySong(@Sfx6Data, Sfx6Size, XM_MEMORY);
   Label1.Caption := 'Title : '+uFMOD.uFMOD_GetTitle;
end
else
if (Key = '7') then
begin
   uFMOD_StopSong;
   Label1.Caption := 'Press 1-6 to Change Sfx' +#13#10+ '7 = Stop';

end;

end;

procedure TForm1.FormCreate(Sender: TObject);
begin
   Application.Title := 'Test';
end;

end.


~~~~~~~~~~~~~~~~~~~~~~~~~~EnD~~~~~~~~~~~~~~~~~~~~~~~~~~

NB :

Uses Sfx, Sfx2, Sfx3, Sfx4, Sfx5, Sfx6
  
if (Key = '1') then
begin
   uFMOD_StopSong;
   uFMOD_PlaySong(@SfxData, SfxSize, XM_MEMORY);
   Label1.Caption := 'Title : '+uFMOD.uFMOD_GetTitle;
end
else
if (Key = '2') then
begin
   uFMOD_StopSong;
   uFMOD_PlaySong(@Sfx2Data, Sfx2Size, XM_MEMORY);
   Label1.Caption := 'Title : '+uFMOD.uFMOD_GetTitle;
end
else
if (Key = '3') then
begin
   uFMOD_StopSong;
   uFMOD_PlaySong(@Sfx3Data, Sfx3Size, XM_MEMORY);
   Label1.Caption := 'Title : '+uFMOD.uFMOD_GetTitle;
end
else
if (Key = '4') then
begin
   uFMOD_StopSong;
   uFMOD_PlaySong(@Sfx4Data, Sfx4Size, XM_MEMORY);
   Label1.Caption := 'Title : '+uFMOD.uFMOD_GetTitle;
end
else
if (Key = '5') then
begin
   uFMOD_StopSong;
   uFMOD_PlaySong(@Sfx5Data, Sfx5Size, XM_MEMORY);
   Label1.Caption := 'Title : '+uFMOD.uFMOD_GetTitle;
end
else
if (Key = '6') then
begin
   uFMOD_StopSong;
   uFMOD_PlaySong(@Sfx6Data, Sfx6Size, XM_MEMORY);
   Label1.Caption := 'Title : '+uFMOD.uFMOD_GetTitle;
end

---------------------------------------------------------------->


Unit Sfx2;

Interface

Const
   Sfx2Size = 268215;
   Sfx2Data : Array[1..Sfx2Size] of Byte = (
   69,120,116,101,110,100,101,100,32,77,111,
   .., .., .., .., .., .., .., .., .., .., .., .., .., .., .., .., .., Etc Done.

Attached Files

  • Attached File  ZN.zip (1.64MB)
    downloads: 217





One of the best resorce that i ever saw

Deep Thanx

May 2013

S M T W T F S
   1234
567891011
12131415161718
192021 22 232425
262728293031 

Categories