pub unsafe fn run<
        'a,
        AudioInputs,
        AudioOutputs,
        AtomSequenceInputs,
        AtomSequenceOutputs,
        CVInputs,
        CVOutputs,
    >(
        &mut self,
        samples: usize,
        ports: PortConnections<
            'a,
            AudioInputs,
            AudioOutputs,
            AtomSequenceInputs,
            AtomSequenceOutputs,
            CVInputs,
            CVOutputs,
        >,
    ) -> Result<(), RunError>
    where
        AudioInputs: ExactSizeIterator + Iterator<Item = &'a [f32]>,
        AudioOutputs: ExactSizeIterator + Iterator<Item = &'a mut [f32]>,
        AtomSequenceInputs: ExactSizeIterator + Iterator<Item = &'a LV2AtomSequence>,
        AtomSequenceOutputs: ExactSizeIterator + Iterator<Item = &'a mut LV2AtomSequence>,
        CVInputs: ExactSizeIterator + Iterator<Item = &'a [f32]>,
        CVOutputs: ExactSizeIterator + Iterator<Item = &'a mut [f32]>,
    {
        if samples < self.min_block_size {
            return Err(RunError::SampleCountTooSmall {
                min_supported: self.min_block_size,
                actual: samples,
            });
        }
        if samples > self.max_block_size {
            return Err(RunError::SampleCountTooLarge {
                max_supported: self.max_block_size,
                actual: samples,
            });
        }
        if ports.audio_inputs.len() != self.audio_inputs.len() {
            return Err(RunError::AudioInputsSizeMismatch {
                expected: self.audio_inputs.len(),
                actual: ports.audio_inputs.len(),
            });
        }
        for (data, index) in ports.audio_inputs.zip(self.audio_inputs.iter()) {
            if data.len() < samples {
                return Err(RunError::AudioInputSampleCountTooSmall {
                    expected: samples,
                    actual: data.len(),
                });
            }
            self.inner
                .instance_mut()
                .connect_port(index.0, data.as_ptr());
        }
        if ports.audio_outputs.len() != self.audio_outputs.len() {
            return Err(RunError::AudioOutputsSizeMismatch {
                expected: self.audio_outputs.len(),
                actual: ports.audio_outputs.len(),
            });
        }
        for (data, index) in ports.audio_outputs.zip(self.audio_outputs.iter()) {
            if data.len() < samples {
                return Err(RunError::AudioOutputSampleCountTooSmall {
                    expected: samples,
                    actual: data.len(),
                });
            }
            self.inner
                .instance_mut()
                .connect_port_mut(index.0, data.as_mut_ptr());
        }
        if ports.atom_sequence_inputs.len() != self.atom_sequence_inputs.len() {
            return Err(RunError::AtomSequenceInputsSizeMismatch {
                expected: self.atom_sequence_inputs.len(),
                actual: ports.atom_sequence_inputs.len(),
            });
        }
        for (data, index) in ports
            .atom_sequence_inputs
            .zip(self.atom_sequence_inputs.iter())
        {
            self.inner
                .instance_mut()
                .connect_port(index.0, data.as_ptr());
        }
        if ports.atom_sequence_outputs.len() != self.atom_sequence_outputs.len() {
            return Err(RunError::AtomSequenceOutputsSizeMismatch {
                expected: self.atom_sequence_outputs.len(),
                actual: ports.atom_sequence_outputs.len(),
            });
        }
        for (data, index) in ports
            .atom_sequence_outputs
            .zip(self.atom_sequence_outputs.iter())
        {
            data.clear_as_chunk();
            self.inner
                .instance_mut()
                .connect_port_mut(index.0, data.as_mut_ptr());
        }
        if ports.cv_inputs.len() != self.cv_inputs.len() {
            return Err(RunError::CVInputsSizeMismatch {
                expected: self.cv_inputs.len(),
                actual: ports.cv_inputs.len(),
            });
        }
        for (data, index) in ports.cv_inputs.zip(self.cv_inputs.iter()) {
            self.inner
                .instance_mut()
                .connect_port(index.0, data.as_ptr());
        }
        if ports.cv_outputs.len() != self.cv_outputs.len() {
            return Err(RunError::CVOutputsSizeMismatch {
                expected: self.cv_outputs.len(),
                actual: ports.cv_outputs.len(),
            });
        }
        for (data, index) in ports.cv_outputs.zip(self.cv_outputs.iter()) {
            self.inner
                .instance_mut()
                .connect_port_mut(index.0, data.as_mut_ptr());
        }
        self.inner.run(samples);

        if let Some(interface) = self.worker_interface.as_mut() {
            worker::handle_work_responses(
                interface,
                &mut self.worker_to_instance_receiver,
                self.inner.instance().handle(),
            );
            worker::end_run(interface, self.inner.instance().handle());
        }

        Ok(())
    }
/// Run the plugin for a given number of samples.
///
/// # Safety
/// Running plugin code is unsafe.
///
/// # Errors
/// Returns an error if the plugin could not be run.
Run the plugin for a given number of samples.
Run the plugin for a given number of samples .
pub unsafe fn run<
        'a,
        AudioInputs,
        AudioOutputs,
        AtomSequenceInputs,
        AtomSequenceOutputs,
        CVInputs,
        CVOutputs,
    >(
        &mut self,
        samples: usize,
        ports: PortConnections<
            'a,
            AudioInputs,
            AudioOutputs,
            AtomSequenceInputs,
            AtomSequenceOutputs,
            CVInputs,
            CVOutputs,
        >,
    ) -> Result<(), RunError>
    where
        AudioInputs: ExactSizeIterator + Iterator<Item = &'a [f32]>,
        AudioOutputs: ExactSizeIterator + Iterator<Item = &'a mut [f32]>,
        AtomSequenceInputs: ExactSizeIterator + Iterator<Item = &'a LV2AtomSequence>,
        AtomSequenceOutputs: ExactSizeIterator + Iterator<Item = &'a mut LV2AtomSequence>,
        CVInputs: ExactSizeIterator + Iterator<Item = &'a [f32]>,
        CVOutputs: ExactSizeIterator + Iterator<Item = &'a mut [f32]>,
    {
        if samples < self.min_block_size {
            return Err(RunError::SampleCountTooSmall {
                min_supported: self.min_block_size,
                actual: samples,
            });
        }
        if samples > self.max_block_size {
            return Err(RunError::SampleCountTooLarge {
                max_supported: self.max_block_size,
                actual: samples,
            });
        }
        if ports.audio_inputs.len() != self.audio_inputs.len() {
            return Err(RunError::AudioInputsSizeMismatch {
                expected: self.audio_inputs.len(),
                actual: ports.audio_inputs.len(),
            });
        }
        for (data, index) in ports.audio_inputs.zip(self.audio_inputs.iter()) {
            if data.len() < samples {
                return Err(RunError::AudioInputSampleCountTooSmall {
                    expected: samples,
                    actual: data.len(),
                });
            }
            self.inner
                .instance_mut()
                .connect_port(index.0, data.as_ptr());
        }
        if ports.audio_outputs.len() != self.audio_outputs.len() {
            return Err(RunError::AudioOutputsSizeMismatch {
                expected: self.audio_outputs.len(),
                actual: ports.audio_outputs.len(),
            });
        }
        for (data, index) in ports.audio_outputs.zip(self.audio_outputs.iter()) {
            if data.len() < samples {
                return Err(RunError::AudioOutputSampleCountTooSmall {
                    expected: samples,
                    actual: data.len(),
                });
            }
            self.inner
                .instance_mut()
                .connect_port_mut(index.0, data.as_mut_ptr());
        }
        if ports.atom_sequence_inputs.len() != self.atom_sequence_inputs.len() {
            return Err(RunError::AtomSequenceInputsSizeMismatch {
                expected: self.atom_sequence_inputs.len(),
                actual: ports.atom_sequence_inputs.len(),
            });
        }
        for (data, index) in ports
            .atom_sequence_inputs
            .zip(self.atom_sequence_inputs.iter())
        {
            self.inner
                .instance_mut()
                .connect_port(index.0, data.as_ptr());
        }
        if ports.atom_sequence_outputs.len() != self.atom_sequence_outputs.len() {
            return Err(RunError::AtomSequenceOutputsSizeMismatch {
                expected: self.atom_sequence_outputs.len(),
                actual: ports.atom_sequence_outputs.len(),
            });
        }
        for (data, index) in ports
            .atom_sequence_outputs
            .zip(self.atom_sequence_outputs.iter())
        {
            data.clear_as_chunk();
            self.inner
                .instance_mut()
                .connect_port_mut(index.0, data.as_mut_ptr());
        }
        if ports.cv_inputs.len() != self.cv_inputs.len() {
            return Err(RunError::CVInputsSizeMismatch {
                expected: self.cv_inputs.len(),
                actual: ports.cv_inputs.len(),
            });
        }
        for (data, index) in ports.cv_inputs.zip(self.cv_inputs.iter()) {
            self.inner
                .instance_mut()
                .connect_port(index.0, data.as_ptr());
        }
        if ports.cv_outputs.len() != self.cv_outputs.len() {
            return Err(RunError::CVOutputsSizeMismatch {
                expected: self.cv_outputs.len(),
                actual: ports.cv_outputs.len(),
            });
        }
        for (data, index) in ports.cv_outputs.zip(self.cv_outputs.iter()) {
            self.inner
                .instance_mut()
                .connect_port_mut(index.0, data.as_mut_ptr());
        }
        self.inner.run(samples);
        if let Some(interface) = self.worker_interface.as_mut() {
            worker::handle_work_responses(
                interface,
                &mut self.worker_to_instance_receiver,
                self.inner.instance().handle(),
            );
            worker::end_run(interface, self.inner.instance().handle());
        }
        Ok(())
    }
pub unsafe fn run < ' a , AudioInputs , AudioOutputs , AtomSequenceInputs , AtomSequenceOutputs , CVInputs , CVOutputs , > ( & mut self , samples : usize , ports : PortConnections < ' a , AudioInputs , AudioOutputs , AtomSequenceInputs , AtomSequenceOutputs , CVInputs , CVOutputs , > , ) -> Result < ( ) , RunError > where AudioInputs : ExactSizeIterator + Iterator < Item = & ' a [ f32 ] > , AudioOutputs : ExactSizeIterator + Iterator < Item = & ' a mut [ f32 ] > , AtomSequenceInputs : ExactSizeIterator + Iterator < Item = & ' a LV2AtomSequence > , AtomSequenceOutputs : ExactSizeIterator + Iterator < Item = & ' a mut LV2AtomSequence > , CVInputs : ExactSizeIterator + Iterator < Item = & ' a [ f32 ] > , CVOutputs : ExactSizeIterator + Iterator < Item = & ' a mut [ f32 ] > , { if samples < self . min_block_size { return Err ( RunError :: SampleCountTooSmall { min_supported : self . min_block_size , actual : samples , } ) ; } if samples > self . max_block_size { return Err ( RunError :: SampleCountTooLarge { max_supported : self . max_block_size , actual : samples , } ) ; } if ports . audio_inputs . len ( ) != self . audio_inputs . len ( ) { return Err ( RunError :: AudioInputsSizeMismatch { expected : self . audio_inputs . len ( ) , actual : ports . audio_inputs . len ( ) , } ) ; } for ( data , index ) in ports . audio_inputs . zip ( self . audio_inputs . iter ( ) ) { if data . len ( ) < samples { return Err ( RunError :: AudioInputSampleCountTooSmall { expected : samples , actual : data . len ( ) , } ) ; } self . inner . instance_mut ( ) . connect_port ( index . 0 , data . as_ptr ( ) ) ; } if ports . audio_outputs . len ( ) != self . audio_outputs . len ( ) { return Err ( RunError :: AudioOutputsSizeMismatch { expected : self . audio_outputs . len ( ) , actual : ports . audio_outputs . len ( ) , } ) ; } for ( data , index ) in ports . audio_outputs . zip ( self . audio_outputs . iter ( ) ) { if data . len ( ) < samples { return Err ( RunError :: AudioOutputSampleCountTooSmall { expected : samples , actual : data . len ( ) , } ) ; } self . inner . instance_mut ( ) . connect_port_mut ( index . 0 , data . as_mut_ptr ( ) ) ; } if ports . atom_sequence_inputs . len ( ) != self . atom_sequence_inputs . len ( ) { return Err ( RunError :: AtomSequenceInputsSizeMismatch { expected : self . atom_sequence_inputs . len ( ) , actual : ports . atom_sequence_inputs . len ( ) , } ) ; } for ( data , index ) in ports . atom_sequence_inputs . zip ( self . atom_sequence_inputs . iter ( ) ) { self . inner . instance_mut ( ) . connect_port ( index . 0 , data . as_ptr ( ) ) ; } if ports . atom_sequence_outputs . len ( ) != self . atom_sequence_outputs . len ( ) { return Err ( RunError :: AtomSequenceOutputsSizeMismatch { expected : self . atom_sequence_outputs . len ( ) , actual : ports . atom_sequence_outputs . len ( ) , } ) ; } for ( data , index ) in ports . atom_sequence_outputs . zip ( self . atom_sequence_outputs . iter ( ) ) { data . clear_as_chunk ( ) ; self . inner . instance_mut ( ) . connect_port_mut ( index . 0 , data . as_mut_ptr ( ) ) ; } if ports . cv_inputs . len ( ) != self . cv_inputs . len ( ) { return Err ( RunError :: CVInputsSizeMismatch { expected : self . cv_inputs . len ( ) , actual : ports . cv_inputs . len ( ) , } ) ; } for ( data , index ) in ports . cv_inputs . zip ( self . cv_inputs . iter ( ) ) { self . inner . instance_mut ( ) . connect_port ( index . 0 , data . as_ptr ( ) ) ; } if ports . cv_outputs . len ( ) != self . cv_outputs . len ( ) { return Err ( RunError :: CVOutputsSizeMismatch { expected : self . cv_outputs . len ( ) , actual : ports . cv_outputs . len ( ) , } ) ; } for ( data , index ) in ports . cv_outputs . zip ( self . cv_outputs . iter ( ) ) { self . inner . instance_mut ( ) . connect_port_mut ( index . 0 , data . as_mut_ptr ( ) ) ; } self . inner . run ( samples ) ; if let Some ( interface ) = self . worker_interface . as_mut ( ) { worker :: handle_work_responses ( interface , & mut self . worker_to_instance_receiver , self . inner . instance ( ) . handle ( ) , ) ; worker :: end_run ( interface , self . inner . instance ( ) . handle ( ) ) ; } Ok ( ( ) ) }
Run the plugin for a given number of samples.
Run the plugin for a given number of samples .
&mut self
samples
usize
ports
PortConnections<
            'a,
            AudioInputs,
            AudioOutputs,
            AtomSequenceInputs,
            AtomSequenceOutputs,
            CVInputs,
            CVOutputs,
        >
&mut self
samples
usize
ports
PortConnections<
            'a,
            AudioInputs,
            AudioOutputs,
            AtomSequenceInputs,
            AtomSequenceOutputs,
            CVInputs,
            CVOutputs,
        >
safety
Running plugin code is unsafe.
Running plugin code is unsafe .
errors
Returns an error if the plugin could not be run.
Returns an error if the plugin could not be run .