RESOLVED FIXED 74030
Webaudio IDL descriptions may not match implementation
https://bugs.webkit.org/show_bug.cgi?id=74030
Summary Webaudio IDL descriptions may not match implementation
Raymond Toy
Reported 2011-12-07 15:25:33 PST
Consider the description for AudioBufferSourceNode at https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#AudioBufferSourceNode-section The IDL for noteGrainOn says floats are taken for the parameters. But the actual implementation for noteGrainOn in AudioBufferSourceNode.cpp takes doubles. I think this means that the javascript floats (64-bit precision floats) are converted to single-precision floats which are then coerced back to double floats. (This causes a loss of precision.) I think these should be made consistent. Either the IDL should specify double floats or the C++ implementation should take floats. See http://code.google.com/p/chromium/issues/detail?id=106147 for an example of what can happen.
Attachments
Chris Rogers
Comment 1 2011-12-11 19:37:58 PST
I agree. I think the IDL should be changed to double. In fact, any API involving time values or durations should be changed to double. I've seen similar types of rounding problems in the past when dealing with time (especially cumulative time), significant time drift due to lack of precision, etc.
Raymond Toy
Comment 2 2011-12-12 10:50:30 PST
(In reply to comment #1) > I agree. I think the IDL should be changed to double. > > In fact, any API involving time values or durations should be changed to double. I've seen similar types of rounding problems in the past when dealing with time (especially cumulative time), significant time drift due to lack of precision, etc. Great! I'll make a patch soon where all the IDL uses doubles (except, of course, the Float32Array stuff). I'll also send an update for the webaudio spec to use doubles.
Chris Rogers
Comment 3 2013-05-10 18:04:52 PDT
Both the spec and the .idl now use doubles so closing
Note You need to log in before you can comment on or make changes to this bug.