grame-cncm / faust

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

Missing Parenthesis in D backend #729

Closed PolyVector closed 2 years ago

PolyVector commented 2 years ago

Hello,

After updating to 2.40.0 (from 2.37.3) Faust is generating invalid D code when using the -lang dlang option.

Comparing my old generated code with the new, it appears that the issue is caused by parenthesis being left out.

Here's the smallest DSP I could get to demonstrate the issue.

import("stdfaust.lib");
process = co.limiter_lad_bw;

Compiling the generated D code gives me:

Error: cannot implicitly convert expression `0.0F * fConst0` of type `float` to `int`

This isn't the only error I'm seeing, but it was the only one I could reproduce in a simple Faust project.

I suspect these commits could be related: https://github.com/grame-cncm/faust/commit/506917edca6b4ef11b4e1f05370f442c3629dc34 https://github.com/grame-cncm/faust/commit/74063b09a95157e5c50ff4f6601c8da2ca753631

sletz commented 2 years ago

Should be fixed in https://github.com/grame-cncm/faust/commit/c350e772b314c8feb18aac4e54b859b740b4dcc9. Can you test and report ?

PolyVector commented 2 years ago

Works perfectly!

That may have been the fastest I've ever seen a bug fixed, thank you! :)

sletz commented 2 years ago

Thanks!