Title: [91723] trunk/Source/WebCore
- Revision
- 91723
- Author
- [email protected]
- Date
- 2011-07-25 16:40:16 -0700 (Mon, 25 Jul 2011)
Log Message
Deprecate AudioBufferSourceNode .looping attribute and implement .loop
https://bugs.webkit.org/show_bug.cgi?id=65133
Reviewed by Kenneth Russell.
No new tests since audio API is not yet implemented.
* webaudio/AudioBufferSourceNode.cpp:
(WebCore::AudioBufferSourceNode::renderFromBuffer):
(WebCore::AudioBufferSourceNode::totalPitchRate):
(WebCore::AudioBufferSourceNode::looping):
(WebCore::AudioBufferSourceNode::setLooping):
* webaudio/AudioBufferSourceNode.h:
(WebCore::AudioBufferSourceNode::loop):
(WebCore::AudioBufferSourceNode::setLoop):
* webaudio/AudioBufferSourceNode.idl:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (91722 => 91723)
--- trunk/Source/WebCore/ChangeLog 2011-07-25 23:35:22 UTC (rev 91722)
+++ trunk/Source/WebCore/ChangeLog 2011-07-25 23:40:16 UTC (rev 91723)
@@ -1,3 +1,22 @@
+2011-07-25 Chris Rogers <[email protected]>
+
+ Deprecate AudioBufferSourceNode .looping attribute and implement .loop
+ https://bugs.webkit.org/show_bug.cgi?id=65133
+
+ Reviewed by Kenneth Russell.
+
+ No new tests since audio API is not yet implemented.
+
+ * webaudio/AudioBufferSourceNode.cpp:
+ (WebCore::AudioBufferSourceNode::renderFromBuffer):
+ (WebCore::AudioBufferSourceNode::totalPitchRate):
+ (WebCore::AudioBufferSourceNode::looping):
+ (WebCore::AudioBufferSourceNode::setLooping):
+ * webaudio/AudioBufferSourceNode.h:
+ (WebCore::AudioBufferSourceNode::loop):
+ (WebCore::AudioBufferSourceNode::setLoop):
+ * webaudio/AudioBufferSourceNode.idl:
+
2011-07-25 James Robinson <[email protected]>
[chromium] HUD texture must be unreserved after drawing
Modified: trunk/Source/WebCore/webaudio/AudioBufferSourceNode.cpp (91722 => 91723)
--- trunk/Source/WebCore/webaudio/AudioBufferSourceNode.cpp 2011-07-25 23:35:22 UTC (rev 91722)
+++ trunk/Source/WebCore/webaudio/AudioBufferSourceNode.cpp 2011-07-25 23:40:16 UTC (rev 91723)
@@ -30,6 +30,8 @@
#include "AudioContext.h"
#include "AudioNodeOutput.h"
+#include "Document.h"
+#include "ScriptCallStack.h"
#include <algorithm>
#include <wtf/MathExtras.h>
@@ -247,7 +249,7 @@
// For linear interpolation we need the next sample-frame too.
unsigned readIndex2 = readIndex + 1;
if (readIndex2 >= endFrame) {
- if (looping()) {
+ if (loop()) {
// Make sure to wrap around at the end of the buffer.
readIndex2 -= deltaFrames;
} else
@@ -278,7 +280,7 @@
if (virtualReadIndex >= endFrame) {
virtualReadIndex -= deltaFrames;
- if (!looping()) {
+ if (!loop()) {
// If we're not looping, then stop playing when we get to the end.
m_isPlaying = false;
@@ -424,10 +426,32 @@
ASSERT(isTotalRateValid);
if (!isTotalRateValid)
totalRate = 1.0;
-
+
return totalRate;
}
+bool AudioBufferSourceNode::looping()
+{
+ static bool firstTime = true;
+ if (firstTime && context() && context()->document()) {
+ context()->document()->addMessage(JSMessageSource, LogMessageType, WarningMessageLevel, "AudioBufferSourceNode 'looping' attribute is deprecated. Use 'loop' instead.", 1, String(), 0);
+ firstTime = false;
+ }
+
+ return m_isLooping;
+}
+
+void AudioBufferSourceNode::setLooping(bool looping)
+{
+ static bool firstTime = true;
+ if (firstTime && context() && context()->document()) {
+ context()->document()->addMessage(JSMessageSource, LogMessageType, WarningMessageLevel, "AudioBufferSourceNode 'looping' attribute is deprecated. Use 'loop' instead.", 1, String(), 0);
+ firstTime = false;
+ }
+
+ m_isLooping = looping;
+}
+
} // namespace WebCore
#endif // ENABLE(WEB_AUDIO)
Modified: trunk/Source/WebCore/webaudio/AudioBufferSourceNode.h (91722 => 91723)
--- trunk/Source/WebCore/webaudio/AudioBufferSourceNode.h 2011-07-25 23:35:22 UTC (rev 91722)
+++ trunk/Source/WebCore/webaudio/AudioBufferSourceNode.h 2011-07-25 23:40:16 UTC (rev 91723)
@@ -65,8 +65,15 @@
void noteGrainOn(double when, double grainOffset, double grainDuration);
void noteOff(double when);
- bool looping() const { return m_isLooping; }
- void setLooping(bool looping) { m_isLooping = looping; }
+ // Note: the attribute was originally exposed as .looping, but to be more consistent in naming with <audio>
+ // and with how it's described in the specification, the proper attribute name is .loop
+ // The old attribute is kept for backwards compatibility.
+ bool loop() const { return m_isLooping; }
+ void setLoop(bool looping) { m_isLooping = looping; }
+
+ // Deprecated.
+ bool looping();
+ void setLooping(bool);
AudioGain* gain() { return m_gain.get(); }
AudioParam* playbackRate() { return m_playbackRate.get(); }
Modified: trunk/Source/WebCore/webaudio/AudioBufferSourceNode.idl (91722 => 91723)
--- trunk/Source/WebCore/webaudio/AudioBufferSourceNode.idl 2011-07-25 23:35:22 UTC (rev 91722)
+++ trunk/Source/WebCore/webaudio/AudioBufferSourceNode.idl 2011-07-25 23:40:16 UTC (rev 91723)
@@ -33,8 +33,10 @@
readonly attribute AudioGain gain;
readonly attribute AudioParam playbackRate;
- attribute boolean looping; // FIXME: change name to 'loop' once samples are updated
+ attribute boolean loop; // This is the proper attribute name from the specification.
+ attribute boolean looping; // This is an alias for the .loop attribute for backwards compatibility.
+
void noteOn(in float when);
void noteGrainOn(in float when, in float grainOffset, in float grainDuration);
void noteOff(in float when);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes