@@ -149,13 +149,13 @@ impl ConvolverNode {
149
149
/// Panics when an AudioBuffer is provided via the `ConvolverOptions` with a sample rate
150
150
/// different from the audio context sample rate.
151
151
pub fn new < C : BaseAudioContext > ( context : & C , options : ConvolverOptions ) -> Self {
152
- let node = context. base ( ) . register ( move |registration| {
153
- let ConvolverOptions {
154
- buffer,
155
- disable_normalization,
156
- channel_config,
157
- } = options;
152
+ let ConvolverOptions {
153
+ buffer,
154
+ disable_normalization,
155
+ channel_config,
156
+ } = options;
158
157
158
+ let node = context. base ( ) . register ( move |registration| {
159
159
// create a dummy convolver to be replaced by a real one without deallocation
160
160
let sample_rate = context. base ( ) . sample_rate ( ) ;
161
161
let padded_buffer = AudioBuffer :: from ( vec ! [ vec![ 0. ; 0 ] ; 1 ] , sample_rate) ;
@@ -170,14 +170,14 @@ impl ConvolverNode {
170
170
registration,
171
171
channel_config : channel_config. into ( ) ,
172
172
normalize : AtomicBool :: new ( !disable_normalization) ,
173
- buffer : Mutex :: new ( buffer ) ,
173
+ buffer : Mutex :: new ( None ) ,
174
174
} ;
175
175
176
176
( node, Box :: new ( renderer) )
177
177
} ) ;
178
178
179
179
// audio node has been sent to render thread, we can sent it messages
180
- if let Some ( buffer) = node . buffer ( ) {
180
+ if let Some ( buffer) = buffer {
181
181
node. set_buffer ( buffer) ;
182
182
}
183
183
@@ -447,7 +447,6 @@ impl AudioProcessor for ConvolverRenderer {
447
447
448
448
fn onmessage ( & mut self , msg : & mut dyn Any ) {
449
449
if let Some ( convolver) = msg. downcast_mut :: < ConvolverRendererInner > ( ) {
450
- println ! ( "convolver set" ) ;
451
450
// Avoid deallocation in the render thread by swapping the convolver.
452
451
std:: mem:: swap ( & mut self . convolver , convolver) ;
453
452
self . convolver_set = true ;
0 commit comments