Make WebAudio API const-correct.
https://bugs.webkit.org/show_bug.cgi?id=76573
Reviewed by Daniel Bates.
Source/WebCore:
No new tests; no net change in functionality, so covered by existing tests.
The non-const data() accessor was renamed mutableData() to expose const-correctness
bugs during compile time:
* platform/audio/AudioChannel.h:
(WebCore::AudioChannel::mutableData):
The following functions were made const correct:
* platform/audio/AudioArray.h:
(WebCore::AudioArray::copyToRange):
* platform/audio/AudioBus.h:
(WebCore::AudioBus::createBufferFromRange):
(WebCore::AudioBus::createBySampleRateConverting):
(WebCore::AudioBus::createByMixingToMono):
* platform/audio/FFTConvolver.cpp:
(WebCore::FFTConvolver::process):
* platform/audio/FFTConvolver.h:
* platform/audio/FFTFrame.cpp:
(WebCore::FFTFrame::doPaddedFFT):
(WebCore::FFTFrame::doFFT):
* platform/audio/FFTFrame.h:
* platform/audio/ReverbConvolverStage.cpp:
(WebCore::ReverbConvolverStage::ReverbConvolverStage):
(WebCore::ReverbConvolverStage::process):
* platform/audio/ReverbConvolverStage.h:
* platform/audio/ReverbInputBuffer.cpp:
(WebCore::ReverbInputBuffer::write):
* platform/audio/ReverbInputBuffer.h:
* platform/audio/SincResampler.cpp:
(WebCore::SincResampler::process):
* platform/audio/SincResampler.h:
* platform/audio/ZeroPole.cpp:
(WebCore::ZeroPole::process):
* platform/audio/ZeroPole.h:
* platform/audio/AudioBus.cpp:
(WebCore::AudioBus::channelByType):
* platform/audio/AudioBus.h:
(WebCore::AudioBus::gain):
* platform/audio/AudioDSPKernelProcessor.cpp:
(WebCore::AudioDSPKernelProcessor::process):
* platform/audio/AudioDSPKernelProcessor.h:
* platform/audio/AudioProcessor.h:
* platform/audio/DynamicsCompressor.cpp:
(WebCore::DynamicsCompressor::process):
* platform/audio/DynamicsCompressor.h:
* platform/audio/DynamicsCompressorKernel.cpp:
(WebCore::DynamicsCompressorKernel::process):
* platform/audio/DynamicsCompressorKernel.h:
* platform/audio/EqualPowerPanner.cpp:
(WebCore::EqualPowerPanner::pan):
* platform/audio/EqualPowerPanner.h:
* platform/audio/HRTFElevation.h:
(WebCore::HRTFElevation::numberOfAzimuths):
* platform/audio/HRTFPanner.cpp:
(WebCore::HRTFPanner::pan):
* platform/audio/HRTFPanner.h:
* platform/audio/Panner.h:
* platform/audio/Reverb.cpp:
(WebCore::Reverb::process):
* platform/audio/Reverb.h:
* platform/audio/ReverbConvolver.cpp:
(WebCore::ReverbConvolver::process):
* platform/audio/ReverbConvolver.h:
* platform/audio/ffmpeg/FFTFrameFFMPEG.cpp:
(WebCore::FFTFrame::doFFT):
* platform/audio/mkl/FFTFrameMKL.cpp:
(WebCore::FFTFrame::doFFT):
The following functions were modified to use the renamed mutableData() accessor:
* platform/audio/AudioBus.cpp:
(WebCore::AudioBus::processWithGainFromMonoStereo):
(WebCore::AudioBus::copyWithSampleAccurateGainValuesFrom):
* platform/audio/AudioChannel.cpp:
(WebCore::AudioChannel::scale):
(WebCore::AudioChannel::copyFrom):
(WebCore::AudioChannel::copyFromRange):
(WebCore::AudioChannel::sumFrom):
* platform/audio/AudioDSPKernelProcessor.cpp:
(WebCore::AudioDSPKernelProcessor::process):
* platform/audio/AudioResampler.cpp:
(WebCore::AudioResampler::process):
* platform/audio/DynamicsCompressor.cpp:
(WebCore::DynamicsCompressor::process):
* platform/audio/EqualPowerPanner.cpp:
(WebCore::EqualPowerPanner::pan):
* platform/audio/HRTFKernel.cpp:
(WebCore::extractAverageGroupDelay):
(WebCore::HRTFKernel::HRTFKernel):
(WebCore::HRTFKernel::createImpulseResponse):
* platform/audio/HRTFPanner.cpp:
(WebCore::HRTFPanner::pan):
* platform/audio/MultiChannelResampler.cpp:
(WebCore::MultiChannelResampler::process):
* platform/audio/Reverb.cpp:
(WebCore::Reverb::process):
* platform/audio/ReverbConvolver.cpp:
(WebCore::ReverbConvolver::ReverbConvolver):
(WebCore::ReverbConvolver::process):
* platform/audio/mac/AudioFileReaderMac.cpp:
(WebCore::AudioFileReader::createBus):
* platform/audio/mac/FFTFrameMac.cpp:
(WebCore::FFTFrame::doFFT):
* webaudio/AudioBufferSourceNode.cpp:
(WebCore::AudioBufferSourceNode::process):
(WebCore::AudioBufferSourceNode::renderFromBuffer):
* webaudio/BiquadProcessor.cpp:
(WebCore::BiquadProcessor::process):
* webaudio/JavaScriptAudioNode.cpp:
(WebCore::JavaScriptAudioNode::process):
* webaudio/OfflineAudioDestinationNode.cpp:
(WebCore::OfflineAudioDestinationNode::render):
* webaudio/RealtimeAnalyser.cpp:
(WebCore::RealtimeAnalyser::writeInput):
* webaudio/WaveShaperProcessor.cpp:
(WebCore::WaveShaperProcessor::process):
Source/WebKit/chromium:
The following functions were modified to use the renamed mutableData() accessor:
* src/AudioDestinationChromium.cpp:
(WebCore::AudioDestinationChromium::FIFO::fillBuffer):
(WebCore::AudioDestinationChromium::FIFO::consume):
* src/WebAudioData.cpp:
(WebCore::WebAudioBus::channelData):
* src/WebMediaPlayerClientImpl.cpp:
(WebKit::WebMediaPlayerClientImpl::AudioSourceProviderImpl::provideInput):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105431 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/platform/audio/EqualPowerPanner.cpp b/Source/WebCore/platform/audio/EqualPowerPanner.cpp
index 0da7622..a2d2dff 100644
--- a/Source/WebCore/platform/audio/EqualPowerPanner.cpp
+++ b/Source/WebCore/platform/audio/EqualPowerPanner.cpp
@@ -49,7 +49,7 @@
m_smoothingConstant = AudioUtilities::discreteTimeConstantForSampleRate(SmoothingTimeConstant, sampleRate);
}
-void EqualPowerPanner::pan(double azimuth, double /*elevation*/, AudioBus* inputBus, AudioBus* outputBus, size_t framesToProcess)
+void EqualPowerPanner::pan(double azimuth, double /*elevation*/, const AudioBus* inputBus, AudioBus* outputBus, size_t framesToProcess)
{
// FIXME: implement stereo sources
bool isInputSafe = inputBus && inputBus->numberOfChannels() == 1 && framesToProcess <= inputBus->length();
@@ -62,10 +62,10 @@
if (!isOutputSafe)
return;
- AudioChannel* channel = inputBus->channel(0);
- float* sourceP = channel->data();
- float* destinationL = outputBus->channelByType(AudioBus::ChannelLeft)->data();
- float* destinationR = outputBus->channelByType(AudioBus::ChannelRight)->data();
+ const AudioChannel* channel = inputBus->channel(0);
+ const float* sourceP = channel->data();
+ float* destinationL = outputBus->channelByType(AudioBus::ChannelLeft)->mutableData();
+ float* destinationR = outputBus->channelByType(AudioBus::ChannelRight)->mutableData();
if (!sourceP || !destinationL || !destinationR)
return;