Modified: trunk/Source/WebCore/Modules/webaudio/AudioParam.cpp (266262 => 266263)
--- trunk/Source/WebCore/Modules/webaudio/AudioParam.cpp 2020-08-27 23:47:54 UTC (rev 266262)
+++ trunk/Source/WebCore/Modules/webaudio/AudioParam.cpp 2020-08-27 23:48:31 UTC (rev 266263)
@@ -41,7 +41,7 @@
const double AudioParam::DefaultSmoothingConstant = 0.05;
const double AudioParam::SnapThreshold = 0.001;
-AudioParam::AudioParam(BaseAudioContext& context, const String& name, double defaultValue, double minValue, double maxValue, AutomationRate automationRate, AutomationRateMode automationRateMode, unsigned units)
+AudioParam::AudioParam(BaseAudioContext& context, const String& name, float defaultValue, float minValue, float maxValue, AutomationRate automationRate, AutomationRateMode automationRateMode)
: AudioSummingJunction(context)
, m_name(name)
, m_value(defaultValue)
@@ -50,7 +50,6 @@
, m_maxValue(maxValue)
, m_automationRate(automationRate)
, m_automationRateMode(automationRateMode)
- , m_units(units)
, m_smoothedValue(defaultValue)
, m_smoothingConstant(DefaultSmoothingConstant)
#if !RELEASE_LOG_DISABLED
@@ -58,7 +57,7 @@
, m_logIdentifier(context.nextAudioParameterLogIdentifier())
#endif
{
- ALWAYS_LOG(LOGIDENTIFIER, "name = ", m_name, ", value = ", m_value, ", default = ", m_defaultValue, ", min = ", m_minValue, ", max = ", m_maxValue, ", units = ", m_units);
+ ALWAYS_LOG(LOGIDENTIFIER, "name = ", m_name, ", value = ", m_value, ", default = ", m_defaultValue, ", min = ", m_minValue, ", max = ", m_maxValue);
}
float AudioParam::value()
@@ -66,13 +65,13 @@
// Update value for timeline.
if (context().isAudioThread()) {
bool hasValue;
- float timelineValue = m_timeline.valueForContextTime(context(), narrowPrecisionToFloat(m_value), hasValue);
+ float timelineValue = m_timeline.valueForContextTime(context(), m_value, hasValue);
if (hasValue)
m_value = timelineValue;
}
- return narrowPrecisionToFloat(m_value);
+ return m_value;
}
void AudioParam::setValue(float value)
@@ -96,7 +95,7 @@
float AudioParam::smoothedValue()
{
- return narrowPrecisionToFloat(m_smoothedValue);
+ return m_smoothedValue;
}
bool AudioParam::smooth()
@@ -104,7 +103,7 @@
// If values have been explicitly scheduled on the timeline, then use the exact value.
// Smoothing effectively is performed by the timeline.
bool useTimelineValue = false;
- m_value = m_timeline.valueForContextTime(context(), narrowPrecisionToFloat(m_value), useTimelineValue);
+ m_value = m_timeline.valueForContextTime(context(), m_value, useTimelineValue);
if (m_smoothedValue == m_value) {
// Smoothed value has already approached and snapped to value.
@@ -229,12 +228,12 @@
} else {
// Calculate control-rate (k-rate) intrinsic value.
bool hasValue;
- float timelineValue = m_timeline.valueForContextTime(context(), narrowPrecisionToFloat(m_value), hasValue);
+ float timelineValue = m_timeline.valueForContextTime(context(), m_value, hasValue);
if (hasValue)
m_value = timelineValue;
- values[0] = narrowPrecisionToFloat(m_value);
+ values[0] = m_value;
}
// Now sum all of the audio-rate connections together (unity-gain summing junction).
@@ -263,7 +262,7 @@
// Note we're running control rate at the sample-rate.
// Pass in the current value as default value.
- m_value = m_timeline.valuesForTimeRange(startTime, endTime, narrowPrecisionToFloat(m_value), values, numberOfValues, sampleRate, sampleRate);
+ m_value = m_timeline.valuesForTimeRange(startTime, endTime, m_value, values, numberOfValues, sampleRate, sampleRate);
}
void AudioParam::connect(AudioNodeOutput* output)
Modified: trunk/Source/WebCore/Modules/webaudio/AudioParam.h (266262 => 266263)
--- trunk/Source/WebCore/Modules/webaudio/AudioParam.h 2020-08-27 23:47:54 UTC (rev 266262)
+++ trunk/Source/WebCore/Modules/webaudio/AudioParam.h 2020-08-27 23:48:31 UTC (rev 266263)
@@ -56,9 +56,9 @@
static const double DefaultSmoothingConstant;
static const double SnapThreshold;
- static Ref<AudioParam> create(BaseAudioContext& context, const String& name, double defaultValue, double minValue, double maxValue, AutomationRate automationRate, AutomationRateMode automationRateMode = AutomationRateMode::Variable, unsigned units = 0)
+ static Ref<AudioParam> create(BaseAudioContext& context, const String& name, float defaultValue, float minValue, float maxValue, AutomationRate automationRate, AutomationRateMode automationRateMode = AutomationRateMode::Variable)
{
- return adoptRef(*new AudioParam(context, name, defaultValue, minValue, maxValue, automationRate, automationRateMode, units));
+ return adoptRef(*new AudioParam(context, name, defaultValue, minValue, maxValue, automationRate, automationRateMode));
}
// AudioSummingJunction
@@ -78,11 +78,13 @@
String name() const { return m_name; }
- float minValue() const { return static_cast<float>(m_minValue); }
- float maxValue() const { return static_cast<float>(m_maxValue); }
- float defaultValue() const { return static_cast<float>(m_defaultValue); }
- unsigned units() const { return m_units; }
+ float minValue() const { return m_minValue; }
+ float maxValue() const { return m_maxValue; }
+ float defaultValue() const { return m_defaultValue; }
+ // FIXME: Remove this once it is no longer exposed to the Web.
+ static unsigned units() { return 0; }
+
// Value smoothing:
// When a new value is set with setValue(), in our internal use of the parameter we don't immediately jump to it.
@@ -94,7 +96,7 @@
bool smooth();
void resetSmoothedValue() { m_smoothedValue = m_value; }
- void setSmoothingConstant(double k) { m_smoothingConstant = k; }
+ void setSmoothingConstant(float k) { m_smoothingConstant = k; }
// Parameter automation.
ExceptionOr<AudioParam&> setValueAtTime(float value, double startTime);
@@ -115,7 +117,7 @@
void disconnect(AudioNodeOutput*);
protected:
- AudioParam(BaseAudioContext&, const String&, double defaultValue, double minValue, double maxValue, AutomationRate, AutomationRateMode, unsigned units = 0);
+ AudioParam(BaseAudioContext&, const String&, float defaultValue, float minValue, float maxValue, AutomationRate, AutomationRateMode);
private:
// sampleAccurate corresponds to a-rate (audio rate) vs. k-rate in the Web Audio specification.
@@ -130,17 +132,16 @@
#endif
String m_name;
- double m_value;
- double m_defaultValue;
- double m_minValue;
- double m_maxValue;
+ float m_value;
+ float m_defaultValue;
+ float m_minValue;
+ float m_maxValue;
AutomationRate m_automationRate;
AutomationRateMode m_automationRateMode;
- unsigned m_units;
// Smoothing (de-zippering)
- double m_smoothedValue;
- double m_smoothingConstant;
+ float m_smoothedValue;
+ float m_smoothingConstant;
AudioParamTimeline m_timeline;