DEADSOFTWARE

Sound: OpenAL: Free the sound buffer after load
[d2df-sdl.git] / src / engine / e_sound_al.inc
index b73b37f760bdc00f7ea75883425a92b4360ee711..aa843dfba137b59c736efbd1a9537c69571e95c8 100644 (file)
@@ -93,6 +93,8 @@ var
   e_SoundsArray: array of TSoundRec = nil;
   e_ZeroPosition: array [0..2] of ALfloat = (0, 0, 0);
   e_ALError: ALenum = 0;
+  e_SoundFont: string = '';
+  e_MusicLerp: Boolean = True;
 
 implementation
 
@@ -335,6 +337,8 @@ begin
     e_SoundsArray[find_id].Loader := Loader;
   end;
 
+  // the calling side won't free this, the loader will get a copy, so fuck it
+  FreeMem(pData);
   ID := find_id;
   Result := True;
 end;
@@ -410,6 +414,8 @@ begin
     e_SoundsArray[find_id].Loader := Loader;
   end;
 
+  // the calling side won't free this, the loader will get a copy, so fuck it
+  FreeMem(pData);
   ID := find_id;
   Result := True;
 end;
@@ -815,7 +821,7 @@ end;
 
 function TBasicSound.GetPan(): Single;
 var
-  Pos: array [0..2] of ALfloat;
+  Pos: array [0..2] of ALfloat = (0, 0, 0);
 begin
   Result := 0.0;
   if InvalidSource() then