summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2a0e75a)
raw | patch | inline | side by side (parent: 2a0e75a)
author | fgsfds <pvt.fgsfds@gmail.com> | |
Mon, 2 Sep 2019 17:41:31 +0000 (20:41 +0300) | ||
committer | fgsfds <pvt.fgsfds@gmail.com> | |
Mon, 2 Sep 2019 17:41:31 +0000 (20:41 +0300) |
src/engine/e_sound_al.inc | patch | blob | history |
index a5c83646ff18937ecf004e228250272b3af25b05..b73b37f760bdc00f7ea75883425a92b4360ee711 100644 (file)
end;
procedure AssignSound(ID: DWORD; Src: ALuint); inline;
+var
+ S: ALint;
begin
alGetError(); // reset error state
// 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