X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fengine%2Fe_sound_al.inc;h=c57e2a3c53f516deca4d04e9f58654f534a891cb;hb=987c4a835a103345b59937e8e1be8524a6228712;hp=a5c83646ff18937ecf004e228250272b3af25b05;hpb=01f7c9f6fb35b2b193cb967c2d881ab9fc5b6bcc;p=d2df-sdl.git diff --git a/src/engine/e_sound_al.inc b/src/engine/e_sound_al.inc index a5c8364..c57e2a3 100644 --- a/src/engine/e_sound_al.inc +++ b/src/engine/e_sound_al.inc @@ -2,8 +2,7 @@ * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * the Free Software Foundation, version 3 of the License ONLY. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -93,6 +92,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 @@ -410,6 +411,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; @@ -451,6 +454,8 @@ begin end; procedure AssignSound(ID: DWORD; Src: ALuint); inline; +var + S: ALint; begin alGetError(); // reset error state @@ -459,8 +464,17 @@ begin // this is a stream // reset position e_SoundsArray[ID].Loader.SetPosition(0); - if CurStream <> ID then // changing streams, stop the thing just in case - alSourceStop(Src); + if CurStream <> ID then // changing streams + begin + alSourceStop(Src); // this should mark all buffers as processed + alGetSourcei(Src, AL_BUFFERS_PROCESSED, S); + // unqueue all buffers + if S > 0 then + begin + alSourceUnqueueBuffers(Src, S, @alStreamBufs[alStreamAvail]); + alStreamAvail := NUM_STREAM_BUFFERS; + end; + end; // this shit is playing now CurStream := ID; end @@ -804,7 +818,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