logo
pub fn process_raw(input_buffer: &[f32], output_buffer: &mut [f32])
Expand description

Processes the non-interleaved f32 audio buffer in place through the loaded pd patch.

The processing order is like the following, input_buffer -> libpd -> output_buffer.

Copies buffer contents to/from libpd without striping.

Call this in your audio callback.

Examples

use libpd_rs::process::process_raw;

// After initializing audio and opening a patch file then in the audio callback..

// We can imagine that these are the buffers which has been handed to us by the audio callback.
let input_buffer = [0.0_f32; 512];
let mut output_buffer = [0.0_f32; 1024];

process_raw(&input_buffer, &mut output_buffer);
// Or if you wish,
// the input buffer can also be an empty slice if you're not going to use any inputs.
process_raw(&[], &mut output_buffer);

Panics

This function may panic for multiple reasons, first of all there is a mutex lock used internally and also it processes buffers in place so there are possibilities of segfaults. Use with care.