| 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 21 matching lines...) Expand all Loading... |
| 32 #include "platform/FloatConversion.h" | 32 #include "platform/FloatConversion.h" |
| 33 #include "platform/Histogram.h" | 33 #include "platform/Histogram.h" |
| 34 #include "platform/audio/AudioUtilities.h" | 34 #include "platform/audio/AudioUtilities.h" |
| 35 #include "wtf/MathExtras.h" | 35 #include "wtf/MathExtras.h" |
| 36 | 36 |
| 37 namespace blink { | 37 namespace blink { |
| 38 | 38 |
| 39 const double AudioParamHandler::DefaultSmoothingConstant = 0.05; | 39 const double AudioParamHandler::DefaultSmoothingConstant = 0.05; |
| 40 const double AudioParamHandler::SnapThreshold = 0.001; | 40 const double AudioParamHandler::SnapThreshold = 0.001; |
| 41 | 41 |
| 42 AudioParamHandler::AudioParamHandler(AbstractAudioContext& context, AudioParamTy
pe paramType, double defaultValue, float minValue, float maxValue) | 42 AudioParamHandler::AudioParamHandler(BaseAudioContext& context, AudioParamType p
aramType, double defaultValue, float minValue, float maxValue) |
| 43 : AudioSummingJunction(context.deferredTaskHandler()) | 43 : AudioSummingJunction(context.deferredTaskHandler()) |
| 44 , m_paramType(paramType) | 44 , m_paramType(paramType) |
| 45 , m_intrinsicValue(defaultValue) | 45 , m_intrinsicValue(defaultValue) |
| 46 , m_defaultValue(defaultValue) | 46 , m_defaultValue(defaultValue) |
| 47 , m_minValue(minValue) | 47 , m_minValue(minValue) |
| 48 , m_maxValue(maxValue) | 48 , m_maxValue(maxValue) |
| 49 { | 49 { |
| 50 // The destination MUST exist because we need the destination handler for th
e AudioParam. | 50 // The destination MUST exist because we need the destination handler for th
e AudioParam. |
| 51 RELEASE_ASSERT(context.destination()); | 51 RELEASE_ASSERT(context.destination()); |
| 52 | 52 |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 } | 331 } |
| 332 break; | 332 break; |
| 333 default: | 333 default: |
| 334 // Nothing to do for all other types. | 334 // Nothing to do for all other types. |
| 335 break; | 335 break; |
| 336 } | 336 } |
| 337 } | 337 } |
| 338 | 338 |
| 339 // ---------------------------------------------------------------- | 339 // ---------------------------------------------------------------- |
| 340 | 340 |
| 341 AudioParam::AudioParam(AbstractAudioContext& context, AudioParamType paramType,
double defaultValue, float minValue, float maxValue) | 341 AudioParam::AudioParam(BaseAudioContext& context, AudioParamType paramType, doub
le defaultValue, float minValue, float maxValue) |
| 342 : m_handler(AudioParamHandler::create(context, paramType, defaultValue, minV
alue, maxValue)) | 342 : m_handler(AudioParamHandler::create(context, paramType, defaultValue, minV
alue, maxValue)) |
| 343 , m_context(context) | 343 , m_context(context) |
| 344 { | 344 { |
| 345 } | 345 } |
| 346 | 346 |
| 347 AudioParam* AudioParam::create(AbstractAudioContext& context, AudioParamType par
amType, double defaultValue) | 347 AudioParam* AudioParam::create(BaseAudioContext& context, AudioParamType paramTy
pe, double defaultValue) |
| 348 { | 348 { |
| 349 // Default nominal range is most negative float to most positive. This basi
cally means any | 349 // Default nominal range is most negative float to most positive. This basi
cally means any |
| 350 // value is valid, except that floating-point infinities are excluded. | 350 // value is valid, except that floating-point infinities are excluded. |
| 351 float limit = std::numeric_limits<float>::max(); | 351 float limit = std::numeric_limits<float>::max(); |
| 352 return new AudioParam(context, paramType, defaultValue, -limit, limit); | 352 return new AudioParam(context, paramType, defaultValue, -limit, limit); |
| 353 } | 353 } |
| 354 | 354 |
| 355 AudioParam* AudioParam::create(AbstractAudioContext& context, AudioParamType par
amType, double defaultValue, float minValue, float maxValue) | 355 AudioParam* AudioParam::create(BaseAudioContext& context, AudioParamType paramTy
pe, double defaultValue, float minValue, float maxValue) |
| 356 { | 356 { |
| 357 DCHECK_LE(minValue, maxValue); | 357 DCHECK_LE(minValue, maxValue); |
| 358 return new AudioParam(context, paramType, defaultValue, minValue, maxValue); | 358 return new AudioParam(context, paramType, defaultValue, minValue, maxValue); |
| 359 } | 359 } |
| 360 | 360 |
| 361 DEFINE_TRACE(AudioParam) | 361 DEFINE_TRACE(AudioParam) |
| 362 { | 362 { |
| 363 visitor->trace(m_context); | 363 visitor->trace(m_context); |
| 364 } | 364 } |
| 365 | 365 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 } | 498 } |
| 499 | 499 |
| 500 AudioParam* AudioParam::cancelScheduledValues(double startTime, ExceptionState&
exceptionState) | 500 AudioParam* AudioParam::cancelScheduledValues(double startTime, ExceptionState&
exceptionState) |
| 501 { | 501 { |
| 502 handler().timeline().cancelScheduledValues(startTime, exceptionState); | 502 handler().timeline().cancelScheduledValues(startTime, exceptionState); |
| 503 return this; | 503 return this; |
| 504 } | 504 } |
| 505 | 505 |
| 506 } // namespace blink | 506 } // namespace blink |
| 507 | 507 |
| OLD | NEW |