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

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

Issue 2760353002: Define default values for options dictionaries for WebAudio (Closed)
Patch Set: Rebase Created 3 years, 8 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
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 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 ExceptionState& exception_state) { 671 ExceptionState& exception_state) {
672 DCHECK(IsMainThread()); 672 DCHECK(IsMainThread());
673 673
674 AudioBufferSourceNode* node = Create(*context, exception_state); 674 AudioBufferSourceNode* node = Create(*context, exception_state);
675 675
676 if (!node) 676 if (!node)
677 return nullptr; 677 return nullptr;
678 678
679 if (options.hasBuffer()) 679 if (options.hasBuffer())
680 node->setBuffer(options.buffer(), exception_state); 680 node->setBuffer(options.buffer(), exception_state);
681 if (options.hasDetune()) 681 node->detune()->setValue(options.detune());
682 node->detune()->setValue(options.detune()); 682 node->setLoop(options.loop());
683 if (options.hasLoop()) 683 node->setLoopEnd(options.loopEnd());
684 node->setLoop(options.loop()); 684 node->setLoopStart(options.loopStart());
685 if (options.hasLoopEnd()) 685 node->playbackRate()->setValue(options.playbackRate());
686 node->setLoopEnd(options.loopEnd());
687 if (options.hasLoopStart())
688 node->setLoopStart(options.loopStart());
689 if (options.hasPlaybackRate())
690 node->playbackRate()->setValue(options.playbackRate());
691 686
692 return node; 687 return node;
693 } 688 }
694 689
695 DEFINE_TRACE(AudioBufferSourceNode) { 690 DEFINE_TRACE(AudioBufferSourceNode) {
696 visitor->Trace(playback_rate_); 691 visitor->Trace(playback_rate_);
697 visitor->Trace(detune_); 692 visitor->Trace(detune_);
698 AudioScheduledSourceNode::Trace(visitor); 693 AudioScheduledSourceNode::Trace(visitor);
699 } 694 }
700 695
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 756
762 void AudioBufferSourceNode::start(double when, 757 void AudioBufferSourceNode::start(double when,
763 double grain_offset, 758 double grain_offset,
764 double grain_duration, 759 double grain_duration,
765 ExceptionState& exception_state) { 760 ExceptionState& exception_state) {
766 GetAudioBufferSourceHandler().Start(when, grain_offset, grain_duration, 761 GetAudioBufferSourceHandler().Start(when, grain_offset, grain_duration,
767 exception_state); 762 exception_state);
768 } 763 }
769 764
770 } // namespace blink 765 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698