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

Post bugs that have to do with sound and/or in-game music here.

Moderator: GZDoom Developers

Forum rules
Please construct and post a simple demo whenever possible for all bug reports. Please provide links to everything.

If you can include a wad demonstrating the problem, please do so. Bug reports that include fully-constructed demos have a much better chance of being investigated in a timely manner than those that don't.

Please make a new topic for every bug. Don't combine multiple bugs into a single topic. Thanks!

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

Postby Edward-san » Mon Jun 01, 2020 1:00 pm

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

Code: Select allExpand view
>>>>>>>>>>>> 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.
You do not have the required permissions to view the files attached to this post.
Edward-san
Mathematics is the language with which God has written the universe. (Galilei)
 
Joined: 17 Oct 2009

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

Postby Chris » Mon Jun 01, 2020 6:00 pm

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).
User avatar
Chris
 
Joined: 17 Jul 2003

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

Postby Edward-san » Wed Jun 03, 2020 6:42 am

For the time being, this PR should fix the regression. Is the duplicate code I touched in both the functions intended?
Edward-san
Mathematics is the language with which God has written the universe. (Galilei)
 
Joined: 17 Oct 2009

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

Postby Graf Zahl » Wed Jun 03, 2020 7:28 am

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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany


Return to Audio/Music Bugs

Who is online

Users browsing this forum: No registered users and 0 guests