audiojs / web-audio-api

Node.js implementation of Web audio API
MIT License
817 stars 67 forks source link

Add PannerNode #52

Closed fand closed 8 years ago

fand commented 8 years ago

:hear_no_evil:

implemented PannerNode! Many codes are from chromium's Web Audio API implementation.

I'm sorry for +1600 diff... I didn't know PannerNode is such a complicated node.

Files

This P-R includes these files:

lib
├── AudioListener.js : AudioListener interface 
├── FloatPoint3D.js : 3D vector class for position, orientation, etc.
├── InvalidStateError.js: an error class required in the spec
├── NotSupportedError.js: an error class required in the spec
├── PannerNode
│   ├── ConeEffect.js : computes gain for sound cone
│   ├── DistanceEffect.js : computes gain for distance effect
│   ├── EqualPowerPanner.js : computes "equalpower" panning algorithm
│   ├── Panner.js : the Parent class for EqualPowerPanner, HRTFPanner (not implemented)
│   ├── PannerNode.js : main AudioNode file
│   ├── PannerProvider.js : a factory for Panner classes
│   └── index.js
└── mathUtils.js

Also there are test files for these new modules.

You can try it with speaker like this: node test/manual-testing/PannerNode-sound-output.js

Omitted features

I didn't implement HRTFPanner because it's so complicated. There's no test for setVelocity because it will be deprecated soon.

Some other modules are deprecated in the spec, but I implemented them to make it work.

License issue

I think it doesn't matter that I translated codes from chromium (which are licensed under BSD and GPLv2). If it came a problem I'll find another way... :cow2:

sebpiq commented 8 years ago

Hey! Thanks for all the great pull requests!!! This one is still work in progress I guess. Tests would be nice too.

fand commented 8 years ago

Chromium PannerNode implementation https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/modules/webaudio/PannerNode.cpp

spec https://webaudio.github.io/web-audio-api/#the-pannernode-interface http://g200kg.github.io/web-audio-api-ja/#the-pannernode-interface

fand commented 8 years ago

thx :muscle:

fand commented 8 years ago

rebased & push -f ed

fand commented 8 years ago

https://github.com/WebAudio/web-audio-api/issues/730

PannerNode's setVelocity should be removed

:woot:

hughrawlinson commented 8 years ago

Woohoo! :smile:

fand commented 8 years ago

Now it's ready for review! Updated P-R description.

sebpiq commented 8 years ago

Hi @fand ! Sorry for the slow response time, I've been super busy last week, and I will be again this week. I should be able to have a look at this the week of the 14th March. Thanks again for all the work you've done :+1: :+1: :+1:

fand commented 8 years ago

ok, thx!

sebpiq commented 8 years ago

well done! That's an awesome pull request! Amazing work you did :) I merged it. I think the whole library needs a bit of reorganization (mostly shuffling files around), cause atm it's a bit messy, but that's not your problem ...