#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/platform/audio/dynamics_compressor.h"
#include <algorithm>
#include <cmath>
#include "base/logging.h"
#include "base/notreached.h"
#include "third_party/blink/renderer/platform/audio/audio_bus.h"
#include "third_party/blink/renderer/platform/audio/audio_utilities.h"
#include "third_party/blink/renderer/platform/audio/denormal_disabler.h"
#include "third_party/blink/renderer/platform/wtf/math_extras.h"
#include "third_party/fdlibm/ieee754.h"
namespace blink {
namespace {
constexpr float kMeteringReleaseTimeConstant = …;
constexpr float kUninitializedValue = …;
constexpr float kPreDelay = …;
constexpr float kReleaseZone1 = …;
constexpr float kReleaseZone2 = …;
constexpr float kReleaseZone3 = …;
constexpr float kReleaseZone4 = …;
constexpr float kABase = …;
constexpr float kBBase = …;
constexpr float kCBase = …;
constexpr float kDBase = …;
constexpr float kEBase = …;
constexpr float kSatReleaseTime = …;
float EnsureFinite(float x, float default_value) { … }
}
DynamicsCompressor::DynamicsCompressor(float sample_rate,
unsigned number_of_channels)
: … { … }
void DynamicsCompressor::Process(const AudioBus* source_bus,
AudioBus* destination_bus,
unsigned frames_to_process) { … }
void DynamicsCompressor::Reset() { … }
void DynamicsCompressor::SetNumberOfChannels(unsigned number_of_channels) { … }
void DynamicsCompressor::SetParameterValue(unsigned parameter_id, float value) { … }
float DynamicsCompressor::ParameterValue(unsigned parameter_id) const { … }
float DynamicsCompressor::SampleRate() const { … }
float DynamicsCompressor::Nyquist() const { … }
double DynamicsCompressor::TailTime() const { … }
double DynamicsCompressor::LatencyTime() const { … }
bool DynamicsCompressor::RequiresTailProcessing() const { … }
void DynamicsCompressor::InitializeParameters() { … }
void DynamicsCompressor::SetPreDelayTime(float pre_delay_time) { … }
float DynamicsCompressor::KneeCurve(float x, float k) const { … }
float DynamicsCompressor::Saturate(float x, float k) const { … }
float DynamicsCompressor::KAtSlope(float desired_slope) const { … }
float DynamicsCompressor::UpdateStaticCurveParameters(float db_threshold,
float db_knee,
float ratio) { … }
}