Jump to content
Tuts 4 You

How to use minifmod in delphi?


nilsen

Recommended Posts

Hi!

Can anybody help me ? i need to use bassmod.dll or minifmod.dll

i wonder how the code should look like

Edited by nilsen
Link to comment

hi

here is a small example

 [Files]
Source: "C:\BASSMOD.dll"; DestDir: "{tmp}"; Flags: dontcopy
Source: "C:\music.mod"; DestDir: "{tmp}"; Flags: dontcopy[Code]
const
BASS_MUSIC_LOOP = 4;function BASSMOD_Init(device: Integer; freq, flags: DWORD): Boolean;
external 'BASSMOD_Init@files:BASSMOD.dll stdcall delayload';procedure BASSMOD_MusicFree();
external 'BASSMOD_MusicFree@files:BASSMOD.dll stdcall delayload';function BASSMOD_MusicLoad(mem: BOOL; f: PChar; offset: DWORD; length: DWORD; flags: DWORD): Boolean;
external 'BASSMOD_MusicLoad@files:BASSMOD.dll stdcall delayload';function BASSMOD_MusicPlay(): Boolean;
external 'BASSMOD_MusicPlay@files:BASSMOD.dll stdcall delayload';procedure BASSMOD_Free();
external 'BASSMOD_Free@files:BASSMOD.dll stdcall delayload';procedure InitializeWizard();
var
hMod: Integer;
Name1: string;
begin
ExtractTemporaryFile(ExpandConstant('BASSMOD.dll'));
ExtractTemporaryFile(ExpandConstant('music.mod'));
if not BASSMOD_Init(-1,44100,0) then begin
MsgBox('BASSMOD не смогла инициализироваться, проигрывание музыки невозможно.', mbInformation, MB_OK)
BASSMOD_Free;
end;
begin
Name1:=ExpandConstant('{tmp}\music.mod');
BASSMOD_MusicFree;
if BASSMOD_MusicLoad(FALSE, PChar(Name1), 0, 0, BASS_MUSIC_LOOP) then
BASSMOD_MusicPlay;
end;
end;

you can find mor by google with bassmod inno setup or so

ru_example.txt

Edited by ragdog
Link to comment

Thank You ragdog it's working fine !

Another question i have.When i use code for minifmod.dll like this:

[Files]Source: "MiniFMOD.dll"; DestDir: "{tmp}"; Flags:dontcopy
Source: "music.XM"; DestDir: "{tmp}"; Flags:dontcopy[Code]const
MB_ICONINFORMATION = $40;
function SongLoadFromFile(FileName: PChar): Integer;
external 'SongLoadFromFile@files:minifmod.dll cdecl delayload';procedure SongPlay(hMod: Integer);
external 'SongPlay@files:minifmod.dll cdecl delayload'; procedure InitializeWizard();
var
hMod: Integer;
Name1: string;begin
ExtractTemporaryFile(ExpandConstant('MiniFMOD.dll'));
ExtractTemporaryFile(ExpandConstant('music.XM'));
Name1:=ExpandConstant('{tmp}\music.XM');
hMod := SongLoadFromFile(PChar(Name1));
SongPlay(hMod);
end;

Problem is when i use this code and cancel installation or finish installation,i've got message error from windows "setup\uninstall error" Zone alarm shows application "MyProgram.tmp". What is wrong?

Link to comment

Just add code to the appropriate handlers to:

1) Stop playing the music.

2) Release the used handles.

3) Delete the temporary files.

Edited by HVC
Link to comment
Just add code to the appropriate handlers to:

1) Stop playing the music.

2) Release the used handles.

3) Delete the temporary files.

I don't know how to do it,could You show me how should i modify the code? i'm just learning. Thanks in advanced

Link to comment
  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...