summaryrefslogtreecommitdiffstats
path: root/WebCore/webaudio
diff options
context:
space:
mode:
authorShimeng (Simon) Wang <swang@google.com>2010-12-07 17:22:45 -0800
committerShimeng (Simon) Wang <swang@google.com>2010-12-22 14:15:40 -0800
commit4576aa36e9a9671459299c7963ac95aa94beaea9 (patch)
tree3863574e050f168c0126ecb47c83319fab0972d8 /WebCore/webaudio
parent55323ac613cc31553107b68603cb627264d22bb0 (diff)
downloadexternal_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.zip
external_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.tar.gz
external_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.tar.bz2
Merge WebKit at r73109: Initial merge by git.
Change-Id: I61f1a66d9642e3d8405d3ac6ccab2a53421c75d8
Diffstat (limited to 'WebCore/webaudio')
-rw-r--r--WebCore/webaudio/AudioBufferSourceNode.idl2
-rw-r--r--WebCore/webaudio/AudioContext.cpp1
-rw-r--r--WebCore/webaudio/AudioListener.h34
-rw-r--r--WebCore/webaudio/AudioPannerNode.cpp48
-rw-r--r--WebCore/webaudio/AudioPannerNode.h21
-rw-r--r--WebCore/webaudio/ConvolverNode.idl2
6 files changed, 53 insertions, 55 deletions
diff --git a/WebCore/webaudio/AudioBufferSourceNode.idl b/WebCore/webaudio/AudioBufferSourceNode.idl
index c8a3efb..dec7461 100644
--- a/WebCore/webaudio/AudioBufferSourceNode.idl
+++ b/WebCore/webaudio/AudioBufferSourceNode.idl
@@ -28,7 +28,7 @@ module audio {
Conditional=WEB_AUDIO,
GenerateToJS
] AudioBufferSourceNode : AudioSourceNode {
- attribute [Custom] AudioBuffer buffer;
+ attribute [JSCCustomSetter] AudioBuffer buffer;
readonly attribute AudioGain gain;
readonly attribute AudioParam playbackRate;
diff --git a/WebCore/webaudio/AudioContext.cpp b/WebCore/webaudio/AudioContext.cpp
index da7df1b..30198e8 100644
--- a/WebCore/webaudio/AudioContext.cpp
+++ b/WebCore/webaudio/AudioContext.cpp
@@ -43,7 +43,6 @@
#include "Document.h"
#include "HRTFDatabaseLoader.h"
#include "HRTFPanner.h"
-#include "HTMLNames.h"
#include "HighPass2FilterNode.h"
#include "JavaScriptAudioNode.h"
#include "LowPass2FilterNode.h"
diff --git a/WebCore/webaudio/AudioListener.h b/WebCore/webaudio/AudioListener.h
index 2ac1520..5281a89 100644
--- a/WebCore/webaudio/AudioListener.h
+++ b/WebCore/webaudio/AudioListener.h
@@ -29,9 +29,9 @@
#ifndef AudioListener_h
#define AudioListener_h
+#include "FloatPoint3D.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
-#include <wtf/Vector3.h>
namespace WebCore {
@@ -45,27 +45,27 @@ public:
}
// Position
- void setPosition(double x, double y, double z) { setPosition(Vector3(x, y, z)); }
- void setPosition(const Vector3 &position) { m_position = position; }
- const Vector3& position() const { return m_position; }
+ void setPosition(double x, double y, double z) { setPosition(FloatPoint3D(x, y, z)); }
+ void setPosition(const FloatPoint3D &position) { m_position = position; }
+ const FloatPoint3D& position() const { return m_position; }
// Orientation
void setOrientation(double x, double y, double z, double upX, double upY, double upZ)
{
- setOrientation(Vector3(x, y, z));
- setUpVector(Vector3(upX, upY, upZ));
+ setOrientation(FloatPoint3D(x, y, z));
+ setUpVector(FloatPoint3D(upX, upY, upZ));
}
- void setOrientation(const Vector3 &orientation) { m_orientation = orientation; }
- const Vector3& orientation() const { return m_orientation; }
+ void setOrientation(const FloatPoint3D &orientation) { m_orientation = orientation; }
+ const FloatPoint3D& orientation() const { return m_orientation; }
// Up-vector
- void setUpVector(const Vector3 &upVector) { m_upVector = upVector; }
- const Vector3& upVector() const { return m_upVector; }
+ void setUpVector(const FloatPoint3D &upVector) { m_upVector = upVector; }
+ const FloatPoint3D& upVector() const { return m_upVector; }
// Velocity
- void setVelocity(double x, double y, double z) { setVelocity(Vector3(x, y, z)); }
- void setVelocity(const Vector3 &velocity) { m_velocity = velocity; }
- const Vector3& velocity() const { return m_velocity; }
+ void setVelocity(double x, double y, double z) { setVelocity(FloatPoint3D(x, y, z)); }
+ void setVelocity(const FloatPoint3D &velocity) { m_velocity = velocity; }
+ const FloatPoint3D& velocity() const { return m_velocity; }
// Doppler factor
void setDopplerFactor(double dopplerFactor) { m_dopplerFactor = dopplerFactor; }
@@ -79,11 +79,11 @@ private:
AudioListener();
// Position / Orientation
- Vector3 m_position;
- Vector3 m_orientation;
- Vector3 m_upVector;
+ FloatPoint3D m_position;
+ FloatPoint3D m_orientation;
+ FloatPoint3D m_upVector;
- Vector3 m_velocity;
+ FloatPoint3D m_velocity;
double m_dopplerFactor;
double m_speedOfSound;
diff --git a/WebCore/webaudio/AudioPannerNode.cpp b/WebCore/webaudio/AudioPannerNode.cpp
index 4afca27..5cd17cb 100644
--- a/WebCore/webaudio/AudioPannerNode.cpp
+++ b/WebCore/webaudio/AudioPannerNode.cpp
@@ -58,9 +58,9 @@ AudioPannerNode::AudioPannerNode(AudioContext* context, double sampleRate)
m_distanceGain = AudioGain::create("distanceGain", 1.0, 0.0, 1.0);
m_coneGain = AudioGain::create("coneGain", 1.0, 0.0, 1.0);
- m_position = Vector3(0, 0, 0);
- m_orientation = Vector3(1, 0, 0);
- m_velocity = Vector3(0, 0, 0);
+ m_position = FloatPoint3D(0, 0, 0);
+ m_orientation = FloatPoint3D(1, 0, 0);
+ m_velocity = FloatPoint3D(0, 0, 0);
setType(NodeTypePanner);
@@ -165,8 +165,8 @@ void AudioPannerNode::getAzimuthElevation(double* outAzimuth, double* outElevati
double azimuth = 0.0;
// Calculate the source-listener vector
- Vector3 listenerPosition = listener()->position();
- Vector3 sourceListener = m_position - listenerPosition;
+ FloatPoint3D listenerPosition = listener()->position();
+ FloatPoint3D sourceListener = m_position - listenerPosition;
if (sourceListener.isZero()) {
// degenerate case if source and listener are at the same point
@@ -178,26 +178,26 @@ void AudioPannerNode::getAzimuthElevation(double* outAzimuth, double* outElevati
sourceListener.normalize();
// Align axes
- Vector3 listenerFront = listener()->orientation();
- Vector3 listenerUp = listener()->upVector();
- Vector3 listenerRight = cross(listenerFront, listenerUp);
+ FloatPoint3D listenerFront = listener()->orientation();
+ FloatPoint3D listenerUp = listener()->upVector();
+ FloatPoint3D listenerRight = listenerFront.cross(listenerUp);
listenerRight.normalize();
- Vector3 listenerFrontNorm = listenerFront;
+ FloatPoint3D listenerFrontNorm = listenerFront;
listenerFrontNorm.normalize();
- Vector3 up = cross(listenerRight, listenerFrontNorm);
+ FloatPoint3D up = listenerRight.cross(listenerFrontNorm);
- double upProjection = dot(sourceListener, up);
+ double upProjection = sourceListener.dot(up);
- Vector3 projectedSource = sourceListener - upProjection * up;
+ FloatPoint3D projectedSource = sourceListener - upProjection * up;
projectedSource.normalize();
- azimuth = 180.0 * acos(dot(projectedSource, listenerRight)) / M_PI;
+ azimuth = 180.0 * acos(projectedSource.dot(listenerRight)) / M_PI;
fixNANs(azimuth); // avoid illegal values
// Source in front or behind the listener
- double frontBack = dot(projectedSource, listenerFrontNorm);
+ double frontBack = projectedSource.dot(listenerFrontNorm);
if (frontBack < 0.0)
azimuth = 360.0 - azimuth;
@@ -208,7 +208,7 @@ void AudioPannerNode::getAzimuthElevation(double* outAzimuth, double* outElevati
azimuth = 450.0 - azimuth;
// Elevation
- double elevation = 90.0 - 180.0 * acos(dot(sourceListener, up)) / M_PI;
+ double elevation = 90.0 - 180.0 * acos(sourceListener.dot(up)) / M_PI;
fixNANs(azimuth); // avoid illegal values
if (elevation > 90.0)
@@ -232,8 +232,8 @@ float AudioPannerNode::dopplerRate()
if (dopplerFactor > 0.0) {
double speedOfSound = listener()->speedOfSound();
- const Vector3 &sourceVelocity = m_velocity;
- const Vector3 &listenerVelocity = listener()->velocity();
+ const FloatPoint3D &sourceVelocity = m_velocity;
+ const FloatPoint3D &listenerVelocity = listener()->velocity();
// Don't bother if both source and listener have no velocity
bool sourceHasVelocity = !sourceVelocity.isZero();
@@ -241,13 +241,13 @@ float AudioPannerNode::dopplerRate()
if (sourceHasVelocity || listenerHasVelocity) {
// Calculate the source to listener vector
- Vector3 listenerPosition = listener()->position();
- Vector3 sourceToListener = m_position - listenerPosition;
+ FloatPoint3D listenerPosition = listener()->position();
+ FloatPoint3D sourceToListener = m_position - listenerPosition;
- double sourceListenerMagnitude = sourceToListener.abs();
+ double sourceListenerMagnitude = sourceToListener.length();
- double listenerProjection = dot(sourceToListener, listenerVelocity) / sourceListenerMagnitude;
- double sourceProjection = dot(sourceToListener, sourceVelocity) / sourceListenerMagnitude;
+ double listenerProjection = sourceToListener.dot(listenerVelocity) / sourceListenerMagnitude;
+ double sourceProjection = sourceToListener.dot(sourceVelocity) / sourceListenerMagnitude;
listenerProjection = -listenerProjection;
sourceProjection = -sourceProjection;
@@ -272,9 +272,9 @@ float AudioPannerNode::dopplerRate()
float AudioPannerNode::distanceConeGain()
{
- Vector3 listenerPosition = listener()->position();
+ FloatPoint3D listenerPosition = listener()->position();
- double listenerDistance = distance(m_position, listenerPosition);
+ double listenerDistance = m_position.distanceTo(listenerPosition);
double distanceGain = m_distanceEffect.gain(listenerDistance);
m_distanceGain->setValue(static_cast<float>(distanceGain));
diff --git a/WebCore/webaudio/AudioPannerNode.h b/WebCore/webaudio/AudioPannerNode.h
index 4d49bc8..61e34a9 100644
--- a/WebCore/webaudio/AudioPannerNode.h
+++ b/WebCore/webaudio/AudioPannerNode.h
@@ -31,9 +31,9 @@
#include "AudioNode.h"
#include "Cone.h"
#include "Distance.h"
+#include "FloatPoint3D.h"
#include "Panner.h"
#include <wtf/OwnPtr.h>
-#include <wtf/Vector3.h>
namespace WebCore {
@@ -75,16 +75,16 @@ public:
void setPanningModel(unsigned short);
// Position
- Vector3 position() const { return m_position; }
- void setPosition(float x, float y, float z) { m_position = Vector3(x, y, z); }
+ FloatPoint3D position() const { return m_position; }
+ void setPosition(float x, float y, float z) { m_position = FloatPoint3D(x, y, z); }
// Orientation
- Vector3 orientation() const { return m_position; }
- void setOrientation(float x, float y, float z) { m_orientation = Vector3(x, y, z); }
+ FloatPoint3D orientation() const { return m_position; }
+ void setOrientation(float x, float y, float z) { m_orientation = FloatPoint3D(x, y, z); }
// Velocity
- Vector3 velocity() const { return m_velocity; }
- void setVelocity(float x, float y, float z) { m_velocity = Vector3(x, y, z); }
+ FloatPoint3D velocity() const { return m_velocity; }
+ void setVelocity(float x, float y, float z) { m_velocity = FloatPoint3D(x, y, z); }
// Distance parameters
unsigned short distanceModel() { return m_distanceEffect.model(); }
@@ -129,10 +129,9 @@ private:
OwnPtr<Panner> m_panner;
unsigned m_panningModel;
- // FIXME: upgrade to FloatPoint3D from Vector3.
- Vector3 m_position;
- Vector3 m_orientation;
- Vector3 m_velocity;
+ FloatPoint3D m_position;
+ FloatPoint3D m_orientation;
+ FloatPoint3D m_velocity;
// Gain
RefPtr<AudioGain> m_distanceGain;
diff --git a/WebCore/webaudio/ConvolverNode.idl b/WebCore/webaudio/ConvolverNode.idl
index cb49a45..d3eb475 100644
--- a/WebCore/webaudio/ConvolverNode.idl
+++ b/WebCore/webaudio/ConvolverNode.idl
@@ -28,6 +28,6 @@ module audio {
Conditional=WEB_AUDIO,
GenerateToJS
] ConvolverNode : AudioNode {
- attribute [Custom] AudioBuffer buffer;
+ attribute [JSCCustomSetter] AudioBuffer buffer;
};
}