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