Source/WebCore: Add Oscillator/WaveTable implementation and tests
authorcrogers@google.com <crogers@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Apr 2012 21:07:37 +0000 (21:07 +0000)
committercrogers@google.com <crogers@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Apr 2012 21:07:37 +0000 (21:07 +0000)
commit752b3e6812798640dc2b518b6e55499f532440c2
tree54d7cd2aeb38ec5b5447c254ad3e83926dffbd32
parent6960d398f6ce58342a3ce2ae487986b1eec4c6ba
Source/WebCore: Add Oscillator/WaveTable implementation and tests
https://bugs.webkit.org/show_bug.cgi?id=82414

Oscillator represents an audio source generating a periodic waveform.  It can be set to
a few commonly used waveforms.  Additionally, it can be set to an arbitrary periodic
waveform through the use of a WaveTable object.

Reviewed by Kenneth Russell.

Tests: webaudio/oscillator-custom.html
       webaudio/oscillator-sawtooth.html
       webaudio/oscillator-sine.html
       webaudio/oscillator-square.html
       webaudio/oscillator-triangle.html

* DerivedSources.make:
* GNUmakefile.list.am:
Add Oscillator and WaveTable to build files.
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::createOscillator):
(WebCore):
(WebCore::AudioContext::createWaveTable):
* Modules/webaudio/AudioContext.h:
Add create methods for Oscillator and WaveTable.
(WebCore):
(AudioContext):
* Modules/webaudio/AudioContext.idl:
* Modules/webaudio/AudioNode.h:
* Modules/webaudio/Oscillator.cpp: Added.
(WebCore):
(WebCore::Oscillator::create):
(WebCore::Oscillator::Oscillator):
(WebCore::Oscillator::~Oscillator):
(WebCore::Oscillator::setType):
(WebCore::Oscillator::calculateSampleAccuratePhaseIncrements):
(WebCore::Oscillator::process):
(WebCore::Oscillator::reset):
(WebCore::Oscillator::setWaveTable):
* Modules/webaudio/Oscillator.h: Added.
(WebCore):
(Oscillator):
(WebCore::Oscillator::type):
(WebCore::Oscillator::frequency):
(WebCore::Oscillator::detune):
Implement Oscillator as AudioSourceNode.
* Modules/webaudio/Oscillator.idl: Added.
* Modules/webaudio/WaveTable.cpp: Added.
(WebCore):
(WebCore::WaveTable::create):
(WebCore::WaveTable::createSine):
(WebCore::WaveTable::createSquare):
(WebCore::WaveTable::createSawtooth):
(WebCore::WaveTable::createTriangle):
(WebCore::WaveTable::WaveTable):
(WebCore::WaveTable::waveDataForFundamentalFrequency):
(WebCore::WaveTable::maxNumberOfPartials):
(WebCore::WaveTable::numberOfPartialsForRange):
(WebCore::WaveTable::createBandLimitedTables):
(WebCore::WaveTable::generateBasicWaveform):
* Modules/webaudio/WaveTable.h: Added.
(WebCore):
(WaveTable):
(WebCore::WaveTable::rateScale):
(WebCore::WaveTable::waveTableSize):
(WebCore::WaveTable::sampleRate):
(WebCore::WaveTable::numberOfRanges):
Implement WaveTable which is constructed given a set of Fourier coefficients.
* Modules/webaudio/WaveTable.idl: Added.
* WebCore.gypi:
* WebCore.xcodeproj/project.pbxproj:
Add Oscillator and WaveTable files to build files.

LayoutTests: Add Oscillator/WaveTable implementation and tests
https://bugs.webkit.org/show_bug.cgi?id=82414

Reviewed by Kenneth Russell.

* webaudio/oscillator-custom-expected.wav: Added.
* webaudio/oscillator-custom.html: Added.
* webaudio/oscillator-sawtooth-expected.wav: Added.
* webaudio/oscillator-sawtooth.html: Added.
* webaudio/oscillator-sine-expected.wav: Added.
* webaudio/oscillator-sine.html: Added.
* webaudio/oscillator-square-expected.wav: Added.
* webaudio/oscillator-square.html: Added.
* webaudio/oscillator-triangle-expected.wav: Added.
* webaudio/oscillator-triangle.html: Added.
* webaudio/resources/oscillator-testing.js: Added.
(generateExponentialOscillatorSweep):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@112938 268f45cc-cd09-0410-ab3c-d52691b4dbfc
27 files changed:
LayoutTests/ChangeLog
LayoutTests/webaudio/oscillator-custom-expected.wav [new file with mode: 0644]
LayoutTests/webaudio/oscillator-custom.html [new file with mode: 0644]
LayoutTests/webaudio/oscillator-sawtooth-expected.wav [new file with mode: 0644]
LayoutTests/webaudio/oscillator-sawtooth.html [new file with mode: 0644]
LayoutTests/webaudio/oscillator-sine-expected.wav [new file with mode: 0644]
LayoutTests/webaudio/oscillator-sine.html [new file with mode: 0644]
LayoutTests/webaudio/oscillator-square-expected.wav [new file with mode: 0644]
LayoutTests/webaudio/oscillator-square.html [new file with mode: 0644]
LayoutTests/webaudio/oscillator-triangle-expected.wav [new file with mode: 0644]
LayoutTests/webaudio/oscillator-triangle.html [new file with mode: 0644]
LayoutTests/webaudio/resources/oscillator-testing.js [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Modules/webaudio/AudioContext.cpp
Source/WebCore/Modules/webaudio/AudioContext.h
Source/WebCore/Modules/webaudio/AudioContext.idl
Source/WebCore/Modules/webaudio/AudioNode.h
Source/WebCore/Modules/webaudio/Oscillator.cpp [new file with mode: 0644]
Source/WebCore/Modules/webaudio/Oscillator.h [new file with mode: 0644]
Source/WebCore/Modules/webaudio/Oscillator.idl [new file with mode: 0644]
Source/WebCore/Modules/webaudio/WaveTable.cpp [new file with mode: 0644]
Source/WebCore/Modules/webaudio/WaveTable.h [new file with mode: 0644]
Source/WebCore/Modules/webaudio/WaveTable.idl [new file with mode: 0644]
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.xcodeproj/project.pbxproj