Changeset 267544 in webkit
- Timestamp:
- Sep 24, 2020, 1:10:05 PM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 74 edited
-
ChangeLog (modified) (1 diff)
-
Modules/webaudio/AudioBufferSourceNode.cpp (modified) (1 diff)
-
Modules/webaudio/AudioDestinationNode.cpp (modified) (1 diff)
-
Modules/webaudio/AudioDestinationNode.h (modified) (1 diff)
-
Modules/webaudio/AudioNodeOutput.cpp (modified) (1 diff)
-
Modules/webaudio/AudioNodeOutput.h (modified) (1 diff)
-
Modules/webaudio/AudioParamTimeline.h (modified) (1 diff)
-
Modules/webaudio/AudioScheduledSourceNode.cpp (modified) (3 diffs)
-
Modules/webaudio/AudioScheduledSourceNode.h (modified) (1 diff)
-
Modules/webaudio/AudioSummingJunction.cpp (modified) (1 diff)
-
Modules/webaudio/AudioSummingJunction.h (modified) (1 diff)
-
Modules/webaudio/BiquadDSPKernel.cpp (modified) (1 diff)
-
Modules/webaudio/BiquadProcessor.cpp (modified) (1 diff)
-
Modules/webaudio/BiquadProcessor.h (modified) (2 diffs)
-
Modules/webaudio/ConvolverNode.cpp (modified) (1 diff)
-
Modules/webaudio/DefaultAudioDestinationNode.cpp (modified) (1 diff)
-
Modules/webaudio/DelayNode.cpp (modified) (1 diff)
-
Modules/webaudio/DynamicsCompressorNode.cpp (modified) (1 diff)
-
Modules/webaudio/MediaElementAudioSourceNode.cpp (modified) (1 diff)
-
Modules/webaudio/PeriodicWave.cpp (modified) (3 diffs)
-
Modules/webaudio/PeriodicWave.h (modified) (1 diff)
-
Modules/webaudio/RealtimeAnalyser.cpp (modified) (1 diff)
-
Modules/webaudio/RealtimeAnalyser.h (modified) (1 diff)
-
Modules/webaudio/ScriptProcessorNode.cpp (modified) (1 diff)
-
Modules/webaudio/ScriptProcessorNode.h (modified) (1 diff)
-
Modules/webaudio/WaveShaperProcessor.cpp (modified) (1 diff)
-
Modules/webaudio/WaveShaperProcessor.h (modified) (1 diff)
-
Modules/webaudio/WebKitAudioContext.cpp (modified) (1 diff)
-
Modules/webaudio/WebKitAudioPannerNode.cpp (modified) (1 diff)
-
Modules/webaudio/WebKitAudioPannerNode.h (modified) (2 diffs)
-
platform/audio/AudioBus.cpp (modified) (2 diffs)
-
platform/audio/AudioBus.h (modified) (1 diff)
-
platform/audio/AudioChannel.h (modified) (3 diffs)
-
platform/audio/AudioDSPKernelProcessor.cpp (modified) (1 diff)
-
platform/audio/AudioDSPKernelProcessor.h (modified) (1 diff)
-
platform/audio/AudioHardwareListener.cpp (modified) (1 diff)
-
platform/audio/AudioHardwareListener.h (modified) (1 diff)
-
platform/audio/AudioResampler.cpp (modified) (2 diffs)
-
platform/audio/AudioResampler.h (modified) (1 diff)
-
platform/audio/AudioResamplerKernel.cpp (modified) (1 diff)
-
platform/audio/AudioResamplerKernel.h (modified) (2 diffs)
-
platform/audio/Biquad.cpp (modified) (1 diff)
-
platform/audio/Cone.cpp (modified) (1 diff)
-
platform/audio/Cone.h (modified) (1 diff)
-
platform/audio/Distance.cpp (modified) (1 diff)
-
platform/audio/Distance.h (modified) (1 diff)
-
platform/audio/DownSampler.cpp (modified) (1 diff)
-
platform/audio/DownSampler.h (modified) (1 diff)
-
platform/audio/DynamicsCompressorKernel.cpp (modified) (1 diff)
-
platform/audio/DynamicsCompressorKernel.h (modified) (4 diffs)
-
platform/audio/EqualPowerPanner.cpp (modified) (2 diffs)
-
platform/audio/EqualPowerPanner.h (modified) (1 diff)
-
platform/audio/FFTConvolver.cpp (modified) (1 diff)
-
platform/audio/FFTConvolver.h (modified) (1 diff)
-
platform/audio/HRTFDatabase.cpp (modified) (1 diff)
-
platform/audio/HRTFDatabase.h (modified) (1 diff)
-
platform/audio/HRTFElevation.cpp (modified) (1 diff)
-
platform/audio/HRTFElevation.h (modified) (1 diff)
-
platform/audio/HRTFKernel.cpp (modified) (1 diff)
-
platform/audio/HRTFKernel.h (modified) (1 diff)
-
platform/audio/HRTFPanner.cpp (modified) (6 diffs)
-
platform/audio/HRTFPanner.h (modified) (1 diff)
-
platform/audio/PlatformMediaSession.cpp (modified) (2 diffs)
-
platform/audio/PlatformMediaSession.h (modified) (1 diff)
-
platform/audio/PushPullFIFO.cpp (modified) (1 diff)
-
platform/audio/PushPullFIFO.h (modified) (1 diff)
-
platform/audio/Reverb.cpp (modified) (1 diff)
-
platform/audio/ReverbAccumulationBuffer.cpp (modified) (1 diff)
-
platform/audio/ReverbAccumulationBuffer.h (modified) (1 diff)
-
platform/audio/ReverbConvolver.cpp (modified) (2 diffs)
-
platform/audio/ReverbConvolverStage.cpp (modified) (1 diff)
-
platform/audio/ReverbConvolverStage.h (modified) (1 diff)
-
platform/audio/ReverbInputBuffer.cpp (modified) (1 diff)
-
platform/audio/ReverbInputBuffer.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r267543 r267544 1 2020-09-24 Chris Dumez <cdumez@apple.com> 2 3 Use more inline initialization and constexpr in WebAudio code 4 https://bugs.webkit.org/show_bug.cgi?id=216939 5 6 Reviewed by Darin Adler. 7 8 Use more inline initialization and constexpr in WebAudio code. 9 10 * Modules/webaudio/AudioBufferSourceNode.cpp: 11 * Modules/webaudio/AudioDestinationNode.cpp: 12 (WebCore::AudioDestinationNode::AudioDestinationNode): 13 * Modules/webaudio/AudioDestinationNode.h: 14 * Modules/webaudio/AudioNodeOutput.cpp: 15 (WebCore::AudioNodeOutput::AudioNodeOutput): 16 * Modules/webaudio/AudioNodeOutput.h: 17 * Modules/webaudio/AudioParamTimeline.h: 18 * Modules/webaudio/AudioScheduledSourceNode.cpp: 19 (WebCore::AudioScheduledSourceNode::AudioScheduledSourceNode): 20 (WebCore::AudioScheduledSourceNode::updateSchedulingInfo): 21 * Modules/webaudio/AudioScheduledSourceNode.h: 22 * Modules/webaudio/AudioSummingJunction.cpp: 23 (WebCore::AudioSummingJunction::AudioSummingJunction): 24 * Modules/webaudio/AudioSummingJunction.h: 25 * Modules/webaudio/BiquadDSPKernel.cpp: 26 * Modules/webaudio/BiquadProcessor.cpp: 27 (WebCore::BiquadProcessor::BiquadProcessor): 28 * Modules/webaudio/BiquadProcessor.h: 29 * Modules/webaudio/ConvolverNode.cpp: 30 * Modules/webaudio/DefaultAudioDestinationNode.cpp: 31 * Modules/webaudio/DelayNode.cpp: 32 * Modules/webaudio/DynamicsCompressorNode.cpp: 33 * Modules/webaudio/MediaElementAudioSourceNode.cpp: 34 * Modules/webaudio/PeriodicWave.cpp: 35 (WebCore::PeriodicWave::PeriodicWave): 36 (WebCore::PeriodicWave::waveDataForFundamentalFrequency): 37 (WebCore::PeriodicWave::numberOfPartialsForRange const): 38 * Modules/webaudio/PeriodicWave.h: 39 * Modules/webaudio/RealtimeAnalyser.cpp: 40 (WebCore::RealtimeAnalyser::RealtimeAnalyser): 41 * Modules/webaudio/RealtimeAnalyser.h: 42 * Modules/webaudio/ScriptProcessorNode.cpp: 43 (WebCore::ScriptProcessorNode::ScriptProcessorNode): 44 * Modules/webaudio/ScriptProcessorNode.h: 45 * Modules/webaudio/WaveShaperProcessor.cpp: 46 (WebCore::WaveShaperProcessor::WaveShaperProcessor): 47 * Modules/webaudio/WaveShaperProcessor.h: 48 * Modules/webaudio/WebKitAudioContext.cpp: 49 * Modules/webaudio/WebKitAudioPannerNode.cpp: 50 (WebCore::WebKitAudioPannerNode::WebKitAudioPannerNode): 51 * Modules/webaudio/WebKitAudioPannerNode.h: 52 * platform/audio/AudioBus.cpp: 53 (WebCore::AudioBus::AudioBus): 54 * platform/audio/AudioBus.h: 55 * platform/audio/AudioChannel.h: 56 * platform/audio/AudioDSPKernelProcessor.cpp: 57 (WebCore::AudioDSPKernelProcessor::AudioDSPKernelProcessor): 58 * platform/audio/AudioDSPKernelProcessor.h: 59 * platform/audio/AudioHardwareListener.cpp: 60 (WebCore::AudioHardwareListener::AudioHardwareListener): 61 * platform/audio/AudioHardwareListener.h: 62 * platform/audio/AudioResampler.cpp: 63 (WebCore::AudioResampler::AudioResampler): 64 * platform/audio/AudioResampler.h: 65 * platform/audio/AudioResamplerKernel.cpp: 66 (WebCore::AudioResamplerKernel::AudioResamplerKernel): 67 * platform/audio/AudioResamplerKernel.h: 68 * platform/audio/Biquad.cpp: 69 * platform/audio/Cone.cpp: 70 * platform/audio/Cone.h: 71 * platform/audio/Distance.cpp: 72 * platform/audio/Distance.h: 73 * platform/audio/DownSampler.cpp: 74 (WebCore::DownSampler::DownSampler): 75 * platform/audio/DownSampler.h: 76 * platform/audio/DynamicsCompressorKernel.cpp: 77 (WebCore::DynamicsCompressorKernel::DynamicsCompressorKernel): 78 * platform/audio/DynamicsCompressorKernel.h: 79 * platform/audio/EqualPowerPanner.cpp: 80 (WebCore::EqualPowerPanner::EqualPowerPanner): 81 * platform/audio/EqualPowerPanner.h: 82 * platform/audio/FFTConvolver.cpp: 83 (WebCore::FFTConvolver::FFTConvolver): 84 * platform/audio/FFTConvolver.h: 85 * platform/audio/HRTFDatabase.cpp: 86 (WebCore::HRTFDatabase::HRTFDatabase): 87 * platform/audio/HRTFDatabase.h: 88 * platform/audio/HRTFElevation.cpp: 89 * platform/audio/HRTFElevation.h: 90 * platform/audio/HRTFKernel.cpp: 91 (WebCore::HRTFKernel::HRTFKernel): 92 * platform/audio/HRTFKernel.h: 93 * platform/audio/HRTFPanner.cpp: 94 (WebCore::HRTFPanner::HRTFPanner): 95 * platform/audio/HRTFPanner.h: 96 * platform/audio/PlatformMediaSession.cpp: 97 (WebCore::PlatformMediaSession::PlatformMediaSession): 98 * platform/audio/PlatformMediaSession.h: 99 * platform/audio/PushPullFIFO.cpp: 100 (WebCore::PushPullFIFO::PushPullFIFO): 101 * platform/audio/PushPullFIFO.h: 102 * platform/audio/Reverb.cpp: 103 * platform/audio/ReverbAccumulationBuffer.cpp: 104 (WebCore::ReverbAccumulationBuffer::ReverbAccumulationBuffer): 105 * platform/audio/ReverbAccumulationBuffer.h: 106 * platform/audio/ReverbConvolver.cpp: 107 * platform/audio/ReverbConvolverStage.cpp: 108 (WebCore::ReverbConvolverStage::ReverbConvolverStage): 109 * platform/audio/ReverbConvolverStage.h: 110 * platform/audio/ReverbInputBuffer.cpp: 111 (WebCore::ReverbInputBuffer::ReverbInputBuffer): 112 * platform/audio/ReverbInputBuffer.h: 113 1 114 2020-09-24 Chris Dumez <cdumez@apple.com> 2 115 -
trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp
r267543 r267544 46 46 WTF_MAKE_ISO_ALLOCATED_IMPL(WebKitAudioBufferSourceNode); 47 47 48 const double DefaultGrainDuration = 0.020; // 20ms48 constexpr double DefaultGrainDuration = 0.020; // 20ms 49 49 50 50 // Arbitrary upper limit on playback rate. -
trunk/Source/WebCore/Modules/webaudio/AudioDestinationNode.cpp
r267543 r267544 42 42 AudioDestinationNode::AudioDestinationNode(BaseAudioContext& context) 43 43 : AudioNode(context) 44 , m_currentSampleFrame(0)45 , m_isSilent(true)46 , m_isEffectivelyPlayingAudio(false)47 , m_muted(false)48 44 { 49 45 setNodeType(NodeTypeDestination); -
trunk/Source/WebCore/Modules/webaudio/AudioDestinationNode.h
r267537 r267544 72 72 73 73 // Counts the number of sample-frames processed by the destination. 74 size_t m_currentSampleFrame ;74 size_t m_currentSampleFrame { 0 }; 75 75 76 bool m_isSilent ;77 bool m_isEffectivelyPlayingAudio ;78 bool m_muted ;76 bool m_isSilent { true }; 77 bool m_isEffectivelyPlayingAudio { false }; 78 bool m_muted { false }; 79 79 }; 80 80 -
trunk/Source/WebCore/Modules/webaudio/AudioNodeOutput.cpp
r267541 r267544 41 41 , m_numberOfChannels(numberOfChannels) 42 42 , m_desiredNumberOfChannels(numberOfChannels) 43 , m_isInPlace(false)44 , m_isEnabled(true)45 , m_renderingFanOutCount(0)46 , m_renderingParamFanOutCount(0)47 43 { 48 44 ASSERT(numberOfChannels <= AudioContext::maxNumberOfChannels()); -
trunk/Source/WebCore/Modules/webaudio/AudioNodeOutput.h
r266518 r267544 139 139 RefPtr<AudioBus> m_inPlaceBus; 140 140 // If m_isInPlace is true, use m_inPlaceBus as the valid AudioBus; If false, use the default m_internalBus. 141 bool m_isInPlace ;141 bool m_isInPlace { false }; 142 142 143 143 HashSet<AudioNodeInput*> m_inputs; 144 144 typedef HashSet<AudioNodeInput*>::iterator InputsIterator; 145 bool m_isEnabled ;145 bool m_isEnabled { true }; 146 146 147 147 // For the purposes of rendering, keeps track of the number of inputs and AudioParams we're connected to. 148 148 // These value should only be changed at the very start or end of the rendering quantum. 149 unsigned m_renderingFanOutCount ;150 unsigned m_renderingParamFanOutCount ;149 unsigned m_renderingFanOutCount { 0 }; 150 unsigned m_renderingParamFanOutCount { 0 }; 151 151 152 152 HashSet<RefPtr<AudioParam>> m_params; -
trunk/Source/WebCore/Modules/webaudio/AudioParamTimeline.h
r267381 r267544 40 40 WTF_MAKE_FAST_ALLOCATED; 41 41 public: 42 AudioParamTimeline() 43 { 44 } 42 AudioParamTimeline() = default; 45 43 46 44 ExceptionOr<void> setValueAtTime(float value, Seconds time); -
trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.cpp
r267541 r267544 48 48 WTF_MAKE_ISO_ALLOCATED_IMPL(AudioScheduledSourceNode); 49 49 50 const double AudioScheduledSourceNode::UnknownTime = -1;51 52 50 AudioScheduledSourceNode::AudioScheduledSourceNode(BaseAudioContext& context) 53 51 : AudioNode(context) 54 52 , ActiveDOMObject(context.scriptExecutionContext()) 55 , m_endTime(UnknownTime)56 53 { 57 54 suspendIfNeeded(); … … 81 78 size_t startFrame = AudioUtilities::timeToSampleFrame(m_startTime, sampleRate, AudioUtilities::SampleFrameRounding::Up); 82 79 size_t endFrame = 0; 83 if (m_endTime != UnknownTime) {80 if (m_endTime) { 84 81 // The end frame is the end time rounded up because it is an exclusive upper 85 82 // bound of the end time. We also need to take care to handle huge end 86 83 // times and clamp the corresponding frame to the largest size_t value. 87 endFrame = AudioUtilities::timeToSampleFrame( m_endTime, sampleRate, AudioUtilities::SampleFrameRounding::Up);84 endFrame = AudioUtilities::timeToSampleFrame(*m_endTime, sampleRate, AudioUtilities::SampleFrameRounding::Up); 88 85 } 89 86 90 87 // If we know the end time and it's already passed, then don't bother doing any more rendering this cycle. 91 if (m_endTime != UnknownTime&& endFrame <= quantumStartFrame)88 if (m_endTime && endFrame <= quantumStartFrame) 92 89 finish(); 93 90 … … 128 125 // If the end time is somewhere in the middle of this time quantum, then zero out the 129 126 // frames from the end time to the very end of the quantum. 130 if (m_endTime != UnknownTime&& endFrame >= quantumStartFrame && endFrame < quantumEndFrame) {127 if (m_endTime && endFrame >= quantumStartFrame && endFrame < quantumEndFrame) { 131 128 size_t zeroStartFrame = endFrame - quantumStartFrame; 132 129 size_t framesToZero = quantumFrameSize - zeroStartFrame; -
trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.h
r266417 r267544 91 91 // 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 92 92 // has been reached. 93 double m_endTime; // in seconds 94 95 static const double UnknownTime; 93 Optional<double> m_endTime; // in seconds 96 94 }; 97 95 -
trunk/Source/WebCore/Modules/webaudio/AudioSummingJunction.cpp
r263410 r267544 37 37 AudioSummingJunction::AudioSummingJunction(BaseAudioContext& context) 38 38 : m_context(context) 39 , m_renderingStateNeedUpdating(false)40 39 { 41 40 } -
trunk/Source/WebCore/Modules/webaudio/AudioSummingJunction.h
r263410 r267544 78 78 79 79 // m_renderingStateNeedUpdating keeps track if m_outputs is modified. 80 bool m_renderingStateNeedUpdating ;80 bool m_renderingStateNeedUpdating { false }; 81 81 }; 82 82 -
trunk/Source/WebCore/Modules/webaudio/BiquadDSPKernel.cpp
r267541 r267544 38 38 namespace WebCore { 39 39 40 // FIXME: As a recursive linear filter, depending on its parameters, a biquad filter can have41 // an infinite tailTime. In practice, Biquad filters do not usually (except for very high resonance values)42 // have a tailTime of longer than approx. 200ms. This value could possibly be calculated based on the43 // settings of the Biquad.44 static const double MaxBiquadDelayTime = 0.2;45 46 40 static bool hasConstantValues(float* values, int framesToProcess) 47 41 { -
trunk/Source/WebCore/Modules/webaudio/BiquadProcessor.cpp
r267541 r267544 35 35 BiquadProcessor::BiquadProcessor(BaseAudioContext& context, float sampleRate, size_t numberOfChannels, bool autoInitialize) 36 36 : AudioDSPKernelProcessor(sampleRate, numberOfChannels) 37 , m_type(BiquadFilterType::Lowpass)38 37 , m_parameter1(AudioParam::create(context, "frequency", 350.0, 0.0, 0.5 * sampleRate, AutomationRate::ARate)) 39 38 , m_parameter2(AudioParam::create(context, "Q", 1, -FLT_MAX, FLT_MAX, AutomationRate::ARate)) 40 39 , m_parameter3(AudioParam::create(context, "gain", 0.0, -FLT_MAX, 40 * std::log10(std::numeric_limits<float>::max()), AutomationRate::ARate)) 41 40 , m_parameter4(AudioParam::create(context, "detune", 0.0, -153600, 153600, AutomationRate::ARate)) 42 , m_filterCoefficientsDirty(true)43 , m_hasSampleAccurateValues(false)44 41 { 45 42 if (autoInitialize) -
trunk/Source/WebCore/Modules/webaudio/BiquadProcessor.h
r267432 r267544 70 70 71 71 private: 72 BiquadFilterType m_type ;72 BiquadFilterType m_type { BiquadFilterType::Lowpass }; 73 73 74 74 Ref<AudioParam> m_parameter1; … … 78 78 79 79 // so DSP kernels know when to re-compute coefficients 80 bool m_filterCoefficientsDirty ;80 bool m_filterCoefficientsDirty { true }; 81 81 82 82 // Set to true if any of the filter parameters are sample-accurate. 83 bool m_hasSampleAccurateValues ;83 bool m_hasSampleAccurateValues { false }; 84 84 85 85 bool m_shouldUseARate { true }; -
trunk/Source/WebCore/Modules/webaudio/ConvolverNode.cpp
r267543 r267544 43 43 // But, the Reverb object is multi-threaded, so we want this as high as possible without losing too much accuracy. 44 44 // Very large FFTs will have worse phase errors. Given these constraints 32768 is a good compromise. 45 const size_t MaxFFTSize = 32768;45 constexpr size_t MaxFFTSize = 32768; 46 46 47 47 namespace WebCore { -
trunk/Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.cpp
r267014 r267544 38 38 #include <wtf/MainThread.h> 39 39 40 const unsigned EnabledInputChannels = 2;40 constexpr unsigned EnabledInputChannels = 2; 41 41 42 42 namespace WebCore { -
trunk/Source/WebCore/Modules/webaudio/DelayNode.cpp
r267432 r267544 37 37 WTF_MAKE_ISO_ALLOCATED_IMPL(DelayNode); 38 38 39 const double maximumAllowedDelayTime = 180;39 constexpr double maximumAllowedDelayTime = 180; 40 40 41 41 inline DelayNode::DelayNode(BaseAudioContext& context, double maxDelayTime) -
trunk/Source/WebCore/Modules/webaudio/DynamicsCompressorNode.cpp
r267543 r267544 39 39 40 40 // Set output to stereo by default. 41 static const unsigned defaultNumberOfOutputChannels = 2;41 static constexpr unsigned defaultNumberOfOutputChannels = 2; 42 42 43 43 namespace WebCore { -
trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.cpp
r267543 r267544 39 39 40 40 // These are somewhat arbitrary limits, but we need to do some kind of sanity-checking. 41 const unsigned minSampleRate = 8000;42 const unsigned maxSampleRate = 192000;41 constexpr unsigned minSampleRate = 8000; 42 constexpr unsigned maxSampleRate = 192000; 43 43 44 44 namespace WebCore { -
trunk/Source/WebCore/Modules/webaudio/PeriodicWave.cpp
r267383 r267544 134 134 : m_sampleRate(sampleRate) 135 135 , m_numberOfRanges(0.5 + NumberOfOctaveBands * log2f(periodicWaveSize())) 136 , m_centsPerRange(CentsPerRange)137 136 { 138 137 float nyquist = 0.5 * m_sampleRate; … … 151 150 152 151 // Add one to round-up to the next range just in time to truncate partials before aliasing occurs. 153 float pitchRange = 1 + centsAboveLowestFrequency / m_centsPerRange;152 float pitchRange = 1 + centsAboveLowestFrequency / CentsPerRange; 154 153 155 154 pitchRange = std::max(pitchRange, 0.0f); … … 177 176 { 178 177 // Number of cents below nyquist where we cull partials. 179 float centsToCull = rangeIndex * m_centsPerRange;178 float centsToCull = rangeIndex * CentsPerRange; 180 179 181 180 // A value from 0 -> 1 representing what fraction of the partials to keep. -
trunk/Source/WebCore/Modules/webaudio/PeriodicWave.h
r267153 r267544 84 84 float m_sampleRate; 85 85 unsigned m_numberOfRanges; 86 float m_centsPerRange;87 86 88 87 // The lowest frequency (in Hertz) where playback will include all of the partials. -
trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyser.cpp
r267541 r267544 43 43 namespace WebCore { 44 44 45 const double RealtimeAnalyser::DefaultSmoothingTimeConstant = 0.8;46 const double RealtimeAnalyser::DefaultMinDecibels = -100;47 const double RealtimeAnalyser::DefaultMaxDecibels = -30;48 49 const unsigned RealtimeAnalyser::DefaultFFTSize = 2048;50 // All FFT implementations are expected to handle power-of-two sizes MinFFTSize <= size <= MaxFFTSize.51 const unsigned RealtimeAnalyser::MinFFTSize = 32;52 const unsigned RealtimeAnalyser::MaxFFTSize = 32768;53 const unsigned RealtimeAnalyser::InputBufferSize = RealtimeAnalyser::MaxFFTSize * 2;54 55 45 RealtimeAnalyser::RealtimeAnalyser() 56 46 : m_inputBuffer(InputBufferSize) 57 , m_writeIndex(0)58 47 , m_downmixBus(AudioBus::create(1, AudioUtilities::renderQuantumSize)) 59 , m_fftSize(DefaultFFTSize)60 , m_magnitudeBuffer(DefaultFFTSize / 2)61 , m_smoothingTimeConstant(DefaultSmoothingTimeConstant)62 , m_minDecibels(DefaultMinDecibels)63 , m_maxDecibels(DefaultMaxDecibels)64 48 { 65 49 m_analysisFrame = makeUnique<FFTFrame>(DefaultFFTSize); -
trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyser.h
r267537 r267544 66 66 void writeInput(AudioBus*, size_t framesToProcess); 67 67 68 static const double DefaultSmoothingTimeConstant;69 static const double DefaultMinDecibels;70 static const double DefaultMaxDecibels;68 static constexpr double DefaultSmoothingTimeConstant { 0.8 }; 69 static constexpr double DefaultMinDecibels { -100 }; 70 static constexpr double DefaultMaxDecibels { -30 }; 71 71 72 static const unsigned DefaultFFTSize; 73 static const unsigned MinFFTSize; 74 static const unsigned MaxFFTSize; 75 static const unsigned InputBufferSize; 72 // All FFT implementations are expected to handle power-of-two sizes MinFFTSize <= size <= MaxFFTSize. 73 static constexpr unsigned DefaultFFTSize { 2048 }; 74 static constexpr unsigned MinFFTSize { 32 }; 75 static constexpr unsigned MaxFFTSize { 32768 }; 76 static constexpr unsigned InputBufferSize { MaxFFTSize * 2 }; 76 77 77 78 private: 78 79 // The audio thread writes the input audio here. 79 80 AudioFloatArray m_inputBuffer; 80 unsigned m_writeIndex ;81 unsigned m_writeIndex { 0 }; 81 82 82 83 // AudioBus used for downmixing input audio before copying it to m_inputBuffer. 83 84 RefPtr<AudioBus> m_downmixBus; 84 85 85 size_t m_fftSize ;86 size_t m_fftSize { DefaultFFTSize }; 86 87 std::unique_ptr<FFTFrame> m_analysisFrame; 87 88 void doFFTAnalysisIfNecessary(); 88 89 89 90 // doFFTAnalysisIfNecessary() stores the floating-point magnitude analysis data here. 90 AudioFloatArray m_magnitudeBuffer ;91 AudioFloatArray m_magnitudeBuffer { DefaultFFTSize / 2 }; 91 92 AudioFloatArray& magnitudeBuffer() { return m_magnitudeBuffer; } 92 93 93 94 // A value between 0 and 1 which averages the previous version of m_magnitudeBuffer with the current analysis magnitude data. 94 double m_smoothingTimeConstant ;95 double m_smoothingTimeConstant { DefaultSmoothingTimeConstant }; 95 96 96 97 // The range used when converting when using getByteFrequencyData(). 97 double m_minDecibels ;98 double m_maxDecibels ;98 double m_minDecibels { DefaultMinDecibels }; 99 double m_maxDecibels { DefaultMaxDecibels }; 99 100 100 101 // We should only do the FFT analysis once per render quantum. -
trunk/Source/WebCore/Modules/webaudio/ScriptProcessorNode.cpp
r267543 r267544 55 55 : AudioNode(context) 56 56 , ActiveDOMObject(context.scriptExecutionContext()) 57 , m_doubleBufferIndex(0)58 57 , m_bufferSize(bufferSize) 59 , m_bufferReadWriteIndex(0)60 58 , m_numberOfInputChannels(numberOfInputChannels) 61 59 , m_numberOfOutputChannels(numberOfOutputChannels) -
trunk/Source/WebCore/Modules/webaudio/ScriptProcessorNode.h
r267537 r267544 82 82 unsigned doubleBufferIndex() const { return m_doubleBufferIndex; } 83 83 void swapBuffers() { m_doubleBufferIndex = 1 - m_doubleBufferIndex; } 84 unsigned m_doubleBufferIndex ;84 unsigned m_doubleBufferIndex { 0 }; 85 85 Vector<RefPtr<AudioBuffer>> m_inputBuffers; 86 86 Vector<RefPtr<AudioBuffer>> m_outputBuffers; 87 87 88 88 size_t m_bufferSize; 89 unsigned m_bufferReadWriteIndex ;89 unsigned m_bufferReadWriteIndex { 0 }; 90 90 91 91 unsigned m_numberOfInputChannels; -
trunk/Source/WebCore/Modules/webaudio/WaveShaperProcessor.cpp
r257688 r267544 35 35 WaveShaperProcessor::WaveShaperProcessor(float sampleRate, size_t numberOfChannels) 36 36 : AudioDSPKernelProcessor(sampleRate, numberOfChannels) 37 , m_oversample(OverSampleNone)38 37 { 39 38 } -
trunk/Source/WebCore/Modules/webaudio/WaveShaperProcessor.h
r233650 r267544 63 63 RefPtr<Float32Array> m_curve; 64 64 65 OverSampleType m_oversample ;65 OverSampleType m_oversample { OverSampleNone }; 66 66 67 67 // This synchronizes process() with setCurve(). -
trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.cpp
r267147 r267544 52 52 #endif 53 53 54 const unsigned MaxPeriodicWaveLength = 4096;54 constexpr unsigned MaxPeriodicWaveLength = 4096; 55 55 56 56 namespace WebCore { -
trunk/Source/WebCore/Modules/webaudio/WebKitAudioPannerNode.cpp
r267543 r267544 51 51 WebKitAudioPannerNode::WebKitAudioPannerNode(WebKitAudioContext& context) 52 52 : PannerNodeBase(context) 53 , m_panningModel(PanningModelType::HRTF)54 , m_connectionCount(0)55 53 { 56 54 setNodeType(NodeTypePanner); -
trunk/Source/WebCore/Modules/webaudio/WebKitAudioPannerNode.h
r267537 r267544 130 130 131 131 std::unique_ptr<Panner> m_panner; 132 PanningModelType m_panningModel ;132 PanningModelType m_panningModel { PanningModelType::HRTF }; 133 133 134 134 FloatPoint3D m_position; … … 143 143 RefPtr<HRTFDatabaseLoader> m_hrtfDatabaseLoader; 144 144 145 unsigned m_connectionCount ;145 unsigned m_connectionCount { 0 }; 146 146 147 147 // Synchronize process() and setPanningModel() which can change the panner. -
trunk/Source/WebCore/platform/audio/AudioBus.cpp
r266794 r267544 45 45 using namespace VectorMath; 46 46 47 const unsigned MaxBusChannels = 32;47 constexpr unsigned MaxBusChannels = 32; 48 48 49 49 RefPtr<AudioBus> AudioBus::create(unsigned numberOfChannels, size_t length, bool allocate) … … 58 58 AudioBus::AudioBus(unsigned numberOfChannels, size_t length, bool allocate) 59 59 : m_length(length) 60 , m_busGain(1)61 , m_isFirstTime(true)62 , m_sampleRate(0)63 60 { 64 61 m_channels.reserveInitialCapacity(numberOfChannels); -
trunk/Source/WebCore/platform/audio/AudioBus.h
r266794 r267544 161 161 Vector<std::unique_ptr<AudioChannel>> m_channels; 162 162 int m_layout; 163 float m_busGain ;163 float m_busGain { 1 }; 164 164 std::unique_ptr<AudioFloatArray> m_dezipperGainValues; 165 bool m_isFirstTime ;166 float m_sampleRate ; // 0.0 if unknown or N/A165 bool m_isFirstTime { 0 }; 166 float m_sampleRate { 0 }; // 0.0 if unknown or N/A 167 167 }; 168 168 -
trunk/Source/WebCore/platform/audio/AudioChannel.h
r248846 r267544 55 55 explicit AudioChannel(size_t length) 56 56 : m_length(length) 57 , m_rawPointer(0)58 , m_silent(true)59 57 { 60 58 m_memBuffer = makeUnique<AudioFloatArray>(length); … … 62 60 63 61 // A "blank" audio channel -- must call set() before it's useful... 64 AudioChannel() 65 : m_length(0) 66 , m_rawPointer(0) 67 , m_silent(true) 68 { 69 } 62 AudioChannel() = default; 70 63 71 64 // Redefine the memory for this channel. … … 130 123 131 124 private: 132 size_t m_length ;125 size_t m_length { 0 }; 133 126 134 float* m_rawPointer ;127 float* m_rawPointer { nullptr }; 135 128 std::unique_ptr<AudioFloatArray> m_memBuffer; 136 bool m_silent ;129 bool m_silent { true }; 137 130 }; 138 131 -
trunk/Source/WebCore/platform/audio/AudioDSPKernelProcessor.cpp
r267432 r267544 42 42 AudioDSPKernelProcessor::AudioDSPKernelProcessor(float sampleRate, unsigned numberOfChannels) 43 43 : AudioProcessor(sampleRate, numberOfChannels) 44 , m_hasJustReset(true)45 44 { 46 45 } -
trunk/Source/WebCore/platform/audio/AudioDSPKernelProcessor.h
r267432 r267544 70 70 protected: 71 71 Vector<std::unique_ptr<AudioDSPKernel>> m_kernels; 72 bool m_hasJustReset ;72 bool m_hasJustReset { true }; 73 73 }; 74 74 -
trunk/Source/WebCore/platform/audio/AudioHardwareListener.cpp
r237266 r267544 38 38 AudioHardwareListener::AudioHardwareListener(Client& client) 39 39 : m_client(client) 40 , m_activity(AudioHardwareActivityType::Unknown)41 , m_outputDeviceSupportsLowPowerMode(false)42 40 { 43 41 #if PLATFORM(IOS_FAMILY) -
trunk/Source/WebCore/platform/audio/AudioHardwareListener.h
r228483 r267544 61 61 62 62 Client& m_client; 63 AudioHardwareActivityType m_activity ;64 bool m_outputDeviceSupportsLowPowerMode ;63 AudioHardwareActivityType m_activity { AudioHardwareActivityType::Unknown }; 64 bool m_outputDeviceSupportsLowPowerMode { false }; 65 65 }; 66 66 -
trunk/Source/WebCore/platform/audio/AudioResampler.cpp
r248846 r267544 35 35 namespace WebCore { 36 36 37 const double AudioResampler::MaxRate = 8.0;38 39 37 AudioResampler::AudioResampler() 40 : m_rate(1.0)41 38 { 42 39 m_kernels.append(makeUnique<AudioResamplerKernel>(this)); … … 45 42 46 43 AudioResampler::AudioResampler(unsigned numberOfChannels) 47 : m_rate(1.0)48 44 { 49 45 for (unsigned i = 0; i < numberOfChannels; ++i) -
trunk/Source/WebCore/platform/audio/AudioResampler.h
r248762 r267544 57 57 double rate() const { return m_rate; } 58 58 59 static const double MaxRate;59 static constexpr double MaxRate { 8 }; 60 60 61 61 private: 62 double m_rate ;62 double m_rate { 1 }; 63 63 Vector<std::unique_ptr<AudioResamplerKernel>> m_kernels; 64 64 RefPtr<AudioBus> m_sourceBus; -
trunk/Source/WebCore/platform/audio/AudioResamplerKernel.cpp
r267541 r267544 39 39 // The buffer size must be large enough to hold up to two extra sample frames for the linear interpolation. 40 40 , m_sourceBuffer(2 + static_cast<int>(AudioUtilities::renderQuantumSize * AudioResampler::MaxRate)) 41 , m_virtualReadIndex(0.0)42 , m_fillIndex(0)43 41 { 44 42 m_lastValues[0] = 0.0f; -
trunk/Source/WebCore/platform/audio/AudioResamplerKernel.h
r267541 r267544 64 64 65 65 // This is a (floating point) read index on the input stream. 66 double m_virtualReadIndex ;66 double m_virtualReadIndex { 0 }; 67 67 68 68 // We need to have continuity from one call of process() to the next. … … 71 71 // For the first call to process() (or after reset()) there will be no buffered samples. 72 72 float m_lastValues[2]; 73 unsigned m_fillIndex ;73 unsigned m_fillIndex { 0 }; 74 74 }; 75 75 -
trunk/Source/WebCore/platform/audio/Biquad.cpp
r267541 r267544 48 48 49 49 #if USE(ACCELERATE) 50 const int kBufferSize = 1024;50 constexpr int kBufferSize = 1024; 51 51 #endif 52 52 -
trunk/Source/WebCore/platform/audio/Cone.cpp
r165676 r267544 36 36 namespace WebCore { 37 37 38 ConeEffect::ConeEffect() 39 : m_innerAngle(360.0) 40 , m_outerAngle(360.0) 41 , m_outerGain(0.0) 42 { 43 } 38 ConeEffect::ConeEffect() = default; 44 39 45 40 double ConeEffect::gain(FloatPoint3D sourcePosition, FloatPoint3D sourceOrientation, FloatPoint3D listenerPosition) -
trunk/Source/WebCore/platform/audio/Cone.h
r248762 r267544 55 55 56 56 protected: 57 double m_innerAngle ;58 double m_outerAngle ;59 double m_outerGain ;57 double m_innerAngle { 360 }; 58 double m_outerAngle { 360 }; 59 double m_outerGain { 0 }; 60 60 }; 61 61 -
trunk/Source/WebCore/platform/audio/Distance.cpp
r265838 r267544 38 38 namespace WebCore { 39 39 40 DistanceEffect::DistanceEffect() 41 : m_model(DistanceModelType::Inverse) 42 , m_isClamped(true) 43 , m_refDistance(1.0) 44 , m_maxDistance(10000.0) 45 , m_rolloffFactor(1.0) 46 { 47 } 40 DistanceEffect::DistanceEffect() = default; 48 41 49 42 double DistanceEffect::gain(double distance) -
trunk/Source/WebCore/platform/audio/Distance.h
r248762 r267544 71 71 double exponentialGain(double distance); 72 72 73 DistanceModelType m_model ;74 bool m_isClamped ;75 double m_refDistance ;76 double m_maxDistance ;77 double m_rolloffFactor ;73 DistanceModelType m_model { DistanceModelType::Inverse }; 74 bool m_isClamped { true }; 75 double m_refDistance { 1 }; 76 double m_maxDistance { 10000 }; 77 double m_rolloffFactor { 1 }; 78 78 }; 79 79 -
trunk/Source/WebCore/platform/audio/DownSampler.cpp
r165676 r267544 39 39 DownSampler::DownSampler(size_t inputBlockSize) 40 40 : m_inputBlockSize(inputBlockSize) 41 , m_reducedKernel(DefaultKernelSize / 2)42 41 , m_convolver(inputBlockSize / 2) // runs at 1/2 source sample-rate 43 42 , m_tempBuffer(inputBlockSize / 2) -
trunk/Source/WebCore/platform/audio/DownSampler.h
r248762 r267544 58 58 // In other words, filter out all frequencies higher than 0.25 * Nyquist. 59 59 void initializeKernel(); 60 AudioFloatArray m_reducedKernel ;60 AudioFloatArray m_reducedKernel { DefaultKernelSize / 2 }; 61 61 62 62 // Half-band filter. -
trunk/Source/WebCore/platform/audio/DynamicsCompressorKernel.cpp
r267361 r267544 43 43 44 44 // Metering hits peaks instantly, but releases this fast (in seconds). 45 const float meteringReleaseTimeConstant = 0.325f; 46 47 const float uninitializedValue = -1; 45 constexpr float meteringReleaseTimeConstant = 0.325f; 48 46 49 47 DynamicsCompressorKernel::DynamicsCompressorKernel(float sampleRate, unsigned numberOfChannels) 50 48 : m_sampleRate(sampleRate) 51 , m_lastPreDelayFrames(DefaultPreDelayFrames)52 , m_preDelayReadIndex(0)53 , m_preDelayWriteIndex(DefaultPreDelayFrames)54 , m_ratio(uninitializedValue)55 , m_slope(uninitializedValue)56 , m_linearThreshold(uninitializedValue)57 , m_dbThreshold(uninitializedValue)58 , m_dbKnee(uninitializedValue)59 , m_kneeThreshold(uninitializedValue)60 , m_kneeThresholdDb(uninitializedValue)61 , m_ykneeThresholdDb(uninitializedValue)62 , m_K(uninitializedValue)63 49 { 64 50 setNumberOfChannels(numberOfChannels); -
trunk/Source/WebCore/platform/audio/DynamicsCompressorKernel.h
r267361 r267544 75 75 76 76 protected: 77 static constexpr float uninitializedValue = -1; 77 78 float m_sampleRate; 78 79 … … 88 89 enum { MaxPreDelayFramesMask = MaxPreDelayFrames - 1 }; 89 90 enum { DefaultPreDelayFrames = 256 }; // setPreDelayTime() will override this initial value 90 unsigned m_lastPreDelayFrames ;91 unsigned m_lastPreDelayFrames { DefaultPreDelayFrames }; 91 92 void setPreDelayTime(float); 92 93 93 94 Vector<std::unique_ptr<AudioFloatArray>> m_preDelayBuffers; 94 int m_preDelayReadIndex ;95 int m_preDelayWriteIndex ;95 int m_preDelayReadIndex { 0 }; 96 int m_preDelayWriteIndex { DefaultPreDelayFrames }; 96 97 97 98 float m_maxAttackCompressionDiffDb; … … 107 108 // Amount of input change in dB required for 1 dB of output change. 108 109 // This applies to the portion of the curve above m_kneeThresholdDb (see below). 109 float m_ratio ;110 float m_slope ; // Inverse ratio.110 float m_ratio { uninitializedValue }; 111 float m_slope { uninitializedValue }; // Inverse ratio. 111 112 112 113 // The input to output change below the threshold is linear 1:1. 113 float m_linearThreshold ;114 float m_dbThreshold ;114 float m_linearThreshold { uninitializedValue }; 115 float m_dbThreshold { uninitializedValue }; 115 116 116 117 // m_dbKnee is the number of dB above the threshold before we enter the "ratio" portion of the curve. … … 118 119 // The portion between m_dbThreshold and m_kneeThresholdDb is the "soft knee" portion of the curve 119 120 // which transitions smoothly from the linear portion to the ratio portion. 120 float m_dbKnee ;121 float m_kneeThreshold ;122 float m_kneeThresholdDb ;123 float m_ykneeThresholdDb ;121 float m_dbKnee { uninitializedValue }; 122 float m_kneeThreshold { uninitializedValue }; 123 float m_kneeThresholdDb { uninitializedValue }; 124 float m_ykneeThresholdDb { uninitializedValue }; 124 125 125 126 // Internal parameter for the knee portion of the curve. 126 float m_K ;127 float m_K { uninitializedValue }; 127 128 }; 128 129 -
trunk/Source/WebCore/platform/audio/EqualPowerPanner.cpp
r266319 r267544 35 35 36 36 // Use a 50ms smoothing / de-zippering time-constant. 37 const float SmoothingTimeConstant = 0.050f;37 constexpr float SmoothingTimeConstant = 0.050f; 38 38 39 39 namespace WebCore { … … 41 41 EqualPowerPanner::EqualPowerPanner(float sampleRate) 42 42 : Panner(PanningModelType::Equalpower) 43 , m_isFirstRender(true)44 , m_gainL(0.0)45 , m_gainR(0.0)46 43 { 47 44 m_smoothingConstant = AudioUtilities::discreteTimeConstantForSampleRate(SmoothingTimeConstant, sampleRate); -
trunk/Source/WebCore/platform/audio/EqualPowerPanner.h
r266417 r267544 49 49 50 50 // For smoothing / de-zippering 51 bool m_isFirstRender ;51 bool m_isFirstRender { true }; 52 52 double m_smoothingConstant; 53 53 54 double m_gainL ;55 double m_gainR ;54 double m_gainL { 0 }; 55 double m_gainR { 0 }; 56 56 }; 57 57 -
trunk/Source/WebCore/platform/audio/FFTConvolver.cpp
r165676 r267544 41 41 FFTConvolver::FFTConvolver(size_t fftSize) 42 42 : m_frame(fftSize) 43 , m_readWriteIndex(0)44 43 , m_inputBuffer(fftSize) // 2nd half of buffer is always zeroed 45 44 , m_outputBuffer(fftSize) -
trunk/Source/WebCore/platform/audio/FFTConvolver.h
r248762 r267544 59 59 60 60 // Buffer input until we get fftSize / 2 samples then do an FFT 61 size_t m_readWriteIndex ;61 size_t m_readWriteIndex { 0 }; 62 62 AudioFloatArray m_inputBuffer; 63 63 -
trunk/Source/WebCore/platform/audio/HRTFDatabase.cpp
r194496 r267544 37 37 namespace WebCore { 38 38 39 const int HRTFDatabase::MinElevation = -45;40 const int HRTFDatabase::MaxElevation = 90;41 const unsigned HRTFDatabase::RawElevationAngleSpacing = 15;42 const unsigned HRTFDatabase::NumberOfRawElevations = 10; // -45 -> +90 (each 15 degrees)43 const unsigned HRTFDatabase::InterpolationFactor = 1;44 const unsigned HRTFDatabase::NumberOfTotalElevations = NumberOfRawElevations * InterpolationFactor;45 46 39 HRTFDatabase::HRTFDatabase(float sampleRate) 47 : m_elevations(NumberOfTotalElevations) 48 , m_sampleRate(sampleRate) 40 : m_sampleRate(sampleRate) 49 41 { 50 42 unsigned elevationIndex = 0; -
trunk/Source/WebCore/platform/audio/HRTFDatabase.h
r248762 r267544 58 58 59 59 // Number of elevations loaded from resource. 60 static const unsigned NumberOfRawElevations ;60 static const unsigned NumberOfRawElevations { 10 }; 61 61 62 62 private: 63 63 // Minimum and maximum elevation angles (inclusive) for a HRTFDatabase. 64 static const int MinElevation;65 static const int MaxElevation;66 static const unsigned RawElevationAngleSpacing;64 static constexpr int MinElevation { -45 }; 65 static constexpr int MaxElevation { 90 }; 66 static constexpr unsigned RawElevationAngleSpacing { 15 }; 67 67 68 68 // Interpolates by this factor to get the total number of elevations from every elevation loaded from resource. 69 static const unsigned InterpolationFactor;69 static constexpr unsigned InterpolationFactor { 1 }; 70 70 71 71 // Total number of elevations after interpolation. 72 static const unsigned NumberOfTotalElevations;72 static constexpr unsigned NumberOfTotalElevations { NumberOfRawElevations * InterpolationFactor }; 73 73 74 74 // Returns the index for the correct HRTFElevation given the elevation angle. 75 75 static unsigned indexFromElevationAngle(double); 76 76 77 Vector<std::unique_ptr<HRTFElevation>> m_elevations ;77 Vector<std::unique_ptr<HRTFElevation>> m_elevations { NumberOfTotalElevations }; 78 78 float m_sampleRate; 79 79 }; -
trunk/Source/WebCore/platform/audio/HRTFElevation.cpp
r248846 r267544 45 45 namespace WebCore { 46 46 47 const unsigned HRTFElevation::AzimuthSpacing = 15;48 const unsigned HRTFElevation::NumberOfRawAzimuths = 360 / AzimuthSpacing;49 const unsigned HRTFElevation::InterpolationFactor = 8;50 const unsigned HRTFElevation::NumberOfTotalAzimuths = NumberOfRawAzimuths * InterpolationFactor;51 52 47 // Total number of components of an HRTF database. 53 const size_t TotalNumberOfResponses = 240;48 constexpr size_t TotalNumberOfResponses = 240; 54 49 55 50 // Number of frames in an individual impulse response. 56 const size_t ResponseFrameSize = 256;51 constexpr size_t ResponseFrameSize = 256; 57 52 58 53 // Sample-rate of the spatialization impulse responses as stored in the resource file. 59 54 // The impulse responses may be resampled to a different sample-rate (depending on the audio hardware) when they are loaded. 60 const float ResponseSampleRate = 44100;55 constexpr float ResponseSampleRate = 44100; 61 56 62 57 #if PLATFORM(COCOA) || USE(WEBAUDIO_GSTREAMER) -
trunk/Source/WebCore/platform/audio/HRTFElevation.h
r248762 r267544 74 74 75 75 // Spacing, in degrees, between every azimuth loaded from resource. 76 static const unsigned AzimuthSpacing;76 static constexpr unsigned AzimuthSpacing { 15 }; 77 77 78 78 // Number of azimuths loaded from resource. 79 static const unsigned NumberOfRawAzimuths;79 static constexpr unsigned NumberOfRawAzimuths { 360 / AzimuthSpacing }; 80 80 81 81 // Interpolates by this factor to get the total number of azimuths from every azimuth loaded from resource. 82 static const unsigned InterpolationFactor;82 static constexpr unsigned InterpolationFactor { 8 }; 83 83 84 84 // Total number of azimuths after interpolation. 85 static const unsigned NumberOfTotalAzimuths;85 static constexpr unsigned NumberOfTotalAzimuths { NumberOfRawAzimuths * InterpolationFactor }; 86 86 87 87 // Given a specific azimuth and elevation angle, returns the left and right HRTFKernel. -
trunk/Source/WebCore/platform/audio/HRTFKernel.cpp
r248846 r267544 69 69 70 70 HRTFKernel::HRTFKernel(AudioChannel* channel, size_t fftSize, float sampleRate) 71 : m_frameDelay(0) 72 , m_sampleRate(sampleRate) 71 : m_sampleRate(sampleRate) 73 72 { 74 73 ASSERT(channel); -
trunk/Source/WebCore/platform/audio/HRTFKernel.h
r216679 r267544 86 86 87 87 std::unique_ptr<FFTFrame> m_fftFrame; 88 float m_frameDelay ;88 float m_frameDelay { 0 }; 89 89 float m_sampleRate; 90 90 }; -
trunk/Source/WebCore/platform/audio/HRTFPanner.cpp
r267541 r267544 41 41 // The value of 2 milliseconds is larger than the largest delay which exists in any HRTFKernel from the default HRTFDatabase (0.0136 seconds). 42 42 // We ASSERT the delay values used in process() with this value. 43 const double MaxDelayTimeSeconds = 0.002; 44 45 const int UninitializedAzimuth = -1; 43 constexpr double MaxDelayTimeSeconds = 0.002; 46 44 47 45 HRTFPanner::HRTFPanner(float sampleRate, HRTFDatabaseLoader* databaseLoader) … … 49 47 , m_databaseLoader(databaseLoader) 50 48 , m_sampleRate(sampleRate) 51 , m_crossfadeSelection(CrossfadeSelection1)52 , m_azimuthIndex1(UninitializedAzimuth)53 , m_elevation1(0)54 , m_azimuthIndex2(UninitializedAzimuth)55 , m_elevation2(0)56 , m_crossfadeX(0)57 , m_crossfadeIncr(0)58 49 , m_convolverL1(fftSizeForSampleRate(sampleRate)) 59 50 , m_convolverR1(fftSizeForSampleRate(sampleRate)) … … 187 178 188 179 // Initially snap azimuth and elevation values to first values encountered. 189 if ( m_azimuthIndex1 == UninitializedAzimuth) {180 if (!m_azimuthIndex1) { 190 181 m_azimuthIndex1 = desiredAzimuthIndex; 191 182 m_elevation1 = elevation; 192 183 } 193 if ( m_azimuthIndex2 == UninitializedAzimuth) {184 if (!m_azimuthIndex2) { 194 185 m_azimuthIndex2 = desiredAzimuthIndex; 195 186 m_elevation2 = elevation; … … 203 194 // Check for azimuth and elevation changes, initiating a cross-fade if needed. 204 195 if (!m_crossfadeX && m_crossfadeSelection == CrossfadeSelection1) { 205 if (desiredAzimuthIndex != m_azimuthIndex1 || elevation != m_elevation1) {196 if (desiredAzimuthIndex != *m_azimuthIndex1 || elevation != m_elevation1) { 206 197 // Cross-fade from 1 -> 2 207 198 m_crossfadeIncr = 1 / fadeFrames; … … 211 202 } 212 203 if (m_crossfadeX == 1 && m_crossfadeSelection == CrossfadeSelection2) { 213 if (desiredAzimuthIndex != m_azimuthIndex2 || elevation != m_elevation2) {204 if (desiredAzimuthIndex != *m_azimuthIndex2 || elevation != m_elevation2) { 214 205 // Cross-fade from 2 -> 1 215 206 m_crossfadeIncr = -1 / fadeFrames; … … 236 227 double frameDelayL2; 237 228 double frameDelayR2; 238 database->getKernelsFromAzimuthElevation(azimuthBlend, m_azimuthIndex1, m_elevation1, kernelL1, kernelR1, frameDelayL1, frameDelayR1);239 database->getKernelsFromAzimuthElevation(azimuthBlend, m_azimuthIndex2, m_elevation2, kernelL2, kernelR2, frameDelayL2, frameDelayR2);229 database->getKernelsFromAzimuthElevation(azimuthBlend, *m_azimuthIndex1, m_elevation1, kernelL1, kernelR1, frameDelayL1, frameDelayR1); 230 database->getKernelsFromAzimuthElevation(azimuthBlend, *m_azimuthIndex2, m_elevation2, kernelL2, kernelR2, frameDelayL2, frameDelayR2); 240 231 241 232 bool areKernelsGood = kernelL1 && kernelR1 && kernelL2 && kernelR2; -
trunk/Source/WebCore/platform/audio/HRTFPanner.h
r266417 r267544 78 78 }; 79 79 80 CrossfadeSelection m_crossfadeSelection ;80 CrossfadeSelection m_crossfadeSelection { CrossfadeSelection1 }; 81 81 82 82 // azimuth/elevation for CrossfadeSelection1. 83 intm_azimuthIndex1;84 double m_elevation1 ;83 Optional<int> m_azimuthIndex1; 84 double m_elevation1 { 0 }; 85 85 86 86 // azimuth/elevation for CrossfadeSelection2. 87 intm_azimuthIndex2;88 double m_elevation2 ;87 Optional<int> m_azimuthIndex2; 88 double m_elevation2 { 0 }; 89 89 90 90 // A crossfade value 0 <= m_crossfadeX <= 1. 91 float m_crossfadeX ;91 float m_crossfadeX { 0 }; 92 92 93 93 // Per-sample-frame crossfade value increment. 94 float m_crossfadeIncr ;94 float m_crossfadeIncr { 0 }; 95 95 96 96 FFTConvolver m_convolverL1; -
trunk/Source/WebCore/platform/audio/PlatformMediaSession.cpp
r261899 r267544 36 36 namespace WebCore { 37 37 38 static const Seconds clientDataBufferingTimerThrottleDelay { 100_ms };38 static constexpr Seconds clientDataBufferingTimerThrottleDelay { 100_ms }; 39 39 40 40 #if !RELEASE_LOG_DISABLED … … 120 120 , m_client(client) 121 121 , m_mediaSessionIdentifier(MediaSessionIdentifier::generate()) 122 , m_state(Idle)123 , m_stateToRestore(Idle)124 , m_notifyingClient(false)125 122 #if !RELEASE_LOG_DISABLED 126 123 , m_logger(client.logger()) -
trunk/Source/WebCore/platform/audio/PlatformMediaSession.h
r260182 r267544 206 206 PlatformMediaSessionClient& m_client; 207 207 MediaSessionIdentifier m_mediaSessionIdentifier; 208 State m_state ;209 State m_stateToRestore ;208 State m_state { Idle }; 209 State m_stateToRestore { Idle }; 210 210 InterruptionType m_interruptionType { NoInterruption }; 211 211 int m_interruptionCount { 0 }; 212 bool m_notifyingClient ;212 bool m_notifyingClient { false }; 213 213 bool m_isPlayingToWirelessPlaybackTarget { false }; 214 214 bool m_hasPlayedSinceLastInterruption { false }; -
trunk/Source/WebCore/platform/audio/PushPullFIFO.cpp
r267014 r267544 32 32 namespace WebCore { 33 33 34 const size_t PushPullFIFO::kMaxFIFOLength = 65536;35 36 34 PushPullFIFO::PushPullFIFO(unsigned numberOfChannels, size_t fifoLength) 37 35 : m_fifoLength(fifoLength) 38 36 { 39 ASSERT(m_fifoLength <= kMaxFIFOLength);37 ASSERT(m_fifoLength <= maxFIFOLength); 40 38 m_fifoBus = AudioBus::create(numberOfChannels, m_fifoLength); 41 39 } -
trunk/Source/WebCore/platform/audio/PushPullFIFO.h
r267014 r267544 43 43 public: 44 44 // Maximum FIFO length. (512 render quanta) 45 static const size_t kMaxFIFOLength;45 static constexpr size_t maxFIFOLength { 65536 }; 46 46 47 // |fifoLength| cannot exceed | kMaxFIFOLength|. Otherwise it crashes.47 // |fifoLength| cannot exceed |maxFIFOLength|. Otherwise it crashes. 48 48 PushPullFIFO(unsigned numberOfChannels, size_t fifoLength); 49 49 ~PushPullFIFO(); -
trunk/Source/WebCore/platform/audio/Reverb.cpp
r266501 r267544 45 45 46 46 // Empirical gain calibration tested across many impulse responses to ensure perceived volume is same as dry (unprocessed) signal 47 const float GainCalibration = -58;48 const float GainCalibrationSampleRate = 44100;47 constexpr float GainCalibration = -58; 48 constexpr float GainCalibrationSampleRate = 44100; 49 49 50 50 // A minimum power value to when normalizing a silent (or very quiet) impulse response 51 const float MinPower = 0.000125f;51 constexpr float MinPower = 0.000125f; 52 52 53 53 static float calculateNormalizationScale(AudioBus* response) -
trunk/Source/WebCore/platform/audio/ReverbAccumulationBuffer.cpp
r218840 r267544 43 43 ReverbAccumulationBuffer::ReverbAccumulationBuffer(size_t length) 44 44 : m_buffer(length) 45 , m_readIndex(0)46 , m_readTimeFrame(0)47 45 { 48 46 } -
trunk/Source/WebCore/platform/audio/ReverbAccumulationBuffer.h
r248762 r267544 60 60 private: 61 61 AudioFloatArray m_buffer; 62 size_t m_readIndex ;63 size_t m_readTimeFrame ; // for debugging (frame on continuous timeline)62 size_t m_readIndex { 0 }; 63 size_t m_readTimeFrame { 0 }; // for debugging (frame on continuous timeline) 64 64 }; 65 65 -
trunk/Source/WebCore/platform/audio/ReverbConvolver.cpp
r266492 r267544 41 41 using namespace VectorMath; 42 42 43 const int InputBufferSize = 8 * 16384;43 constexpr int InputBufferSize = 8 * 16384; 44 44 45 45 // We only process the leading portion of the impulse response in the real-time thread. We don't exceed this length. … … 50 50 // the very rough scheduling latencies are similar on these time-scales. Of course, this code may need to be 51 51 // tuned for individual platforms if this assumption is found to be incorrect. 52 const size_t RealtimeFrameLimit = 8192 + 4096; // ~278msec @ 44.1KHz53 54 const size_t MinFFTSize = 128;55 const size_t MaxRealtimeFFTSize = 2048;52 constexpr size_t RealtimeFrameLimit = 8192 + 4096; // ~278msec @ 44.1KHz 53 54 constexpr size_t MinFFTSize = 128; 55 constexpr size_t MaxRealtimeFFTSize = 2048; 56 56 57 57 ReverbConvolver::ReverbConvolver(AudioChannel* impulseResponse, size_t renderSliceSize, size_t maxFFTSize, size_t convolverRenderPhase, bool useBackgroundThreads, float scale) -
trunk/Source/WebCore/platform/audio/ReverbConvolverStage.cpp
r266492 r267544 48 48 size_t fftSize, size_t renderPhase, size_t renderSliceSize, ReverbAccumulationBuffer* accumulationBuffer, float scale, bool directMode) 49 49 : m_accumulationBuffer(accumulationBuffer) 50 , m_accumulationReadIndex(0)51 , m_inputReadIndex(0)52 50 , m_directMode(directMode) 53 51 { -
trunk/Source/WebCore/platform/audio/ReverbConvolverStage.h
r266492 r267544 68 68 69 69 ReverbAccumulationBuffer* m_accumulationBuffer; 70 int m_accumulationReadIndex ;71 int m_inputReadIndex ;70 int m_accumulationReadIndex { 0 }; 71 int m_inputReadIndex { 0 }; 72 72 73 73 size_t m_preDelayLength; -
trunk/Source/WebCore/platform/audio/ReverbInputBuffer.cpp
r165676 r267544 37 37 ReverbInputBuffer::ReverbInputBuffer(size_t length) 38 38 : m_buffer(length) 39 , m_writeIndex(0)40 39 { 41 40 } -
trunk/Source/WebCore/platform/audio/ReverbInputBuffer.h
r248762 r267544 58 58 private: 59 59 AudioFloatArray m_buffer; 60 size_t m_writeIndex ;60 size_t m_writeIndex { 0 }; 61 61 }; 62 62
Note:
See TracChangeset
for help on using the changeset viewer.