Closed bluenote10 closed 4 years ago
-inpl
option but that only works in scalar mode (an AFAICS is not working correctly on some DSP).FAUSTFLOAT**
inputs/outputs are actually interleaved. This is somewhat reflected by the FAUSTFLOAT**
type since interleaved buffers would use the FAUSTFLOAT*
type. But yes this should be added in the documentation ((-;A bit of improvement in the doc https://github.com/grame-cncm/faustdoc/commit/b24980ddde03bea5285108d4773d4e1534887464
Perfect thanks! Somehow I had missed the documentation on the -inpl
mode.
So, regarding the Rust backend, I assume that it is currently scalar-only anyway (so a possible candidate for -inpl
processing), but probably lacks an explicit handling of in-place mode. The question is if the compute
interface should already account for the possibility of in-place processing. I'll have to experiment with the idea and the implications a bit more to see if that makes sense.
Since the documentation aspect is covered, we may as well close the ticket and address the Rust aspect separately?
faust -lang rust -vec foo.dsp
will return an error)-inpl
is supposed to be backend generic, so it should work with the Rust backend, but I've never tried for now
I'm wondering if Faust in general has "in-place semantics", i.e., whether it is always okay to re-use input buffers as output?
I've only looked at a few examples, but the pattern often is (using the C++ code generator as an example):
In such a case it would be okay to use the same memory for both input and output, because the generated code never needs to re-read an input value.
Is this a general property that the code generation always fulfills?
In case this is guaranteed:
FAUSTFLOAT** inputs
is interleaved or not.compute
function may be changed to use raw pointers as well. When relying on borrowing it is probably not possible to borrow a buffer simultaneously as input and output because of the standard rules of borrow checking. (I could help with solving this part if needed.)Background: I'm using Faust in a context where I instantiate several small Faust components as "building blocks", passing signals manually between various
compute
functions. In most cases there is no need to preserve the inputs, i.e., components could be chained in an in-place fashion, which would be more cache efficient and save memory.