Diff
Modified: trunk/LayoutTests/ChangeLog (265244 => 265245)
--- trunk/LayoutTests/ChangeLog 2020-08-04 16:01:26 UTC (rev 265244)
+++ trunk/LayoutTests/ChangeLog 2020-08-04 16:23:40 UTC (rev 265245)
@@ -1,3 +1,15 @@
+2020-08-04 Chris Dumez <cdu...@apple.com>
+
+ Move non standard AudioBufferSourceNode API to new WebKitAudioBufferSourceNode interface
+ https://bugs.webkit.org/show_bug.cgi?id=215106
+
+ Reviewed by Eric Carlson.
+
+ Add layout test coverage.
+
+ * webaudio/audiobuffersourcenode-legacy-api-expected.txt: Added.
+ * webaudio/audiobuffersourcenode-legacy-api.html: Added.
+
2020-08-03 Lauro Moura <lmo...@igalia.com>
[GTK][WPE] Gardening some failures and rebaseline.
Modified: trunk/LayoutTests/webaudio/audiobuffersource-channels-expected.txt (265244 => 265245)
--- trunk/LayoutTests/webaudio/audiobuffersource-channels-expected.txt 2020-08-04 16:01:26 UTC (rev 265244)
+++ trunk/LayoutTests/webaudio/audiobuffersource-channels-expected.txt 2020-08-04 16:23:40 UTC (rev 265245)
@@ -3,7 +3,7 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS source.buffer is null
-PASS source.buffer = 57 threw exception TypeError: The AudioBufferSourceNode.buffer attribute must be an instance of AudioBuffer.
+PASS source.buffer = 57 threw exception TypeError: The WebKitAudioBufferSourceNode.buffer attribute must be an instance of AudioBuffer.
PASS Mono buffer can be set.
PASS Stereo buffer can be set.
PASS 3 channels buffer can be set.
Added: trunk/LayoutTests/webaudio/audiobuffersourcenode-legacy-api-expected.txt (0 => 265245)
--- trunk/LayoutTests/webaudio/audiobuffersourcenode-legacy-api-expected.txt (rev 0)
+++ trunk/LayoutTests/webaudio/audiobuffersourcenode-legacy-api-expected.txt 2020-08-04 16:23:40 UTC (rev 265245)
@@ -0,0 +1,21 @@
+Testing that the legacy AudioBufferSourceNode API is not exposed on the unprefixed AudioBufferSourceNode
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS AudioBufferSourceNode.prototype.playbackState is undefined.
+PASS AudioBufferSourceNode.prototype.gain is undefined.
+PASS AudioBufferSourceNode.UNSCHEDULED_STATE is 0
+PASS AudioBufferSourceNode.SCHEDULED_STATE is 1
+PASS AudioBufferSourceNode.PLAYING_STATE is 2
+PASS AudioBufferSourceNode.FINISHED_STATE is 3
+PASS legacyBufferSource.playbackState is defined.
+PASS legacyBufferSource.gain is defined.
+PASS legacyBufferSource.UNSCHEDULED_STATE is 0
+PASS legacyBufferSource.SCHEDULED_STATE is 1
+PASS legacyBufferSource.PLAYING_STATE is 2
+PASS legacyBufferSource.FINISHED_STATE is 3
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/webaudio/audiobuffersourcenode-legacy-api.html (0 => 265245)
--- trunk/LayoutTests/webaudio/audiobuffersourcenode-legacy-api.html (rev 0)
+++ trunk/LayoutTests/webaudio/audiobuffersourcenode-legacy-api.html 2020-08-04 16:23:40 UTC (rev 265245)
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script src=""
+</head>
+<body>
+ <script>
+ description("Testing that the legacy AudioBufferSourceNode API is not exposed on the unprefixed AudioBufferSourceNode");
+
+ shouldBeUndefined("AudioBufferSourceNode.prototype.playbackState");
+ shouldBeUndefined("AudioBufferSourceNode.prototype.gain");
+
+ // Tests backward compatibility for prefixed API.
+ shouldBe("AudioBufferSourceNode.UNSCHEDULED_STATE", "0");
+ shouldBe("AudioBufferSourceNode.SCHEDULED_STATE", "1");
+ shouldBe("AudioBufferSourceNode.PLAYING_STATE", "2");
+ shouldBe("AudioBufferSourceNode.FINISHED_STATE", "3");
+
+ let legacyContext = new webkitAudioContext;
+ let legacyBufferSource = legacyContext.createBufferSource();
+ shouldBeDefined("legacyBufferSource.playbackState");
+ shouldBeDefined("legacyBufferSource.gain");
+ shouldBe("legacyBufferSource.UNSCHEDULED_STATE", "0");
+ shouldBe("legacyBufferSource.SCHEDULED_STATE", "1");
+ shouldBe("legacyBufferSource.PLAYING_STATE", "2");
+ shouldBe("legacyBufferSource.FINISHED_STATE", "3");
+ </script>
+</body>
+</html>
Modified: trunk/Source/WebCore/CMakeLists.txt (265244 => 265245)
--- trunk/Source/WebCore/CMakeLists.txt 2020-08-04 16:01:26 UTC (rev 265244)
+++ trunk/Source/WebCore/CMakeLists.txt 2020-08-04 16:23:40 UTC (rev 265245)
@@ -498,6 +498,7 @@
Modules/webaudio/ScriptProcessorNode.idl
Modules/webaudio/WaveShaperNode.idl
Modules/webaudio/WaveShaperOptions.idl
+ Modules/webaudio/WebKitAudioBufferSourceNode.idl
Modules/webaudio/WebKitAudioContext.idl
Modules/webaudio/WebKitAudioPannerNode.idl
Modules/webaudio/WebKitOfflineAudioContext.idl
Modified: trunk/Source/WebCore/ChangeLog (265244 => 265245)
--- trunk/Source/WebCore/ChangeLog 2020-08-04 16:01:26 UTC (rev 265244)
+++ trunk/Source/WebCore/ChangeLog 2020-08-04 16:23:40 UTC (rev 265245)
@@ -1,3 +1,40 @@
+2020-08-04 Chris Dumez <cdu...@apple.com>
+
+ Move non standard AudioBufferSourceNode API to new WebKitAudioBufferSourceNode interface
+ https://bugs.webkit.org/show_bug.cgi?id=215106
+
+ Reviewed by Eric Carlson.
+
+ Move non standard AudioBufferSourceNode API to new WebKitAudioBufferSourceNode interface
+ to maintain backward compatibility while having an unprefixed API that matches the
+ specification:
+ - https://www.w3.org/TR/webaudio/#AudioBufferSourceNode
+
+ In particular the 'playbackState' and 'gain' attributes should not part of the standard.
+
+ Test: webaudio/audiobuffersourcenode-legacy-api.html
+
+ * CMakeLists.txt:
+ * DerivedSources-input.xcfilelist:
+ * DerivedSources-output.xcfilelist:
+ * DerivedSources.make:
+ * Modules/webaudio/AudioBufferSourceNode.cpp:
+ (WebCore::AudioBufferSourceNode::AudioBufferSourceNode):
+ (WebCore::AudioBufferSourceNode::process):
+ (WebCore::AudioBufferSourceNode::reset):
+ * Modules/webaudio/AudioBufferSourceNode.h:
+ (WebCore::AudioBufferSourceNode::legacyGainValue const):
+ * Modules/webaudio/AudioBufferSourceNode.idl:
+ * Modules/webaudio/WebKitAudioBufferSourceNode.h: Copied from Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl.
+ * Modules/webaudio/WebKitAudioBufferSourceNode.idl: Copied from Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl.
+ * Modules/webaudio/WebKitAudioContext.cpp:
+ (WebCore::WebKitAudioContext::createWebKitBufferSource):
+ * Modules/webaudio/WebKitAudioContext.h:
+ * Modules/webaudio/WebKitAudioContext.idl:
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/WebCoreBuiltinNames.h:
+
2020-08-04 Youenn Fablet <you...@apple.com>
Remove AudioSampleDataSource::setPaused
Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (265244 => 265245)
--- trunk/Source/WebCore/DerivedSources-input.xcfilelist 2020-08-04 16:01:26 UTC (rev 265244)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist 2020-08-04 16:23:40 UTC (rev 265245)
@@ -347,6 +347,7 @@
$(PROJECT_DIR)/Modules/webaudio/ScriptProcessorNode.idl
$(PROJECT_DIR)/Modules/webaudio/WaveShaperNode.idl
$(PROJECT_DIR)/Modules/webaudio/WaveShaperOptions.idl
+$(PROJECT_DIR)/Modules/webaudio/WebKitAudioBufferSourceNode.idl
$(PROJECT_DIR)/Modules/webaudio/WebKitAudioContext.idl
$(PROJECT_DIR)/Modules/webaudio/WebKitAudioPannerNode.idl
$(PROJECT_DIR)/Modules/webaudio/WebKitOfflineAudioContext.idl
Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (265244 => 265245)
--- trunk/Source/WebCore/DerivedSources-output.xcfilelist 2020-08-04 16:01:26 UTC (rev 265244)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist 2020-08-04 16:23:40 UTC (rev 265245)
@@ -2130,6 +2130,8 @@
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUTextureView.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebKitAnimationEvent.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebKitAnimationEvent.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebKitAudioBufferSourceNode.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebKitAudioBufferSourceNode.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebKitAudioContext.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebKitAudioContext.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebKitAudioPannerNode.cpp
Modified: trunk/Source/WebCore/DerivedSources.make (265244 => 265245)
--- trunk/Source/WebCore/DerivedSources.make 2020-08-04 16:01:26 UTC (rev 265244)
+++ trunk/Source/WebCore/DerivedSources.make 2020-08-04 16:23:40 UTC (rev 265245)
@@ -430,6 +430,7 @@
$(WebCore)/Modules/webaudio/ScriptProcessorNode.idl \
$(WebCore)/Modules/webaudio/WaveShaperNode.idl \
$(WebCore)/Modules/webaudio/WaveShaperOptions.idl \
+ $(WebCore)/Modules/webaudio/WebKitAudioBufferSourceNode.idl \
$(WebCore)/Modules/webaudio/WebKitAudioContext.idl \
$(WebCore)/Modules/webaudio/WebKitAudioPannerNode.idl \
$(WebCore)/Modules/webaudio/WebKitOfflineAudioContext.idl \
Modified: trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp (265244 => 265245)
--- trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp 2020-08-04 16:01:26 UTC (rev 265244)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp 2020-08-04 16:23:40 UTC (rev 265245)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2010, Google Inc. All rights reserved.
+ * Copyright (C) 2020, Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -36,11 +37,13 @@
#include "FloatConversion.h"
#include "PannerNode.h"
#include "ScriptExecutionContext.h"
+#include "WebKitAudioBufferSourceNode.h"
#include <wtf/IsoMallocInlines.h>
namespace WebCore {
WTF_MAKE_ISO_ALLOCATED_IMPL(AudioBufferSourceNode);
+WTF_MAKE_ISO_ALLOCATED_IMPL(WebKitAudioBufferSourceNode);
const double DefaultGrainDuration = 0.020; // 20ms
@@ -74,7 +77,6 @@
AudioBufferSourceNode::AudioBufferSourceNode(BaseAudioContext& context)
: AudioScheduledSourceNode(context, context.sampleRate())
- , m_gain(AudioParam::create(context, "gain"_s, 1.0, 0.0, 1.0))
, m_detune(AudioParam::create(context, "detune"_s, 0.0, -FLT_MAX, FLT_MAX))
, m_playbackRate(AudioParam::create(context, "playbackRate"_s, 1.0, -FLT_MAX, FLT_MAX))
, m_grainDuration(DefaultGrainDuration)
@@ -142,7 +144,7 @@
}
// Apply the gain (in-place) to the output bus.
- float totalGain = gain().value() * m_buffer->gain();
+ float totalGain = legacyGainValue() * m_buffer->gain();
outputBus.copyWithGainFrom(outputBus, &m_lastGain, totalGain);
outputBus.clearSilentFlag();
}
@@ -413,7 +415,7 @@
void AudioBufferSourceNode::reset()
{
m_virtualReadIndex = 0;
- m_lastGain = gain().value();
+ m_lastGain = legacyGainValue();
}
void AudioBufferSourceNode::setBuffer(RefPtr<AudioBuffer>&& buffer)
Modified: trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.h (265244 => 265245)
--- trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.h 2020-08-04 16:01:26 UTC (rev 265244)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.h 2020-08-04 16:23:40 UTC (rev 265245)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2010, Google Inc. All rights reserved.
+ * Copyright (C) 2020, Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -38,7 +39,7 @@
// AudioBufferSourceNode is an AudioNode representing an audio source from an in-memory audio asset represented by an AudioBuffer.
// It generally will be used for short sounds which require a high degree of scheduling flexibility (can playback in rhythmically perfect ways).
-class AudioBufferSourceNode final : public AudioScheduledSourceNode {
+class AudioBufferSourceNode : public AudioScheduledSourceNode {
WTF_MAKE_ISO_ALLOCATED(AudioBufferSourceNode);
public:
static Ref<AudioBufferSourceNode> create(BaseAudioContext&, float sampleRate);
@@ -74,7 +75,6 @@
void setLoopStart(double loopStart) { m_loopStart = loopStart; }
void setLoopEnd(double loopEnd) { m_loopEnd = loopEnd; }
- AudioParam& gain() { return m_gain.get(); }
AudioParam& detune() { return m_detune.get(); }
AudioParam& playbackRate() { return m_playbackRate.get(); }
@@ -90,12 +90,15 @@
const char* activeDOMObjectName() const override { return "AudioBufferSourceNode"; }
-private:
+protected:
explicit AudioBufferSourceNode(BaseAudioContext&);
+private:
double tailTime() const final { return 0; }
double latencyTime() const final { return 0; }
+ virtual double legacyGainValue() const { return 1.0; }
+
enum BufferPlaybackMode {
Entire,
Partial
@@ -116,8 +119,6 @@
UniqueArray<const float*> m_sourceChannels;
UniqueArray<float*> m_destinationChannels;
- // Used for the "gain", "detune" and "playbackRate" attributes.
- Ref<AudioParam> m_gain;
Ref<AudioParam> m_detune;
Ref<AudioParam> m_playbackRate;
Modified: trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl (265244 => 265245)
--- trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl 2020-08-04 16:01:26 UTC (rev 265244)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl 2020-08-04 16:23:40 UTC (rev 265245)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2010, Google Inc. All rights reserved.
+ * Copyright (C) 2020, Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,26 +27,25 @@
[
Conditional=WEB_AUDIO,
JSGenerateToJSObject,
+ EnabledBySetting=ModernUnprefixedWebAudio
] interface AudioBufferSourceNode : AudioScheduledSourceNode {
- [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] constructor (BaseAudioContext context, optional AudioBufferSourceOptions options);
+ [MayThrowException] constructor (BaseAudioContext context, optional AudioBufferSourceOptions options);
attribute AudioBuffer? buffer;
- const unsigned short UNSCHEDULED_STATE = 0;
- const unsigned short SCHEDULED_STATE = 1;
- const unsigned short PLAYING_STATE = 2;
- const unsigned short FINISHED_STATE = 3;
-
- readonly attribute unsigned short playbackState; // FIXME: This is not part of the specification.
-
- readonly attribute AudioParam gain; // FIXME: This is not part of the specification.
- [EnabledBySetting=ModernUnprefixedWebAudio] readonly attribute AudioParam detune;
readonly attribute AudioParam playbackRate;
+ readonly attribute AudioParam detune;
attribute boolean loop;
-
attribute double loopStart;
attribute double loopEnd;
[MayThrowException, ImplementedAs=startLater] void start(optional double when = 0, optional double grainOffset = 0, optional double grainDuration);
+
+ // FIXME: Those constants are kept for backward compatibility with the prefixed API and should
+ // be removed once we stop supporting it.
+ const unsigned short UNSCHEDULED_STATE = 0;
+ const unsigned short SCHEDULED_STATE = 1;
+ const unsigned short PLAYING_STATE = 2;
+ const unsigned short FINISHED_STATE = 3;
};
Copied: trunk/Source/WebCore/Modules/webaudio/WebKitAudioBufferSourceNode.h (from rev 265244, trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl) (0 => 265245)
--- trunk/Source/WebCore/Modules/webaudio/WebKitAudioBufferSourceNode.h (rev 0)
+++ trunk/Source/WebCore/Modules/webaudio/WebKitAudioBufferSourceNode.h 2020-08-04 16:23:40 UTC (rev 265245)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2010, Google Inc. All rights reserved.
+ * Copyright (C) 2020, Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "AudioBufferSourceNode.h"
+#include "AudioParam.h"
+
+namespace WebCore {
+
+class WebKitAudioBufferSourceNode final : public AudioBufferSourceNode {
+ WTF_MAKE_ISO_ALLOCATED(WebKitAudioBufferSourceNode);
+public:
+ static Ref<WebKitAudioBufferSourceNode> create(BaseAudioContext& context)
+ {
+ return adoptRef(*new WebKitAudioBufferSourceNode(context));
+ }
+
+ AudioParam& gain() const { return m_gain.get(); }
+
+private:
+ explicit WebKitAudioBufferSourceNode(BaseAudioContext& context)
+ : AudioBufferSourceNode(context)
+ , m_gain(AudioParam::create(context, "gain"_s, 1.0, 0.0, 1.0))
+ {
+ }
+
+ double legacyGainValue() const final { return gain().value(); }
+
+ Ref<AudioParam> m_gain;
+};
+
+}
Copied: trunk/Source/WebCore/Modules/webaudio/WebKitAudioBufferSourceNode.idl (from rev 265244, trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl) (0 => 265245)
--- trunk/Source/WebCore/Modules/webaudio/WebKitAudioBufferSourceNode.idl (rev 0)
+++ trunk/Source/WebCore/Modules/webaudio/WebKitAudioBufferSourceNode.idl 2020-08-04 16:23:40 UTC (rev 265245)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2010, Google Inc. All rights reserved.
+ * Copyright (C) 2020, Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// A cached (non-streamed), memory-resident audio source
+[
+ Conditional=WEB_AUDIO,
+ EnabledBySetting=PrefixedWebAudio,
+ JSGenerateToJSObject,
+ NoInterfaceObject
+] interface WebKitAudioBufferSourceNode : AudioScheduledSourceNode {
+ attribute AudioBuffer? buffer;
+
+ const unsigned short UNSCHEDULED_STATE = 0;
+ const unsigned short SCHEDULED_STATE = 1;
+ const unsigned short PLAYING_STATE = 2;
+ const unsigned short FINISHED_STATE = 3;
+
+ readonly attribute unsigned short playbackState;
+
+ readonly attribute AudioParam gain;
+ readonly attribute AudioParam playbackRate;
+
+ attribute boolean loop;
+
+ attribute double loopStart;
+ attribute double loopEnd;
+
+ [MayThrowException, ImplementedAs=startLater] void start(optional double when = 0, optional double grainOffset = 0, optional double grainDuration);
+};
Modified: trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.cpp (265244 => 265245)
--- trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.cpp 2020-08-04 16:01:26 UTC (rev 265244)
+++ trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.cpp 2020-08-04 16:23:40 UTC (rev 265245)
@@ -31,6 +31,7 @@
#include "JSDOMPromiseDeferred.h"
#include "PeriodicWave.h"
+#include "WebKitAudioBufferSourceNode.h"
#include "WebKitAudioPannerNode.h"
#include "WebKitOscillatorNode.h"
#include <wtf/IsoMallocInlines.h>
@@ -206,6 +207,25 @@
return PeriodicWave::create(sampleRate(), real, imaginary);
}
+ExceptionOr<Ref<WebKitAudioBufferSourceNode>> WebKitAudioContext::createWebKitBufferSource()
+{
+ ALWAYS_LOG(LOGIDENTIFIER);
+
+ ASSERT(isMainThread());
+ if (isStopped())
+ return Exception { InvalidStateError };
+
+ lazyInitialize();
+
+ auto node = WebKitAudioBufferSourceNode::create(*this);
+
+ // Because this is an AudioScheduledSourceNode, the context keeps a reference until it has finished playing.
+ // When this happens, AudioScheduledSourceNode::finish() calls BaseAudioContext::notifyNodeFinishedProcessing().
+ refNode(node);
+
+ return node;
+}
+
void WebKitAudioContext::close(DOMPromiseDeferred<void>&& promise)
{
if (isOfflineContext() || isStopped()) {
Modified: trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.h (265244 => 265245)
--- trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.h 2020-08-04 16:01:26 UTC (rev 265244)
+++ trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.h 2020-08-04 16:23:40 UTC (rev 265245)
@@ -37,6 +37,7 @@
class MediaStreamAudioDestinationNode;
class MediaStreamAudioSourceNode;
class PeriodicWave;
+class WebKitAudioBufferSourceNode;
class WebKitAudioPannerNode;
class WebKitOscillatorNode;
@@ -64,6 +65,7 @@
ExceptionOr<Ref<WebKitAudioPannerNode>> createWebKitPanner();
ExceptionOr<Ref<WebKitOscillatorNode>> createWebKitOscillator();
ExceptionOr<Ref<PeriodicWave>> createPeriodicWave(Float32Array& real, Float32Array& imaginary);
+ ExceptionOr<Ref<WebKitAudioBufferSourceNode>> createWebKitBufferSource();
protected:
explicit WebKitAudioContext(Document&);
Modified: trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.idl (265244 => 265245)
--- trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.idl 2020-08-04 16:01:26 UTC (rev 265244)
+++ trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.idl 2020-08-04 16:23:40 UTC (rev 265245)
@@ -62,7 +62,7 @@
void decodeAudioData(ArrayBuffer audioData, AudioBufferCallback? successCallback, optional AudioBufferCallback? errorCallback);
// Sources
- [MayThrowException] AudioBufferSourceNode createBufferSource();
+ [MayThrowException, ImplementedAs=createWebKitBufferSource] WebKitAudioBufferSourceNode createBufferSource();
[Conditional=VIDEO, MayThrowException] MediaElementAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement);
Modified: trunk/Source/WebCore/Sources.txt (265244 => 265245)
--- trunk/Source/WebCore/Sources.txt 2020-08-04 16:01:26 UTC (rev 265244)
+++ trunk/Source/WebCore/Sources.txt 2020-08-04 16:23:40 UTC (rev 265245)
@@ -3570,6 +3570,7 @@
JSWebGPUTexture.cpp
JSWebGPUTextureView.cpp
JSWebKitAnimationEvent.cpp
+JSWebKitAudioBufferSourceNode.cpp
JSWebKitAudioContext.cpp
JSWebKitAudioPannerNode.cpp
JSWebKitCSSMatrix.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (265244 => 265245)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-08-04 16:01:26 UTC (rev 265244)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-08-04 16:23:40 UTC (rev 265245)
@@ -2444,6 +2444,7 @@
833B9E321F508D8500E0E428 /* JSFileSystemDirectoryEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 833B9E2F1F508D8000E0E428 /* JSFileSystemDirectoryEntry.h */; };
833B9E341F508D8500E0E428 /* JSFileSystemEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 833B9E2A1F508D8000E0E428 /* JSFileSystemEntry.h */; };
833B9E361F508D8500E0E428 /* JSFileSystemFileEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 833B9E2C1F508D8000E0E428 /* JSFileSystemFileEntry.h */; };
+ 833D1C7624D8D54F00E813DF /* WebKitAudioBufferSourceNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 833D1C7324D8D53300E813DF /* WebKitAudioBufferSourceNode.h */; };
83407FC11E8D9C1700E048D3 /* VisibilityChangeClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 83407FC01E8D9C1200E048D3 /* VisibilityChangeClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
8343D98424D0DEE9009ABD49 /* WebKitOscillatorNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 8343D98124D0DEA9009ABD49 /* WebKitOscillatorNode.h */; };
834476EF1DA5BC5E002B5EB0 /* JSScrollLogicalPosition.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E9B3011DA5A51E00FFD8D4 /* JSScrollLogicalPosition.h */; };
@@ -10452,6 +10453,8 @@
833B9E2E1F508D8000E0E428 /* JSFileSystemEntry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFileSystemEntry.cpp; sourceTree = "<group>"; };
833B9E2F1F508D8000E0E428 /* JSFileSystemDirectoryEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFileSystemDirectoryEntry.h; sourceTree = "<group>"; };
833CF70F20DB3F5F00141BCC /* JSPerformanceObserverCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPerformanceObserverCustom.cpp; sourceTree = "<group>"; };
+ 833D1C7324D8D53300E813DF /* WebKitAudioBufferSourceNode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebKitAudioBufferSourceNode.h; sourceTree = "<group>"; };
+ 833D1C7524D8D53300E813DF /* WebKitAudioBufferSourceNode.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebKitAudioBufferSourceNode.idl; sourceTree = "<group>"; };
83407FC01E8D9C1200E048D3 /* VisibilityChangeClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VisibilityChangeClient.h; sourceTree = "<group>"; };
8343D98124D0DEA9009ABD49 /* WebKitOscillatorNode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebKitOscillatorNode.h; sourceTree = "<group>"; };
8343D98324D0DEA9009ABD49 /* WebKitOscillatorNode.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebKitOscillatorNode.idl; sourceTree = "<group>"; };
@@ -29648,6 +29651,8 @@
FD7F298C13D4C0CB00AD9535 /* WaveShaperNode.cpp */,
FD7F298D13D4C0CB00AD9535 /* WaveShaperNode.h */,
FD7F298E13D4C0CB00AD9535 /* WaveShaperNode.idl */,
+ 833D1C7324D8D53300E813DF /* WebKitAudioBufferSourceNode.h */,
+ 833D1C7524D8D53300E813DF /* WebKitAudioBufferSourceNode.idl */,
8326BF8C24D35C20001F8A85 /* WaveShaperOptions.h */,
8326BF8D24D35C21001F8A85 /* WaveShaperOptions.idl */,
FD7F298F13D4C0CB00AD9535 /* WaveShaperProcessor.cpp */,
@@ -33595,6 +33600,7 @@
B22279900D00BF220071B782 /* SVGAnimateElement.h in Headers */,
832B843419D8E55100B26055 /* SVGAnimateElementBase.h in Headers */,
B22279930D00BF220071B782 /* SVGAnimateMotionElement.h in Headers */,
+ 833D1C7624D8D54F00E813DF /* WebKitAudioBufferSourceNode.h in Headers */,
B22279950D00BF220071B782 /* SVGAnimateTransformElement.h in Headers */,
B22279980D00BF220071B782 /* SVGAnimationElement.h in Headers */,
B222799C0D00BF220071B782 /* SVGCircleElement.h in Headers */,
Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (265244 => 265245)
--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2020-08-04 16:01:26 UTC (rev 265244)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2020-08-04 16:23:40 UTC (rev 265245)
@@ -49,6 +49,7 @@
macro(ApplePaySetupFeature) \
macro(AttachmentElement) \
macro(Audio) \
+ macro(AudioBufferSourceNode) \
macro(AudioContext) \
macro(AuthenticatorAssertionResponse) \
macro(AuthenticatorAttestationResponse) \