| 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 20 matching lines...) Expand all Loading... |
| 31 #include "modules/webaudio/AudioNodeOutput.h" | 31 #include "modules/webaudio/AudioNodeOutput.h" |
| 32 #include "platform/FloatConversion.h" | 32 #include "platform/FloatConversion.h" |
| 33 #include "platform/audio/AudioUtilities.h" | 33 #include "platform/audio/AudioUtilities.h" |
| 34 #include "wtf/MathExtras.h" | 34 #include "wtf/MathExtras.h" |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 const double AudioParamHandler::DefaultSmoothingConstant = 0.05; | 38 const double AudioParamHandler::DefaultSmoothingConstant = 0.05; |
| 39 const double AudioParamHandler::SnapThreshold = 0.001; | 39 const double AudioParamHandler::SnapThreshold = 0.001; |
| 40 | 40 |
| 41 AudioContext* AudioParamHandler::context() const | 41 AbstractAudioContext* AudioParamHandler::context() const |
| 42 { | 42 { |
| 43 // TODO(tkent): We can remove this dangerous function by removing | 43 // TODO(tkent): We can remove this dangerous function by removing |
| 44 // AudioContext dependency from AudioParamTimeline. | 44 // AbstractAudioContext dependency from AudioParamTimeline. |
| 45 ASSERT_WITH_SECURITY_IMPLICATION(deferredTaskHandler().isAudioThread()); | 45 ASSERT_WITH_SECURITY_IMPLICATION(deferredTaskHandler().isAudioThread()); |
| 46 return &m_context; | 46 return &m_context; |
| 47 } | 47 } |
| 48 | 48 |
| 49 float AudioParamHandler::value() | 49 float AudioParamHandler::value() |
| 50 { | 50 { |
| 51 // Update value for timeline. | 51 // Update value for timeline. |
| 52 if (deferredTaskHandler().isAudioThread()) { | 52 if (deferredTaskHandler().isAudioThread()) { |
| 53 bool hasValue; | 53 bool hasValue; |
| 54 float timelineValue = m_timeline.valueForContextTime(context(), narrowPr
ecisionToFloat(m_value), hasValue); | 54 float timelineValue = m_timeline.valueForContextTime(context(), narrowPr
ecisionToFloat(m_value), hasValue); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 | 187 |
| 188 if (m_outputs.contains(&output)) { | 188 if (m_outputs.contains(&output)) { |
| 189 m_outputs.remove(&output); | 189 m_outputs.remove(&output); |
| 190 changedOutputs(); | 190 changedOutputs(); |
| 191 output.removeParam(*this); | 191 output.removeParam(*this); |
| 192 } | 192 } |
| 193 } | 193 } |
| 194 | 194 |
| 195 // ---------------------------------------------------------------- | 195 // ---------------------------------------------------------------- |
| 196 | 196 |
| 197 AudioParam::AudioParam(AudioContext& context, double defaultValue) | 197 AudioParam::AudioParam(AbstractAudioContext& context, double defaultValue) |
| 198 : m_handler(AudioParamHandler::create(context, defaultValue)) | 198 : m_handler(AudioParamHandler::create(context, defaultValue)) |
| 199 , m_context(context) | 199 , m_context(context) |
| 200 { | 200 { |
| 201 } | 201 } |
| 202 | 202 |
| 203 AudioParam* AudioParam::create(AudioContext& context, double defaultValue) | 203 AudioParam* AudioParam::create(AbstractAudioContext& context, double defaultValu
e) |
| 204 { | 204 { |
| 205 return new AudioParam(context, defaultValue); | 205 return new AudioParam(context, defaultValue); |
| 206 } | 206 } |
| 207 | 207 |
| 208 DEFINE_TRACE(AudioParam) | 208 DEFINE_TRACE(AudioParam) |
| 209 { | 209 { |
| 210 visitor->trace(m_context); | 210 visitor->trace(m_context); |
| 211 } | 211 } |
| 212 | 212 |
| 213 float AudioParam::value() const | 213 float AudioParam::value() const |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 } | 251 } |
| 252 | 252 |
| 253 void AudioParam::cancelScheduledValues(double startTime, ExceptionState& excepti
onState) | 253 void AudioParam::cancelScheduledValues(double startTime, ExceptionState& excepti
onState) |
| 254 { | 254 { |
| 255 handler().timeline().cancelScheduledValues(startTime, exceptionState); | 255 handler().timeline().cancelScheduledValues(startTime, exceptionState); |
| 256 } | 256 } |
| 257 | 257 |
| 258 } // namespace blink | 258 } // namespace blink |
| 259 | 259 |
| 260 #endif // ENABLE(WEB_AUDIO) | 260 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |