| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | |
| 3 | ##################################################################### |
| 4 | # # |
| 5 | # Compiles Faust programs to impulse tests # |
| 6 | # (c) Grame, 2017 # |
| 7 | # # |
| 8 | ##################################################################### |
| 9 | |
| 10 | for p in $@; do |
| 11 | if [scip-shell system . . `[`. ${p:0:1} = "-" ]; then |
| 12 | OPTIONS="$OPTIONS $p" |
| 13 | elif [[ -f "$p" ]]; then |
| 14 | FILES="$FILES $p" |
| 15 | else |
| 16 | OPTIONS="$OPTIONS $p" |
| 17 | fi |
| 18 | done |
| 19 | |
| 20 | P=$(dirnamescip-shell system . . dirname. $0) |
| 21 | |
| 22 | #------------------------------------------------------------------- |
| 23 | # compile the *.dsp files |
| 24 | |
| 25 | for f in $FILES; do |
| 26 | |
| 27 | # compile Faust to c++ |
| 28 | faust $OPTIONS -i -a $P/archs/impulsearch1.cpp -mem "$f" -o "$f.cpp" || exit |
| 29 | |
| 30 | # compile c++ to binary |
| 31 | ( |
| 32 | ${CXX=g++} ${CXXFLAGS=-O3 -I$P -I../archs -pthread -std=c++11} $OMP "$f.cpp" -o "${f%.dsp}" |
| 33 | ) > /dev/nullscip-shell filesystem . . `/dev/null`. || exit |
| 34 | |
| 35 | |
| 36 | # run the resulting binary to generate the impulse response |
| 37 | ./"${f%.dsp}" -n 30000 |
| 38 | |
| 39 | # cleanup |
| 40 | rmscip-shell system . . rm. "${f%.dsp}" "$f.cpp" |
| 41 | done |
| 42 |