| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012, Google Inc. All rights reserved. | 2 * Copyright (C) 2012, 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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 m_type = CUSTOM; | 323 m_type = CUSTOM; |
| 324 } | 324 } |
| 325 | 325 |
| 326 bool OscillatorHandler::propagatesSilence() const | 326 bool OscillatorHandler::propagatesSilence() const |
| 327 { | 327 { |
| 328 return !isPlayingOrScheduled() || hasFinished() || !m_periodicWave.get(); | 328 return !isPlayingOrScheduled() || hasFinished() || !m_periodicWave.get(); |
| 329 } | 329 } |
| 330 | 330 |
| 331 // ---------------------------------------------------------------- | 331 // ---------------------------------------------------------------- |
| 332 | 332 |
| 333 OscillatorNode::OscillatorNode(AbstractAudioContext& context) | 333 OscillatorNode::OscillatorNode(BaseAudioContext& context) |
| 334 : AudioScheduledSourceNode(context) | 334 : AudioScheduledSourceNode(context) |
| 335 // Use musical pitch standard A440 as a default. | 335 // Use musical pitch standard A440 as a default. |
| 336 , m_frequency(AudioParam::create(context, ParamTypeOscillatorFrequency, 440, | 336 , m_frequency(AudioParam::create(context, ParamTypeOscillatorFrequency, 440, |
| 337 - context.sampleRate() / 2, | 337 - context.sampleRate() / 2, |
| 338 context.sampleRate() / 2)) | 338 context.sampleRate() / 2)) |
| 339 // Default to no detuning. | 339 // Default to no detuning. |
| 340 , m_detune(AudioParam::create(context, ParamTypeOscillatorDetune, 0)) | 340 , m_detune(AudioParam::create(context, ParamTypeOscillatorDetune, 0)) |
| 341 { | 341 { |
| 342 setHandler(OscillatorHandler::create(*this, context.sampleRate(), m_frequenc
y->handler(), m_detune->handler())); | 342 setHandler(OscillatorHandler::create(*this, context.sampleRate(), m_frequenc
y->handler(), m_detune->handler())); |
| 343 } | 343 } |
| 344 | 344 |
| 345 OscillatorNode* OscillatorNode::create(AbstractAudioContext& context, ExceptionS
tate& exceptionState) | 345 OscillatorNode* OscillatorNode::create(BaseAudioContext& context, ExceptionState
& exceptionState) |
| 346 { | 346 { |
| 347 DCHECK(isMainThread()); | 347 DCHECK(isMainThread()); |
| 348 | 348 |
| 349 if (context.isContextClosed()) { | 349 if (context.isContextClosed()) { |
| 350 context.throwExceptionForClosedState(exceptionState); | 350 context.throwExceptionForClosedState(exceptionState); |
| 351 return nullptr; | 351 return nullptr; |
| 352 } | 352 } |
| 353 | 353 |
| 354 return new OscillatorNode(context); | 354 return new OscillatorNode(context); |
| 355 } | 355 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 386 return m_detune; | 386 return m_detune; |
| 387 } | 387 } |
| 388 | 388 |
| 389 void OscillatorNode::setPeriodicWave(PeriodicWave* wave) | 389 void OscillatorNode::setPeriodicWave(PeriodicWave* wave) |
| 390 { | 390 { |
| 391 oscillatorHandler().setPeriodicWave(wave); | 391 oscillatorHandler().setPeriodicWave(wave); |
| 392 } | 392 } |
| 393 | 393 |
| 394 } // namespace blink | 394 } // namespace blink |
| 395 | 395 |
| OLD | NEW |