@@ -224,8 +224,8 @@ impl<const NUMGRAINS: usize, const BUFSIZE: usize> Plugin for Havregryn<NUMGRAIN
224224 main_input_channels : NonZeroU32 :: new ( 2 ) ,
225225 main_output_channels : NonZeroU32 :: new ( 2 ) ,
226226
227- aux_input_ports : & [ ] ,
228- aux_output_ports : & [ ] ,
227+ aux_input_ports : & [ new_nonzero_u32 ( 2 ) ] ,
228+ aux_output_ports : & [ new_nonzero_u32 ( 2 ) ] ,
229229
230230 // Individual ports and the layout as a whole can be named here. By default these names
231231 // are generated as needed. This layout will be called 'Stereo', while a layout with
@@ -303,16 +303,6 @@ impl<const NUMGRAINS: usize, const BUFSIZE: usize> Plugin for Havregryn<NUMGRAIN
303303
304304 // Once per buffer
305305 for mut frame in buffer. iter_samples ( ) {
306- // Mono sum of input
307- // since frame is already a product of an iterator,
308- // this should be fine.
309- let mono: f32 = unsafe { (
310- * frame. get_unchecked_mut ( 0 )
311- + * frame. get_unchecked_mut ( 1 )
312- ) * 0.5
313- } ;
314-
315-
316306 ' midi_loop: while let Some ( event) = context. next_event ( ) {
317307 // if event.timing() != sample_id as u32 {
318308 // break;
@@ -355,7 +345,15 @@ impl<const NUMGRAINS: usize, const BUFSIZE: usize> Plugin for Havregryn<NUMGRAIN
355345 self . imp . play ( trig)
356346 }
357347 } ;
358-
348+
349+ // Mono sum of input
350+ // since frame is already a product of an iterator,
351+ // this should be fine.
352+ let mono: f32 = unsafe {
353+ ( * frame. get_unchecked_mut ( 0 )
354+ + * frame. get_unchecked_mut ( 1 )
355+ ) * 0.5
356+ } ;
359357
360358 // granulator record buffer returns None when the buffer is full.
361359 if self . granulator . record ( mono) . is_none ( ) {
0 commit comments