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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 m_type = CUSTOM; | 343 m_type = CUSTOM; |
344 } | 344 } |
345 | 345 |
346 bool OscillatorHandler::propagatesSilence() const { | 346 bool OscillatorHandler::propagatesSilence() const { |
347 return !isPlayingOrScheduled() || hasFinished() || !m_periodicWave.get(); | 347 return !isPlayingOrScheduled() || hasFinished() || !m_periodicWave.get(); |
348 } | 348 } |
349 | 349 |
350 // ---------------------------------------------------------------- | 350 // ---------------------------------------------------------------- |
351 | 351 |
352 OscillatorNode::OscillatorNode(BaseAudioContext& context) | 352 OscillatorNode::OscillatorNode(BaseAudioContext& context) |
353 : AudioScheduledSourceNode(context) | 353 : AudioScheduledSourceNode(context), |
354 // Use musical pitch standard A440 as a default. | 354 // Use musical pitch standard A440 as a default. |
355 , | |
356 m_frequency(AudioParam::create(context, | 355 m_frequency(AudioParam::create(context, |
357 ParamTypeOscillatorFrequency, | 356 ParamTypeOscillatorFrequency, |
358 440, | 357 440, |
359 -context.sampleRate() / 2, | 358 -context.sampleRate() / 2, |
360 context.sampleRate() / 2)) | 359 context.sampleRate() / 2)), |
361 // Default to no detuning. | 360 // Default to no detuning. |
362 , | |
363 m_detune(AudioParam::create(context, ParamTypeOscillatorDetune, 0)) { | 361 m_detune(AudioParam::create(context, ParamTypeOscillatorDetune, 0)) { |
364 setHandler(OscillatorHandler::create(*this, context.sampleRate(), | 362 setHandler(OscillatorHandler::create(*this, context.sampleRate(), |
365 m_frequency->handler(), | 363 m_frequency->handler(), |
366 m_detune->handler())); | 364 m_detune->handler())); |
367 } | 365 } |
368 | 366 |
369 OscillatorNode* OscillatorNode::create(BaseAudioContext& context, | 367 OscillatorNode* OscillatorNode::create(BaseAudioContext& context, |
370 ExceptionState& exceptionState) { | 368 ExceptionState& exceptionState) { |
371 DCHECK(isMainThread()); | 369 DCHECK(isMainThread()); |
372 | 370 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 | 444 |
447 AudioParam* OscillatorNode::detune() { | 445 AudioParam* OscillatorNode::detune() { |
448 return m_detune; | 446 return m_detune; |
449 } | 447 } |
450 | 448 |
451 void OscillatorNode::setPeriodicWave(PeriodicWave* wave) { | 449 void OscillatorNode::setPeriodicWave(PeriodicWave* wave) { |
452 oscillatorHandler().setPeriodicWave(wave); | 450 oscillatorHandler().setPeriodicWave(wave); |
453 } | 451 } |
454 | 452 |
455 } // namespace blink | 453 } // namespace blink |
OLD | NEW |