[startTime commit] OpenAL error with looping 0-length sound

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
Edward-san
Posts: 1774
Joined: Sat Oct 17, 2009 9:40 am

[startTime commit] OpenAL error with looping 0-length sound

Post by Edward-san »

If a looping sound with playable length 0 is played, openal throws the following error:

Code: Select all

>>>>>>>>>>>> Received AL error Invalid Value (0xa003), oalsound.cpp:1439
which corresponds to this code.

this happens because of this line (confirmed by calling GetALError right after that line). It seems 'st' results NaN and is propagated from 'startTime' being NaN, but then this happened because of this code, due to the fact that GSnd->GetMSLength(sfx->data) is 0 and the 'fmod' operation returns NaN under such case.

In order to reproduce this, load the attached pk3 with Doom2 wad and summon the actor 'TestError' and see the error twice in the console.

I'm not sure, but I suppose the implementation of startTime in A_StartSound did not take this situation into account. What should it happen under such case?

This was found out when the DRPGCrates actors from DoomRPG SE mod are loaded.
Attachments
LoopLength0.pk3
(2.97 KiB) Downloaded 18 times
User avatar
Chris
Posts: 2942
Joined: Thu Jul 17, 2003 12:07 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: [startTime commit] OpenAL error with looping 0-length so

Post by Chris »

A 0 length sound probably shouldn't be flagged to loop. I'm not even sure 0 length sounds should be allowed to begin with, since they don't have anything to play.

From my point of view, trying to play a 0 length sound should be an error. Alternatively, a non-looping 0 length sound should be treated as completing immediately, while a looping 0 length sound could be replaced with a short sound containing silence. Although it could be confusing to callers that the sound has a non-0 offset despite being 0 length (but then, a 0 offset with 0 length isn't good either, since the offset should be in the range [0, length), which makes no sense when length=0). For OpenAL Soft's part, it immediately stops a source that tries to play a 0 length buffer, even if it's set to looping (it might make sense to make this an invalid operation error).
Edward-san
Posts: 1774
Joined: Sat Oct 17, 2009 9:40 am

Re: [startTime commit] OpenAL error with looping 0-length so

Post by Edward-san »

For the time being, this PR should fix the regression. Is the duplicate code I touched in both the functions intended?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49071
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [startTime commit] OpenAL error with looping 0-length so

Post by Graf Zahl »

The code got this much duplication only by progressive feature addition. Of course it has reached a point now where a separate function makes sense.
Post Reply

Return to “Closed Bugs [GZDoom]”