| 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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, float sampleRate) | 333 OscillatorNode::OscillatorNode(AbstractAudioContext& context, float sampleRate) |
| 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,
0, sampleRate / 2)) |
| 337 // Default to no detuning. | 337 // Default to no detuning. |
| 338 , m_detune(AudioParam::create(context, ParamTypeOscillatorDetune, 0)) | 338 , m_detune(AudioParam::create(context, ParamTypeOscillatorDetune, 0)) |
| 339 { | 339 { |
| 340 setHandler(OscillatorHandler::create(*this, sampleRate, m_frequency->handler
(), m_detune->handler())); | 340 setHandler(OscillatorHandler::create(*this, sampleRate, m_frequency->handler
(), m_detune->handler())); |
| 341 } | 341 } |
| 342 | 342 |
| 343 OscillatorNode* OscillatorNode::create(AbstractAudioContext& context, float samp
leRate) | 343 OscillatorNode* OscillatorNode::create(AbstractAudioContext& context, float samp
leRate) |
| 344 { | 344 { |
| 345 return new OscillatorNode(context, sampleRate); | 345 return new OscillatorNode(context, sampleRate); |
| 346 } | 346 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 377 return m_detune; | 377 return m_detune; |
| 378 } | 378 } |
| 379 | 379 |
| 380 void OscillatorNode::setPeriodicWave(PeriodicWave* wave) | 380 void OscillatorNode::setPeriodicWave(PeriodicWave* wave) |
| 381 { | 381 { |
| 382 oscillatorHandler().setPeriodicWave(wave); | 382 oscillatorHandler().setPeriodicWave(wave); |
| 383 } | 383 } |
| 384 | 384 |
| 385 } // namespace blink | 385 } // namespace blink |
| 386 | 386 |
| OLD | NEW |