I'm sorry that I'm being too minimalist trying to explain my problem. Having a hard time figururing out which information is relevant and which are not, trying not to be repetitive and providing useless information.
Below is some more context from my script hoping that will be more helpfull:
[Files]
Source: "bass.dll"; Flags: dontcopy
Source: "BGM.mp3"; Flags: dontcopy
Source: "On.png"; Flags: dontcopy
Source: "Off.png"; Flags: dontcopy
Source: "*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs overwritereadonly sortfilesbyextension
[Code]
const
BASS_SAMPLE_LOOP = 4;
BASS_ACTIVE_STOPPED = 0;
BASS_ACTIVE_PLAYING = 1;
BASS_ACTIVE_STALLED = 2;
BASS_ACTIVE_PAUSED = 4;
BASS_UNICODE = $80000000;
BASS_CONFIG_GVOL_STREAM = 5;
#ifndef UNICODE
EncodingFlag = 0;
#else
EncodingFlag = BASS_UNICODE;
#endif
//-----------------------------------------------------------------------------------------------------------------------------
// Procedure to play music and put sound off/on Button on Wizard
Var
SoundStream : DWORD;
SpeakerImage : TBitmapImage;
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): DWORD;
external 'BASS_StreamCreateFile@files:bass.dll stdcall';
Function BASS_Start: BOOL;
external 'BASS_Start@files:bass.dll stdcall';
Function BASS_Pause: BOOL;
external 'BASS_Pause@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_ChannelIsActive(handle: DWORD): DWORD;
external 'BASS_ChannelIsActive@files:bass.dll stdcall';
Function BASS_Free: BOOL;
external 'BASS_Free@files:bass.dll stdcall';
Procedure SpeakerImageOnClick(Sender: TObject);
Begin
Case BASS_ChannelIsActive(SoundStream) Of
BASS_ACTIVE_PLAYING: If BASS_Pause Then SpeakerImage.PngImage.LoadFromFile(ExpandConstant('{tmp}\off.png'));
BASS_ACTIVE_PAUSED: If BASS_Start Then SpeakerImage.PngImage.LoadFromFile(ExpandConstant('{tmp}\on.png'));
End;
End;
//-----------------------------------------------------------------------------------------------------------------------------
// Procedure to initialize and draw main WizardForm
Procedure InitializeWizard;
Begin
// Extract the PNG file to a temporary location
// ExtractTemporaryFile(ExtractFileName(ExpandConstant('{tmp}\on.png')));
// ExtractTemporaryFile(ExtractFileName(ExpandConstant('{tmp}\off.png')));
ExtractTemporaryFile('BGM.mp3');
ExtractTemporaryFile('On.png');
ExtractTemporaryFile('Off.png');
If BASS_Init(-1, 44100, 0, 0, 0) Then
Begin
SoundStream := BASS_StreamCreateFile(False, ExpandConstant('{tmp}\BGM.mp3'), 0, 0, 0, 0, EncodingFlag or BASS_SAMPLE_LOOP);
BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, 2500);
BASS_ChannelPlay(SoundStream, False);
// Create the TBitmapImage object
SpeakerImage := TBitmapImage.Create(WizardForm);
// Load the PNG file
SpeakerImage.PngImage.LoadFromFile(ExpandConstant('{tmp}\on.png'));
// Configure and display the image
SpeakerImage.Cursor := crHand;
SpeakerImage.OnClick := @SpeakerImageOnClick;
SpeakerImage.Parent := WizardForm;
SpeakerImage.Left := 10;
SpeakerImage.Width := 36;
SpeakerImage.Height := 36;
SpeakerImage.Top := WizardForm.ClientHeight - SpeakerImage.Bitmap.Height - 4;
End;
End;
//-----------------------------------------------------------------------------------------------------------------------------
// Procedure to cleanup Inno setup and release BASS.DLL from memory
Procedure DeinitializeSetup;
Begin
BASS_Free;
End;
I hope this makes sense...
Thanks again for you patience