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

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

Issue 26913005: start/stop method for AudioBufferSourceNodes and OscillatorNodes can take no args. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 // setBuffer() is called on the main thread. This is the buffer we use for p layback. 55 // setBuffer() is called on the main thread. This is the buffer we use for p layback.
56 void setBuffer(AudioBuffer*, ExceptionState&); 56 void setBuffer(AudioBuffer*, ExceptionState&);
57 AudioBuffer* buffer() { return m_buffer.get(); } 57 AudioBuffer* buffer() { return m_buffer.get(); }
58 58
59 // numberOfChannels() returns the number of output channels. This value equ als the number of channels from the buffer. 59 // numberOfChannels() returns the number of output channels. This value equ als the number of channels from the buffer.
60 // If a new buffer is set with a different number of channels, then this val ue will dynamically change. 60 // If a new buffer is set with a different number of channels, then this val ue will dynamically change.
61 unsigned numberOfChannels(); 61 unsigned numberOfChannels();
62 62
63 // Play-state 63 // Play-state
64 void startGrain(double when, double grainOffset); 64 void start(double when = 0);
65 void startGrain(double when, double grainOffset, double grainDuration); 65 void start(double when, double grainOffset);
66 void start(double when, double grainOffset, double grainDuration);
66 67
67 void noteGrainOn(double when, double grainOffset, double grainDuration); 68 void noteGrainOn(double when, double grainOffset, double grainDuration);
68 69
69 // Note: the attribute was originally exposed as .looping, but to be more co nsistent in naming with <audio> 70 // Note: the attribute was originally exposed as .looping, but to be more co nsistent in naming with <audio>
70 // and with how it's described in the specification, the proper attribute na me is .loop 71 // and with how it's described in the specification, the proper attribute na me is .loop
71 // The old attribute is kept for backwards compatibility. 72 // The old attribute is kept for backwards compatibility.
72 bool loop() const { return m_isLooping; } 73 bool loop() const { return m_isLooping; }
73 void setLoop(bool looping) { m_isLooping = looping; } 74 void setLoop(bool looping) { m_isLooping = looping; }
74 75
75 // Loop times in seconds. 76 // Loop times in seconds.
(...skipping 11 matching lines...) Expand all
87 88
88 // If we are no longer playing, propogate silence ahead to downstream nodes. 89 // If we are no longer playing, propogate silence ahead to downstream nodes.
89 virtual bool propagatesSilence() const; 90 virtual bool propagatesSilence() const;
90 91
91 // AudioScheduledSourceNode 92 // AudioScheduledSourceNode
92 virtual void finish() OVERRIDE; 93 virtual void finish() OVERRIDE;
93 94
94 private: 95 private:
95 AudioBufferSourceNode(AudioContext*, float sampleRate); 96 AudioBufferSourceNode(AudioContext*, float sampleRate);
96 97
98 void startPlaying(bool isGrain, double when, double grainOffset, double grai nDuration);
99
97 // Returns true on success. 100 // Returns true on success.
98 bool renderFromBuffer(AudioBus*, unsigned destinationFrameOffset, size_t num berOfFrames); 101 bool renderFromBuffer(AudioBus*, unsigned destinationFrameOffset, size_t num berOfFrames);
99 102
100 // Render silence starting from "index" frame in AudioBus. 103 // Render silence starting from "index" frame in AudioBus.
101 inline bool renderSilenceAndFinishIfNotLooping(AudioBus*, unsigned index, si ze_t framesToProcess); 104 inline bool renderSilenceAndFinishIfNotLooping(AudioBus*, unsigned index, si ze_t framesToProcess);
102 105
103 // m_buffer holds the sample data which this node outputs. 106 // m_buffer holds the sample data which this node outputs.
104 RefPtr<AudioBuffer> m_buffer; 107 RefPtr<AudioBuffer> m_buffer;
105 108
106 // Pointers for the buffer and destination. 109 // Pointers for the buffer and destination.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // the pitch rate. We manually manage ref-counting because we want to use Re fTypeConnection. 141 // the pitch rate. We manually manage ref-counting because we want to use Re fTypeConnection.
139 PannerNode* m_pannerNode; 142 PannerNode* m_pannerNode;
140 143
141 // This synchronizes process() with setBuffer() which can cause dynamic chan nel count changes. 144 // This synchronizes process() with setBuffer() which can cause dynamic chan nel count changes.
142 mutable Mutex m_processLock; 145 mutable Mutex m_processLock;
143 }; 146 };
144 147
145 } // namespace WebCore 148 } // namespace WebCore
146 149
147 #endif // AudioBufferSourceNode_h 150 #endif // AudioBufferSourceNode_h
OLDNEW
« no previous file with comments | « LayoutTests/webaudio/dom-exceptions-expected.txt ('k') | Source/modules/webaudio/AudioBufferSourceNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698