Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Side by Side Diff: Source/modules/webaudio/AudioBufferSourceNode.cpp

Issue 26913005: start/stop method for AudioBufferSourceNodes and OscillatorNodes can take no args. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove incorrect comment. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 * 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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 m_buffer = buffer; 365 m_buffer = buffer;
366 366
367 return true; 367 return true;
368 } 368 }
369 369
370 unsigned AudioBufferSourceNode::numberOfChannels() 370 unsigned AudioBufferSourceNode::numberOfChannels()
371 { 371 {
372 return output(0)->numberOfChannels(); 372 return output(0)->numberOfChannels();
373 } 373 }
374 374
375 void AudioBufferSourceNode::startGrain(double when, double grainOffset) 375 void AudioBufferSourceNode::start(double when)
376 { 376 {
377 // Duration of 0 has special value, meaning calculate based on the entire bu ffer's duration. 377 AudioScheduledSourceNode::start(when);
Ken Russell (switch to Gerrit) 2013/10/14 22:54:05 Are you sure it's correct to delegate to AudioSche
Raymond Toy (Google) 2013/10/28 17:34:57 The diff is confusing. A plain start(when) is the
Ken Russell (switch to Gerrit) 2013/10/28 20:13:42 I understand this, but the new code's behavior is
378 startGrain(when, grainOffset, 0);
379 } 378 }
380 379
381 void AudioBufferSourceNode::startGrain(double when, double grainOffset, double g rainDuration) 380 void AudioBufferSourceNode::start(double when, double grainOffset, double grainD uration)
382 { 381 {
383 ASSERT(isMainThread()); 382 ASSERT(isMainThread());
384 383
385 if (m_playbackState != UNSCHEDULED_STATE) 384 if (m_playbackState != UNSCHEDULED_STATE)
386 return; 385 return;
387 386
388 if (!buffer()) 387 if (!buffer())
389 return; 388 return;
390 389
391 // Do sanity checking of grain parameters versus buffer size. 390 // Do sanity checking of grain parameters versus buffer size.
(...skipping 19 matching lines...) Expand all
411 // at a sub-sample position since it will degrade the quality. 410 // at a sub-sample position since it will degrade the quality.
412 // When aligned to the sample-frame the playback will be identical to the PC M data stored in the buffer. 411 // When aligned to the sample-frame the playback will be identical to the PC M data stored in the buffer.
413 // Since playbackRate == 1 is very common, it's worth considering quality. 412 // Since playbackRate == 1 is very common, it's worth considering quality.
414 m_virtualReadIndex = AudioUtilities::timeToSampleFrame(m_grainOffset, buffer ()->sampleRate()); 413 m_virtualReadIndex = AudioUtilities::timeToSampleFrame(m_grainOffset, buffer ()->sampleRate());
415 414
416 m_playbackState = SCHEDULED_STATE; 415 m_playbackState = SCHEDULED_STATE;
417 } 416 }
418 417
419 void AudioBufferSourceNode::noteGrainOn(double when, double grainOffset, double grainDuration) 418 void AudioBufferSourceNode::noteGrainOn(double when, double grainOffset, double grainDuration)
420 { 419 {
421 startGrain(when, grainOffset, grainDuration); 420 start(when, grainOffset, grainDuration);
422 } 421 }
423 422
424 double AudioBufferSourceNode::totalPitchRate() 423 double AudioBufferSourceNode::totalPitchRate()
425 { 424 {
426 double dopplerRate = 1.0; 425 double dopplerRate = 1.0;
427 if (m_pannerNode) 426 if (m_pannerNode)
428 dopplerRate = m_pannerNode->dopplerRate(); 427 dopplerRate = m_pannerNode->dopplerRate();
429 428
430 // Incorporate buffer's sample-rate versus AudioContext's sample-rate. 429 // Incorporate buffer's sample-rate versus AudioContext's sample-rate.
431 // Normally it's not an issue because buffers are loaded at the AudioContext 's sample-rate, but we can handle it in any case. 430 // Normally it's not an issue because buffers are loaded at the AudioContext 's sample-rate, but we can handle it in any case.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 void AudioBufferSourceNode::finish() 478 void AudioBufferSourceNode::finish()
480 { 479 {
481 clearPannerNode(); 480 clearPannerNode();
482 ASSERT(!m_pannerNode); 481 ASSERT(!m_pannerNode);
483 AudioScheduledSourceNode::finish(); 482 AudioScheduledSourceNode::finish();
484 } 483 }
485 484
486 } // namespace WebCore 485 } // namespace WebCore
487 486
488 #endif // ENABLE(WEB_AUDIO) 487 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/modules/webaudio/AudioBufferSourceNode.h ('k') | Source/modules/webaudio/AudioBufferSourceNode.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698