Bug 74030
Summary: | Webaudio IDL descriptions may not match implementation | ||
---|---|---|---|
Product: | WebKit | Reporter: | Raymond Toy <rtoy> |
Component: | Web Audio | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | crogers |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Raymond Toy
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 | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Chris Rogers
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
(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
Both the spec and the .idl now use doubles so closing