【问题标题】:Add audio when Splash Screen starts on Inno Setup [duplicate]在 Inno Setup 上启动启动画面时添加音频 [重复]
【发布时间】:2018-10-26 00:19:39
【问题描述】:

我已经创建了一个带有 inno setup 的安装程序,我还设法放置了一个启动屏幕,我还设法为安装向导添加了声音。

我真正需要的是让我添加的音频可以在启动画面启动时播放。

我的音频代码:

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

[ISSI]
;; Name of the bitmap image:
#define ISSI_SplashScreen "C:\Users\Administrator\Desktop\Program\Splash\SPLASH.bmp"

;; Time in seconds:
#define ISSI_SplashScreen_T 10

;; Image Width:
#define ISSI_SplashScreen_X 700

;; Image Heigth:
#define ISSI_SplashScreen_Y 169

;; Rounded corners (Optional):
#define ISSI_Splash_Corner

;; Include ISSI (required)
#define ISSI_IncludePath "C:\ISSI"
#include ISSI_IncludePath+"\_issi.isi"

[Files]
Source: "C:\Users\Administrator\Desktop\Program\Splash\isgsg.dll"; Flags: dontcopy
Source: "C:\Users\Administrator\Desktop\Program\Splash\IsUtilsHb.dll"; Flags: dontcopy
Source: "C:\Users\Administrator\Desktop\Program\Splash\SPLASH.bmp"; Flags: dontcopy
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Code]
const  
  BASS_SAMPLE_LOOP = 4;
  BASS_UNICODE = $80000000;
  BASS_CONFIG_GVOL_STREAM = 5;
const
  #ifndef UNICODE
    EncodingFlag = 0;
  #else
    EncodingFlag = BASS_UNICODE;
  #endif
type
  HSTREAM = DWORD;

function BASS_Init(device: LongInt; freq, flags: DWORD; 
  win: HWND; clsid: Cardinal): BOOL;
  external 'BASS_Init@files:bass.dll stdcall';
function BASS_StreamCreateFile(mem: BOOL; f: string; offset1: DWORD; 
  offset2: DWORD; length1: DWORD; length2: DWORD; flags: DWORD): HSTREAM;
  external 'BASS_StreamCreateFile@files:bass.dll stdcall';
function BASS_ChannelPlay(handle: DWORD; restart: BOOL): BOOL; 
  external 'BASS_ChannelPlay@files:bass.dll stdcall';
function BASS_SetConfig(option: DWORD; value: DWORD ): BOOL;
  external 'BASS_SetConfig@files:bass.dll stdcall';
function BASS_Free: BOOL;
  external 'BASS_Free@files:bass.dll stdcall';

procedure InitializeWizard;
var
  StreamHandle: HSTREAM;
begin
  ExtractTemporaryFile('AudioFile.mp3');
  if BASS_Init(-1, 44100, 0, 0, 0) then
  begin
    StreamHandle := BASS_StreamCreateFile(False, 
      ExpandConstant('{tmp}\AudioFile.mp3'), 0, 0, 0, 0, 
      EncodingFlag or BASS_SAMPLE_LOOP);
    BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, 2500);
    BASS_ChannelPlay(StreamHandle, False);
  end;
end;

procedure DeinitializeSetup;
begin
  BASS_Free;
end; 

这是我根据martin的解释尝试的代码

[Code]
function ISSI_InitializeSetup: Boolean;
begin
  procedure InitializeWizard;
var
  StreamHandle: HSTREAM;
begin
  ExtractTemporaryFile('AudioFile.mp3');
  if BASS_Init(-1, 44100, 0, 0, 0) then
  begin
    StreamHandle := BASS_StreamCreateFile(False, 
      ExpandConstant('{tmp}\AudioFile.mp3'), 0, 0, 0, 0, 
      EncodingFlag or BASS_SAMPLE_LOOP);
    BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, 2500);
    BASS_ChannelPlay(StreamHandle, False);
  end;
end;

procedure DeinitializeSetup;
begin
  BASS_Free;
end; 

  Result := True;
end;
[/Code]

好的...

【问题讨论】:

  • 我已经在回复中添加了。

标签: inno-setup splash-screen


【解决方案1】:

也许你可以试试这个方法:

#define ISSI_InitializeSetup

[Code]
const  
  BASS_SAMPLE_LOOP = 4;
  BASS_UNICODE = $80000000;
  BASS_CONFIG_GVOL_STREAM = 5;
const
  #ifndef UNICODE
    EncodingFlag = 0;
  #else
    EncodingFlag = BASS_UNICODE;
  #endif
type
  HSTREAM = DWORD;

function BASS_Init(device: LongInt; freq, flags: DWORD; 
  win: HWND; clsid: Cardinal): BOOL;
  external 'BASS_Init@files:bass.dll stdcall';
function BASS_StreamCreateFile(mem: BOOL; f: string; offset1: DWORD; 
  offset2: DWORD; length1: DWORD; length2: DWORD; flags: DWORD): HSTREAM;
  external 'BASS_StreamCreateFile@files:bass.dll stdcall';
function BASS_ChannelPlay(handle: DWORD; restart: BOOL): BOOL; 
  external 'BASS_ChannelPlay@files:bass.dll stdcall';
function BASS_SetConfig(option: DWORD; value: DWORD ): BOOL;
  external 'BASS_SetConfig@files:bass.dll stdcall';
function BASS_Free: BOOL;
  external 'BASS_Free@files:bass.dll stdcall';

function ISSI_InitializeSetup: Boolean;
var
  StreamHandle: HSTREAM;
begin
  ExtractTemporaryFile('AudioFile.mp3');
  if BASS_Init(-1, 44100, 0, 0, 0) then
  begin
    StreamHandle := BASS_StreamCreateFile(False, 
      ExpandConstant('{tmp}\AudioFile.mp3'), 0, 0, 0, 0, 
      EncodingFlag or BASS_SAMPLE_LOOP);
    BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, 2500);
    BASS_ChannelPlay(StreamHandle, False);
  end;

  Result := True;
end;
[/Code]

【讨论】:

  • 感谢louis的回答,我编译的时候还是有错误,我想我得放弃这个问题,寻找其他方法,非常感谢你的回答。
  • 我会尽力帮助你的,你能告诉我编译错误吗?
  • 谢谢,效果很好!最后,我应该怎么做才能让音乐不再重复?只有一次
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-04-22
  • 2015-06-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多