Question

I'm evaluating HTML5 Web Audio API example and trying to get it work. Here is what I'm working with. As far as I got I understood that it's using old API and I need to refactor function refreshFilterType() on line ~590. Link - www.smartjava.org/examples/webaudio-filters/

According to Web Audio BiquadFilterNode I need to rework switch statement and make it and to use the new string-based values. (I.e. a value of "3" - the default lowshelf filter - needs to be passed into currentFilterType as "lowshelf"). I've tried to implement new BiquadFilterNode, but still it was unsuccessfully.

Thank you in advance.

Was it helpful?

Solution

I just opened a pull request with the necessary fixes. Or look at https://github.com/cwilso/smartjava.

OTHER TIPS

...and actually, I note the real problem with the code you have is not that it's using numeric values - that's wrong, according to the spec, but it's still supported - it's line 663:

filter.type = currentFilterType;

currentFilterType is "3" - that is, the STRING "3" - and type now takes a string, so it's not being coerced. If you changed this line to

filter.type = parseInt(currentFilterType);

it would actually fix the problem (because filter.type accepts ints, and will coerce them to the appropriate string of "lowpass", etc. - but it doesn't accept the string of a number.)

However, this will fail in the long term, when we remove the deprecated types.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top