grame-cncm / faust

Functional programming language for signal processing and sound synthesis
http://faust.grame.fr
Other
2.59k stars 325 forks source link

rust: provide a compute_arrays function #1058

Closed crop2000 closed 1 month ago

crop2000 commented 1 month ago

The benefit of using arrays as function arguments is that they fail compilation if a wrong length array is provided. When the compute_arrays function is used then we have one less possible panic.

sletz commented 1 month ago

Be sure to test the Rust backend with make rust in tests/impulse-tests folder.

crop2000 commented 1 month ago

@sletz after fixing the error introduced by me some tests are failing, which are also failing on master-dev.

sletz commented 1 month ago

@sletz after fixing the error introduced by me some tests are failing, which are also failing on master-dev.

Which ones ?

sletz commented 1 month ago

I don't see it here.

rustc -V rustc 1.81.0 (eeb90cda1 2024-09-04) (built from a source tarball)

macOS Monterey 12.7.6

crop2000 commented 1 month ago

rustc 1.78.0 (9b00956e5 2024-04-29) (built from a source tarball) Linux 6.1.108-rt40 #1-NixOS SMP PREEMPT_RT Wed Sep 4 11:25:05 UTC 2024 x86_64 GNU/Linux

crop2000 commented 1 month ago

I think this PR is ready. This change is fully backward compatible. And tested with the impulse-tests.

sletz commented 1 month ago

Thanks. Testing here with faust2portaudiorust tool, but I gets runtime error like:

Faust Rust code running with Portaudio: sample-rate = 44100 buffer-size = 64
get_num_inputs: 1
get_num_outputs: 2
thread 'main' panicked at src/main.rs:227:11:
called `Result::unwrap()` on an `Err` value: InvalidChannelCount
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

so I guess the current port audio architecture, which use a fixed const CHANNELS: i32 = 2; will have to be adapted.

Can you have a look ?

sletz commented 1 month ago

Merged, thanks.

crop2000 commented 1 month ago

yes i will have a look at the architecture files. unfortunately some of them are very outdated.