OLD | NEW |
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 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 if (hasValue) | 50 if (hasValue) |
51 m_value = timelineValue; | 51 m_value = timelineValue; |
52 } | 52 } |
53 | 53 |
54 return narrowPrecisionToFloat(m_value); | 54 return narrowPrecisionToFloat(m_value); |
55 } | 55 } |
56 | 56 |
57 void AudioParam::setValue(float value) | 57 void AudioParam::setValue(float value) |
58 { | 58 { |
59 // Check against JavaScript giving us bogus floating-point values. | 59 m_value = value; |
60 // Don't ASSERT, since this can happen if somebody writes bad JS. | |
61 if (!std::isnan(value) && !std::isinf(value)) | |
62 m_value = value; | |
63 } | 60 } |
64 | 61 |
65 float AudioParam::smoothedValue() | 62 float AudioParam::smoothedValue() |
66 { | 63 { |
67 return narrowPrecisionToFloat(m_smoothedValue); | 64 return narrowPrecisionToFloat(m_smoothedValue); |
68 } | 65 } |
69 | 66 |
70 bool AudioParam::smooth() | 67 bool AudioParam::smooth() |
71 { | 68 { |
72 // If values have been explicitly scheduled on the timeline, then use the ex
act value. | 69 // If values have been explicitly scheduled on the timeline, then use the ex
act value. |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 if (m_outputs.contains(&output)) { | 180 if (m_outputs.contains(&output)) { |
184 m_outputs.remove(&output); | 181 m_outputs.remove(&output); |
185 changedOutputs(); | 182 changedOutputs(); |
186 output.removeParam(*this); | 183 output.removeParam(*this); |
187 } | 184 } |
188 } | 185 } |
189 | 186 |
190 } // namespace blink | 187 } // namespace blink |
191 | 188 |
192 #endif // ENABLE(WEB_AUDIO) | 189 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |