0

Thanks to this article posted at Add audio when Splash Screen starts on Inno Setup

the code work like a charm, I just wanted to know what to do so that the music of my installer is only played once.

I don´t want it to be repeated continuously.

Thanks in advance...

Code im using

[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; 
MITHUN VS
  • 1
  • 1
  • The post you linked has answers that play the sound exactly one time, without repeating at all. What specific problem are you having? Please provide more detail and a [mcve] that we can use to reproduce the problem. – Ken White Nov 01 '18 at 21:53
  • thanks, I think I got confused about code, I took the one from another user who posted a similar post. see above, the one that I currently use added. – MITHUN VS Nov 01 '18 at 22:06
  • 1
    Hmmm... I don't use Bass, but the `BASS_SAMPLE_LOOP` might be an issue that would cause it to play more than once, don't you think? :-) – Ken White Nov 01 '18 at 22:20
  • thanks ken White! i think so – MITHUN VS Nov 02 '18 at 14:05

0 Answers0