@@ -11,12 +11,13 @@ use super::{AudioNode, AudioScheduledSourceNode, ChannelConfig};
11
11
// dictionary ConstantSourceOptions {
12
12
// float offset = 1;
13
13
// };
14
- //
15
14
// @note - Does not extend AudioNodeOptions because AudioNodeOptions are
16
15
// useless for source nodes as they instruct how to upmix the inputs.
17
16
// This is a common source of confusion, see e.g. https://github.com/mdn/content/pull/18472
17
+ >>>>>>> 83 a0107 ( refactor: renaming variables)
18
18
#[ derive( Clone , Debug ) ]
19
19
pub struct ConstantSourceOptions {
20
+ /// Initial parameter value of the constant signal
20
21
pub offset : f32,
21
22
}
22
23
@@ -114,14 +115,16 @@ impl AudioScheduledSourceNode for ConstantSourceNode {
114
115
impl ConstantSourceNode {
115
116
pub fn new< C : BaseAudioContext > ( context: & C , options: ConstantSourceOptions ) -> Self {
116
117
context. register( move |registration| {
117
- let param_opts = AudioParamDescriptor {
118
+ let ConstantSourceOptions { offset } = options;
119
+
120
+ let param_options = AudioParamDescriptor {
118
121
min_value : f32:: MIN ,
119
122
max_value : f32:: MAX ,
120
123
default_value : 1. ,
121
124
automation_rate : AutomationRate :: A ,
122
125
} ;
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) ;
125
128
126
129
let render = ConstantSourceRenderer {
127
130
offset : proc,
0 commit comments