在Inno Setup上启动启动画面时添加音频 [英] Add audio when Splash Screen starts on Inno Setup

查看:103
本文介绍了在Inno Setup上启动启动画面时添加音频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个具有inno设置的安装程序,还设法放置了一个初始屏幕,并且还向安装向导添加了声音.

I have created an installer with inno setup, I have also managed to place a splash screen and I have also managed to add a sound to the installation wizard.

我真正需要的是使启动屏幕启动时可以播放添加的音频.

What I really need is to make the audio that I have added can be playad when the Splash Screen starts.

我的音频代码:

; 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; 

这是我根据马丁的解释尝试过的代码

This is the code that I tried according to the explanation of 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]

好吧...

推荐答案

也许您可以尝试以下方式:

Maybe you can try this way:

#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]

这篇关于在Inno Setup上启动启动画面时添加音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆