Skip to content

Commit 9e1d707

Browse files
committed
Rename RenderScope -> AudioWorkletGlobalScope
Not sure why we opted for the non-spec name earlier https://webaudio.github.io/web-audio-api/#AudioWorkletGlobalScope
1 parent 3e30204 commit 9e1d707

31 files changed

+120
-75
lines changed

benches/worklet.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use web_audio_api::worklet::{AudioParamValues, AudioWorkletProcessor, RenderScope};
1+
use web_audio_api::worklet::{AudioParamValues, AudioWorkletGlobalScope, AudioWorkletProcessor};
22
use web_audio_api::{AudioParamDescriptor, AutomationRate};
33

44
pub struct GainProcessor;
@@ -28,7 +28,7 @@ impl AudioWorkletProcessor for GainProcessor {
2828
inputs: &'b [&'a [&'a [f32]]],
2929
outputs: &'b mut [&'a mut [&'a mut [f32]]],
3030
params: AudioParamValues<'b>,
31-
_scope: &'b RenderScope,
31+
_scope: &'b AudioWorkletGlobalScope,
3232
) -> bool {
3333
let gain = params.get("gain");
3434
let io_zip = inputs[0].iter().zip(outputs[0].iter_mut());

examples/roundtrip_latency_test.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ use web_audio_api::media_devices::{
99
};
1010
use web_audio_api::node::AudioNode;
1111
use web_audio_api::worklet::{
12-
AudioParamValues, AudioWorkletNode, AudioWorkletNodeOptions, AudioWorkletProcessor, RenderScope,
12+
AudioParamValues, AudioWorkletGlobalScope, AudioWorkletNode, AudioWorkletNodeOptions,
13+
AudioWorkletProcessor,
1314
};
1415

1516
use std::sync::atomic::{AtomicU64, Ordering};
@@ -92,7 +93,7 @@ impl AudioWorkletProcessor for LatencyTesterProcessor {
9293
inputs: &'b [&'a [&'a [f32]]],
9394
outputs: &'b mut [&'a mut [&'a mut [f32]]],
9495
_params: AudioParamValues<'b>,
95-
scope: &'b RenderScope,
96+
scope: &'b AudioWorkletGlobalScope,
9697
) -> bool {
9798
// send a dirac every second
9899
// 48000 / 128 = 375

examples/worklet.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ use web_audio_api::context::{
33
};
44
use web_audio_api::node::{AudioNode, AudioScheduledSourceNode};
55
use web_audio_api::worklet::{
6-
AudioParamValues, AudioWorkletNode, AudioWorkletNodeOptions, AudioWorkletProcessor, RenderScope,
6+
AudioParamValues, AudioWorkletGlobalScope, AudioWorkletNode, AudioWorkletNodeOptions,
7+
AudioWorkletProcessor,
78
};
89
use web_audio_api::{AudioParamDescriptor, AutomationRate};
910

@@ -35,7 +36,7 @@ impl AudioWorkletProcessor for MyProcessor {
3536
inputs: &'b [&'a [&'a [f32]]],
3637
outputs: &'b mut [&'a mut [&'a mut [f32]]],
3738
params: AudioParamValues<'b>,
38-
_scope: &'b RenderScope,
39+
_scope: &'b AudioWorkletGlobalScope,
3940
) -> bool {
4041
// passthrough with gain
4142
inputs[0]

examples/worklet_bitcrusher.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ use web_audio_api::node::{
55
AudioNode, AudioScheduledSourceNode, OscillatorNode, OscillatorOptions, OscillatorType,
66
};
77
use web_audio_api::worklet::{
8-
AudioParamValues, AudioWorkletNode, AudioWorkletNodeOptions, AudioWorkletProcessor, RenderScope,
8+
AudioParamValues, AudioWorkletGlobalScope, AudioWorkletNode, AudioWorkletNodeOptions,
9+
AudioWorkletProcessor,
910
};
1011
use web_audio_api::{AudioParamDescriptor, AutomationRate};
1112

@@ -70,7 +71,7 @@ impl AudioWorkletProcessor for BitCrusher {
7071
inputs: &'b [&'a [&'a [f32]]],
7172
outputs: &'b mut [&'a mut [&'a mut [f32]]],
7273
params: AudioParamValues<'b>,
73-
_scope: &'b RenderScope,
74+
_scope: &'b AudioWorkletGlobalScope,
7475
) -> bool {
7576
let bit_depth = params.get("bit_depth");
7677
let frequency_reduction = params.get("frequency_reduction");

examples/worklet_message_port.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ use web_audio_api::context::{
99
use web_audio_api::node::{AudioNode, ChannelConfigOptions};
1010

1111
use web_audio_api::worklet::{
12-
AudioParamValues, AudioWorkletNode, AudioWorkletNodeOptions, AudioWorkletProcessor, RenderScope,
12+
AudioParamValues, AudioWorkletGlobalScope, AudioWorkletNode, AudioWorkletNodeOptions,
13+
AudioWorkletProcessor,
1314
};
1415

1516
// Showcase how to create your own audio node with message passing
@@ -75,7 +76,7 @@ impl AudioWorkletProcessor for WhiteNoiseProcessor {
7576
_inputs: &'b [&'a [&'a [f32]]],
7677
outputs: &'b mut [&'a mut [&'a mut [f32]]],
7778
_params: AudioParamValues<'_>,
78-
scope: &RenderScope,
79+
scope: &AudioWorkletGlobalScope,
7980
) -> bool {
8081
// edit the output buffer in place
8182
outputs[0].iter_mut().for_each(|buf| {

src/node/analyser.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ use crate::analysis::{
33
DEFAULT_SMOOTHING_TIME_CONSTANT,
44
};
55
use crate::context::{AudioContextRegistration, BaseAudioContext};
6-
use crate::render::{AudioParamValues, AudioProcessor, AudioRenderQuantum, RenderScope};
6+
use crate::render::{
7+
AudioParamValues, AudioProcessor, AudioRenderQuantum, AudioWorkletGlobalScope,
8+
};
79

810
use super::{AudioNode, ChannelConfig, ChannelConfigOptions, ChannelInterpretation};
911

@@ -266,7 +268,7 @@ impl AudioProcessor for AnalyserRenderer {
266268
inputs: &[AudioRenderQuantum],
267269
outputs: &mut [AudioRenderQuantum],
268270
_params: AudioParamValues<'_>,
269-
_scope: &RenderScope,
271+
_scope: &AudioWorkletGlobalScope,
270272
) -> bool {
271273
// single input/output node
272274
let input = &inputs[0];

src/node/audio_buffer_source.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ use std::sync::Arc;
55
use crate::buffer::AudioBuffer;
66
use crate::context::{AudioContextRegistration, AudioParamId, BaseAudioContext};
77
use crate::param::{AudioParam, AudioParamDescriptor, AutomationRate};
8-
use crate::render::{AudioParamValues, AudioProcessor, AudioRenderQuantum, RenderScope};
8+
use crate::render::{
9+
AudioParamValues, AudioProcessor, AudioRenderQuantum, AudioWorkletGlobalScope,
10+
};
911
use crate::{assert_valid_time_value, AtomicF64, RENDER_QUANTUM_SIZE};
1012

1113
use super::{AudioNode, AudioScheduledSourceNode, ChannelConfig};
@@ -407,7 +409,7 @@ impl AudioProcessor for AudioBufferSourceRenderer {
407409
_inputs: &[AudioRenderQuantum], // no input...
408410
outputs: &mut [AudioRenderQuantum],
409411
params: AudioParamValues<'_>,
410-
scope: &RenderScope,
412+
scope: &AudioWorkletGlobalScope,
411413
) -> bool {
412414
// single output node
413415
let output = &mut outputs[0];

src/node/biquad_filter.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ use num_complex::Complex;
77

88
use crate::context::{AudioContextRegistration, AudioParamId, BaseAudioContext};
99
use crate::param::{AudioParam, AudioParamDescriptor};
10-
use crate::render::{AudioParamValues, AudioProcessor, AudioRenderQuantum, RenderScope};
10+
use crate::render::{
11+
AudioParamValues, AudioProcessor, AudioRenderQuantum, AudioWorkletGlobalScope,
12+
};
1113
use crate::{MAX_CHANNELS, RENDER_QUANTUM_SIZE};
1214

1315
use super::{AudioNode, ChannelConfig, ChannelConfigOptions};
@@ -557,7 +559,7 @@ impl AudioProcessor for BiquadFilterRenderer {
557559
inputs: &[AudioRenderQuantum],
558560
outputs: &mut [AudioRenderQuantum],
559561
params: AudioParamValues<'_>,
560-
scope: &RenderScope,
562+
scope: &AudioWorkletGlobalScope,
561563
) -> bool {
562564
// single input/output node
563565
let input = &inputs[0];

src/node/channel_merger.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
use std::fmt::Debug;
22

33
use crate::context::{AudioContextRegistration, BaseAudioContext};
4-
use crate::render::{AudioParamValues, AudioProcessor, AudioRenderQuantum, RenderScope};
4+
use crate::render::{
5+
AudioParamValues, AudioProcessor, AudioRenderQuantum, AudioWorkletGlobalScope,
6+
};
57

68
use super::{
79
AudioNode, ChannelConfig, ChannelConfigOptions, ChannelCountMode, ChannelInterpretation,
@@ -129,7 +131,7 @@ impl AudioProcessor for ChannelMergerRenderer {
129131
inputs: &[AudioRenderQuantum],
130132
outputs: &mut [AudioRenderQuantum],
131133
_params: AudioParamValues<'_>,
132-
_scope: &RenderScope,
134+
_scope: &AudioWorkletGlobalScope,
133135
) -> bool {
134136
// single output node
135137
let output = &mut outputs[0];

src/node/channel_splitter.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
use std::fmt::Debug;
22

33
use crate::context::{AudioContextRegistration, BaseAudioContext};
4-
use crate::render::{AudioParamValues, AudioProcessor, AudioRenderQuantum, RenderScope};
4+
use crate::render::{
5+
AudioParamValues, AudioProcessor, AudioRenderQuantum, AudioWorkletGlobalScope,
6+
};
57

68
use super::{
79
AudioNode, ChannelConfig, ChannelConfigOptions, ChannelCountMode, ChannelInterpretation,
@@ -141,7 +143,7 @@ impl AudioProcessor for ChannelSplitterRenderer {
141143
inputs: &[AudioRenderQuantum],
142144
outputs: &mut [AudioRenderQuantum],
143145
_params: AudioParamValues<'_>,
144-
_scope: &RenderScope,
146+
_scope: &AudioWorkletGlobalScope,
145147
) -> bool {
146148
// single input node
147149
let input = &inputs[0];

0 commit comments

Comments
 (0)