@woosh/meep-engine 3.46.0 → 3.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/editor/actions/concrete/TransformModifyAction.d.ts.map +1 -1
- package/editor/actions/concrete/TransformModifyAction.js +10 -2
- package/editor/ecs/component/FieldDescriptor.js +15 -0
- package/editor/ecs/component/createObjectEditor.js +41 -12
- package/editor/ecs/component/editors/ecs/Transform64Editor.d.ts.map +1 -1
- package/editor/ecs/component/editors/ecs/Transform64Editor.js +77 -70
- package/editor/tools/TransformToolV2.d.ts.map +1 -1
- package/editor/tools/TransformToolV2.js +4 -0
- package/editor/tools/v2/TransformControls.d.ts.map +1 -1
- package/editor/tools/v2/TransformControls.js +7 -0
- package/editor/view/ecs/EntityEditor.d.ts.map +1 -1
- package/editor/view/ecs/EntityEditor.js +4 -2
- package/package.json +1 -1
- package/src/core/collection/array/array_insert_at.d.ts +16 -0
- package/src/core/collection/array/array_insert_at.d.ts.map +1 -0
- package/src/core/collection/array/array_insert_at.js +32 -0
- package/src/core/collection/array/array_remove_at.d.ts +15 -0
- package/src/core/collection/array/array_remove_at.d.ts.map +1 -0
- package/src/core/collection/array/array_remove_at.js +30 -0
- package/src/core/geom/3d/quaternion/quat3_look_rotation.d.ts +37 -0
- package/src/core/geom/3d/quaternion/quat3_look_rotation.d.ts.map +1 -0
- package/src/core/geom/3d/quaternion/quat3_look_rotation.js +172 -0
- package/src/core/geom/Quaternion.d.ts +1 -0
- package/src/core/geom/Quaternion.d.ts.map +1 -1
- package/src/core/geom/Quaternion.js +12 -48
- package/src/engine/Engine.d.ts.map +1 -1
- package/src/engine/Engine.js +9 -4
- package/src/engine/ecs/storage/populateEngineSerializationRegistry.d.ts.map +1 -1
- package/src/engine/ecs/storage/populateEngineSerializationRegistry.js +10 -0
- package/src/engine/ecs/transform/t64_look_rotation.d.ts +4 -4
- package/src/engine/ecs/transform/t64_look_rotation.d.ts.map +1 -1
- package/src/engine/ecs/transform/t64_look_rotation.js +7 -18
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSystem.js +30 -1
- package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts +6 -0
- package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts.map +1 -1
- package/src/engine/graphics3/GPUParticleEmitterSystem.js +72 -29
- package/src/engine/input/devices/KeyboardDevice.d.ts +1 -0
- package/src/engine/input/devices/KeyboardDevice.d.ts.map +1 -1
- package/src/engine/input/devices/KeyboardDevice.js +7 -6
- package/src/engine/navigation/ecs/path_following/PathFollowingSystem.d.ts.map +1 -1
- package/src/engine/navigation/ecs/path_following/PathFollowingSystem.js +15 -2
- package/src/engine/network/CONGESTION_CONTROL.md +9 -9
- package/src/engine/network/MESSAGE_TRANSPORT.md +364 -0
- package/src/engine/network/NetworkSession.d.ts +31 -11
- package/src/engine/network/NetworkSession.d.ts.map +1 -1
- package/src/engine/network/NetworkSession.js +453 -286
- package/src/engine/network/README.md +77 -27
- package/src/engine/network/SMOOTHNESS_DESIGN.md +13 -5
- package/src/engine/network/diagnostics/BandwidthMeter.d.ts +1 -1
- package/src/engine/network/diagnostics/BandwidthMeter.js +1 -1
- package/src/engine/network/orchestrator/HostJoin.d.ts +111 -0
- package/src/engine/network/orchestrator/HostJoin.d.ts.map +1 -0
- package/src/engine/network/orchestrator/HostJoin.js +271 -0
- package/src/engine/network/orchestrator/NetworkPeer.d.ts +151 -112
- package/src/engine/network/orchestrator/NetworkPeer.d.ts.map +1 -1
- package/src/engine/network/orchestrator/NetworkPeer.js +450 -499
- package/src/engine/network/orchestrator/PendingSlices.d.ts +30 -0
- package/src/engine/network/orchestrator/PendingSlices.d.ts.map +1 -0
- package/src/engine/network/orchestrator/PendingSlices.js +83 -0
- package/src/engine/network/orchestrator/ReliableFrames.d.ts +34 -0
- package/src/engine/network/orchestrator/ReliableFrames.d.ts.map +1 -0
- package/src/engine/network/orchestrator/ReliableFrames.js +96 -0
- package/src/engine/network/orchestrator/ServerAuthoritativeClient.d.ts +77 -10
- package/src/engine/network/orchestrator/ServerAuthoritativeClient.d.ts.map +1 -1
- package/src/engine/network/orchestrator/ServerAuthoritativeClient.js +236 -61
- package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts +20 -6
- package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts.map +1 -1
- package/src/engine/network/orchestrator/ServerAuthoritativeServer.js +33 -8
- package/src/engine/network/replication/Replicator.d.ts.map +1 -1
- package/src/engine/network/replication/Replicator.js +7 -1
- package/src/engine/network/sim/ActionLog.d.ts +32 -5
- package/src/engine/network/sim/ActionLog.d.ts.map +1 -1
- package/src/engine/network/sim/ActionLog.js +47 -5
- package/src/engine/network/sim/SimActionExecutor.d.ts +42 -2
- package/src/engine/network/sim/SimActionExecutor.d.ts.map +1 -1
- package/src/engine/network/sim/SimActionExecutor.js +100 -4
- package/src/engine/network/sim/Snapshotter.d.ts +12 -0
- package/src/engine/network/sim/Snapshotter.d.ts.map +1 -1
- package/src/engine/network/sim/Snapshotter.js +43 -0
- package/src/engine/network/state/Baseline.d.ts +1 -1
- package/src/engine/network/state/Baseline.js +1 -1
- package/src/engine/network/state/FrameBufferRing.d.ts +25 -6
- package/src/engine/network/state/FrameBufferRing.d.ts.map +1 -1
- package/src/engine/network/state/FrameBufferRing.js +51 -6
- package/src/engine/network/state/InputRing.d.ts +4 -0
- package/src/engine/network/state/InputRing.d.ts.map +1 -1
- package/src/engine/network/state/InputRing.js +7 -0
- package/src/engine/network/transport/DeferredTransport.d.ts.map +1 -1
- package/src/engine/network/transport/DeferredTransport.js +1 -0
- package/src/engine/network/transport/LoopbackTransport.d.ts.map +1 -1
- package/src/engine/network/transport/LoopbackTransport.js +4 -2
- package/src/engine/network/transport/Transport.d.ts +7 -0
- package/src/engine/network/transport/Transport.d.ts.map +1 -1
- package/src/engine/network/transport/Transport.js +8 -0
- package/src/engine/network/transport/adapters/NodeUDPTransport.d.ts.map +1 -1
- package/src/engine/network/transport/adapters/NodeUDPTransport.js +20 -5
- package/src/engine/network/transport/adapters/WebRTCDataChannelTransport.d.ts.map +1 -1
- package/src/engine/network/transport/adapters/WebRTCDataChannelTransport.js +8 -0
- package/src/engine/network/transport/adapters/WebTransportTransport.d.ts.map +1 -1
- package/src/engine/network/transport/adapters/WebTransportTransport.js +6 -0
- package/src/engine/network/transport/connection/Connection.d.ts +191 -0
- package/src/engine/network/transport/connection/Connection.d.ts.map +1 -0
- package/src/engine/network/transport/connection/Connection.js +1262 -0
- package/src/engine/network/transport/connection/RangeSet.d.ts +94 -0
- package/src/engine/network/transport/connection/RangeSet.d.ts.map +1 -0
- package/src/engine/network/transport/connection/RangeSet.js +260 -0
- package/src/engine/network/transport/connection/RxStream.d.ts +48 -0
- package/src/engine/network/transport/connection/RxStream.d.ts.map +1 -0
- package/src/engine/network/transport/connection/RxStream.js +211 -0
- package/src/engine/network/transport/connection/TxStream.d.ts +90 -0
- package/src/engine/network/transport/connection/TxStream.d.ts.map +1 -0
- package/src/engine/network/transport/connection/TxStream.js +243 -0
- package/src/engine/network/transport/connection/bytes_copy.d.ts +17 -0
- package/src/engine/network/transport/connection/bytes_copy.d.ts.map +1 -0
- package/src/engine/network/transport/connection/bytes_copy.js +34 -0
- package/src/engine/network/transport/connection/varint.d.ts +46 -0
- package/src/engine/network/transport/connection/varint.d.ts.map +1 -0
- package/src/engine/network/transport/connection/varint.js +107 -0
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/engine/sound/ecs/audio/AudioEmitter.d.ts +38 -7
- package/src/engine/sound/ecs/audio/AudioEmitter.d.ts.map +1 -1
- package/src/engine/sound/ecs/audio/AudioEmitter.js +35 -7
- package/src/engine/sound/ecs/audio/AudioEmitterSerializationAdapter.d.ts.map +1 -1
- package/src/engine/sound/ecs/audio/AudioEmitterSerializationAdapter.js +5 -1
- package/src/engine/sound/ecs/audio/AudioEmitterSerializationUpgrader_0_1.d.ts +18 -0
- package/src/engine/sound/ecs/audio/AudioEmitterSerializationUpgrader_0_1.d.ts.map +1 -0
- package/src/engine/sound/ecs/audio/AudioEmitterSerializationUpgrader_0_1.js +48 -0
- package/src/engine/sound/ecs/audio/AudioEmitterSystem.d.ts +12 -2
- package/src/engine/sound/ecs/audio/AudioEmitterSystem.d.ts.map +1 -1
- package/src/engine/sound/ecs/audio/AudioEmitterSystem.js +173 -9
- package/src/engine/sound/ecs/audio/LiveEmitterSet.d.ts +9 -3
- package/src/engine/sound/ecs/audio/LiveEmitterSet.d.ts.map +1 -1
- package/src/engine/sound/ecs/audio/LiveEmitterSet.js +28 -8
- package/src/engine/sound/ecs/trigger/AudioEventTrigger.d.ts +8 -0
- package/src/engine/sound/ecs/trigger/AudioEventTrigger.d.ts.map +1 -1
- package/src/engine/sound/ecs/trigger/AudioEventTriggerSerializationAdapter.d.ts.map +1 -1
- package/src/engine/sound/ecs/trigger/AudioEventTriggerSerializationAdapter.js +5 -1
- package/src/engine/sound/ecs/trigger/AudioEventTriggerSerializationUpgrader_0_1.d.ts +18 -0
- package/src/engine/sound/ecs/trigger/AudioEventTriggerSerializationUpgrader_0_1.d.ts.map +1 -0
- package/src/engine/sound/ecs/trigger/AudioEventTriggerSerializationUpgrader_0_1.js +51 -0
- package/src/engine/sound/ecs/trigger/AudioEventTriggerSystem.d.ts.map +1 -1
- package/src/engine/sound/ecs/trigger/AudioEventTriggerSystem.js +15 -1
- package/src/engine/sound/sopra/README.md +768 -644
- package/src/engine/sound/sopra/SopraEngine.d.ts +104 -8
- package/src/engine/sound/sopra/SopraEngine.d.ts.map +1 -1
- package/src/engine/sound/sopra/SopraEngine.js +327 -12
- package/src/engine/sound/sopra/definition/EventDescription.d.ts +28 -2
- package/src/engine/sound/sopra/definition/EventDescription.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/EventDescription.js +55 -5
- package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.d.ts +10 -0
- package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.js +77 -55
- package/src/engine/sound/sopra/definition/EventDescriptionSerializationUpgrader_0_1.d.ts +31 -0
- package/src/engine/sound/sopra/definition/EventDescriptionSerializationUpgrader_0_1.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/EventDescriptionSerializationUpgrader_0_1.js +75 -0
- package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.d.ts +38 -9
- package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.js +34 -5
- package/src/engine/sound/sopra/definition/effect/CompressorEffect.d.ts +7 -2
- package/src/engine/sound/sopra/definition/effect/CompressorEffect.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/effect/CompressorEffect.js +137 -122
- package/src/engine/sound/sopra/definition/effect/EqEffect.d.ts +3 -1
- package/src/engine/sound/sopra/definition/effect/EqEffect.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/effect/EqEffect.js +146 -131
- package/src/engine/sound/sopra/definition/effect/ReverbEffect.d.ts +1 -0
- package/src/engine/sound/sopra/definition/effect/ReverbEffect.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/effect/ReverbEffect.js +6 -1
- package/src/engine/sound/sopra/runtime/BusGraph.d.ts +44 -2
- package/src/engine/sound/sopra/runtime/BusGraph.d.ts.map +1 -1
- package/src/engine/sound/sopra/runtime/BusGraph.js +83 -43
- package/src/engine/sound/sopra/runtime/EffectChain.d.ts +96 -0
- package/src/engine/sound/sopra/runtime/EffectChain.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/EffectChain.js +286 -0
- package/src/engine/sound/sopra/runtime/EffectParamOverrides.d.ts +123 -0
- package/src/engine/sound/sopra/runtime/EffectParamOverrides.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/EffectParamOverrides.js +320 -0
- package/src/engine/sound/sopra/runtime/EventInstance.d.ts +55 -5
- package/src/engine/sound/sopra/runtime/EventInstance.d.ts.map +1 -1
- package/src/engine/sound/sopra/runtime/EventInstance.js +201 -26
- package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.d.ts +2 -1
- package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.d.ts.map +1 -1
- package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.js +6 -1
- package/src/engine/sound/sopra/serialization/sopraSerializationHarness.d.ts +15 -0
- package/src/engine/sound/sopra/serialization/sopraSerializationHarness.d.ts.map +1 -1
- package/src/engine/sound/sopra/serialization/sopraSerializationHarness.js +32 -0
- package/src/engine/sound/sopra/util/MockAudioContext.d.ts.map +1 -1
- package/src/engine/sound/sopra/util/MockAudioContext.js +3 -0
- package/src/engine/sound/sopra/util/fadeOutAndStop.d.ts +13 -3
- package/src/engine/sound/sopra/util/fadeOutAndStop.d.ts.map +1 -1
- package/src/engine/sound/sopra/util/fadeOutAndStop.js +25 -13
- package/src/shade/RENDERER_CONTRACT.md +6 -3
- package/src/shade/device/SHADE_DEVICE_FLOOR.d.ts +24 -0
- package/src/shade/device/SHADE_DEVICE_FLOOR.d.ts.map +1 -0
- package/src/shade/device/SHADE_DEVICE_FLOOR.js +34 -0
- package/src/shade/device/ShadeDeviceFailure.d.ts +12 -5
- package/src/shade/device/ShadeDeviceFailure.d.ts.map +1 -1
- package/src/shade/device/ShadeDeviceFailure.js +17 -8
- package/src/shade/device/ShadeDeviceFailureReason.d.ts +1 -1
- package/src/shade/device/ShadeDeviceFailureReason.js +2 -2
- package/src/shade/device/shade_device_floor_unmet.d.ts +13 -0
- package/src/shade/device/shade_device_floor_unmet.d.ts.map +1 -0
- package/src/shade/device/shade_device_floor_unmet.js +32 -0
- package/src/shade/renderer/Renderer.d.ts +2 -0
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +29 -55
- package/src/shade/renderer/buffer/GPUBufferAllocator.d.ts.map +1 -1
- package/src/shade/renderer/buffer/GPUBufferAllocator.js +9 -0
- package/src/shade/renderer/buffer/buffer_pool_ops.d.ts +21 -12
- package/src/shade/renderer/buffer/buffer_pool_ops.d.ts.map +1 -1
- package/src/shade/renderer/buffer/buffer_pool_ops.js +18 -19
- package/src/shade/renderer/gpu_primitive/test/gpu_test.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/test/gpu_test.js +8 -11
- package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
- package/src/shade/renderer/pool/TransientResourcePool.d.ts +24 -0
- package/src/shade/renderer/pool/TransientResourcePool.d.ts.map +1 -1
- package/src/shade/renderer/pool/TransientResourcePool.js +41 -10
- package/src/shade/renderer/shader/ComputeShader.d.ts.map +1 -1
- package/src/shade/renderer/shader/ComputeShader.js +18 -2
- package/src/shade/renderer/shader/ImageShader.d.ts.map +1 -1
- package/src/shade/renderer/shader/ImageShader.js +230 -218
- package/src/view/graphics/GraphicsContextFailureView.d.ts +1 -2
- package/src/view/graphics/GraphicsContextFailureView.d.ts.map +1 -1
- package/src/view/graphics/GraphicsContextFailureView.js +1 -2
- package/src/engine/network/transport/Channel.js +0 -336
- package/src/engine/network/transport/ReliableCommandPipeline.js +0 -335
- package/src/engine/network/transport/fragments/FragmentAssembler.js +0 -350
- package/src/engine/network/transport/fragments/FragmentRetention.js +0 -191
- package/src/engine/network/transport/fragments/fragment_send.js +0 -157
- package/src/engine/network/transport/fragments/packet_size.js +0 -107
|
@@ -1,14 +1,21 @@
|
|
|
1
|
+
import { hash_mix2 } from "../../../../core/math/hash/hash_mix2.js";
|
|
1
2
|
import { hash_mix3 } from "../../../../core/math/hash/hash_mix3.js";
|
|
2
3
|
import { computeHashFloat } from "../../../../core/primitives/numbers/computeHashFloat.js";
|
|
3
4
|
import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
|
|
4
5
|
import { AnimationCurve } from "../../../animation/curve/AnimationCurve.js";
|
|
5
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
deserializeAudioClipFromJSON,
|
|
8
|
+
deserializeAudioEffectFromJSON,
|
|
9
|
+
serializeAudioClipToJSON,
|
|
10
|
+
serializeAudioEffectToJSON
|
|
11
|
+
} from "../serialization/sopraJSON.js";
|
|
6
12
|
import { SilenceAudioClip } from "./clip/SilenceAudioClip.js";
|
|
7
13
|
import { SopraPanningModel } from "./SopraPanningModel.js";
|
|
8
14
|
import { VoiceStealMode } from "./VoiceStealMode.js";
|
|
9
15
|
|
|
10
16
|
/**
|
|
11
17
|
* @typedef {import("./clip/AbstractAudioClip.js").AbstractAudioClip} AbstractAudioClip
|
|
18
|
+
* @typedef {import("./effect/AbstractAudioEffect.js").AbstractAudioEffect} AbstractAudioEffect
|
|
12
19
|
*/
|
|
13
20
|
|
|
14
21
|
/**
|
|
@@ -103,6 +110,22 @@ export class EventDescription {
|
|
|
103
110
|
*/
|
|
104
111
|
virtualThresholdDb = -60;
|
|
105
112
|
|
|
113
|
+
/**
|
|
114
|
+
* Insert effects every instance of this event plays through, in order — the event's own DSP, as a
|
|
115
|
+
* bus has its own ({@link BusDefinition.effects}). Each instance builds its own copy, ahead of its
|
|
116
|
+
* fader: `voices → effects[0] → … → effects[n] → instance gain → (3D chain) → bus`.
|
|
117
|
+
*
|
|
118
|
+
* Because the copy is per instance, so is its control: one play of an event can be filtered or
|
|
119
|
+
* compressed independently of every other play of it, through {@link EventInstance#setEffectParam}.
|
|
120
|
+
* Empty (the default) builds nothing.
|
|
121
|
+
*
|
|
122
|
+
* Part of {@link equals} and {@link hash}, like every authored field — so never edit an effect's fields
|
|
123
|
+
* in place on a description that is playing: the `VoiceManager` files live instances under the hash, and
|
|
124
|
+
* a moved field loses them. Move a playing effect through its instance.
|
|
125
|
+
* @type {AbstractAudioEffect[]}
|
|
126
|
+
*/
|
|
127
|
+
effects = [];
|
|
128
|
+
|
|
106
129
|
/**
|
|
107
130
|
*
|
|
108
131
|
* @param {string} label
|
|
@@ -121,7 +144,8 @@ export class EventDescription {
|
|
|
121
144
|
maxInstances = 32,
|
|
122
145
|
priority = 0,
|
|
123
146
|
stealMode = VoiceStealMode.Oldest,
|
|
124
|
-
virtualThresholdDb = -60
|
|
147
|
+
virtualThresholdDb = -60,
|
|
148
|
+
effects = []
|
|
125
149
|
} = {}) {
|
|
126
150
|
const r = new EventDescription();
|
|
127
151
|
|
|
@@ -138,6 +162,7 @@ export class EventDescription {
|
|
|
138
162
|
r.priority = priority;
|
|
139
163
|
r.stealMode = stealMode;
|
|
140
164
|
r.virtualThresholdDb = virtualThresholdDb;
|
|
165
|
+
r.effects = effects;
|
|
141
166
|
|
|
142
167
|
return r;
|
|
143
168
|
}
|
|
@@ -148,6 +173,18 @@ export class EventDescription {
|
|
|
148
173
|
* @returns {boolean}
|
|
149
174
|
*/
|
|
150
175
|
equals(other) {
|
|
176
|
+
const effects = this.effects;
|
|
177
|
+
|
|
178
|
+
if (effects.length !== other.effects.length) {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
for (let i = 0; i < effects.length; i++) {
|
|
183
|
+
if (!effects[i].equals(other.effects[i])) {
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
151
188
|
return this.label === other.label
|
|
152
189
|
&& this.busId === other.busId
|
|
153
190
|
&& this.gainDb === other.gainDb
|
|
@@ -170,7 +207,7 @@ export class EventDescription {
|
|
|
170
207
|
* @returns {number}
|
|
171
208
|
*/
|
|
172
209
|
hash() {
|
|
173
|
-
|
|
210
|
+
let h = hash_mix3(
|
|
174
211
|
hash_mix3(
|
|
175
212
|
hash_mix3(
|
|
176
213
|
hash_mix3(
|
|
@@ -195,6 +232,14 @@ export class EventDescription {
|
|
|
195
232
|
this.attenuation.hash(),
|
|
196
233
|
this.rootClip.hash()
|
|
197
234
|
);
|
|
235
|
+
|
|
236
|
+
const effects = this.effects;
|
|
237
|
+
|
|
238
|
+
for (let i = 0; i < effects.length; i++) {
|
|
239
|
+
h = hash_mix2(h, effects[i].hash());
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return h;
|
|
198
243
|
}
|
|
199
244
|
|
|
200
245
|
clone() {
|
|
@@ -213,6 +258,7 @@ export class EventDescription {
|
|
|
213
258
|
r.priority = this.priority;
|
|
214
259
|
r.stealMode = this.stealMode;
|
|
215
260
|
r.virtualThresholdDb = this.virtualThresholdDb;
|
|
261
|
+
r.effects = this.effects.map(e => e.clone());
|
|
216
262
|
|
|
217
263
|
return r;
|
|
218
264
|
}
|
|
@@ -231,7 +277,8 @@ export class EventDescription {
|
|
|
231
277
|
maxInstances: this.maxInstances,
|
|
232
278
|
priority: this.priority,
|
|
233
279
|
stealMode: this.stealMode,
|
|
234
|
-
virtualThresholdDb: this.virtualThresholdDb
|
|
280
|
+
virtualThresholdDb: this.virtualThresholdDb,
|
|
281
|
+
effects: this.effects.map(serializeAudioEffectToJSON)
|
|
235
282
|
};
|
|
236
283
|
}
|
|
237
284
|
|
|
@@ -248,7 +295,9 @@ export class EventDescription {
|
|
|
248
295
|
maxInstances = 32,
|
|
249
296
|
priority = 0,
|
|
250
297
|
stealMode = VoiceStealMode.Oldest,
|
|
251
|
-
virtualThresholdDb = -60
|
|
298
|
+
virtualThresholdDb = -60,
|
|
299
|
+
// absent from JSON written before events carried inserts
|
|
300
|
+
effects = []
|
|
252
301
|
}) {
|
|
253
302
|
this.label = label;
|
|
254
303
|
this.rootClip = rootClip === undefined ? new SilenceAudioClip() : deserializeAudioClipFromJSON(rootClip);
|
|
@@ -270,6 +319,7 @@ export class EventDescription {
|
|
|
270
319
|
this.priority = priority;
|
|
271
320
|
this.stealMode = stealMode;
|
|
272
321
|
this.virtualThresholdDb = virtualThresholdDb;
|
|
322
|
+
this.effects = effects.map(deserializeAudioEffectFromJSON);
|
|
273
323
|
}
|
|
274
324
|
}
|
|
275
325
|
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format history:
|
|
3
|
+
* - 0: every field but the inserts.
|
|
4
|
+
* - 1: {@link EventDescription.effects} appended, as a count and then each effect by type
|
|
5
|
+
* (upgrade: `EventDescriptionSerializationUpgrader_0_1`).
|
|
6
|
+
*
|
|
7
|
+
* ⚠ The record is also EMBEDDED, without its own version tag, by the `AudioEmitter` and
|
|
8
|
+
* `AudioEventTrigger` component adapters, so a change here is a change to their formats too: bump them
|
|
9
|
+
* with it, and have their upgraders run the embedded record through this class's upgrader for the same step.
|
|
10
|
+
*/
|
|
1
11
|
export class EventDescriptionSerializationAdapter extends ObjectBasedClassSerializationAdapter {
|
|
2
12
|
klass: typeof EventDescription;
|
|
3
13
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventDescriptionSerializationAdapter.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.js"],"names":[],"mappings":"AAOA;IACI,+BAAyB;IAGzB;;;OAGG;IACH,uCAFW,gBAAgB,
|
|
1
|
+
{"version":3,"file":"EventDescriptionSerializationAdapter.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.js"],"names":[],"mappings":"AAOA;;;;;;;;;GASG;AACH;IACI,+BAAyB;IAGzB;;;OAGG;IACH,uCAFW,gBAAgB,QAwB1B;IAED;;;OAGG;IACH,yCAFW,gBAAgB,QAwB1B;CACJ;qDAxEoD,4EAA4E;iCAChG,uBAAuB"}
|
|
@@ -1,55 +1,77 @@
|
|
|
1
|
-
import {
|
|
2
|
-
deserialize_animation_curve,
|
|
3
|
-
serialize_animation_curve
|
|
4
|
-
} from "../../../animation/curve/animation_curve_binary_codec.js";
|
|
5
|
-
import { ObjectBasedClassSerializationAdapter } from "../../../ecs/storage/binary/object/ObjectBasedClassSerializationAdapter.js";
|
|
6
|
-
import { EventDescription } from "./EventDescription.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
buffer.
|
|
30
|
-
buffer.
|
|
31
|
-
buffer.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
value.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
1
|
+
import {
|
|
2
|
+
deserialize_animation_curve,
|
|
3
|
+
serialize_animation_curve
|
|
4
|
+
} from "../../../animation/curve/animation_curve_binary_codec.js";
|
|
5
|
+
import { ObjectBasedClassSerializationAdapter } from "../../../ecs/storage/binary/object/ObjectBasedClassSerializationAdapter.js";
|
|
6
|
+
import { EventDescription } from "./EventDescription.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Format history:
|
|
10
|
+
* - 0: every field but the inserts.
|
|
11
|
+
* - 1: {@link EventDescription.effects} appended, as a count and then each effect by type
|
|
12
|
+
* (upgrade: `EventDescriptionSerializationUpgrader_0_1`).
|
|
13
|
+
*
|
|
14
|
+
* ⚠ The record is also EMBEDDED, without its own version tag, by the `AudioEmitter` and
|
|
15
|
+
* `AudioEventTrigger` component adapters, so a change here is a change to their formats too: bump them
|
|
16
|
+
* with it, and have their upgraders run the embedded record through this class's upgrader for the same step.
|
|
17
|
+
*/
|
|
18
|
+
export class EventDescriptionSerializationAdapter extends ObjectBasedClassSerializationAdapter {
|
|
19
|
+
klass = EventDescription;
|
|
20
|
+
version = 1;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @param {BinaryBuffer} buffer
|
|
24
|
+
* @param {EventDescription} value
|
|
25
|
+
*/
|
|
26
|
+
serialize(buffer, value) {
|
|
27
|
+
buffer.writeUTF8String(value.label);
|
|
28
|
+
this.objectAdapter.serialize(buffer, value.rootClip);
|
|
29
|
+
buffer.writeUTF8String(value.busId);
|
|
30
|
+
buffer.writeFloat32(value.gainDb);
|
|
31
|
+
buffer.writeUint8(value.is3D ? 1 : 0);
|
|
32
|
+
buffer.writeUint8(value.panningModel);
|
|
33
|
+
buffer.writeFloat32(value.distanceMin);
|
|
34
|
+
buffer.writeFloat32(value.distanceMax);
|
|
35
|
+
|
|
36
|
+
serialize_animation_curve(buffer, value.attenuation);
|
|
37
|
+
|
|
38
|
+
buffer.writeUintVar(value.maxInstances);
|
|
39
|
+
buffer.writeFloat32(value.priority);
|
|
40
|
+
buffer.writeUint8(value.stealMode);
|
|
41
|
+
buffer.writeFloat32(value.virtualThresholdDb);
|
|
42
|
+
|
|
43
|
+
const effects = value.effects;
|
|
44
|
+
buffer.writeUintVar(effects.length);
|
|
45
|
+
for (let i = 0; i < effects.length; i++) {
|
|
46
|
+
this.objectAdapter.serialize(buffer, effects[i]);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @param {BinaryBuffer} buffer
|
|
52
|
+
* @param {EventDescription} value
|
|
53
|
+
*/
|
|
54
|
+
deserialize(buffer, value) {
|
|
55
|
+
value.label = buffer.readUTF8String();
|
|
56
|
+
value.rootClip = this.objectAdapter.deserialize(buffer);
|
|
57
|
+
value.busId = buffer.readUTF8String();
|
|
58
|
+
value.gainDb = buffer.readFloat32();
|
|
59
|
+
value.is3D = buffer.readUint8() !== 0;
|
|
60
|
+
value.panningModel = buffer.readUint8();
|
|
61
|
+
value.distanceMin = buffer.readFloat32();
|
|
62
|
+
value.distanceMax = buffer.readFloat32();
|
|
63
|
+
|
|
64
|
+
value.attenuation = deserialize_animation_curve(buffer);
|
|
65
|
+
|
|
66
|
+
value.maxInstances = buffer.readUintVar();
|
|
67
|
+
value.priority = buffer.readFloat32();
|
|
68
|
+
value.stealMode = buffer.readUint8();
|
|
69
|
+
value.virtualThresholdDb = buffer.readFloat32();
|
|
70
|
+
|
|
71
|
+
const effectCount = buffer.readUintVar();
|
|
72
|
+
value.effects = [];
|
|
73
|
+
for (let i = 0; i < effectCount; i++) {
|
|
74
|
+
value.effects.push(this.objectAdapter.deserialize(buffer));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import("../../../ecs/storage/binary/BinarySerializationRegistry.js").BinarySerializationRegistry} BinarySerializationRegistry
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Version 0 → 1: an event gains its insert effects (`EventDescription.effects`), written after every other
|
|
6
|
+
* field. A version-0 record had none, so it upgrades to itself followed by an empty list.
|
|
7
|
+
*
|
|
8
|
+
* Field by field, as every upgrader must: `source` and `target` need not share an encoding (the dataset
|
|
9
|
+
* stream dictionary-encodes its strings, the upgrade buffers do not), so bytes are never copied raw. The
|
|
10
|
+
* version-0 layout is frozen here rather than borrowed from the current adapter, so a later format change
|
|
11
|
+
* cannot alter what this step produces.
|
|
12
|
+
*
|
|
13
|
+
* The one field that is not a flat value is the root clip, a polymorphic tree whose length is not known
|
|
14
|
+
* until it is read. It is read through the object adapter (which upgrades it, if it was saved at an older
|
|
15
|
+
* clip format) and written back at its current format under its own type-and-version header — clip formats
|
|
16
|
+
* are versioned by that header, independently of this record's.
|
|
17
|
+
*
|
|
18
|
+
* Also the upgrade of the record wherever a component EMBEDS it untagged (`AudioEmitter`,
|
|
19
|
+
* `AudioEventTrigger`): their upgraders hand the embedded span to {@link upgrade}, which consumes exactly
|
|
20
|
+
* one record from `source`.
|
|
21
|
+
*/
|
|
22
|
+
export class EventDescriptionSerializationUpgrader_0_1 extends BinaryClassUpgrader {
|
|
23
|
+
/**
|
|
24
|
+
* @param {BinarySerializationRegistry} registry where the event's clip types are registered
|
|
25
|
+
*/
|
|
26
|
+
constructor(registry: BinarySerializationRegistry);
|
|
27
|
+
#private;
|
|
28
|
+
}
|
|
29
|
+
export type BinarySerializationRegistry = import("../../../ecs/storage/binary/BinarySerializationRegistry.js").BinarySerializationRegistry;
|
|
30
|
+
import { BinaryClassUpgrader } from "../../../ecs/storage/binary/BinaryClassUpgrader.js";
|
|
31
|
+
//# sourceMappingURL=EventDescriptionSerializationUpgrader_0_1.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventDescriptionSerializationUpgrader_0_1.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/sound/sopra/definition/EventDescriptionSerializationUpgrader_0_1.js"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH;IASI;;OAEG;IACH,sBAFW,2BAA2B,EAMrC;;CAgCJ;0CArEY,OAAO,4DAA4D,EAAE,2BAA2B;oCAJzE,oDAAoD"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { BinaryBuffer } from "../../../../core/binary/BinaryBuffer.js";
|
|
2
|
+
import { BinaryClassUpgrader } from "../../../ecs/storage/binary/BinaryClassUpgrader.js";
|
|
3
|
+
import { BinaryObjectSerializationAdapter } from "../../../ecs/storage/binary/object/BinaryObjectSerializationAdapter.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {import("../../../ecs/storage/binary/BinarySerializationRegistry.js").BinarySerializationRegistry} BinarySerializationRegistry
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Version 0 → 1: an event gains its insert effects (`EventDescription.effects`), written after every other
|
|
11
|
+
* field. A version-0 record had none, so it upgrades to itself followed by an empty list.
|
|
12
|
+
*
|
|
13
|
+
* Field by field, as every upgrader must: `source` and `target` need not share an encoding (the dataset
|
|
14
|
+
* stream dictionary-encodes its strings, the upgrade buffers do not), so bytes are never copied raw. The
|
|
15
|
+
* version-0 layout is frozen here rather than borrowed from the current adapter, so a later format change
|
|
16
|
+
* cannot alter what this step produces.
|
|
17
|
+
*
|
|
18
|
+
* The one field that is not a flat value is the root clip, a polymorphic tree whose length is not known
|
|
19
|
+
* until it is read. It is read through the object adapter (which upgrades it, if it was saved at an older
|
|
20
|
+
* clip format) and written back at its current format under its own type-and-version header — clip formats
|
|
21
|
+
* are versioned by that header, independently of this record's.
|
|
22
|
+
*
|
|
23
|
+
* Also the upgrade of the record wherever a component EMBEDS it untagged (`AudioEmitter`,
|
|
24
|
+
* `AudioEventTrigger`): their upgraders hand the embedded span to {@link upgrade}, which consumes exactly
|
|
25
|
+
* one record from `source`.
|
|
26
|
+
*/
|
|
27
|
+
export class EventDescriptionSerializationUpgrader_0_1 extends BinaryClassUpgrader {
|
|
28
|
+
__startVersion = 0;
|
|
29
|
+
__targetVersion = 1;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @type {BinaryObjectSerializationAdapter}
|
|
33
|
+
*/
|
|
34
|
+
#objects = new BinaryObjectSerializationAdapter();
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @param {BinarySerializationRegistry} registry where the event's clip types are registered
|
|
38
|
+
*/
|
|
39
|
+
constructor(registry) {
|
|
40
|
+
super();
|
|
41
|
+
|
|
42
|
+
this.#objects.initialize(registry);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @param {BinaryBuffer} source
|
|
47
|
+
* @param {BinaryBuffer} target
|
|
48
|
+
*/
|
|
49
|
+
upgrade(source, target) {
|
|
50
|
+
BinaryBuffer.copyUTF8String(source, target); // label
|
|
51
|
+
|
|
52
|
+
this.#objects.serialize(target, this.#objects.deserialize(source)); // rootClip
|
|
53
|
+
|
|
54
|
+
BinaryBuffer.copyUTF8String(source, target); // busId
|
|
55
|
+
BinaryBuffer.copyFloat32(source, target); // gainDb
|
|
56
|
+
BinaryBuffer.copyUint8(source, target); // is3D
|
|
57
|
+
BinaryBuffer.copyUint8(source, target); // panningModel
|
|
58
|
+
BinaryBuffer.copyFloat32(source, target); // distanceMin
|
|
59
|
+
BinaryBuffer.copyFloat32(source, target); // distanceMax
|
|
60
|
+
|
|
61
|
+
// attenuation: key count, then time / value / inTangent / outTangent per key
|
|
62
|
+
const keyCount = BinaryBuffer.copyUintVar(source, target);
|
|
63
|
+
for (let i = 0; i < keyCount * 4; i++) {
|
|
64
|
+
BinaryBuffer.copyFloat32(source, target);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
BinaryBuffer.copyUintVar(source, target); // maxInstances
|
|
68
|
+
BinaryBuffer.copyFloat32(source, target); // priority
|
|
69
|
+
BinaryBuffer.copyUint8(source, target); // stealMode
|
|
70
|
+
BinaryBuffer.copyFloat32(source, target); // virtualThresholdDb
|
|
71
|
+
|
|
72
|
+
// new in 1: no inserts
|
|
73
|
+
target.writeUintVar(0);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -1,24 +1,53 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* What {@link AbstractAudioEffect#build} returns: the live sub-graph, as the two nodes it is spliced in by,
|
|
3
|
+
* and the parameters that can be moved while it plays.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* `params` holds the live {@link AudioParam} of each of the class's {@link AbstractAudioEffect.parameters},
|
|
6
|
+
* in that order. Omitted by an effect that declares none.
|
|
7
|
+
*
|
|
8
|
+
* @typedef {{input: AudioNode, output: AudioNode, params?: AudioParam[]}} BuiltAudioEffect
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Base class for serializable insert effects — on a bus ({@link BusDefinition.effects}) or on an event
|
|
12
|
+
* ({@link EventDescription.effects}).
|
|
13
|
+
*
|
|
14
|
+
* An effect is a DEFINITION; {@link build} turns it into a live WebAudio sub-graph, once per bus or once per
|
|
15
|
+
* playing instance. The returned `{ input, output }` lets an {@link EffectChain} splice the effect in
|
|
16
|
+
* (`input → effect → output`); for single-node effects `input === output`. The definition is never touched
|
|
17
|
+
* at runtime: a parameter moved on a built effect moves that one copy (see `SopraEngine.setBusEffectParam`,
|
|
18
|
+
* `EventInstance.setEffectParam`).
|
|
19
|
+
*
|
|
20
|
+
* A subclass that has parameters worth moving while it plays names them in a static `parameters` list and
|
|
21
|
+
* returns their `AudioParam`s from {@link build} in the same order. An "effect param" is one of those — a
|
|
22
|
+
* live `AudioParam` of an insert — which is not the same thing as a sopra parameter (the named game value
|
|
23
|
+
* of `SopraEngine.setParameter`).
|
|
7
24
|
*/
|
|
8
25
|
export class AbstractAudioEffect {
|
|
9
26
|
/**
|
|
10
27
|
* Construct the live WebAudio nodes for this effect.
|
|
11
28
|
* @param {BaseAudioContext} ctx
|
|
12
|
-
* @returns {
|
|
29
|
+
* @returns {BuiltAudioEffect}
|
|
13
30
|
*/
|
|
14
|
-
build(ctx: BaseAudioContext):
|
|
15
|
-
input: AudioNode;
|
|
16
|
-
output: AudioNode;
|
|
17
|
-
};
|
|
31
|
+
build(ctx: BaseAudioContext): BuiltAudioEffect;
|
|
18
32
|
/**
|
|
19
33
|
* @readonly
|
|
20
34
|
* @type {boolean}
|
|
21
35
|
*/
|
|
22
36
|
readonly isAudioEffect: boolean;
|
|
23
37
|
}
|
|
38
|
+
export namespace AbstractAudioEffect {
|
|
39
|
+
let parameters: string[];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* What {@link AbstractAudioEffectbuild } returns: the live sub-graph, as the two nodes it is spliced in by,
|
|
43
|
+
* and the parameters that can be moved while it plays.
|
|
44
|
+
*
|
|
45
|
+
* `params` holds the live {@link AudioParam } of each of the class's {@link AbstractAudioEffect.parameters },
|
|
46
|
+
* in that order. Omitted by an effect that declares none.
|
|
47
|
+
*/
|
|
48
|
+
export type BuiltAudioEffect = {
|
|
49
|
+
input: AudioNode;
|
|
50
|
+
output: AudioNode;
|
|
51
|
+
params?: AudioParam[];
|
|
52
|
+
};
|
|
24
53
|
//# sourceMappingURL=AbstractAudioEffect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractAudioEffect.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/sound/sopra/definition/effect/AbstractAudioEffect.js"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"AbstractAudioEffect.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/sound/sopra/definition/effect/AbstractAudioEffect.js"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;GAcG;AACH;IAEI;;;;OAIG;IACH,WAHW,gBAAgB,GACd,gBAAgB,CAI5B;IAcL;;;OAGG;IACH,wBAFU,OAAO,CAE0B;CAjB1C;;oBASS,MAAM,EAAE;;;;;;;;;+BArCL;IAAC,KAAK,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM,CAAC,EAAE,UAAU,EAAE,CAAA;CAAC"}
|
|
@@ -1,22 +1,51 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* What {@link AbstractAudioEffect#build} returns: the live sub-graph, as the two nodes it is spliced in by,
|
|
3
|
+
* and the parameters that can be moved while it plays.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* `params` holds the live {@link AudioParam} of each of the class's {@link AbstractAudioEffect.parameters},
|
|
6
|
+
* in that order. Omitted by an effect that declares none.
|
|
7
|
+
*
|
|
8
|
+
* @typedef {{input: AudioNode, output: AudioNode, params?: AudioParam[]}} BuiltAudioEffect
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Base class for serializable insert effects — on a bus ({@link BusDefinition.effects}) or on an event
|
|
13
|
+
* ({@link EventDescription.effects}).
|
|
14
|
+
*
|
|
15
|
+
* An effect is a DEFINITION; {@link build} turns it into a live WebAudio sub-graph, once per bus or once per
|
|
16
|
+
* playing instance. The returned `{ input, output }` lets an {@link EffectChain} splice the effect in
|
|
17
|
+
* (`input → effect → output`); for single-node effects `input === output`. The definition is never touched
|
|
18
|
+
* at runtime: a parameter moved on a built effect moves that one copy (see `SopraEngine.setBusEffectParam`,
|
|
19
|
+
* `EventInstance.setEffectParam`).
|
|
20
|
+
*
|
|
21
|
+
* A subclass that has parameters worth moving while it plays names them in a static `parameters` list and
|
|
22
|
+
* returns their `AudioParam`s from {@link build} in the same order. An "effect param" is one of those — a
|
|
23
|
+
* live `AudioParam` of an insert — which is not the same thing as a sopra parameter (the named game value
|
|
24
|
+
* of `SopraEngine.setParameter`).
|
|
7
25
|
*/
|
|
8
26
|
export class AbstractAudioEffect {
|
|
9
27
|
|
|
10
28
|
/**
|
|
11
29
|
* Construct the live WebAudio nodes for this effect.
|
|
12
30
|
* @param {BaseAudioContext} ctx
|
|
13
|
-
* @returns {
|
|
31
|
+
* @returns {BuiltAudioEffect}
|
|
14
32
|
*/
|
|
15
33
|
build(ctx) {
|
|
16
34
|
throw new Error('Implementation must override build()');
|
|
17
35
|
}
|
|
18
36
|
}
|
|
19
37
|
|
|
38
|
+
/**
|
|
39
|
+
* The names of the parameters this class's built effect can move while it plays, in the order
|
|
40
|
+
* {@link AbstractAudioEffect#build} returns their `AudioParam`s. Each is the name of the definition field
|
|
41
|
+
* it starts from, so the field that authors a value and the name that moves it are one word. Declared
|
|
42
|
+
* once per CLASS, so a built effect carries no names of its own. Empty: nothing to move — which is also
|
|
43
|
+
* what a subclass written before parameters existed inherits.
|
|
44
|
+
* @readonly
|
|
45
|
+
* @type {string[]}
|
|
46
|
+
*/
|
|
47
|
+
AbstractAudioEffect.parameters = [];
|
|
48
|
+
|
|
20
49
|
/**
|
|
21
50
|
* @readonly
|
|
22
51
|
* @type {boolean}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
|
|
2
|
+
* @typedef {import("./AbstractAudioEffect.js").BuiltAudioEffect} BuiltAudioEffect
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Dynamics compressor insert (on a bus or an event), backed by a {@link DynamicsCompressorNode}.
|
|
6
|
+
* NOTE: this is a per-bus or per-instance insert; the engine's master compressor (in SoundEngine) is separate
|
|
4
7
|
* master-glue and is not duplicated here.
|
|
5
8
|
*/
|
|
6
9
|
export class CompressorEffect extends AbstractAudioEffect {
|
|
@@ -65,6 +68,8 @@ export class CompressorEffect extends AbstractAudioEffect {
|
|
|
65
68
|
}
|
|
66
69
|
export namespace CompressorEffect {
|
|
67
70
|
let typeName: string;
|
|
71
|
+
let parameters: string[];
|
|
68
72
|
}
|
|
73
|
+
export type BuiltAudioEffect = import("./AbstractAudioEffect.js").BuiltAudioEffect;
|
|
69
74
|
import { AbstractAudioEffect } from "./AbstractAudioEffect.js";
|
|
70
75
|
//# sourceMappingURL=CompressorEffect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompressorEffect.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/sound/sopra/definition/effect/CompressorEffect.js"],"names":[],"mappings":"AAIA;;;;GAIG;AACH;IA+BI;;;;OAIG;IACH,0DAHW;QAAC,SAAS,CAAC,EAAC,MAAM,CAAC;QAAC,IAAI,CAAC,EAAC,MAAM,CAAC;QAAC,KAAK,CAAC,EAAC,MAAM,CAAC;QAAC,MAAM,CAAC,EAAC,MAAM,CAAC;QAAC,OAAO,CAAC,EAAC,MAAM,CAAA;KAAC,GAC/E,gBAAgB,CAY5B;IA5CD;;;OAGG;IACH,WAFU,MAAM,CAEA;IAEhB;;;OAGG;IACH,MAFU,MAAM,CAEN;IAEV;;OAEG;IACH,OAFU,MAAM,CAEL;IAEX;;;OAGG;IACH,QAFU,MAAM,CAED;IAEf;;;OAGG;IACH,SAFU,MAAM,CAED;
|
|
1
|
+
{"version":3,"file":"CompressorEffect.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/sound/sopra/definition/effect/CompressorEffect.js"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;;GAIG;AACH;IA+BI;;;;OAIG;IACH,0DAHW;QAAC,SAAS,CAAC,EAAC,MAAM,CAAC;QAAC,IAAI,CAAC,EAAC,MAAM,CAAC;QAAC,KAAK,CAAC,EAAC,MAAM,CAAC;QAAC,MAAM,CAAC,EAAC,MAAM,CAAC;QAAC,OAAO,CAAC,EAAC,MAAM,CAAA;KAAC,GAC/E,gBAAgB,CAY5B;IA5CD;;;OAGG;IACH,WAFU,MAAM,CAEA;IAEhB;;;OAGG;IACH,MAFU,MAAM,CAEN;IAEV;;OAEG;IACH,OAFU,MAAM,CAEL;IAEX;;;OAGG;IACH,QAFU,MAAM,CAED;IAEf;;;OAGG;IACH,SAFU,MAAM,CAED;IAuCf;;;;OAIG;IACH,cAHW,gBAAgB,GACd,OAAO,CAQnB;IAED,eAUC;IAED,0BAEC;IAED;;;;;;MAQC;IAED;;;;;;aAMC;CACJ;;;oBAOS,MAAM,EAAE;;+BAjIL,OAAO,0BAA0B,EAAE,gBAAgB;oCAH5B,0BAA0B"}
|