1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247
|
var
str: string;
BASSMODArray: array of Char;
APlayButtonIndex, AStopButtonIndex: integer;
APlayButton, AStopButton: TButton;
PlayButtonPanel, StopButtonPanel: array [0..4] of TPanel;
PlayButtonImage, StopButtonImage: array [0..4] of TBitmapImage;
PlayButtonLabel, StopButtonLabel: array [0..4] of TLabel;
const
BASS_MUSIC_RAMP = 1; // (Fast Tracker .xm Mode 1)
BASS_MUSIC_RAMPS = 2; // (Fast Tracker .xm Mode 2)
BASS_MUSIC_LOOP = 4; // (Loop Play Mode)
BASS_MUSIC_FT2MOD = 16; // (.mod FastTracker 2)
BASS_MUSIC_PT1MOD = 32; // (.mod ProTracker 1)
BASS_MUSIC_SURROUND = 512; // (surround Mode 1)
BASS_MUSIC_SURROUND2 = 1024; // (surround Mode 2)
HALIGN_CENTER = 0;
VALIGN_CENTER = 0;
FIT_NONE = 0;
CLR_INVALID = $FFFFFFFF;
/////////////////////////////////////////////////////////////////////////////////////////////////
function BASSMOD_Init(device: Integer; freq, flags: DWORD): Boolean;
external 'BASSMOD_Init@files:bassmod.dll stdcall delayload';
function BASSMOD_MusicLoad(mem: BOOL; f: PChar; offset: DWORD; length: DWORD; flags: DWORD): Boolean;
external 'BASSMOD_MusicLoad@files:bassmod.dll stdcall delayload';
procedure BASSMOD_MusicFree();
external 'BASSMOD_MusicFree@files:bassmod.dll stdcall delayload';
function BASSMOD_MusicPlay(): Boolean;
external 'BASSMOD_MusicPlay@files:bassmod.dll stdcall delayload';
function BASSMOD_MusicPause(): Boolean;
external 'BASSMOD_MusicPause@files:bassmod.dll stdcall delayload';
function BASSMOD_MusicStop(): Boolean;
external 'BASSMOD_MusicStop@files:bassmod.dll stdcall delayload';
procedure BASSMOD_Free();
external 'BASSMOD_Free@files:bassmod.dll stdcall delayload';
////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
procedure PlayButtonLabelMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if PlayButtonLabel[TLabel(Sender).Tag].Enabled then
PlayButtonImage[TLabel(Sender).Tag].Left:=-64
end;
procedure PlayButtonLabelMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
PlayButtonImage[TLabel(Sender).Tag].Left:=0
end;
////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
procedure StopButtonLabelMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if StopButtonLabel[TLabel(Sender).Tag].Enabled then
StopButtonImage[TLabel(Sender).Tag].Left:=-64
end;
procedure StopButtonLabelMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
StopButtonImage[TLabel(Sender).Tag].Left:=-0
end;
//////////////////////////////////////////////////////////////////////////////////////////////////
procedure MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
StopButtonImage[TLabel(Sender).Tag].Left:=0
PlayButtonImage[TLabel(Sender).Tag].Left:=0
end;
///////////////////////////////////////////////////////////////////////////////////////////////////
procedure PlayButtonOnClick(Sender: TObject);
var
Name1: string;
begin
if not BASSMOD_MusicPlay then
begin
Name1 := ExpandConstant('{tmp}\_Music.xm');
if BASSMOD_MusicLoad(FALSE, PChar(Name1), 0, 0, BASS_MUSIC_LOOP or BASS_MUSIC_SURROUND) then
BASSMOD_MusicPlay;
end;
end;
procedure PauseButtonOnClick(Sender: TObject);
begin
BASSMOD_MusicPause;
end;
procedure StopButtonOnClick(Sender: TObject);
begin
BASSMOD_MusicStop;
BASSMOD_MusicFree;
end;
////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
procedure InitializeWizard();
var
Name1: string;
PlayLbl, StopLbl: TNewStaticText;
PlayImage, StopImage: TBitmapImage;
Panel, PlayPanel, StopPanel: TPanel;
PlayLabl, StopLabl: TLabel;
begin
ExtractTemporaryFile(ExpandConstant('bassmod.dll'));
ExtractTemporaryFile(ExpandConstant('_Music.xm'));
ExtractTemporaryFile(ExpandConstant('_MusicPlayButton.bmp'));
ExtractTemporaryFile(ExpandConstant('_MusicPauseButton.bmp'));
ExtractTemporaryFile(ExpandConstant('_MusicStopButton.bmp'));
if not BASSMOD_Init(-1, 44100, 0)
then
begin
MsgBox('BASSMOD Can''t initialize the device. Playing is not possible.', mbError, MB_OK)
BASSMOD_Free;
end
else
begin
Name1 := ExpandConstant('{tmp}\_Music.xm');
if BASSMOD_MusicLoad(FALSE, PChar(Name1), 0, 0, BASS_MUSIC_LOOP or BASS_MUSIC_SURROUND) then
BASSMOD_MusicPlay;
end;
begin
Panel:=TPanel.Create(WizardForm)
Panel.Left:=5
Panel.Top:=WizardForm.ClientHeight - 41
Panel.Width:=ScaleY(70)
Panel.Height:=ScaleX(40)
Panel.Parent:=WizardForm
Panel.BevelInner := bvLowered
Panel.BevelOuter := bvRaised
Panel.Color :=$e2e2e2
PlayPanel:=TPanel.Create(WizardForm)
PlayPanel.Left:=10
PlayPanel.Top:=WizardForm.ClientHeight - 38
PlayPanel.Width:=ScaleY(31)
PlayPanel.Height:=ScaleX(33)
PlayPanel.Parent:=WizardForm
PlayButtonPanel[APlayButtonIndex]:=PlayPanel
PlayImage:=TBitmapImage.Create(WizardForm)
PlayImage.Width:=96
PlayImage.Height:=33
PlayImage.Enabled:=False
PlayImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\_MusicPlayButton.bmp'))
PlayImage.Parent:=PlayPanel
PlayButtonImage[APlayButtonIndex]:=PlayImage
with TLabel.Create(WizardForm) do begin
Tag:=APlayButtonIndex
Parent:=PlayPanel
Width:=PlayPanel.Width
Height:=PlayPanel.Height
Transparent:=True
Cursor := crHand
OnClick:=@PlayButtonOnClick
OnDblClick:=@PlayButtonOnClick
OnMouseDown:=@PlayButtonLabelMouseDown
OnMouseUp:=@PlayButtonLabelMouseUp
end
PlayLabl:=TLabel.Create(WizardForm)
PlayLabl.Left:=23
PlayLabl.Top:=5
PlayLabl.Autosize:=True
PlayLabl.Alignment:=taCenter
PlayLabl.Transparent:=True
PlayLabl.Font.Color:=clWhite
PlayLabl.Parent:=PlayPanel
PlayLabl.OnClick:=@PlayButtonOnClick
PlayLabl.Hint := 'Play Music'
PlayLabl.ShowHint := True
PlayLabl.OnDblClick:=@PlayButtonOnClick
PlayLabl.OnMouseDown:=@PlayButtonLabelMouseDown
PlayLabl.OnMouseUp:=@PlayButtonLabelMouseUp
PlayButtonLabel[APlayButtonIndex]:=PlayLabl
end
Begin
StopPanel:=TPanel.Create(WizardForm)
StopPanel.Left:=43
StopPanel.Top:=WizardForm.ClientHeight - 38
StopPanel.Width:=ScaleY(31)
StopPanel.Height:=ScaleX(33)
StopPanel.Parent:=WizardForm
StopButtonPanel[AStopButtonIndex]:=StopPanel
StopImage:=TBitmapImage.Create(WizardForm)
StopImage.Width:=96
StopImage.Height:=33
StopImage.Enabled:=False
StopImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\_MusicStopButton.bmp'))
StopImage.Parent:=StopPanel
StopButtonImage[AStopButtonIndex]:=StopImage
with TLabel.Create(WizardForm) do begin
Tag:=AStopButtonIndex
Parent:=StopPanel
Width:=StopPanel.Width
Height:=StopPanel.Height
Transparent:=True
Cursor := crHand
OnClick:=@StopButtonOnClick
OnDblClick:=@StopButtonOnClick
OnMouseDown:=@StopButtonLabelMouseDown
OnMouseUp:=@StopButtonLabelMouseUp
end
StopLabl:=TLabel.Create(WizardForm)
StopLabl.Left:=23
StopLabl.Top:=5
StopLabl.Autosize:=True
StopLabl.Alignment:=taCenter
StopLabl.Transparent:=True
StopLabl.Hint := 'Stop Music'
StopLabl.ShowHint := True
StopLabl.Font.Color:=clWhite
StopLabl.Parent:=StopPanel
StopLabl.OnClick:=@StopButtonOnClick
StopLabl.OnDblClick:=@StopButtonOnClick
StopLabl.OnMouseDown:=@StopButtonLabelMouseDown
StopLabl.OnMouseUp:=@StopButtonLabelMouseUp
StopButtonLabel[AStopButtonIndex]:=StopLabl
end
end; |
Partager