grame-cncm / faust

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

faust2supercollider: filenames with dash ("a-b.dsp") breaks compilation #520

Closed LFSaw closed 2 years ago

LFSaw commented 3 years ago

with current faust install (2.28.8, see below), compilation of supercollider UGens breaks, if the ".dsp" filename includes a dash:

reproduce error

given an arbitrary dsp file named testdsp.dsp resp. test-dsp.dsp

$ faust2supercollider testdsp.dsp # works
$ faust2supercollider test-dsp.dsp # throws errors in `cpp`-compilation step 

errors start with

test-sc.cpp:702:7: error: expected unqualified-id
class mydsp : public dsp {
      ^
<command line>:5:19: note: expanded from here
#define mydsp test-sc
[...]

environment

$ faust -v
FAUST Version 2.28.8
Embedded backends:
   DSP to C
   DSP to C++
   DSP to FIR
   DSP to Interpreter
   DSP to Java
   DSP to LLVM IR
   DSP to old C++
   DSP to Rust
   DSP to SOUL
   DSP to WebAssembly (wast/wasm)
Build with LLVM version 10.0.0
Copyright (C) 2002-2020, GRAME - Centre National de Creation Musicale. All rights reserved.

$ git rev-parse HEAD
c1bce6cd64214ab58e49ddba259e0c0616a585bf
$
madskjeldgaard commented 3 years ago

Probably related: This also happens when the meta data name contains a space.

sletz commented 3 years ago

Can you send the DSP?

madskjeldgaard commented 3 years ago

Can you send the DSP?

Yes, Dario's concatenative synth is a good example https://github.com/dariosanfilippo/concatenative_granulation/blob/master/cgp.dsp

madskjeldgaard commented 3 years ago

Can you send the DSP?

Yes, Dario's concatenative synth is a good example https://github.com/dariosanfilippo/concatenative_granulation/blob/master/cgp.dsp

wait no this is related to the other issue, sorry. https://github.com/grame-cncm/faust/issues/521

madskjeldgaard commented 2 years ago

I finally figured this out. This is caused by the preprocessor flag -Dmydsp getting supplied a name containing the dash either from the file name or the name metadata field. This gets inserted into the converted cpp file when compiling and C++ freaks out because of the dash in the class name here:

https://github.com/grame-cncm/faust/blob/073a5c6f277c04c97418d8e72d366959bf122471/tools/faust2appls/faust2supercollider#L170

To fix this, the bash script needs to sanitize the dspname before supplying it to the c++ command.

I've fixed this in the upcoming faust2sc.py script https://github.com/madskjeldgaard/faust2sc.py

sletz commented 2 years ago

Fixed in 2fcb7aa81cfc9c453b63eb7ff4993e5c9594cc60.