Подскажите, напишите. Нужен простенький код для проигрывания mp3 и пару кнопок, вкл,выкл. Видел на форуме код выключения wav, но в mp3 надо ещё и bass.dll впихнуть.
Как делаю кнопки, начинаются ошибки с sndPlaySound.
Ладно, я уже придумал
[more=вот так нормально...]
[Setup]
AppName=My Program
AppVerName=My Program 1.5
AppPublisher=My Company, Inc.
DefaultDirName={pf}\My Program
DefaultGroupName=My Program
OutputBaseFilename=setup
Compression=none
[files]
;файл звука
Source: "C:\1.mp3"; DestDir: "{tmp}"; Flags: dontcopy
[code]
const
BASS_ACTIVE_STOPPED = 0;
BASS_ACTIVE_PLAYING = 1;
BASS_ACTIVE_STALLED = 2;
BASS_ACTIVE_PAUSED = 3;
BASS_SAMPLE_LOOP = 4;//повторять
function mciSendString(lpstrCommand: string; lpstrReturnString: string; uReturnLength:integer; hwndCallback:integer):integer;
external 'mciSendStringA@winmm.dll stdcall';
procedure StopSound(Sender: TObject);
begin
mciSendString(ExpandConstant('stop {tmp}\1.mp3'),'NULL',0,0)
end;
procedure playSound(Sender: TObject);
begin
mciSendString(ExpandConstant('play {tmp}\1.mp3'),'NULL',0,0)
end;
procedure InitializeWizard();
var
ButtonStop: TButton;
ButtonPlay: TButton;
begin
ExtractTemporaryFile(ExpandConstant('1.mp3'))
mciSendString(ExpandConstant('stop {tmp}\1.mp3'),'NULL',0,0)
mciSendString(ExpandConstant('play {tmp}\1.mp3'),'NULL',0,0)
ButtonStop := TButton.Create(WizardForm);
ButtonPlay := TButton.Create(WizardForm);
with ButtonStop do
begin
Parent := WizardForm;
Caption :='стоп';
Left := ScaleX(8);
Top :=320
Width := ScaleX(43);
Height := ScaleY(33);
TabOrder := 0;
OnClick:=@StopSound
end;
with ButtonPlay do
begin
Parent := WizardForm;
Caption :='игра';
Left := ScaleX(8);
Top :=190
Width := ScaleX(43);
Height := ScaleY(33);
TabOrder := 0;
OnClick:=@playSound
end;
end;
[/more]
Как делаю кнопки, начинаются ошибки с sndPlaySound.
Ладно, я уже придумал
[more=вот так нормально...]
[Setup]
AppName=My Program
AppVerName=My Program 1.5
AppPublisher=My Company, Inc.
DefaultDirName={pf}\My Program
DefaultGroupName=My Program
OutputBaseFilename=setup
Compression=none
[files]
;файл звука
Source: "C:\1.mp3"; DestDir: "{tmp}"; Flags: dontcopy
[code]
const
BASS_ACTIVE_STOPPED = 0;
BASS_ACTIVE_PLAYING = 1;
BASS_ACTIVE_STALLED = 2;
BASS_ACTIVE_PAUSED = 3;
BASS_SAMPLE_LOOP = 4;//повторять
function mciSendString(lpstrCommand: string; lpstrReturnString: string; uReturnLength:integer; hwndCallback:integer):integer;
external 'mciSendStringA@winmm.dll stdcall';
procedure StopSound(Sender: TObject);
begin
mciSendString(ExpandConstant('stop {tmp}\1.mp3'),'NULL',0,0)
end;
procedure playSound(Sender: TObject);
begin
mciSendString(ExpandConstant('play {tmp}\1.mp3'),'NULL',0,0)
end;
procedure InitializeWizard();
var
ButtonStop: TButton;
ButtonPlay: TButton;
begin
ExtractTemporaryFile(ExpandConstant('1.mp3'))
mciSendString(ExpandConstant('stop {tmp}\1.mp3'),'NULL',0,0)
mciSendString(ExpandConstant('play {tmp}\1.mp3'),'NULL',0,0)
ButtonStop := TButton.Create(WizardForm);
ButtonPlay := TButton.Create(WizardForm);
with ButtonStop do
begin
Parent := WizardForm;
Caption :='стоп';
Left := ScaleX(8);
Top :=320
Width := ScaleX(43);
Height := ScaleY(33);
TabOrder := 0;
OnClick:=@StopSound
end;
with ButtonPlay do
begin
Parent := WizardForm;
Caption :='игра';
Left := ScaleX(8);
Top :=190
Width := ScaleX(43);
Height := ScaleY(33);
TabOrder := 0;
OnClick:=@playSound
end;
end;
[/more]