Hi,
The good News is that I found the Memory leak... it is indeed BASS . For example I have in menu the Cursor with Sound. Simply by moving trough the menu... Memory goes higher by every Sound played.
THis is what I am doing in the doMenu procedure :
Code:
procedure TMarsInvadors.doMenu;
begin
// up arrow
if MarsInvadors.Keyboard.KeyPressed[DIK_UP] then
begin
dec(MenuChoice);
if MenuChoice < 1 then MenuChoice := 3;
PlaySound(ExtractFilePath(Application.Exename)+'sounds\choice.mp3');
end;
// down arrow
if MarsInvadors.Keyboard.KeyPressed[DIK_DOWN] then
begin
inc(MenuChoice);
if MenuChoice > 3 then MenuChoice := 1;
PlaySound(ExtractFilePath(Application.Exename)+'sounds\choice.mp3');
end;
case MenuChoice of
1 : MarsCursor.Y:= 320;
2 : MarsCursor.Y:= 352;
3 : MarsCursor.Y:= 416;
end;
// enter
if MarsInvadors.KeyBoard.KeyPressed[DIK_RETURN] then
begin
case MenuChoice of
1:
begin
// game
MarsCursor.Dead;
GameState:=gsReset;
end;
2:
begin
// info
MarsCursor.Dead;
GameState:=gsInsLoad;
end;
3:
begin
// exit
end;
end;
end;
end;
Nothing fancy... the Playsound procedure Looks like this :
Code:
procedure PlaySound(const SampleFilename : String);
var mySound : HStream;
begin
// free both MOD and stream, it must be one of them! :)
BASS_MusicFree(mySound);
BASS_StreamFree(mySound);
mySound := BASS_StreamCreateFile(FALSE, PChar(SampleFilename), 0, 0, BASS_SAMPLE_FX {$IFDEF UNICODE} or BASS_UNICODE {$ENDIF});
// BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, 4000);
BASS_ChannelPlay(mySound, False);
end;
Is there some obvious error here ? I must confess the bass Thing I did in quiet a haste . I googled now... found someone else mentioning some Problems related to BASS.dll free Version with mp3 ... from year 2012.... I am not
sure if it's that same bug still present. Or I am just doing something totaly wrong here.
Thank you
Bookmarks