Debian Codegraph @

tools/faust2appls/faust2plot

raw symbols SCIP
1 #! /bin/bashscip-shell filesystem . . `/bin/bash`. -e
2
3 #####################################################################
4 # #
5 # Compiles Faust programs to plotters #
6 # (c) Grame, 2009-2022 #
7 # #
8 #####################################################################
9
10 . faustpathscip-shell source . . faustpath.
11 . faustoptflagsscip-shell source . . faustoptflags.
12 . usage.shscip-shell source . . `usage.sh`.
13
14 CXXFLAGS+=" $MYGCCFLAGS" # So that additional CXXFLAGS can be used
15
16 ARCHFILE=$FAUSTARCH/matlabplot.cpp
17 ARCHLIB+=" -pthread"
18
19 FAUSTFLOAT=float
20
21 echoHelpscip-shell shell shell-project 0.0.0 echoHelp().()
22 {
23 usage faust2plot "[options] [Faust options] <file.dsp>"
24 echoscip-shell system . . echo. "Compiles Faust programs to plotters, additional control parameters depend of the DSP, the following 4 options are given at runtime:"
25 options -dyn
26 option "-s <n>" "start at the sample number <n> (default is 0)"
27 option "-n <n>" "render <n> samples (default is 16)"
28 option "-r <rate>" "change the sample rate (default is 44100 Hz)"
29 option "Faust options"
30 exit
31 }
32
33 if [scip-shell system . . `[`. "$#" -eq 0 ]; then
34 echoscip-shell system . . echo. 'Please, provide a Faust file to process !'
35 echoscip-shell system . . echo. ''
36 echoHelpscip-shell shell shell-project 0.0.0 echoHelp().
37 fi
38
39 #-------------------------------------------------------------------
40 # Analyze command arguments :
41 # faust options -> OPTIONS
42 # if -omp : -openmp or -fopenmp -> OPENMP
43 # existing *.dsp files -> FILES
44
45 # dispatch command arguments
46 for p in $@; do
47
48 if [scip-shell system . . `[`. $p = "-help" ] || [scip-shell system . . `[`. $p = "-h" ]; then
49 echoHelpscip-shell shell shell-project 0.0.0 echoHelp().
50 elif [scip-shell system . . `[`. $p = "-arch32" ]; then
51 PROCARCH="-m32 -L/usr/lib32"
52 elif [scip-shell system . . `[`. $p = "-arch64" ]; then
53 PROCARCH="-m64"
54 elif [scip-shell system . . `[`. $p = "-double" ]; then
55 OPTIONS="$OPTIONS $p"
56 FAUSTFLOAT="double"
57 elif [scip-shell system . . `[`. $p = "-dyn" ]; then
58 OPTIONS="$OPTIONS -inj template-llvm.cpp"
59 LLVM_LIBS="$STRIP $FAUSTLDDIR/libfaust.a `llvm-config --link-static --ldflags --libs all --system-libs`"
60 elif [scip-shell system . . `[`. ${p:0:1} = "-" ]; then
61 OPTIONS="$OPTIONS $p"
62 elif [[ -f "$p" ]] && [scip-shell system . . `[`. ${p: -4} == ".dsp" ]; then
63 FILES="$FILES $p"
64 else
65 OPTIONS="$OPTIONS $p"
66 fi
67
68 done
69
70 #-------------------------------------------------------------------
71 # compile the *.dsp files
72
73 for f in $FILES; do
74
75 # compile faust to c++
76 faust -i -a $ARCHFILE $OPTIONS "$f" -o "$f.cpp" || exit
77
78 # compile c++ to binary
79 (
80 $CXX $CXXFLAGS $PROCARCH $OMP $LLVM_LIBS $ARCHLIB -DFAUSTFLOAT=$FAUSTFLOAT "$f.cpp" -o "${f%.dsp}"
81 ) > /dev/nullscip-shell filesystem . . `/dev/null`. || exit
82 rmscip-shell system . . rm. "$f.cpp"
83
84 # collect binary file name for FaustWorks
85 BINARIES="$BINARIES${f%.dsp};"
86 done
87 echoscip-shell system . . echo. $BINARIES