#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/modules/webaudio/panner_handler.h"
#include "base/metrics/histogram_functions.h"
#include "base/synchronization/lock.h"
#include "third_party/blink/renderer/modules/webaudio/audio_listener.h"
#include "third_party/blink/renderer/modules/webaudio/audio_node_input.h"
#include "third_party/blink/renderer/modules/webaudio/audio_node_output.h"
#include "third_party/blink/renderer/modules/webaudio/audio_param.h"
#include "third_party/blink/renderer/modules/webaudio/base_audio_context.h"
#include "third_party/blink/renderer/platform/audio/audio_bus.h"
#include "third_party/blink/renderer/platform/bindings/exception_messages.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/wtf/math_extras.h"
namespace blink {
namespace {
constexpr unsigned kMinimumOutputChannels = …;
constexpr unsigned kMaximumOutputChannels = …;
constexpr char kEqualPowerString[] = …;
constexpr char kHrtfString[] = …;
void FixNANs(double& x) { … }
}
PannerHandler::PannerHandler(AudioNode& node,
float sample_rate,
AudioParamHandler& position_x,
AudioParamHandler& position_y,
AudioParamHandler& position_z,
AudioParamHandler& orientation_x,
AudioParamHandler& orientation_y,
AudioParamHandler& orientation_z)
: … { … }
scoped_refptr<PannerHandler> PannerHandler::Create(
AudioNode& node,
float sample_rate,
AudioParamHandler& position_x,
AudioParamHandler& position_y,
AudioParamHandler& position_z,
AudioParamHandler& orientation_x,
AudioParamHandler& orientation_y,
AudioParamHandler& orientation_z) { … }
PannerHandler::~PannerHandler() { … }
void PannerHandler::ProcessIfNecessary(uint32_t frames_to_process) { … }
void PannerHandler::Process(uint32_t frames_to_process) { … }
void PannerHandler::ProcessSampleAccurateValues(AudioBus* destination,
const AudioBus* source,
uint32_t frames_to_process) { … }
void PannerHandler::ProcessOnlyAudioParams(uint32_t frames_to_process) { … }
void PannerHandler::Initialize() { … }
void PannerHandler::Uninitialize() { … }
String PannerHandler::PanningModel() const { … }
void PannerHandler::SetPanningModel(const String& model) { … }
bool PannerHandler::SetPanningModel(Panner::PanningModel model) { … }
String PannerHandler::DistanceModel() const { … }
void PannerHandler::SetDistanceModel(const String& model) { … }
bool PannerHandler::SetDistanceModel(unsigned model) { … }
void PannerHandler::SetRefDistance(double distance) { … }
void PannerHandler::SetMaxDistance(double distance) { … }
void PannerHandler::SetRolloffFactor(double factor) { … }
void PannerHandler::SetConeInnerAngle(double angle) { … }
void PannerHandler::SetConeOuterAngle(double angle) { … }
void PannerHandler::SetConeOuterGain(double angle) { … }
void PannerHandler::SetPosition(float x,
float y,
float z,
ExceptionState& exceptionState) { … }
void PannerHandler::SetOrientation(float x,
float y,
float z,
ExceptionState& exceptionState) { … }
void PannerHandler::CalculateAzimuthElevation(
double* out_azimuth,
double* out_elevation,
const gfx::Point3F& position,
const gfx::Point3F& listener_position,
const gfx::Vector3dF& listener_forward,
const gfx::Vector3dF& listener_up) { … }
float PannerHandler::CalculateDistanceConeGain(
const gfx::Point3F& position,
const gfx::Vector3dF& orientation,
const gfx::Point3F& listener_position) { … }
void PannerHandler::AzimuthElevation(double* out_azimuth,
double* out_elevation) { … }
float PannerHandler::DistanceConeGain() { … }
void PannerHandler::MarkPannerAsDirty(unsigned dirty) { … }
void PannerHandler::SetChannelCount(unsigned channel_count,
ExceptionState& exception_state) { … }
void PannerHandler::SetChannelCountMode(const String& mode,
ExceptionState& exception_state) { … }
gfx::Point3F PannerHandler::GetPosition() const { … }
gfx::Vector3dF PannerHandler::Orientation() const { … }
bool PannerHandler::HasSampleAccurateValues() const { … }
bool PannerHandler::IsAudioRate() const { … }
void PannerHandler::UpdateDirtyState() { … }
bool PannerHandler::RequiresTailProcessing() const { … }
}