Skip to main content

ConstantSourceNode

Struct ConstantSourceNode 

Source
pub struct ConstantSourceNode { /* private fields */ }

Implementations§

Source§

impl ConstantSourceNode

Source

pub fn offset(&self) -> AudioParamHandle

Examples found in repository?
examples/spatial_effects_mixer.rs (line 75)
25fn build_spatial_scene(context: &mut AudioContext, stop_time: f64) -> Result<(), Box<dyn Error>> {
26    let listener = context.listener();
27    listener.position_x().set_value_at_time(-0.6, 0.0)?;
28    listener
29        .position_x()
30        .linear_ramp_to_value_at_time(0.6, stop_time)?;
31    listener.forward_z().set_value(-1.0)?;
32
33    let lead = context.create_oscillator();
34    lead.set_type(Waveform::Triangle);
35    lead.frequency().set_value(330.0)?;
36    lead.try_start(0.0)?;
37    lead.try_stop(stop_time)?;
38
39    let source_amp = context.try_create_gain_with_options(GainOptions { gain: 0.12 })?;
40    source_amp.gain().set_value_at_time(0.0, 0.0)?;
41    source_amp.gain().linear_ramp_to_value_at_time(0.12, 0.12)?;
42    source_amp
43        .gain()
44        .linear_ramp_to_value_at_time(0.0, stop_time)?;
45
46    let panner = context.try_create_panner_with_options(PannerOptions {
47        position_x: -1.2,
48        position_z: 1.5,
49        ..Default::default()
50    })?;
51    panner
52        .position_x()
53        .linear_ramp_to_value_at_time(1.2, stop_time)?;
54    panner.orientation_z().set_value(-1.0)?;
55
56    let stereo =
57        context.try_create_stereo_panner_with_options(StereoPannerOptions { pan: -0.35 })?;
58    stereo.pan().linear_ramp_to_value_at_time(0.35, stop_time)?;
59
60    let splitter = context.try_create_channel_splitter_with_options(ChannelSplitterOptions {
61        number_of_outputs: 2,
62    })?;
63    let merger = context.try_create_channel_merger_with_options(ChannelMergerOptions {
64        number_of_inputs: 2,
65    })?;
66    let delay = context.try_create_delay_with_options(DelayOptions {
67        max_delay_time: 0.6,
68        delay_time: 0.16,
69    })?;
70    let send_gain = context.try_create_gain_with_options(GainOptions { gain: 0.18 })?;
71    let return_gain = context.try_create_gain_with_options(GainOptions { gain: 0.22 })?;
72    let output = context.try_create_gain_with_options(GainOptions { gain: 0.8 })?;
73
74    let control = context.create_constant_source();
75    control.offset().set_value(0.04)?;
76    control.try_start(0.0)?;
77    control.try_stop(stop_time)?;
78
79    context.connect(lead, &source_amp)?;
80    context.connect(&source_amp, &panner)?;
81    context.connect(&panner, &stereo)?;
82    context.connect(&stereo, &splitter)?;
83    context.connect_with_indices(&splitter, 0, &merger, 0)?;
84    context.connect_with_indices(&splitter, 1, &merger, 1)?;
85    context.connect_with_indices(&splitter, 0, &send_gain, 0)?;
86    context.connect(&send_gain, &delay)?;
87    context.connect(&delay, &return_gain)?;
88    context.connect(&return_gain, &merger)?;
89    context.connect(&merger, &output)?;
90    context.connect(&output, context.destination())?;
91    context.connect_param_from_output(&splitter, 0, stereo.pan())?;
92    context.connect_param(&control, delay.delay_time())?;
93
94    context.disconnect_param_from_output(&splitter, 0, stereo.pan())?;
95    context.disconnect_with_indices(&splitter, 0, &send_gain, 0)?;
96    context.connect_with_indices(&splitter, 1, &send_gain, 0)?;
97    context.disconnect_outputs(&return_gain)?;
98    context.connect(&return_gain, &merger)?;
99    context.disconnect_param_outputs(&control)?;
100    context.connect_param(&control, delay.delay_time())?;
101
102    println!("listener position: {:?}", listener.position_value());
103    println!("routing mixer output: {:?}", context.node_info(&output)?);
104    Ok(())
105}
Source

pub fn param(&self, name: &str) -> Option<AudioParamHandle>

Source

pub fn parameter(&self, name: &str) -> Option<AudioParamHandle>

Source

pub fn ended(&self) -> bool

Source

pub fn try_start(&self, time: f64) -> Result<(), GraphError>

Examples found in repository?
examples/spatial_effects_mixer.rs (line 76)
25fn build_spatial_scene(context: &mut AudioContext, stop_time: f64) -> Result<(), Box<dyn Error>> {
26    let listener = context.listener();
27    listener.position_x().set_value_at_time(-0.6, 0.0)?;
28    listener
29        .position_x()
30        .linear_ramp_to_value_at_time(0.6, stop_time)?;
31    listener.forward_z().set_value(-1.0)?;
32
33    let lead = context.create_oscillator();
34    lead.set_type(Waveform::Triangle);
35    lead.frequency().set_value(330.0)?;
36    lead.try_start(0.0)?;
37    lead.try_stop(stop_time)?;
38
39    let source_amp = context.try_create_gain_with_options(GainOptions { gain: 0.12 })?;
40    source_amp.gain().set_value_at_time(0.0, 0.0)?;
41    source_amp.gain().linear_ramp_to_value_at_time(0.12, 0.12)?;
42    source_amp
43        .gain()
44        .linear_ramp_to_value_at_time(0.0, stop_time)?;
45
46    let panner = context.try_create_panner_with_options(PannerOptions {
47        position_x: -1.2,
48        position_z: 1.5,
49        ..Default::default()
50    })?;
51    panner
52        .position_x()
53        .linear_ramp_to_value_at_time(1.2, stop_time)?;
54    panner.orientation_z().set_value(-1.0)?;
55
56    let stereo =
57        context.try_create_stereo_panner_with_options(StereoPannerOptions { pan: -0.35 })?;
58    stereo.pan().linear_ramp_to_value_at_time(0.35, stop_time)?;
59
60    let splitter = context.try_create_channel_splitter_with_options(ChannelSplitterOptions {
61        number_of_outputs: 2,
62    })?;
63    let merger = context.try_create_channel_merger_with_options(ChannelMergerOptions {
64        number_of_inputs: 2,
65    })?;
66    let delay = context.try_create_delay_with_options(DelayOptions {
67        max_delay_time: 0.6,
68        delay_time: 0.16,
69    })?;
70    let send_gain = context.try_create_gain_with_options(GainOptions { gain: 0.18 })?;
71    let return_gain = context.try_create_gain_with_options(GainOptions { gain: 0.22 })?;
72    let output = context.try_create_gain_with_options(GainOptions { gain: 0.8 })?;
73
74    let control = context.create_constant_source();
75    control.offset().set_value(0.04)?;
76    control.try_start(0.0)?;
77    control.try_stop(stop_time)?;
78
79    context.connect(lead, &source_amp)?;
80    context.connect(&source_amp, &panner)?;
81    context.connect(&panner, &stereo)?;
82    context.connect(&stereo, &splitter)?;
83    context.connect_with_indices(&splitter, 0, &merger, 0)?;
84    context.connect_with_indices(&splitter, 1, &merger, 1)?;
85    context.connect_with_indices(&splitter, 0, &send_gain, 0)?;
86    context.connect(&send_gain, &delay)?;
87    context.connect(&delay, &return_gain)?;
88    context.connect(&return_gain, &merger)?;
89    context.connect(&merger, &output)?;
90    context.connect(&output, context.destination())?;
91    context.connect_param_from_output(&splitter, 0, stereo.pan())?;
92    context.connect_param(&control, delay.delay_time())?;
93
94    context.disconnect_param_from_output(&splitter, 0, stereo.pan())?;
95    context.disconnect_with_indices(&splitter, 0, &send_gain, 0)?;
96    context.connect_with_indices(&splitter, 1, &send_gain, 0)?;
97    context.disconnect_outputs(&return_gain)?;
98    context.connect(&return_gain, &merger)?;
99    context.disconnect_param_outputs(&control)?;
100    context.connect_param(&control, delay.delay_time())?;
101
102    println!("listener position: {:?}", listener.position_value());
103    println!("routing mixer output: {:?}", context.node_info(&output)?);
104    Ok(())
105}
More examples
Hide additional examples
examples/webaudio_synth_lab.rs (line 109)
56fn build_synth_lab(
57    context: &mut AudioContext,
58    stop_time: f64,
59) -> Result<AnalyserNode, Box<dyn Error>> {
60    let custom_wave = context.try_create_periodic_wave_with_options(
61        [0.0, 0.0, 0.22, 0.12],
62        [0.0, 1.0, 0.35, 0.18],
63        PeriodicWaveOptions {
64            disable_normalization: false,
65        },
66    )?;
67    let carrier = context.try_create_oscillator_with_options(OscillatorOptions {
68        oscillator_type: OscillatorType::Custom(custom_wave),
69        frequency: 110.0,
70        detune: -8.0,
71    })?;
72    carrier
73        .frequency()
74        .linear_ramp_to_value_at_time(146.83, 3.0)?;
75    carrier.try_start(0.0)?;
76    carrier.try_stop(stop_time)?;
77
78    let overtone = context.try_create_oscillator_with_options(OscillatorOptions {
79        oscillator_type: OscillatorType::Basic(Waveform::Triangle),
80        frequency: 220.0,
81        detune: 4.0,
82    })?;
83    overtone.try_start(0.0)?;
84    overtone.try_stop(stop_time)?;
85
86    let buffer = AudioBuffer::try_from_mono(
87        SAMPLE_RATE,
88        SAMPLE_RATE as usize / 2,
89        (0..SAMPLE_RATE / 2).map(|i| {
90            let t = i as f32 / SAMPLE_RATE as f32;
91            let burst = (1.0 - t * 2.0).max(0.0);
92            (t * std::f32::consts::TAU * 880.0).sin() * burst * 0.18
93        }),
94    )?;
95    let buffer_source =
96        context.try_create_buffer_source_with_options(AudioBufferSourceOptions {
97            buffer: Some(buffer),
98            playback_rate: 0.85,
99            detune: 0.0,
100            looping: false,
101            loop_start: 0.0,
102            loop_end: 0.5,
103        })?;
104    buffer_source.try_start(2.0)?;
105    buffer_source.try_stop(3.2)?;
106
107    let lfo =
108        context.try_create_constant_source_with_options(ConstantSourceOptions { offset: 0.012 })?;
109    lfo.try_start(0.0)?;
110    lfo.try_stop(stop_time)?;
111
112    let carrier_gain = context.try_create_gain_with_options(GainOptions { gain: 0.0 })?;
113    carrier_gain.gain().set_value_at_time(0.0, 0.0)?;
114    carrier_gain
115        .gain()
116        .linear_ramp_to_value_at_time(0.11, 0.18)?;
117    carrier_gain
118        .gain()
119        .set_value_curve_at_time([0.11, 0.08, 0.13, 0.09, 0.12], 0.4, 2.8)?;
120    carrier_gain.gain().set_target_at_time(0.07, 3.4, 0.55)?;
121    carrier_gain
122        .gain()
123        .cancel_and_hold_at_time(stop_time - 0.35)?;
124    carrier_gain
125        .gain()
126        .linear_ramp_to_value_at_time(0.0, stop_time)?;
127
128    let burst_gain = context.try_create_gain_with_options(GainOptions { gain: 0.12 })?;
129    let delay = context.try_create_delay_with_options(DelayOptions {
130        max_delay_time: 0.75,
131        delay_time: 0.08,
132    })?;
133    let biquad = context.try_create_biquad_filter_with_options(BiquadFilterOptions {
134        filter_type: BiquadFilterType::Lowpass,
135        frequency: 1_200.0,
136        q: 0.9,
137        ..Default::default()
138    })?;
139    biquad
140        .frequency()
141        .linear_ramp_to_value_at_time(2_400.0, 2.5)?;
142    biquad.frequency().set_target_at_time(700.0, 3.5, 0.8)?;
143
144    let iir = context.try_create_iir_filter_with_options(IirFilterOptions {
145        feedforward: vec![0.55, 0.35],
146        feedback: vec![1.0, -0.18],
147    })?;
148    let shaper = context.try_create_wave_shaper_with_options(WaveShaperOptions {
149        curve: Some(vec![-1.0, -0.35, 0.0, 0.35, 1.0]),
150        oversample: Oversample::TwoX,
151    })?;
152    let stereo =
153        context.try_create_stereo_panner_with_options(StereoPannerOptions { pan: -0.15 })?;
154    stereo.pan().linear_ramp_to_value_at_time(0.25, stop_time)?;
155    let panner = context.try_create_panner_with_options(PannerOptions {
156        position_x: 0.8,
157        position_z: 1.5,
158        ..Default::default()
159    })?;
160    let compressor =
161        context.try_create_dynamics_compressor_with_options(DynamicsCompressorOptions {
162            threshold: -20.0,
163            knee: 18.0,
164            ratio: 2.5,
165            attack: 0.01,
166            release: 0.22,
167        })?;
168    let convolver = context.try_create_convolver_with_options(ConvolverOptions {
169        buffer: Some(AudioBuffer::try_from_mono(
170            SAMPLE_RATE,
171            8,
172            [0.55, 0.28, 0.15, 0.08, 0.04, 0.02, 0.01, 0.005],
173        )?),
174        disable_normalization: true,
175    })?;
176    let analyser = context.try_create_analyser_with_options(AnalyserOptions {
177        fft_size: 1024,
178        min_decibels: -100.0,
179        max_decibels: -12.0,
180        smoothing_time_constant: 0.35,
181    })?;
182    let splitter = context.try_create_channel_splitter_with_options(ChannelSplitterOptions {
183        number_of_outputs: 2,
184    })?;
185    let merger = context.try_create_channel_merger_with_options(ChannelMergerOptions {
186        number_of_inputs: 2,
187    })?;
188    let output = context.try_create_gain_with_options(GainOptions { gain: 0.82 })?;
189
190    context.connect(carrier, &carrier_gain)?;
191    context.connect(overtone, &carrier_gain)?;
192    context.connect(buffer_source, &burst_gain)?;
193    context.connect(&carrier_gain, &delay)?;
194    context.connect(&delay, &biquad)?;
195    context.connect_param(lfo, delay.delay_time())?;
196    context.connect(&biquad, &iir)?;
197    context.connect(&iir, &shaper)?;
198    context.connect(&shaper, &stereo)?;
199    context.connect(&stereo, &panner)?;
200    context.connect(&burst_gain, &splitter)?;
201    context.connect_with_indices(&splitter, 0, &merger, 0)?;
202    context.connect_with_indices(&splitter, 1, &merger, 1)?;
203    context.connect(&panner, &compressor)?;
204    context.connect(&merger, &compressor)?;
205    context.connect(&compressor, &convolver)?;
206    context.connect(&convolver, &output)?;
207    context.connect(&output, &analyser)?;
208    context.connect(&analyser, context.destination())?;
209
210    println!("output node info: {:?}", context.node_info(&output)?);
211    Ok(analyser)
212}
Source

pub fn try_stop(&self, time: f64) -> Result<(), GraphError>

Examples found in repository?
examples/spatial_effects_mixer.rs (line 77)
25fn build_spatial_scene(context: &mut AudioContext, stop_time: f64) -> Result<(), Box<dyn Error>> {
26    let listener = context.listener();
27    listener.position_x().set_value_at_time(-0.6, 0.0)?;
28    listener
29        .position_x()
30        .linear_ramp_to_value_at_time(0.6, stop_time)?;
31    listener.forward_z().set_value(-1.0)?;
32
33    let lead = context.create_oscillator();
34    lead.set_type(Waveform::Triangle);
35    lead.frequency().set_value(330.0)?;
36    lead.try_start(0.0)?;
37    lead.try_stop(stop_time)?;
38
39    let source_amp = context.try_create_gain_with_options(GainOptions { gain: 0.12 })?;
40    source_amp.gain().set_value_at_time(0.0, 0.0)?;
41    source_amp.gain().linear_ramp_to_value_at_time(0.12, 0.12)?;
42    source_amp
43        .gain()
44        .linear_ramp_to_value_at_time(0.0, stop_time)?;
45
46    let panner = context.try_create_panner_with_options(PannerOptions {
47        position_x: -1.2,
48        position_z: 1.5,
49        ..Default::default()
50    })?;
51    panner
52        .position_x()
53        .linear_ramp_to_value_at_time(1.2, stop_time)?;
54    panner.orientation_z().set_value(-1.0)?;
55
56    let stereo =
57        context.try_create_stereo_panner_with_options(StereoPannerOptions { pan: -0.35 })?;
58    stereo.pan().linear_ramp_to_value_at_time(0.35, stop_time)?;
59
60    let splitter = context.try_create_channel_splitter_with_options(ChannelSplitterOptions {
61        number_of_outputs: 2,
62    })?;
63    let merger = context.try_create_channel_merger_with_options(ChannelMergerOptions {
64        number_of_inputs: 2,
65    })?;
66    let delay = context.try_create_delay_with_options(DelayOptions {
67        max_delay_time: 0.6,
68        delay_time: 0.16,
69    })?;
70    let send_gain = context.try_create_gain_with_options(GainOptions { gain: 0.18 })?;
71    let return_gain = context.try_create_gain_with_options(GainOptions { gain: 0.22 })?;
72    let output = context.try_create_gain_with_options(GainOptions { gain: 0.8 })?;
73
74    let control = context.create_constant_source();
75    control.offset().set_value(0.04)?;
76    control.try_start(0.0)?;
77    control.try_stop(stop_time)?;
78
79    context.connect(lead, &source_amp)?;
80    context.connect(&source_amp, &panner)?;
81    context.connect(&panner, &stereo)?;
82    context.connect(&stereo, &splitter)?;
83    context.connect_with_indices(&splitter, 0, &merger, 0)?;
84    context.connect_with_indices(&splitter, 1, &merger, 1)?;
85    context.connect_with_indices(&splitter, 0, &send_gain, 0)?;
86    context.connect(&send_gain, &delay)?;
87    context.connect(&delay, &return_gain)?;
88    context.connect(&return_gain, &merger)?;
89    context.connect(&merger, &output)?;
90    context.connect(&output, context.destination())?;
91    context.connect_param_from_output(&splitter, 0, stereo.pan())?;
92    context.connect_param(&control, delay.delay_time())?;
93
94    context.disconnect_param_from_output(&splitter, 0, stereo.pan())?;
95    context.disconnect_with_indices(&splitter, 0, &send_gain, 0)?;
96    context.connect_with_indices(&splitter, 1, &send_gain, 0)?;
97    context.disconnect_outputs(&return_gain)?;
98    context.connect(&return_gain, &merger)?;
99    context.disconnect_param_outputs(&control)?;
100    context.connect_param(&control, delay.delay_time())?;
101
102    println!("listener position: {:?}", listener.position_value());
103    println!("routing mixer output: {:?}", context.node_info(&output)?);
104    Ok(())
105}
More examples
Hide additional examples
examples/webaudio_synth_lab.rs (line 110)
56fn build_synth_lab(
57    context: &mut AudioContext,
58    stop_time: f64,
59) -> Result<AnalyserNode, Box<dyn Error>> {
60    let custom_wave = context.try_create_periodic_wave_with_options(
61        [0.0, 0.0, 0.22, 0.12],
62        [0.0, 1.0, 0.35, 0.18],
63        PeriodicWaveOptions {
64            disable_normalization: false,
65        },
66    )?;
67    let carrier = context.try_create_oscillator_with_options(OscillatorOptions {
68        oscillator_type: OscillatorType::Custom(custom_wave),
69        frequency: 110.0,
70        detune: -8.0,
71    })?;
72    carrier
73        .frequency()
74        .linear_ramp_to_value_at_time(146.83, 3.0)?;
75    carrier.try_start(0.0)?;
76    carrier.try_stop(stop_time)?;
77
78    let overtone = context.try_create_oscillator_with_options(OscillatorOptions {
79        oscillator_type: OscillatorType::Basic(Waveform::Triangle),
80        frequency: 220.0,
81        detune: 4.0,
82    })?;
83    overtone.try_start(0.0)?;
84    overtone.try_stop(stop_time)?;
85
86    let buffer = AudioBuffer::try_from_mono(
87        SAMPLE_RATE,
88        SAMPLE_RATE as usize / 2,
89        (0..SAMPLE_RATE / 2).map(|i| {
90            let t = i as f32 / SAMPLE_RATE as f32;
91            let burst = (1.0 - t * 2.0).max(0.0);
92            (t * std::f32::consts::TAU * 880.0).sin() * burst * 0.18
93        }),
94    )?;
95    let buffer_source =
96        context.try_create_buffer_source_with_options(AudioBufferSourceOptions {
97            buffer: Some(buffer),
98            playback_rate: 0.85,
99            detune: 0.0,
100            looping: false,
101            loop_start: 0.0,
102            loop_end: 0.5,
103        })?;
104    buffer_source.try_start(2.0)?;
105    buffer_source.try_stop(3.2)?;
106
107    let lfo =
108        context.try_create_constant_source_with_options(ConstantSourceOptions { offset: 0.012 })?;
109    lfo.try_start(0.0)?;
110    lfo.try_stop(stop_time)?;
111
112    let carrier_gain = context.try_create_gain_with_options(GainOptions { gain: 0.0 })?;
113    carrier_gain.gain().set_value_at_time(0.0, 0.0)?;
114    carrier_gain
115        .gain()
116        .linear_ramp_to_value_at_time(0.11, 0.18)?;
117    carrier_gain
118        .gain()
119        .set_value_curve_at_time([0.11, 0.08, 0.13, 0.09, 0.12], 0.4, 2.8)?;
120    carrier_gain.gain().set_target_at_time(0.07, 3.4, 0.55)?;
121    carrier_gain
122        .gain()
123        .cancel_and_hold_at_time(stop_time - 0.35)?;
124    carrier_gain
125        .gain()
126        .linear_ramp_to_value_at_time(0.0, stop_time)?;
127
128    let burst_gain = context.try_create_gain_with_options(GainOptions { gain: 0.12 })?;
129    let delay = context.try_create_delay_with_options(DelayOptions {
130        max_delay_time: 0.75,
131        delay_time: 0.08,
132    })?;
133    let biquad = context.try_create_biquad_filter_with_options(BiquadFilterOptions {
134        filter_type: BiquadFilterType::Lowpass,
135        frequency: 1_200.0,
136        q: 0.9,
137        ..Default::default()
138    })?;
139    biquad
140        .frequency()
141        .linear_ramp_to_value_at_time(2_400.0, 2.5)?;
142    biquad.frequency().set_target_at_time(700.0, 3.5, 0.8)?;
143
144    let iir = context.try_create_iir_filter_with_options(IirFilterOptions {
145        feedforward: vec![0.55, 0.35],
146        feedback: vec![1.0, -0.18],
147    })?;
148    let shaper = context.try_create_wave_shaper_with_options(WaveShaperOptions {
149        curve: Some(vec![-1.0, -0.35, 0.0, 0.35, 1.0]),
150        oversample: Oversample::TwoX,
151    })?;
152    let stereo =
153        context.try_create_stereo_panner_with_options(StereoPannerOptions { pan: -0.15 })?;
154    stereo.pan().linear_ramp_to_value_at_time(0.25, stop_time)?;
155    let panner = context.try_create_panner_with_options(PannerOptions {
156        position_x: 0.8,
157        position_z: 1.5,
158        ..Default::default()
159    })?;
160    let compressor =
161        context.try_create_dynamics_compressor_with_options(DynamicsCompressorOptions {
162            threshold: -20.0,
163            knee: 18.0,
164            ratio: 2.5,
165            attack: 0.01,
166            release: 0.22,
167        })?;
168    let convolver = context.try_create_convolver_with_options(ConvolverOptions {
169        buffer: Some(AudioBuffer::try_from_mono(
170            SAMPLE_RATE,
171            8,
172            [0.55, 0.28, 0.15, 0.08, 0.04, 0.02, 0.01, 0.005],
173        )?),
174        disable_normalization: true,
175    })?;
176    let analyser = context.try_create_analyser_with_options(AnalyserOptions {
177        fft_size: 1024,
178        min_decibels: -100.0,
179        max_decibels: -12.0,
180        smoothing_time_constant: 0.35,
181    })?;
182    let splitter = context.try_create_channel_splitter_with_options(ChannelSplitterOptions {
183        number_of_outputs: 2,
184    })?;
185    let merger = context.try_create_channel_merger_with_options(ChannelMergerOptions {
186        number_of_inputs: 2,
187    })?;
188    let output = context.try_create_gain_with_options(GainOptions { gain: 0.82 })?;
189
190    context.connect(carrier, &carrier_gain)?;
191    context.connect(overtone, &carrier_gain)?;
192    context.connect(buffer_source, &burst_gain)?;
193    context.connect(&carrier_gain, &delay)?;
194    context.connect(&delay, &biquad)?;
195    context.connect_param(lfo, delay.delay_time())?;
196    context.connect(&biquad, &iir)?;
197    context.connect(&iir, &shaper)?;
198    context.connect(&shaper, &stereo)?;
199    context.connect(&stereo, &panner)?;
200    context.connect(&burst_gain, &splitter)?;
201    context.connect_with_indices(&splitter, 0, &merger, 0)?;
202    context.connect_with_indices(&splitter, 1, &merger, 1)?;
203    context.connect(&panner, &compressor)?;
204    context.connect(&merger, &compressor)?;
205    context.connect(&compressor, &convolver)?;
206    context.connect(&convolver, &output)?;
207    context.connect(&output, &analyser)?;
208    context.connect(&analyser, context.destination())?;
209
210    println!("output node info: {:?}", context.node_info(&output)?);
211    Ok(analyser)
212}

Trait Implementations§

Source§

impl Clone for ConstantSourceNode

Source§

fn clone(&self) -> ConstantSourceNode

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ConstantSourceNode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AudioNodeHandle for T
where T: AudioNodeHandlePrivate + ?Sized,

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.