Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(993)

Unified Diff: third_party/WebKit/Source/modules/webaudio/BiquadFilterNode.cpp

Issue 1934683002: Add histograms for Biquad lowpass and highpass Q values (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove variables used only once. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/AudioParam.cpp ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/webaudio/BiquadFilterNode.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/BiquadFilterNode.cpp b/third_party/WebKit/Source/modules/webaudio/BiquadFilterNode.cpp
index 90951fcc105ca9b3cb08365a74222c62b96c719f..8bd06ad39a5c4d126843505e907833f6e915402a 100644
--- a/third_party/WebKit/Source/modules/webaudio/BiquadFilterNode.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/BiquadFilterNode.cpp
@@ -35,6 +35,10 @@ BiquadFilterNode::BiquadFilterNode(AbstractAudioContext& context, float sampleRa
, m_detune(AudioParam::create(context, ParamTypeBiquadFilterDetune, 0.0))
{
setHandler(AudioBasicProcessorHandler::create(AudioHandler::NodeTypeBiquadFilter, *this, sampleRate, adoptPtr(new BiquadProcessor(sampleRate, 1, m_frequency->handler(), m_q->handler(), m_gain->handler(), m_detune->handler()))));
+
+ // Explicitly set the filter type so that any histograms get updated with the default value.
+ // Otherwise, the histogram won't ever show it.
+ setType("lowpass");
}
DEFINE_TRACE(BiquadFilterNode)
@@ -78,22 +82,31 @@ String BiquadFilterNode::type() const
void BiquadFilterNode::setType(const String& type)
{
- if (type == "lowpass")
+ // For the Q histogram, we need to change the name of the AudioParam for the lowpass and
+ // highpass filters so we know to count the Q value when it is set. And explicitly set the value
+ // to itself so the histograms know the initial value.
+
+ if (type == "lowpass") {
setType(BiquadProcessor::LowPass);
- else if (type == "highpass")
+ m_q->setParamType(ParamTypeBiquadFilterQLowpass);
+ m_q->setValue(m_q->value());
+ } else if (type == "highpass") {
setType(BiquadProcessor::HighPass);
- else if (type == "bandpass")
+ m_q->setParamType(ParamTypeBiquadFilterQHighpass);
+ m_q->setValue(m_q->value());
+ } else if (type == "bandpass") {
setType(BiquadProcessor::BandPass);
- else if (type == "lowshelf")
+ } else if (type == "lowshelf") {
setType(BiquadProcessor::LowShelf);
- else if (type == "highshelf")
+ } else if (type == "highshelf") {
setType(BiquadProcessor::HighShelf);
- else if (type == "peaking")
+ } else if (type == "peaking") {
setType(BiquadProcessor::Peaking);
- else if (type == "notch")
+ } else if (type == "notch") {
setType(BiquadProcessor::Notch);
- else if (type == "allpass")
+ } else if (type == "allpass") {
setType(BiquadProcessor::Allpass);
+ }
}
bool BiquadFilterNode::setType(unsigned type)
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/AudioParam.cpp ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698