Diff
Modified: trunk/Source/WebCore/ChangeLog (267543 => 267544)
--- trunk/Source/WebCore/ChangeLog 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/ChangeLog 2020-09-24 20:10:05 UTC (rev 267544)
@@ -1,5 +1,118 @@
2020-09-24 Chris Dumez <[email protected]>
+ Use more inline initialization and constexpr in WebAudio code
+ https://bugs.webkit.org/show_bug.cgi?id=216939
+
+ Reviewed by Darin Adler.
+
+ Use more inline initialization and constexpr in WebAudio code.
+
+ * Modules/webaudio/AudioBufferSourceNode.cpp:
+ * Modules/webaudio/AudioDestinationNode.cpp:
+ (WebCore::AudioDestinationNode::AudioDestinationNode):
+ * Modules/webaudio/AudioDestinationNode.h:
+ * Modules/webaudio/AudioNodeOutput.cpp:
+ (WebCore::AudioNodeOutput::AudioNodeOutput):
+ * Modules/webaudio/AudioNodeOutput.h:
+ * Modules/webaudio/AudioParamTimeline.h:
+ * Modules/webaudio/AudioScheduledSourceNode.cpp:
+ (WebCore::AudioScheduledSourceNode::AudioScheduledSourceNode):
+ (WebCore::AudioScheduledSourceNode::updateSchedulingInfo):
+ * Modules/webaudio/AudioScheduledSourceNode.h:
+ * Modules/webaudio/AudioSummingJunction.cpp:
+ (WebCore::AudioSummingJunction::AudioSummingJunction):
+ * Modules/webaudio/AudioSummingJunction.h:
+ * Modules/webaudio/BiquadDSPKernel.cpp:
+ * Modules/webaudio/BiquadProcessor.cpp:
+ (WebCore::BiquadProcessor::BiquadProcessor):
+ * Modules/webaudio/BiquadProcessor.h:
+ * Modules/webaudio/ConvolverNode.cpp:
+ * Modules/webaudio/DefaultAudioDestinationNode.cpp:
+ * Modules/webaudio/DelayNode.cpp:
+ * Modules/webaudio/DynamicsCompressorNode.cpp:
+ * Modules/webaudio/MediaElementAudioSourceNode.cpp:
+ * Modules/webaudio/PeriodicWave.cpp:
+ (WebCore::PeriodicWave::PeriodicWave):
+ (WebCore::PeriodicWave::waveDataForFundamentalFrequency):
+ (WebCore::PeriodicWave::numberOfPartialsForRange const):
+ * Modules/webaudio/PeriodicWave.h:
+ * Modules/webaudio/RealtimeAnalyser.cpp:
+ (WebCore::RealtimeAnalyser::RealtimeAnalyser):
+ * Modules/webaudio/RealtimeAnalyser.h:
+ * Modules/webaudio/ScriptProcessorNode.cpp:
+ (WebCore::ScriptProcessorNode::ScriptProcessorNode):
+ * Modules/webaudio/ScriptProcessorNode.h:
+ * Modules/webaudio/WaveShaperProcessor.cpp:
+ (WebCore::WaveShaperProcessor::WaveShaperProcessor):
+ * Modules/webaudio/WaveShaperProcessor.h:
+ * Modules/webaudio/WebKitAudioContext.cpp:
+ * Modules/webaudio/WebKitAudioPannerNode.cpp:
+ (WebCore::WebKitAudioPannerNode::WebKitAudioPannerNode):
+ * Modules/webaudio/WebKitAudioPannerNode.h:
+ * platform/audio/AudioBus.cpp:
+ (WebCore::AudioBus::AudioBus):
+ * platform/audio/AudioBus.h:
+ * platform/audio/AudioChannel.h:
+ * platform/audio/AudioDSPKernelProcessor.cpp:
+ (WebCore::AudioDSPKernelProcessor::AudioDSPKernelProcessor):
+ * platform/audio/AudioDSPKernelProcessor.h:
+ * platform/audio/AudioHardwareListener.cpp:
+ (WebCore::AudioHardwareListener::AudioHardwareListener):
+ * platform/audio/AudioHardwareListener.h:
+ * platform/audio/AudioResampler.cpp:
+ (WebCore::AudioResampler::AudioResampler):
+ * platform/audio/AudioResampler.h:
+ * platform/audio/AudioResamplerKernel.cpp:
+ (WebCore::AudioResamplerKernel::AudioResamplerKernel):
+ * platform/audio/AudioResamplerKernel.h:
+ * platform/audio/Biquad.cpp:
+ * platform/audio/Cone.cpp:
+ * platform/audio/Cone.h:
+ * platform/audio/Distance.cpp:
+ * platform/audio/Distance.h:
+ * platform/audio/DownSampler.cpp:
+ (WebCore::DownSampler::DownSampler):
+ * platform/audio/DownSampler.h:
+ * platform/audio/DynamicsCompressorKernel.cpp:
+ (WebCore::DynamicsCompressorKernel::DynamicsCompressorKernel):
+ * platform/audio/DynamicsCompressorKernel.h:
+ * platform/audio/EqualPowerPanner.cpp:
+ (WebCore::EqualPowerPanner::EqualPowerPanner):
+ * platform/audio/EqualPowerPanner.h:
+ * platform/audio/FFTConvolver.cpp:
+ (WebCore::FFTConvolver::FFTConvolver):
+ * platform/audio/FFTConvolver.h:
+ * platform/audio/HRTFDatabase.cpp:
+ (WebCore::HRTFDatabase::HRTFDatabase):
+ * platform/audio/HRTFDatabase.h:
+ * platform/audio/HRTFElevation.cpp:
+ * platform/audio/HRTFElevation.h:
+ * platform/audio/HRTFKernel.cpp:
+ (WebCore::HRTFKernel::HRTFKernel):
+ * platform/audio/HRTFKernel.h:
+ * platform/audio/HRTFPanner.cpp:
+ (WebCore::HRTFPanner::HRTFPanner):
+ * platform/audio/HRTFPanner.h:
+ * platform/audio/PlatformMediaSession.cpp:
+ (WebCore::PlatformMediaSession::PlatformMediaSession):
+ * platform/audio/PlatformMediaSession.h:
+ * platform/audio/PushPullFIFO.cpp:
+ (WebCore::PushPullFIFO::PushPullFIFO):
+ * platform/audio/PushPullFIFO.h:
+ * platform/audio/Reverb.cpp:
+ * platform/audio/ReverbAccumulationBuffer.cpp:
+ (WebCore::ReverbAccumulationBuffer::ReverbAccumulationBuffer):
+ * platform/audio/ReverbAccumulationBuffer.h:
+ * platform/audio/ReverbConvolver.cpp:
+ * platform/audio/ReverbConvolverStage.cpp:
+ (WebCore::ReverbConvolverStage::ReverbConvolverStage):
+ * platform/audio/ReverbConvolverStage.h:
+ * platform/audio/ReverbInputBuffer.cpp:
+ (WebCore::ReverbInputBuffer::ReverbInputBuffer):
+ * platform/audio/ReverbInputBuffer.h:
+
+2020-09-24 Chris Dumez <[email protected]>
+
Simplify AudioNode::addInput() / addOutput() call sites
https://bugs.webkit.org/show_bug.cgi?id=216941
Modified: trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -45,7 +45,7 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(AudioBufferSourceNode);
WTF_MAKE_ISO_ALLOCATED_IMPL(WebKitAudioBufferSourceNode);
-const double DefaultGrainDuration = 0.020; // 20ms
+constexpr double DefaultGrainDuration = 0.020; // 20ms
// Arbitrary upper limit on playback rate.
// Higher than expected rates can be useful when playing back oversampled buffers
Modified: trunk/Source/WebCore/Modules/webaudio/AudioDestinationNode.cpp (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/AudioDestinationNode.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/AudioDestinationNode.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -41,10 +41,6 @@
AudioDestinationNode::AudioDestinationNode(BaseAudioContext& context)
: AudioNode(context)
- , m_currentSampleFrame(0)
- , m_isSilent(true)
- , m_isEffectivelyPlayingAudio(false)
- , m_muted(false)
{
setNodeType(NodeTypeDestination);
addInput();
Modified: trunk/Source/WebCore/Modules/webaudio/AudioDestinationNode.h (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/AudioDestinationNode.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/AudioDestinationNode.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -71,11 +71,11 @@
void updateIsEffectivelyPlayingAudio();
// Counts the number of sample-frames processed by the destination.
- size_t m_currentSampleFrame;
+ size_t m_currentSampleFrame { 0 };
- bool m_isSilent;
- bool m_isEffectivelyPlayingAudio;
- bool m_muted;
+ bool m_isSilent { true };
+ bool m_isEffectivelyPlayingAudio { false };
+ bool m_muted { false };
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/webaudio/AudioNodeOutput.cpp (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/AudioNodeOutput.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/AudioNodeOutput.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -40,10 +40,6 @@
: m_node(node)
, m_numberOfChannels(numberOfChannels)
, m_desiredNumberOfChannels(numberOfChannels)
- , m_isInPlace(false)
- , m_isEnabled(true)
- , m_renderingFanOutCount(0)
- , m_renderingParamFanOutCount(0)
{
ASSERT(numberOfChannels <= AudioContext::maxNumberOfChannels());
Modified: trunk/Source/WebCore/Modules/webaudio/AudioNodeOutput.h (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/AudioNodeOutput.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/AudioNodeOutput.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -138,16 +138,16 @@
RefPtr<AudioBus> m_internalBus;
RefPtr<AudioBus> m_inPlaceBus;
// If m_isInPlace is true, use m_inPlaceBus as the valid AudioBus; If false, use the default m_internalBus.
- bool m_isInPlace;
+ bool m_isInPlace { false };
HashSet<AudioNodeInput*> m_inputs;
typedef HashSet<AudioNodeInput*>::iterator InputsIterator;
- bool m_isEnabled;
+ bool m_isEnabled { true };
// For the purposes of rendering, keeps track of the number of inputs and AudioParams we're connected to.
// These value should only be changed at the very start or end of the rendering quantum.
- unsigned m_renderingFanOutCount;
- unsigned m_renderingParamFanOutCount;
+ unsigned m_renderingFanOutCount { 0 };
+ unsigned m_renderingParamFanOutCount { 0 };
HashSet<RefPtr<AudioParam>> m_params;
typedef HashSet<RefPtr<AudioParam>>::iterator ParamsIterator;
Modified: trunk/Source/WebCore/Modules/webaudio/AudioParamTimeline.h (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/AudioParamTimeline.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/AudioParamTimeline.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -39,9 +39,7 @@
WTF_MAKE_NONCOPYABLE(AudioParamTimeline);
WTF_MAKE_FAST_ALLOCATED;
public:
- AudioParamTimeline()
- {
- }
+ AudioParamTimeline() = default;
ExceptionOr<void> setValueAtTime(float value, Seconds time);
ExceptionOr<void> linearRampToValueAtTime(float targetValue, Seconds endTime, float currentValue, Seconds currentTime);
Modified: trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.cpp (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -47,12 +47,9 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(AudioScheduledSourceNode);
-const double AudioScheduledSourceNode::UnknownTime = -1;
-
AudioScheduledSourceNode::AudioScheduledSourceNode(BaseAudioContext& context)
: AudioNode(context)
, ActiveDOMObject(context.scriptExecutionContext())
- , m_endTime(UnknownTime)
{
suspendIfNeeded();
m_pendingActivity = makePendingActivity(*this);
@@ -80,15 +77,15 @@
// Round up if the start time isn't on a frame boundary so we don't start too early.
size_t startFrame = AudioUtilities::timeToSampleFrame(m_startTime, sampleRate, AudioUtilities::SampleFrameRounding::Up);
size_t endFrame = 0;
- if (m_endTime != UnknownTime) {
+ if (m_endTime) {
// The end frame is the end time rounded up because it is an exclusive upper
// bound of the end time. We also need to take care to handle huge end
// times and clamp the corresponding frame to the largest size_t value.
- endFrame = AudioUtilities::timeToSampleFrame(m_endTime, sampleRate, AudioUtilities::SampleFrameRounding::Up);
+ endFrame = AudioUtilities::timeToSampleFrame(*m_endTime, sampleRate, AudioUtilities::SampleFrameRounding::Up);
}
// If we know the end time and it's already passed, then don't bother doing any more rendering this cycle.
- if (m_endTime != UnknownTime && endFrame <= quantumStartFrame)
+ if (m_endTime && endFrame <= quantumStartFrame)
finish();
if (m_playbackState == UNSCHEDULED_STATE || m_playbackState == FINISHED_STATE || startFrame >= quantumEndFrame) {
@@ -127,7 +124,7 @@
// Handle silence after we're done playing.
// If the end time is somewhere in the middle of this time quantum, then zero out the
// frames from the end time to the very end of the quantum.
- if (m_endTime != UnknownTime && endFrame >= quantumStartFrame && endFrame < quantumEndFrame) {
+ if (m_endTime && endFrame >= quantumStartFrame && endFrame < quantumEndFrame) {
size_t zeroStartFrame = endFrame - quantumStartFrame;
size_t framesToZero = quantumFrameSize - zeroStartFrame;
Modified: trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.h (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -90,9 +90,7 @@
// m_endTime is the time to stop playing based on the context's timeline (0 or a time less than the context's current time means "now").
// If it hasn't been set explicitly, then the sound will not stop playing (if looping) or will stop when the end of the AudioBuffer
// has been reached.
- double m_endTime; // in seconds
-
- static const double UnknownTime;
+ Optional<double> m_endTime; // in seconds
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/webaudio/AudioSummingJunction.cpp (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/AudioSummingJunction.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/AudioSummingJunction.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -36,7 +36,6 @@
AudioSummingJunction::AudioSummingJunction(BaseAudioContext& context)
: m_context(context)
- , m_renderingStateNeedUpdating(false)
{
}
Modified: trunk/Source/WebCore/Modules/webaudio/AudioSummingJunction.h (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/AudioSummingJunction.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/AudioSummingJunction.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -77,7 +77,7 @@
Vector<AudioNodeOutput*> m_renderingOutputs;
// m_renderingStateNeedUpdating keeps track if m_outputs is modified.
- bool m_renderingStateNeedUpdating;
+ bool m_renderingStateNeedUpdating { false };
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/webaudio/BiquadDSPKernel.cpp (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/BiquadDSPKernel.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/BiquadDSPKernel.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -37,12 +37,6 @@
namespace WebCore {
-// FIXME: As a recursive linear filter, depending on its parameters, a biquad filter can have
-// an infinite tailTime. In practice, Biquad filters do not usually (except for very high resonance values)
-// have a tailTime of longer than approx. 200ms. This value could possibly be calculated based on the
-// settings of the Biquad.
-static const double MaxBiquadDelayTime = 0.2;
-
static bool hasConstantValues(float* values, int framesToProcess)
{
// FIXME: Use SIMD to optimize this. This would speed up processing by a factor of 4
Modified: trunk/Source/WebCore/Modules/webaudio/BiquadProcessor.cpp (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/BiquadProcessor.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/BiquadProcessor.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -34,13 +34,10 @@
BiquadProcessor::BiquadProcessor(BaseAudioContext& context, float sampleRate, size_t numberOfChannels, bool autoInitialize)
: AudioDSPKernelProcessor(sampleRate, numberOfChannels)
- , m_type(BiquadFilterType::Lowpass)
, m_parameter1(AudioParam::create(context, "frequency", 350.0, 0.0, 0.5 * sampleRate, AutomationRate::ARate))
, m_parameter2(AudioParam::create(context, "Q", 1, -FLT_MAX, FLT_MAX, AutomationRate::ARate))
, m_parameter3(AudioParam::create(context, "gain", 0.0, -FLT_MAX, 40 * std::log10(std::numeric_limits<float>::max()), AutomationRate::ARate))
, m_parameter4(AudioParam::create(context, "detune", 0.0, -153600, 153600, AutomationRate::ARate))
- , m_filterCoefficientsDirty(true)
- , m_hasSampleAccurateValues(false)
{
if (autoInitialize)
initialize();
Modified: trunk/Source/WebCore/Modules/webaudio/BiquadProcessor.h (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/BiquadProcessor.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/BiquadProcessor.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -69,7 +69,7 @@
bool shouldUseARate() const { return m_shouldUseARate; }
private:
- BiquadFilterType m_type;
+ BiquadFilterType m_type { BiquadFilterType::Lowpass };
Ref<AudioParam> m_parameter1;
Ref<AudioParam> m_parameter2;
@@ -77,10 +77,10 @@
Ref<AudioParam> m_parameter4;
// so DSP kernels know when to re-compute coefficients
- bool m_filterCoefficientsDirty;
+ bool m_filterCoefficientsDirty { true };
// Set to true if any of the filter parameters are sample-accurate.
- bool m_hasSampleAccurateValues;
+ bool m_hasSampleAccurateValues { false };
bool m_shouldUseARate { true };
};
Modified: trunk/Source/WebCore/Modules/webaudio/ConvolverNode.cpp (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/ConvolverNode.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/ConvolverNode.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -42,7 +42,7 @@
// it's important not to make this too high. In this case 8192 is a good value.
// But, the Reverb object is multi-threaded, so we want this as high as possible without losing too much accuracy.
// Very large FFTs will have worse phase errors. Given these constraints 32768 is a good compromise.
-const size_t MaxFFTSize = 32768;
+constexpr size_t MaxFFTSize = 32768;
namespace WebCore {
Modified: trunk/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.cpp (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -37,7 +37,7 @@
#include <wtf/IsoMallocInlines.h>
#include <wtf/MainThread.h>
-const unsigned EnabledInputChannels = 2;
+constexpr unsigned EnabledInputChannels = 2;
namespace WebCore {
Modified: trunk/Source/WebCore/Modules/webaudio/DelayNode.cpp (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/DelayNode.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/DelayNode.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -36,7 +36,7 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(DelayNode);
-const double maximumAllowedDelayTime = 180;
+constexpr double maximumAllowedDelayTime = 180;
inline DelayNode::DelayNode(BaseAudioContext& context, double maxDelayTime)
: AudioBasicProcessorNode(context)
Modified: trunk/Source/WebCore/Modules/webaudio/DynamicsCompressorNode.cpp (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/DynamicsCompressorNode.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/DynamicsCompressorNode.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -38,7 +38,7 @@
#include <wtf/IsoMallocInlines.h>
// Set output to stereo by default.
-static const unsigned defaultNumberOfOutputChannels = 2;
+static constexpr unsigned defaultNumberOfOutputChannels = 2;
namespace WebCore {
Modified: trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.cpp (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -38,8 +38,8 @@
#include <wtf/Locker.h>
// These are somewhat arbitrary limits, but we need to do some kind of sanity-checking.
-const unsigned minSampleRate = 8000;
-const unsigned maxSampleRate = 192000;
+constexpr unsigned minSampleRate = 8000;
+constexpr unsigned maxSampleRate = 192000;
namespace WebCore {
Modified: trunk/Source/WebCore/Modules/webaudio/PeriodicWave.cpp (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/PeriodicWave.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/PeriodicWave.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -133,7 +133,6 @@
PeriodicWave::PeriodicWave(float sampleRate)
: m_sampleRate(sampleRate)
, m_numberOfRanges(0.5 + NumberOfOctaveBands * log2f(periodicWaveSize()))
- , m_centsPerRange(CentsPerRange)
{
float nyquist = 0.5 * m_sampleRate;
m_lowestFundamentalFrequency = nyquist / maxNumberOfPartials();
@@ -150,7 +149,7 @@
float centsAboveLowestFrequency = log2f(ratio) * 1200;
// Add one to round-up to the next range just in time to truncate partials before aliasing occurs.
- float pitchRange = 1 + centsAboveLowestFrequency / m_centsPerRange;
+ float pitchRange = 1 + centsAboveLowestFrequency / CentsPerRange;
pitchRange = std::max(pitchRange, 0.0f);
pitchRange = std::min(pitchRange, static_cast<float>(m_numberOfRanges - 1));
@@ -176,7 +175,7 @@
unsigned PeriodicWave::numberOfPartialsForRange(unsigned rangeIndex) const
{
// Number of cents below nyquist where we cull partials.
- float centsToCull = rangeIndex * m_centsPerRange;
+ float centsToCull = rangeIndex * CentsPerRange;
// A value from 0 -> 1 representing what fraction of the partials to keep.
float cullingScale = pow(2, -centsToCull / 1200);
Modified: trunk/Source/WebCore/Modules/webaudio/PeriodicWave.h (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/PeriodicWave.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/PeriodicWave.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -83,7 +83,6 @@
float m_sampleRate;
unsigned m_numberOfRanges;
- float m_centsPerRange;
// The lowest frequency (in Hertz) where playback will include all of the partials.
// Playing back lower than this frequency will gradually lose more high-frequency information.
Modified: trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyser.cpp (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyser.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyser.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -42,25 +42,9 @@
namespace WebCore {
-const double RealtimeAnalyser::DefaultSmoothingTimeConstant = 0.8;
-const double RealtimeAnalyser::DefaultMinDecibels = -100;
-const double RealtimeAnalyser::DefaultMaxDecibels = -30;
-
-const unsigned RealtimeAnalyser::DefaultFFTSize = 2048;
-// All FFT implementations are expected to handle power-of-two sizes MinFFTSize <= size <= MaxFFTSize.
-const unsigned RealtimeAnalyser::MinFFTSize = 32;
-const unsigned RealtimeAnalyser::MaxFFTSize = 32768;
-const unsigned RealtimeAnalyser::InputBufferSize = RealtimeAnalyser::MaxFFTSize * 2;
-
RealtimeAnalyser::RealtimeAnalyser()
: m_inputBuffer(InputBufferSize)
- , m_writeIndex(0)
, m_downmixBus(AudioBus::create(1, AudioUtilities::renderQuantumSize))
- , m_fftSize(DefaultFFTSize)
- , m_magnitudeBuffer(DefaultFFTSize / 2)
- , m_smoothingTimeConstant(DefaultSmoothingTimeConstant)
- , m_minDecibels(DefaultMinDecibels)
- , m_maxDecibels(DefaultMaxDecibels)
{
m_analysisFrame = makeUnique<FFTFrame>(DefaultFFTSize);
}
Modified: trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyser.h (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyser.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyser.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -65,37 +65,38 @@
// The audio thread writes input data here.
void writeInput(AudioBus*, size_t framesToProcess);
- static const double DefaultSmoothingTimeConstant;
- static const double DefaultMinDecibels;
- static const double DefaultMaxDecibels;
+ static constexpr double DefaultSmoothingTimeConstant { 0.8 };
+ static constexpr double DefaultMinDecibels { -100 };
+ static constexpr double DefaultMaxDecibels { -30 };
- static const unsigned DefaultFFTSize;
- static const unsigned MinFFTSize;
- static const unsigned MaxFFTSize;
- static const unsigned InputBufferSize;
+ // All FFT implementations are expected to handle power-of-two sizes MinFFTSize <= size <= MaxFFTSize.
+ static constexpr unsigned DefaultFFTSize { 2048 };
+ static constexpr unsigned MinFFTSize { 32 };
+ static constexpr unsigned MaxFFTSize { 32768 };
+ static constexpr unsigned InputBufferSize { MaxFFTSize * 2 };
private:
// The audio thread writes the input audio here.
AudioFloatArray m_inputBuffer;
- unsigned m_writeIndex;
+ unsigned m_writeIndex { 0 };
// AudioBus used for downmixing input audio before copying it to m_inputBuffer.
RefPtr<AudioBus> m_downmixBus;
- size_t m_fftSize;
+ size_t m_fftSize { DefaultFFTSize };
std::unique_ptr<FFTFrame> m_analysisFrame;
void doFFTAnalysisIfNecessary();
// doFFTAnalysisIfNecessary() stores the floating-point magnitude analysis data here.
- AudioFloatArray m_magnitudeBuffer;
+ AudioFloatArray m_magnitudeBuffer { DefaultFFTSize / 2 };
AudioFloatArray& magnitudeBuffer() { return m_magnitudeBuffer; }
// A value between 0 and 1 which averages the previous version of m_magnitudeBuffer with the current analysis magnitude data.
- double m_smoothingTimeConstant;
+ double m_smoothingTimeConstant { DefaultSmoothingTimeConstant };
// The range used when converting when using getByteFrequencyData().
- double m_minDecibels;
- double m_maxDecibels;
+ double m_minDecibels { DefaultMinDecibels };
+ double m_maxDecibels { DefaultMaxDecibels };
// We should only do the FFT analysis once per render quantum.
bool m_shouldDoFFTAnalysis { true };
Modified: trunk/Source/WebCore/Modules/webaudio/ScriptProcessorNode.cpp (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/ScriptProcessorNode.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/ScriptProcessorNode.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -54,9 +54,7 @@
ScriptProcessorNode::ScriptProcessorNode(BaseAudioContext& context, size_t bufferSize, unsigned numberOfInputChannels, unsigned numberOfOutputChannels)
: AudioNode(context)
, ActiveDOMObject(context.scriptExecutionContext())
- , m_doubleBufferIndex(0)
, m_bufferSize(bufferSize)
- , m_bufferReadWriteIndex(0)
, m_numberOfInputChannels(numberOfInputChannels)
, m_numberOfOutputChannels(numberOfOutputChannels)
, m_internalInputBus(AudioBus::create(numberOfInputChannels, AudioUtilities::renderQuantumSize, false))
Modified: trunk/Source/WebCore/Modules/webaudio/ScriptProcessorNode.h (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/ScriptProcessorNode.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/ScriptProcessorNode.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -81,12 +81,12 @@
// Double buffering
unsigned doubleBufferIndex() const { return m_doubleBufferIndex; }
void swapBuffers() { m_doubleBufferIndex = 1 - m_doubleBufferIndex; }
- unsigned m_doubleBufferIndex;
+ unsigned m_doubleBufferIndex { 0 };
Vector<RefPtr<AudioBuffer>> m_inputBuffers;
Vector<RefPtr<AudioBuffer>> m_outputBuffers;
size_t m_bufferSize;
- unsigned m_bufferReadWriteIndex;
+ unsigned m_bufferReadWriteIndex { 0 };
unsigned m_numberOfInputChannels;
unsigned m_numberOfOutputChannels;
Modified: trunk/Source/WebCore/Modules/webaudio/WaveShaperProcessor.cpp (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/WaveShaperProcessor.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/WaveShaperProcessor.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -34,7 +34,6 @@
WaveShaperProcessor::WaveShaperProcessor(float sampleRate, size_t numberOfChannels)
: AudioDSPKernelProcessor(sampleRate, numberOfChannels)
- , m_oversample(OverSampleNone)
{
}
Modified: trunk/Source/WebCore/Modules/webaudio/WaveShaperProcessor.h (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/WaveShaperProcessor.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/WaveShaperProcessor.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -62,7 +62,7 @@
// m_curve represents the non-linear shaping curve.
RefPtr<Float32Array> m_curve;
- OverSampleType m_oversample;
+ OverSampleType m_oversample { OverSampleNone };
// This synchronizes process() with setCurve().
mutable Lock m_processMutex;
Modified: trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.cpp (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -51,7 +51,7 @@
#include "MediaElementAudioSourceOptions.h"
#endif
-const unsigned MaxPeriodicWaveLength = 4096;
+constexpr unsigned MaxPeriodicWaveLength = 4096;
namespace WebCore {
Modified: trunk/Source/WebCore/Modules/webaudio/WebKitAudioPannerNode.cpp (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/WebKitAudioPannerNode.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/WebKitAudioPannerNode.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -50,8 +50,6 @@
WebKitAudioPannerNode::WebKitAudioPannerNode(WebKitAudioContext& context)
: PannerNodeBase(context)
- , m_panningModel(PanningModelType::HRTF)
- , m_connectionCount(0)
{
setNodeType(NodeTypePanner);
initializeDefaultNodeOptions(2, ChannelCountMode::ClampedMax, ChannelInterpretation::Speakers);
Modified: trunk/Source/WebCore/Modules/webaudio/WebKitAudioPannerNode.h (267543 => 267544)
--- trunk/Source/WebCore/Modules/webaudio/WebKitAudioPannerNode.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/Modules/webaudio/WebKitAudioPannerNode.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -129,7 +129,7 @@
void notifyAudioSourcesConnectedToNode(AudioNode*, HashSet<AudioNode*>& visitedNodes);
std::unique_ptr<Panner> m_panner;
- PanningModelType m_panningModel;
+ PanningModelType m_panningModel { PanningModelType::HRTF };
FloatPoint3D m_position;
FloatPoint3D m_orientation;
@@ -142,7 +142,7 @@
// HRTF Database loader
RefPtr<HRTFDatabaseLoader> m_hrtfDatabaseLoader;
- unsigned m_connectionCount;
+ unsigned m_connectionCount { 0 };
// Synchronize process() and setPanningModel() which can change the panner.
mutable Lock m_pannerMutex;
Modified: trunk/Source/WebCore/platform/audio/AudioBus.cpp (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/AudioBus.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/AudioBus.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -44,7 +44,7 @@
using namespace VectorMath;
-const unsigned MaxBusChannels = 32;
+constexpr unsigned MaxBusChannels = 32;
RefPtr<AudioBus> AudioBus::create(unsigned numberOfChannels, size_t length, bool allocate)
{
@@ -57,9 +57,6 @@
AudioBus::AudioBus(unsigned numberOfChannels, size_t length, bool allocate)
: m_length(length)
- , m_busGain(1)
- , m_isFirstTime(true)
- , m_sampleRate(0)
{
m_channels.reserveInitialCapacity(numberOfChannels);
Modified: trunk/Source/WebCore/platform/audio/AudioBus.h (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/AudioBus.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/AudioBus.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -160,10 +160,10 @@
size_t m_length;
Vector<std::unique_ptr<AudioChannel>> m_channels;
int m_layout;
- float m_busGain;
+ float m_busGain { 1 };
std::unique_ptr<AudioFloatArray> m_dezipperGainValues;
- bool m_isFirstTime;
- float m_sampleRate; // 0.0 if unknown or N/A
+ bool m_isFirstTime { 0 };
+ float m_sampleRate { 0 }; // 0.0 if unknown or N/A
};
} // WebCore
Modified: trunk/Source/WebCore/platform/audio/AudioChannel.h (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/AudioChannel.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/AudioChannel.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -54,19 +54,12 @@
// Manage storage for us.
explicit AudioChannel(size_t length)
: m_length(length)
- , m_rawPointer(0)
- , m_silent(true)
{
m_memBuffer = makeUnique<AudioFloatArray>(length);
}
// A "blank" audio channel -- must call set() before it's useful...
- AudioChannel()
- : m_length(0)
- , m_rawPointer(0)
- , m_silent(true)
- {
- }
+ AudioChannel() = default;
// Redefine the memory for this channel.
// storage represents external memory not managed by this object.
@@ -129,11 +122,11 @@
float maxAbsValue() const;
private:
- size_t m_length;
+ size_t m_length { 0 };
- float* m_rawPointer;
+ float* m_rawPointer { nullptr };
std::unique_ptr<AudioFloatArray> m_memBuffer;
- bool m_silent;
+ bool m_silent { true };
};
} // WebCore
Modified: trunk/Source/WebCore/platform/audio/AudioDSPKernelProcessor.cpp (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/AudioDSPKernelProcessor.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/AudioDSPKernelProcessor.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -41,7 +41,6 @@
// setNumberOfChannels() may later be called if the object is not yet in an "initialized" state.
AudioDSPKernelProcessor::AudioDSPKernelProcessor(float sampleRate, unsigned numberOfChannels)
: AudioProcessor(sampleRate, numberOfChannels)
- , m_hasJustReset(true)
{
}
Modified: trunk/Source/WebCore/platform/audio/AudioDSPKernelProcessor.h (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/AudioDSPKernelProcessor.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/AudioDSPKernelProcessor.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -69,7 +69,7 @@
protected:
Vector<std::unique_ptr<AudioDSPKernel>> m_kernels;
- bool m_hasJustReset;
+ bool m_hasJustReset { true };
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/audio/AudioHardwareListener.cpp (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/AudioHardwareListener.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/AudioHardwareListener.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -37,8 +37,6 @@
AudioHardwareListener::AudioHardwareListener(Client& client)
: m_client(client)
- , m_activity(AudioHardwareActivityType::Unknown)
- , m_outputDeviceSupportsLowPowerMode(false)
{
#if PLATFORM(IOS_FAMILY)
m_outputDeviceSupportsLowPowerMode = true;
Modified: trunk/Source/WebCore/platform/audio/AudioHardwareListener.h (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/AudioHardwareListener.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/AudioHardwareListener.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -60,8 +60,8 @@
void setOutputDeviceSupportsLowPowerMode(bool support) { m_outputDeviceSupportsLowPowerMode = support; }
Client& m_client;
- AudioHardwareActivityType m_activity;
- bool m_outputDeviceSupportsLowPowerMode;
+ AudioHardwareActivityType m_activity { AudioHardwareActivityType::Unknown };
+ bool m_outputDeviceSupportsLowPowerMode { false };
};
}
Modified: trunk/Source/WebCore/platform/audio/AudioResampler.cpp (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/AudioResampler.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/AudioResampler.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -34,10 +34,7 @@
namespace WebCore {
-const double AudioResampler::MaxRate = 8.0;
-
AudioResampler::AudioResampler()
- : m_rate(1.0)
{
m_kernels.append(makeUnique<AudioResamplerKernel>(this));
m_sourceBus = AudioBus::create(1, 0, false);
@@ -44,7 +41,6 @@
}
AudioResampler::AudioResampler(unsigned numberOfChannels)
- : m_rate(1.0)
{
for (unsigned i = 0; i < numberOfChannels; ++i)
m_kernels.append(makeUnique<AudioResamplerKernel>(this));
Modified: trunk/Source/WebCore/platform/audio/AudioResampler.h (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/AudioResampler.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/AudioResampler.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -56,10 +56,10 @@
void setRate(double rate);
double rate() const { return m_rate; }
- static const double MaxRate;
+ static constexpr double MaxRate { 8 };
private:
- double m_rate;
+ double m_rate { 1 };
Vector<std::unique_ptr<AudioResamplerKernel>> m_kernels;
RefPtr<AudioBus> m_sourceBus;
};
Modified: trunk/Source/WebCore/platform/audio/AudioResamplerKernel.cpp (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/AudioResamplerKernel.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/AudioResamplerKernel.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -38,8 +38,6 @@
: m_resampler(resampler)
// The buffer size must be large enough to hold up to two extra sample frames for the linear interpolation.
, m_sourceBuffer(2 + static_cast<int>(AudioUtilities::renderQuantumSize * AudioResampler::MaxRate))
- , m_virtualReadIndex(0.0)
- , m_fillIndex(0)
{
m_lastValues[0] = 0.0f;
m_lastValues[1] = 0.0f;
Modified: trunk/Source/WebCore/platform/audio/AudioResamplerKernel.h (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/AudioResamplerKernel.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/AudioResamplerKernel.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -63,7 +63,7 @@
AudioFloatArray m_sourceBuffer;
// This is a (floating point) read index on the input stream.
- double m_virtualReadIndex;
+ double m_virtualReadIndex { 0 };
// We need to have continuity from one call of process() to the next.
// m_lastValues stores the last two sample values from the last call to process().
@@ -70,7 +70,7 @@
// m_fillIndex represents how many buffered samples we have which can be as many as 2.
// For the first call to process() (or after reset()) there will be no buffered samples.
float m_lastValues[2];
- unsigned m_fillIndex;
+ unsigned m_fillIndex { 0 };
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/audio/Biquad.cpp (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/Biquad.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/Biquad.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -47,7 +47,7 @@
namespace WebCore {
#if USE(ACCELERATE)
-const int kBufferSize = 1024;
+constexpr int kBufferSize = 1024;
#endif
Biquad::Biquad()
Modified: trunk/Source/WebCore/platform/audio/Cone.cpp (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/Cone.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/Cone.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -35,12 +35,7 @@
namespace WebCore {
-ConeEffect::ConeEffect()
- : m_innerAngle(360.0)
- , m_outerAngle(360.0)
- , m_outerGain(0.0)
-{
-}
+ConeEffect::ConeEffect() = default;
double ConeEffect::gain(FloatPoint3D sourcePosition, FloatPoint3D sourceOrientation, FloatPoint3D listenerPosition)
{
Modified: trunk/Source/WebCore/platform/audio/Cone.h (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/Cone.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/Cone.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -54,9 +54,9 @@
double outerGain() const { return m_outerGain; }
protected:
- double m_innerAngle;
- double m_outerAngle;
- double m_outerGain;
+ double m_innerAngle { 360 };
+ double m_outerAngle { 360 };
+ double m_outerGain { 0 };
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/audio/Distance.cpp (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/Distance.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/Distance.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -37,14 +37,7 @@
namespace WebCore {
-DistanceEffect::DistanceEffect()
- : m_model(DistanceModelType::Inverse)
- , m_isClamped(true)
- , m_refDistance(1.0)
- , m_maxDistance(10000.0)
- , m_rolloffFactor(1.0)
-{
-}
+DistanceEffect::DistanceEffect() = default;
double DistanceEffect::gain(double distance)
{
Modified: trunk/Source/WebCore/platform/audio/Distance.h (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/Distance.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/Distance.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -70,11 +70,11 @@
double inverseGain(double distance);
double exponentialGain(double distance);
- DistanceModelType m_model;
- bool m_isClamped;
- double m_refDistance;
- double m_maxDistance;
- double m_rolloffFactor;
+ DistanceModelType m_model { DistanceModelType::Inverse };
+ bool m_isClamped { true };
+ double m_refDistance { 1 };
+ double m_maxDistance { 10000 };
+ double m_rolloffFactor { 1 };
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/audio/DownSampler.cpp (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/DownSampler.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/DownSampler.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -38,7 +38,6 @@
DownSampler::DownSampler(size_t inputBlockSize)
: m_inputBlockSize(inputBlockSize)
- , m_reducedKernel(DefaultKernelSize / 2)
, m_convolver(inputBlockSize / 2) // runs at 1/2 source sample-rate
, m_tempBuffer(inputBlockSize / 2)
, m_inputBuffer(inputBlockSize * 2)
Modified: trunk/Source/WebCore/platform/audio/DownSampler.h (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/DownSampler.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/DownSampler.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -57,7 +57,7 @@
// Computes ideal band-limited half-band filter coefficients.
// In other words, filter out all frequencies higher than 0.25 * Nyquist.
void initializeKernel();
- AudioFloatArray m_reducedKernel;
+ AudioFloatArray m_reducedKernel { DefaultKernelSize / 2 };
// Half-band filter.
DirectConvolver m_convolver;
Modified: trunk/Source/WebCore/platform/audio/DynamicsCompressorKernel.cpp (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/DynamicsCompressorKernel.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/DynamicsCompressorKernel.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -42,24 +42,10 @@
using namespace AudioUtilities;
// Metering hits peaks instantly, but releases this fast (in seconds).
-const float meteringReleaseTimeConstant = 0.325f;
+constexpr float meteringReleaseTimeConstant = 0.325f;
-const float uninitializedValue = -1;
-
DynamicsCompressorKernel::DynamicsCompressorKernel(float sampleRate, unsigned numberOfChannels)
: m_sampleRate(sampleRate)
- , m_lastPreDelayFrames(DefaultPreDelayFrames)
- , m_preDelayReadIndex(0)
- , m_preDelayWriteIndex(DefaultPreDelayFrames)
- , m_ratio(uninitializedValue)
- , m_slope(uninitializedValue)
- , m_linearThreshold(uninitializedValue)
- , m_dbThreshold(uninitializedValue)
- , m_dbKnee(uninitializedValue)
- , m_kneeThreshold(uninitializedValue)
- , m_kneeThresholdDb(uninitializedValue)
- , m_ykneeThresholdDb(uninitializedValue)
- , m_K(uninitializedValue)
{
setNumberOfChannels(numberOfChannels);
Modified: trunk/Source/WebCore/platform/audio/DynamicsCompressorKernel.h (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/DynamicsCompressorKernel.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/DynamicsCompressorKernel.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -74,6 +74,7 @@
double tailTime() const;
protected:
+ static constexpr float uninitializedValue = -1;
float m_sampleRate;
float m_detectorAverage;
@@ -87,12 +88,12 @@
enum { MaxPreDelayFrames = 1024 };
enum { MaxPreDelayFramesMask = MaxPreDelayFrames - 1 };
enum { DefaultPreDelayFrames = 256 }; // setPreDelayTime() will override this initial value
- unsigned m_lastPreDelayFrames;
+ unsigned m_lastPreDelayFrames { DefaultPreDelayFrames };
void setPreDelayTime(float);
Vector<std::unique_ptr<AudioFloatArray>> m_preDelayBuffers;
- int m_preDelayReadIndex;
- int m_preDelayWriteIndex;
+ int m_preDelayReadIndex { 0 };
+ int m_preDelayWriteIndex { DefaultPreDelayFrames };
float m_maxAttackCompressionDiffDb;
@@ -106,24 +107,24 @@
// Amount of input change in dB required for 1 dB of output change.
// This applies to the portion of the curve above m_kneeThresholdDb (see below).
- float m_ratio;
- float m_slope; // Inverse ratio.
+ float m_ratio { uninitializedValue };
+ float m_slope { uninitializedValue }; // Inverse ratio.
// The input to output change below the threshold is linear 1:1.
- float m_linearThreshold;
- float m_dbThreshold;
+ float m_linearThreshold { uninitializedValue };
+ float m_dbThreshold { uninitializedValue };
// m_dbKnee is the number of dB above the threshold before we enter the "ratio" portion of the curve.
// m_kneeThresholdDb = m_dbThreshold + m_dbKnee
// The portion between m_dbThreshold and m_kneeThresholdDb is the "soft knee" portion of the curve
// which transitions smoothly from the linear portion to the ratio portion.
- float m_dbKnee;
- float m_kneeThreshold;
- float m_kneeThresholdDb;
- float m_ykneeThresholdDb;
+ float m_dbKnee { uninitializedValue };
+ float m_kneeThreshold { uninitializedValue };
+ float m_kneeThresholdDb { uninitializedValue };
+ float m_ykneeThresholdDb { uninitializedValue };
// Internal parameter for the knee portion of the curve.
- float m_K;
+ float m_K { uninitializedValue };
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/audio/EqualPowerPanner.cpp (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/EqualPowerPanner.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/EqualPowerPanner.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -34,15 +34,12 @@
#include <wtf/MathExtras.h>
// Use a 50ms smoothing / de-zippering time-constant.
-const float SmoothingTimeConstant = 0.050f;
+constexpr float SmoothingTimeConstant = 0.050f;
namespace WebCore {
EqualPowerPanner::EqualPowerPanner(float sampleRate)
: Panner(PanningModelType::Equalpower)
- , m_isFirstRender(true)
- , m_gainL(0.0)
- , m_gainR(0.0)
{
m_smoothingConstant = AudioUtilities::discreteTimeConstantForSampleRate(SmoothingTimeConstant, sampleRate);
}
Modified: trunk/Source/WebCore/platform/audio/EqualPowerPanner.h (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/EqualPowerPanner.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/EqualPowerPanner.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -48,11 +48,11 @@
void calculateDesiredGain(double& desiredGainL, double& desiredGainR, double azimuth, unsigned numberOfChannels);
// For smoothing / de-zippering
- bool m_isFirstRender;
+ bool m_isFirstRender { true };
double m_smoothingConstant;
- double m_gainL;
- double m_gainR;
+ double m_gainL { 0 };
+ double m_gainR { 0 };
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/audio/FFTConvolver.cpp (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/FFTConvolver.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/FFTConvolver.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -40,7 +40,6 @@
FFTConvolver::FFTConvolver(size_t fftSize)
: m_frame(fftSize)
- , m_readWriteIndex(0)
, m_inputBuffer(fftSize) // 2nd half of buffer is always zeroed
, m_outputBuffer(fftSize)
, m_lastOverlapBuffer(fftSize / 2)
Modified: trunk/Source/WebCore/platform/audio/FFTConvolver.h (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/FFTConvolver.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/FFTConvolver.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -58,7 +58,7 @@
FFTFrame m_frame;
// Buffer input until we get fftSize / 2 samples then do an FFT
- size_t m_readWriteIndex;
+ size_t m_readWriteIndex { 0 };
AudioFloatArray m_inputBuffer;
// Stores output which we read a little at a time
Modified: trunk/Source/WebCore/platform/audio/HRTFDatabase.cpp (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/HRTFDatabase.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/HRTFDatabase.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -36,16 +36,8 @@
namespace WebCore {
-const int HRTFDatabase::MinElevation = -45;
-const int HRTFDatabase::MaxElevation = 90;
-const unsigned HRTFDatabase::RawElevationAngleSpacing = 15;
-const unsigned HRTFDatabase::NumberOfRawElevations = 10; // -45 -> +90 (each 15 degrees)
-const unsigned HRTFDatabase::InterpolationFactor = 1;
-const unsigned HRTFDatabase::NumberOfTotalElevations = NumberOfRawElevations * InterpolationFactor;
-
HRTFDatabase::HRTFDatabase(float sampleRate)
- : m_elevations(NumberOfTotalElevations)
- , m_sampleRate(sampleRate)
+ : m_sampleRate(sampleRate)
{
unsigned elevationIndex = 0;
for (int elevation = MinElevation; elevation <= MaxElevation; elevation += RawElevationAngleSpacing) {
Modified: trunk/Source/WebCore/platform/audio/HRTFDatabase.h (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/HRTFDatabase.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/HRTFDatabase.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -57,24 +57,24 @@
float sampleRate() const { return m_sampleRate; }
// Number of elevations loaded from resource.
- static const unsigned NumberOfRawElevations;
+ static const unsigned NumberOfRawElevations { 10 };
private:
// Minimum and maximum elevation angles (inclusive) for a HRTFDatabase.
- static const int MinElevation;
- static const int MaxElevation;
- static const unsigned RawElevationAngleSpacing;
+ static constexpr int MinElevation { -45 };
+ static constexpr int MaxElevation { 90 };
+ static constexpr unsigned RawElevationAngleSpacing { 15 };
// Interpolates by this factor to get the total number of elevations from every elevation loaded from resource.
- static const unsigned InterpolationFactor;
+ static constexpr unsigned InterpolationFactor { 1 };
// Total number of elevations after interpolation.
- static const unsigned NumberOfTotalElevations;
+ static constexpr unsigned NumberOfTotalElevations { NumberOfRawElevations * InterpolationFactor };
// Returns the index for the correct HRTFElevation given the elevation angle.
static unsigned indexFromElevationAngle(double);
- Vector<std::unique_ptr<HRTFElevation>> m_elevations;
+ Vector<std::unique_ptr<HRTFElevation>> m_elevations { NumberOfTotalElevations };
float m_sampleRate;
};
Modified: trunk/Source/WebCore/platform/audio/HRTFElevation.cpp (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/HRTFElevation.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/HRTFElevation.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -44,20 +44,15 @@
namespace WebCore {
-const unsigned HRTFElevation::AzimuthSpacing = 15;
-const unsigned HRTFElevation::NumberOfRawAzimuths = 360 / AzimuthSpacing;
-const unsigned HRTFElevation::InterpolationFactor = 8;
-const unsigned HRTFElevation::NumberOfTotalAzimuths = NumberOfRawAzimuths * InterpolationFactor;
-
// Total number of components of an HRTF database.
-const size_t TotalNumberOfResponses = 240;
+constexpr size_t TotalNumberOfResponses = 240;
// Number of frames in an individual impulse response.
-const size_t ResponseFrameSize = 256;
+constexpr size_t ResponseFrameSize = 256;
// Sample-rate of the spatialization impulse responses as stored in the resource file.
// The impulse responses may be resampled to a different sample-rate (depending on the audio hardware) when they are loaded.
-const float ResponseSampleRate = 44100;
+constexpr float ResponseSampleRate = 44100;
#if PLATFORM(COCOA) || USE(WEBAUDIO_GSTREAMER)
#define USE_CONCATENATED_IMPULSE_RESPONSES
Modified: trunk/Source/WebCore/platform/audio/HRTFElevation.h (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/HRTFElevation.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/HRTFElevation.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -73,16 +73,16 @@
void getKernelsFromAzimuth(double azimuthBlend, unsigned azimuthIndex, HRTFKernel* &kernelL, HRTFKernel* &kernelR, double& frameDelayL, double& frameDelayR);
// Spacing, in degrees, between every azimuth loaded from resource.
- static const unsigned AzimuthSpacing;
+ static constexpr unsigned AzimuthSpacing { 15 };
// Number of azimuths loaded from resource.
- static const unsigned NumberOfRawAzimuths;
+ static constexpr unsigned NumberOfRawAzimuths { 360 / AzimuthSpacing };
// Interpolates by this factor to get the total number of azimuths from every azimuth loaded from resource.
- static const unsigned InterpolationFactor;
+ static constexpr unsigned InterpolationFactor { 8 };
// Total number of azimuths after interpolation.
- static const unsigned NumberOfTotalAzimuths;
+ static constexpr unsigned NumberOfTotalAzimuths { NumberOfRawAzimuths * InterpolationFactor };
// Given a specific azimuth and elevation angle, returns the left and right HRTFKernel.
// Valid values for azimuth are 0 -> 345 in 15 degree increments.
Modified: trunk/Source/WebCore/platform/audio/HRTFKernel.cpp (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/HRTFKernel.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/HRTFKernel.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -68,8 +68,7 @@
}
HRTFKernel::HRTFKernel(AudioChannel* channel, size_t fftSize, float sampleRate)
- : m_frameDelay(0)
- , m_sampleRate(sampleRate)
+ : m_sampleRate(sampleRate)
{
ASSERT(channel);
Modified: trunk/Source/WebCore/platform/audio/HRTFKernel.h (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/HRTFKernel.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/HRTFKernel.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -85,7 +85,7 @@
}
std::unique_ptr<FFTFrame> m_fftFrame;
- float m_frameDelay;
+ float m_frameDelay { 0 };
float m_sampleRate;
};
Modified: trunk/Source/WebCore/platform/audio/HRTFPanner.cpp (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/HRTFPanner.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/HRTFPanner.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -40,21 +40,12 @@
// The value of 2 milliseconds is larger than the largest delay which exists in any HRTFKernel from the default HRTFDatabase (0.0136 seconds).
// We ASSERT the delay values used in process() with this value.
-const double MaxDelayTimeSeconds = 0.002;
+constexpr double MaxDelayTimeSeconds = 0.002;
-const int UninitializedAzimuth = -1;
-
HRTFPanner::HRTFPanner(float sampleRate, HRTFDatabaseLoader* databaseLoader)
: Panner(PanningModelType::HRTF)
, m_databaseLoader(databaseLoader)
, m_sampleRate(sampleRate)
- , m_crossfadeSelection(CrossfadeSelection1)
- , m_azimuthIndex1(UninitializedAzimuth)
- , m_elevation1(0)
- , m_azimuthIndex2(UninitializedAzimuth)
- , m_elevation2(0)
- , m_crossfadeX(0)
- , m_crossfadeIncr(0)
, m_convolverL1(fftSizeForSampleRate(sampleRate))
, m_convolverR1(fftSizeForSampleRate(sampleRate))
, m_convolverL2(fftSizeForSampleRate(sampleRate))
@@ -186,11 +177,11 @@
int desiredAzimuthIndex = calculateDesiredAzimuthIndexAndBlend(azimuth, azimuthBlend);
// Initially snap azimuth and elevation values to first values encountered.
- if (m_azimuthIndex1 == UninitializedAzimuth) {
+ if (!m_azimuthIndex1) {
m_azimuthIndex1 = desiredAzimuthIndex;
m_elevation1 = elevation;
}
- if (m_azimuthIndex2 == UninitializedAzimuth) {
+ if (!m_azimuthIndex2) {
m_azimuthIndex2 = desiredAzimuthIndex;
m_elevation2 = elevation;
}
@@ -202,7 +193,7 @@
// Check for azimuth and elevation changes, initiating a cross-fade if needed.
if (!m_crossfadeX && m_crossfadeSelection == CrossfadeSelection1) {
- if (desiredAzimuthIndex != m_azimuthIndex1 || elevation != m_elevation1) {
+ if (desiredAzimuthIndex != *m_azimuthIndex1 || elevation != m_elevation1) {
// Cross-fade from 1 -> 2
m_crossfadeIncr = 1 / fadeFrames;
m_azimuthIndex2 = desiredAzimuthIndex;
@@ -210,7 +201,7 @@
}
}
if (m_crossfadeX == 1 && m_crossfadeSelection == CrossfadeSelection2) {
- if (desiredAzimuthIndex != m_azimuthIndex2 || elevation != m_elevation2) {
+ if (desiredAzimuthIndex != *m_azimuthIndex2 || elevation != m_elevation2) {
// Cross-fade from 2 -> 1
m_crossfadeIncr = -1 / fadeFrames;
m_azimuthIndex1 = desiredAzimuthIndex;
@@ -235,8 +226,8 @@
double frameDelayR1;
double frameDelayL2;
double frameDelayR2;
- database->getKernelsFromAzimuthElevation(azimuthBlend, m_azimuthIndex1, m_elevation1, kernelL1, kernelR1, frameDelayL1, frameDelayR1);
- database->getKernelsFromAzimuthElevation(azimuthBlend, m_azimuthIndex2, m_elevation2, kernelL2, kernelR2, frameDelayL2, frameDelayR2);
+ database->getKernelsFromAzimuthElevation(azimuthBlend, *m_azimuthIndex1, m_elevation1, kernelL1, kernelR1, frameDelayL1, frameDelayR1);
+ database->getKernelsFromAzimuthElevation(azimuthBlend, *m_azimuthIndex2, m_elevation2, kernelL2, kernelR2, frameDelayL2, frameDelayR2);
bool areKernelsGood = kernelL1 && kernelR1 && kernelL2 && kernelR2;
ASSERT(areKernelsGood);
Modified: trunk/Source/WebCore/platform/audio/HRTFPanner.h (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/HRTFPanner.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/HRTFPanner.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -77,21 +77,21 @@
CrossfadeSelection2
};
- CrossfadeSelection m_crossfadeSelection;
+ CrossfadeSelection m_crossfadeSelection { CrossfadeSelection1 };
// azimuth/elevation for CrossfadeSelection1.
- int m_azimuthIndex1;
- double m_elevation1;
+ Optional<int> m_azimuthIndex1;
+ double m_elevation1 { 0 };
// azimuth/elevation for CrossfadeSelection2.
- int m_azimuthIndex2;
- double m_elevation2;
+ Optional<int> m_azimuthIndex2;
+ double m_elevation2 { 0 };
// A crossfade value 0 <= m_crossfadeX <= 1.
- float m_crossfadeX;
+ float m_crossfadeX { 0 };
// Per-sample-frame crossfade value increment.
- float m_crossfadeIncr;
+ float m_crossfadeIncr { 0 };
FFTConvolver m_convolverL1;
FFTConvolver m_convolverR1;
Modified: trunk/Source/WebCore/platform/audio/PlatformMediaSession.cpp (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/PlatformMediaSession.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/PlatformMediaSession.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -35,7 +35,7 @@
namespace WebCore {
-static const Seconds clientDataBufferingTimerThrottleDelay { 100_ms };
+static constexpr Seconds clientDataBufferingTimerThrottleDelay { 100_ms };
#if !RELEASE_LOG_DISABLED
String convertEnumerationToString(PlatformMediaSession::State state)
@@ -119,9 +119,6 @@
: m_manager(makeWeakPtr(manager))
, m_client(client)
, m_mediaSessionIdentifier(MediaSessionIdentifier::generate())
- , m_state(Idle)
- , m_stateToRestore(Idle)
- , m_notifyingClient(false)
#if !RELEASE_LOG_DISABLED
, m_logger(client.logger())
, m_logIdentifier(uniqueLogIdentifier())
Modified: trunk/Source/WebCore/platform/audio/PlatformMediaSession.h (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/PlatformMediaSession.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/PlatformMediaSession.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -205,11 +205,11 @@
WeakPtr<PlatformMediaSessionManager> m_manager;
PlatformMediaSessionClient& m_client;
MediaSessionIdentifier m_mediaSessionIdentifier;
- State m_state;
- State m_stateToRestore;
+ State m_state { Idle };
+ State m_stateToRestore { Idle };
InterruptionType m_interruptionType { NoInterruption };
int m_interruptionCount { 0 };
- bool m_notifyingClient;
+ bool m_notifyingClient { false };
bool m_isPlayingToWirelessPlaybackTarget { false };
bool m_hasPlayedSinceLastInterruption { false };
Modified: trunk/Source/WebCore/platform/audio/PushPullFIFO.cpp (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/PushPullFIFO.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/PushPullFIFO.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -31,12 +31,10 @@
namespace WebCore {
-const size_t PushPullFIFO::kMaxFIFOLength = 65536;
-
PushPullFIFO::PushPullFIFO(unsigned numberOfChannels, size_t fifoLength)
: m_fifoLength(fifoLength)
{
- ASSERT(m_fifoLength <= kMaxFIFOLength);
+ ASSERT(m_fifoLength <= maxFIFOLength);
m_fifoBus = AudioBus::create(numberOfChannels, m_fifoLength);
}
Modified: trunk/Source/WebCore/platform/audio/PushPullFIFO.h (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/PushPullFIFO.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/PushPullFIFO.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -42,9 +42,9 @@
public:
// Maximum FIFO length. (512 render quanta)
- static const size_t kMaxFIFOLength;
+ static constexpr size_t maxFIFOLength { 65536 };
- // |fifoLength| cannot exceed |kMaxFIFOLength|. Otherwise it crashes.
+ // |fifoLength| cannot exceed |maxFIFOLength|. Otherwise it crashes.
PushPullFIFO(unsigned numberOfChannels, size_t fifoLength);
~PushPullFIFO();
Modified: trunk/Source/WebCore/platform/audio/Reverb.cpp (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/Reverb.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/Reverb.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -44,11 +44,11 @@
using namespace VectorMath;
// Empirical gain calibration tested across many impulse responses to ensure perceived volume is same as dry (unprocessed) signal
-const float GainCalibration = -58;
-const float GainCalibrationSampleRate = 44100;
+constexpr float GainCalibration = -58;
+constexpr float GainCalibrationSampleRate = 44100;
// A minimum power value to when normalizing a silent (or very quiet) impulse response
-const float MinPower = 0.000125f;
+constexpr float MinPower = 0.000125f;
static float calculateNormalizationScale(AudioBus* response)
{
Modified: trunk/Source/WebCore/platform/audio/ReverbAccumulationBuffer.cpp (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/ReverbAccumulationBuffer.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/ReverbAccumulationBuffer.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -42,8 +42,6 @@
ReverbAccumulationBuffer::ReverbAccumulationBuffer(size_t length)
: m_buffer(length)
- , m_readIndex(0)
- , m_readTimeFrame(0)
{
}
Modified: trunk/Source/WebCore/platform/audio/ReverbAccumulationBuffer.h (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/ReverbAccumulationBuffer.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/ReverbAccumulationBuffer.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -59,8 +59,8 @@
private:
AudioFloatArray m_buffer;
- size_t m_readIndex;
- size_t m_readTimeFrame; // for debugging (frame on continuous timeline)
+ size_t m_readIndex { 0 };
+ size_t m_readTimeFrame { 0 }; // for debugging (frame on continuous timeline)
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/audio/ReverbConvolver.cpp (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/ReverbConvolver.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/ReverbConvolver.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -40,7 +40,7 @@
using namespace VectorMath;
-const int InputBufferSize = 8 * 16384;
+constexpr int InputBufferSize = 8 * 16384;
// We only process the leading portion of the impulse response in the real-time thread. We don't exceed this length.
// It turns out then, that the background thread has about 278msec of scheduling slop.
@@ -49,10 +49,10 @@
// This was found to be a good value on Mac OS X, and may work well on other platforms as well, assuming
// the very rough scheduling latencies are similar on these time-scales. Of course, this code may need to be
// tuned for individual platforms if this assumption is found to be incorrect.
-const size_t RealtimeFrameLimit = 8192 + 4096; // ~278msec @ 44.1KHz
+constexpr size_t RealtimeFrameLimit = 8192 + 4096; // ~278msec @ 44.1KHz
-const size_t MinFFTSize = 128;
-const size_t MaxRealtimeFFTSize = 2048;
+constexpr size_t MinFFTSize = 128;
+constexpr size_t MaxRealtimeFFTSize = 2048;
ReverbConvolver::ReverbConvolver(AudioChannel* impulseResponse, size_t renderSliceSize, size_t maxFFTSize, size_t convolverRenderPhase, bool useBackgroundThreads, float scale)
: m_impulseResponseLength(impulseResponse->length())
Modified: trunk/Source/WebCore/platform/audio/ReverbConvolverStage.cpp (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/ReverbConvolverStage.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/ReverbConvolverStage.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -47,8 +47,6 @@
ReverbConvolverStage::ReverbConvolverStage(const float* impulseResponse, size_t, size_t reverbTotalLatency, size_t stageOffset, size_t stageLength,
size_t fftSize, size_t renderPhase, size_t renderSliceSize, ReverbAccumulationBuffer* accumulationBuffer, float scale, bool directMode)
: m_accumulationBuffer(accumulationBuffer)
- , m_accumulationReadIndex(0)
- , m_inputReadIndex(0)
, m_directMode(directMode)
{
ASSERT(impulseResponse);
Modified: trunk/Source/WebCore/platform/audio/ReverbConvolverStage.h (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/ReverbConvolverStage.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/ReverbConvolverStage.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -67,8 +67,8 @@
AudioFloatArray m_preDelayBuffer;
ReverbAccumulationBuffer* m_accumulationBuffer;
- int m_accumulationReadIndex;
- int m_inputReadIndex;
+ int m_accumulationReadIndex { 0 };
+ int m_inputReadIndex { 0 };
size_t m_preDelayLength;
size_t m_postDelayLength;
Modified: trunk/Source/WebCore/platform/audio/ReverbInputBuffer.cpp (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/ReverbInputBuffer.cpp 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/ReverbInputBuffer.cpp 2020-09-24 20:10:05 UTC (rev 267544)
@@ -36,7 +36,6 @@
ReverbInputBuffer::ReverbInputBuffer(size_t length)
: m_buffer(length)
- , m_writeIndex(0)
{
}
Modified: trunk/Source/WebCore/platform/audio/ReverbInputBuffer.h (267543 => 267544)
--- trunk/Source/WebCore/platform/audio/ReverbInputBuffer.h 2020-09-24 19:57:28 UTC (rev 267543)
+++ trunk/Source/WebCore/platform/audio/ReverbInputBuffer.h 2020-09-24 20:10:05 UTC (rev 267544)
@@ -57,7 +57,7 @@
private:
AudioFloatArray m_buffer;
- size_t m_writeIndex;
+ size_t m_writeIndex { 0 };
};
} // namespace WebCore