Skip to content

Commit 575bded

Browse files
b-maorottier
authored andcommitted
refactor: renaming variables
1 parent 5c2ea5e commit 575bded

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/node/constant_source.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ use super::{AudioNode, AudioScheduledSourceNode, ChannelConfig};
1111
// dictionary ConstantSourceOptions {
1212
// float offset = 1;
1313
// };
14-
//
1514
// @note - Does not extend AudioNodeOptions because AudioNodeOptions are
1615
// useless for source nodes as they instruct how to upmix the inputs.
1716
// This is a common source of confusion, see e.g. https://github.com/mdn/content/pull/18472
17+
>>>>>>> 83a0107 (refactor: renaming variables)
1818
#[derive(Clone, Debug)]
1919
pub struct ConstantSourceOptions {
20+
/// Initial parameter value of the constant signal
2021
pub offset: f32,
2122
}
2223

@@ -114,14 +115,16 @@ impl AudioScheduledSourceNode for ConstantSourceNode {
114115
impl ConstantSourceNode {
115116
pub fn new<C: BaseAudioContext>(context: &C, options: ConstantSourceOptions) -> Self {
116117
context.register(move |registration| {
117-
let param_opts = AudioParamDescriptor {
118+
let ConstantSourceOptions { offset } = options;
119+
120+
let param_options = AudioParamDescriptor {
118121
min_value: f32::MIN,
119122
max_value: f32::MAX,
120123
default_value: 1.,
121124
automation_rate: AutomationRate::A,
122125
};
123-
let (param, proc) = context.create_audio_param(param_opts, &registration);
124-
param.set_value(options.offset);
126+
let (param, proc) = context.create_audio_param(param_options, &registration);
127+
param.set_value(offset);
125128

126129
let render = ConstantSourceRenderer {
127130
offset: proc,

0 commit comments

Comments
 (0)