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

Side by Side Diff: Source/modules/webaudio/AnalyserNode.cpp

Issue 212793002: Fix attributes types on AnalyserNode as specification of web audio. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add compatibility.js Created 6 years, 8 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 unified diff | Download patch
« no previous file with comments | « Source/modules/webaudio/AnalyserNode.h ('k') | Source/modules/webaudio/AnalyserNode.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 { 73 {
74 if (!m_analyser.setFftSize(size)) { 74 if (!m_analyser.setFftSize(size)) {
75 exceptionState.throwDOMException( 75 exceptionState.throwDOMException(
76 IndexSizeError, 76 IndexSizeError,
77 (size < RealtimeAnalyser::MinFFTSize || size > RealtimeAnalyser::Max FFTSize) ? 77 (size < RealtimeAnalyser::MinFFTSize || size > RealtimeAnalyser::Max FFTSize) ?
78 ExceptionMessages::indexOutsideRange("FFT size", size, RealtimeA nalyser::MinFFTSize, ExceptionMessages::InclusiveBound, RealtimeAnalyser::MaxFFT Size, ExceptionMessages::InclusiveBound) 78 ExceptionMessages::indexOutsideRange("FFT size", size, RealtimeA nalyser::MinFFTSize, ExceptionMessages::InclusiveBound, RealtimeAnalyser::MaxFFT Size, ExceptionMessages::InclusiveBound)
79 : ("The value provided (" + String::number(size) + ") is not a p ower of two.")); 79 : ("The value provided (" + String::number(size) + ") is not a p ower of two."));
80 } 80 }
81 } 81 }
82 82
83 void AnalyserNode::setMinDecibels(float k, ExceptionState& exceptionState) 83 void AnalyserNode::setMinDecibels(double k, ExceptionState& exceptionState)
84 { 84 {
85 if (k <= maxDecibels()) { 85 if (k < maxDecibels()) {
86 m_analyser.setMinDecibels(k); 86 m_analyser.setMinDecibels(k);
87 } else { 87 } else {
88 exceptionState.throwDOMException( 88 exceptionState.throwDOMException(
89 IndexSizeError, 89 IndexSizeError,
90 ExceptionMessages::indexExceedsMaximumBound("minDecibels", k, maxDec ibels())); 90 ExceptionMessages::indexExceedsMaximumBound("minDecibels", k, maxDec ibels()));
91 } 91 }
92 } 92 }
93 93
94 void AnalyserNode::setMaxDecibels(float k, ExceptionState& exceptionState) 94 void AnalyserNode::setMaxDecibels(double k, ExceptionState& exceptionState)
95 { 95 {
96 if (k >= minDecibels()) { 96 if (k > minDecibels()) {
97 m_analyser.setMaxDecibels(k); 97 m_analyser.setMaxDecibels(k);
98 } else { 98 } else {
99 exceptionState.throwDOMException( 99 exceptionState.throwDOMException(
100 IndexSizeError, 100 IndexSizeError,
101 ExceptionMessages::indexExceedsMinimumBound("maxDecibels", k, minDec ibels())); 101 ExceptionMessages::indexExceedsMinimumBound("maxDecibels", k, minDec ibels()));
102 } 102 }
103 } 103 }
104 104
105 void AnalyserNode::setSmoothingTimeConstant(float k, ExceptionState& exceptionSt ate) 105 void AnalyserNode::setSmoothingTimeConstant(double k, ExceptionState& exceptionS tate)
106 { 106 {
107 if (k >= 0 && k <= 1) { 107 if (k >= 0 && k <= 1) {
108 m_analyser.setSmoothingTimeConstant(k); 108 m_analyser.setSmoothingTimeConstant(k);
109 } else { 109 } else {
110 exceptionState.throwDOMException( 110 exceptionState.throwDOMException(
111 IndexSizeError, 111 IndexSizeError,
112 ExceptionMessages::indexOutsideRange("smoothing value", k, 0.0f, Exc eptionMessages::InclusiveBound, 1.0f, ExceptionMessages::InclusiveBound)); 112 ExceptionMessages::indexOutsideRange("smoothing value", k, 0.0, Exce ptionMessages::InclusiveBound, 1.0, ExceptionMessages::InclusiveBound));
113 } 113 }
114 } 114 }
115 115
116 } // namespace WebCore 116 } // namespace WebCore
117 117
118 #endif // ENABLE(WEB_AUDIO) 118 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/modules/webaudio/AnalyserNode.h ('k') | Source/modules/webaudio/AnalyserNode.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698