Audio set volume bug in r200

Bugs will be moved here once resolved.

Post » Sat Mar 21, 2015 4:03 pm

Problem Description
I have just upgraded from r190 to r200 and I got an audio error that will crash the game and give out stack trace complaining "Failed to set the 'volume' property on 'HTMLMediaElement': The provided double value is non-finite."

This problem does not occur in r190. I have reverted back to r190, re-exported the project as node webkit and see that the game runs without a problem.

Attach a Capx
http://www.mediafire.com/download/11ucq ... ioBug.capx

Description of Capx
The capx slowly turns down the volume of the music, using a global variable. The formula used in set volume function is -log10( 100 / ( x / 0.9*100)) *33.2, where x is a variable. This is used in my game to turn down the music or slowly fade away a sound effect. (ex. when you walk away from a waterfall) Once the volume is all the way down, the game will output the stack trace error.

Steps to Reproduce Bug

Have a countdown variable that slowly decrease and use it to set volume using the formula given above. After the variable is less than a certain number, the game will crash. See the event sheet of the provided capx.

I have been trying to reproduce this in several other ways, such as giving -infinity to set volume function, but it does not seem to crash.

Observed Result

I got this stack trace:

TypeError: Failed to set the 'volume' property on 'HTMLMediaElement': The provided double value is non-finite.
at TypeError (native)
at C2AudioInstance.updateVolume ( http://localhost:50000/Audio_plugin.js:1984:33 )
at C2AudioInstance.setVolume ( http://localhost:50000/Audio_plugin.js:1960:8 )
at Acts.SetVolume ( http://localhost:50000/Audio_plugin.js:3368:19 )
at Action.run_object ( http://localhost:50000/eveng.js:1850:10 )
at EventBlock.run_actions_and_subevents ( http://localhost:50000/eveng.js:929:38 )
at EventBlock.run ( http://localhost:50000/eveng.js:886:9 )
at EventSheet.run ( http://localhost:50000/eveng.js:224:7 )
at Runtime.logic ( http://localhost:50000/preview.js:2361:36 )
at Runtime.tick ( http://localhost:50000/preview.js:2056:8 )

Expected Result
The game should not crash, as it does not crash in r190.

Affected Browsers
  • Chrome: YES
  • Exported NodeWebkit: YES
  • FireFox: didn't check
  • Internet Explorer: didn't check

Operating System and Service Pack
Win7 64bits Service pack 1

Construct 2 Version ID
r200


I see that r198 got a bug fix "Audio: setting volume did not work correctly in r197", so this implies the internal code has been changed in the function. Perhaps, you could add some sort of parameter safeguard to prevent the function to crash the game just like back in r190 ?
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: http://www.newgrounds.com/portal/view/660664 (use Chrome on Windows for best performance)

My sites:
http://twinblazar.deviantart.com
http://twinblazar.newgrounds.com
https://twitter.com/twinblazar
http://www.pixiv.net/member.php?id=15072448
B
28
S
11
G
11
Posts: 410
Reputation: 8,387

Post » Mon Mar 30, 2015 1:37 pm

Your calculation produces NaN (not a number) when you take the log of 0 or a negative number, which is an invalid volume. From the next build it replaces NaN with zero volume so it doesn't crash.
Scirra Founder
B
367
S
217
G
82
Posts: 23,263
Reputation: 183,841


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 0 guests