index f6ec993523682ae056ccc574115d1c0ad403cdb8..b73b37f760bdc00f7ea75883425a92b4360ee711 100644 (file)
exit;
end;
+ Loader.Looping := e_SoundsArray[find_id].Loops;
+
if not Loader.Load(FileName, e_SoundsArray[find_id].isMusic) then
begin
e_LogWritefln('Could not load sound `%s`', [FileName]);
end
else
begin
- Loader.Looping := e_SoundsArray[find_id].Loops;
e_SoundsArray[find_id].alBuffer := 0;
e_SoundsArray[find_id].Loader := Loader;
end;
exit;
end;
+ Loader.Looping := e_SoundsArray[find_id].Loops;
+
if not Loader.Load(pData, LongWord(Length), e_SoundsArray[find_id].isMusic) then
begin
e_LogWritefln('Could not load sound `%p`', [pData]);
end
else
begin
- Loader.Looping := e_SoundsArray[find_id].Loops;
e_SoundsArray[find_id].alBuffer := 0;
e_SoundsArray[find_id].Loader := Loader;
end;
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