File: faust2iosKeyboard

package info (click to toggle)
faust 0.9.95~repack1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 164,732 kB
  • ctags: 18,777
  • sloc: cpp: 90,427; sh: 6,116; java: 4,501; objc: 4,428; ansic: 3,301; makefile: 1,298; ruby: 950; yacc: 511; xml: 398; lex: 218; python: 136
file content (78 lines) | stat: -rwxr-xr-x 2,469 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash

#####################################################################
#                                                                   #
#               Compiles Faust programs to iOS applications         #
#               (c) Grame, 2012-2013                                #
#                                                                   #
#####################################################################

. faustpath

NOAGC="0"
POLY="0"
POLY2="0"

#PHASE 1 : collects files and options from the command line

for p in $@; do
    if [ $p = "-help" ] || [ $p = "-h" ]; then
        echo "faust2ios [-xcode] [-all] [-noagc] [-poly2] <file.dsp>"
        echo "Use '-xcode' to keep the intermediate Xcode project"
        echo "Use '-noagc' to deactivate audio automatic gain control"
        echo "Use '-poly2' to produce a polyphonic DSP connected to the effect part, ready to be used with MIDI events"
    fi

    if [ "$p" = -icc ]; then
        ignore=" "
    elif [ "$p" = "-xcode" ]; then
        XCODE="1"
     elif [ "$p" = "-poly2" ]; then
        POLY2="1"
    elif [ "$p" = "-noagc" ]; then
        NOAGC="1"
    elif [ ${p:0:1} = "-" ]; then
        OPTIONS="$OPTIONS $p"
    elif [[ -f "$p" ]]; then
        FILES="$FILES $p"
    else
        OPTIONS="$OPTIONS $p"
    fi
done


#PHASE 2 : compile all files

for p in $FILES; do
	S=$(dirname "$p")
	F=$(basename "$p")
	P=${F%.dsp}
  
	T=$(mktemp -d faust.XXX)
	cp -r /usr/local/share/faust/iOSKeyboard/* $T
#	cp -r /usr/local/include/faust $T

    echo "Compile with CoreAudio support in 64/32 bits"
    faust -i $OPTIONS -a iosKeyboard.cpp "$p" -o "$T/mydsp.h" || exit
    if [ "$POLY2" = "1" ]; then
        faust -i -cn effect -a minimal-effect.cpp "${F%.dsp}_effect.dsp" -o "$T/effect.h" || exit
    fi
    (
        xcodebuild GCC_PREPROCESSOR_DEFINITIONS="${inherited} NOAGC=$NOAGC POLY2=$POLY2" -project "$T/iOSKeyboard.xcodeproj" -target iOSKeyboard PRODUCT_NAME=$P PRODUCT_BUNDLE_IDENTIFIER="romain.$P"
        cd "$T" && xcodebuild -scheme iOSKeyboard archive PRODUCT_NAME=$P PRODUCT_BUNDLE_IDENTIFIER="romain.$P"
    ) > /dev/null || exit
    
    # move generated app to source directory
    rm -rf "$S/$P.app"
    mv "$T/build/Release-iphoneos/$P.app" "$S/"
    if [ "$XCODE" != "1" ]; then
        rm -rf "$T"
    else
        echo "Keep Xcode project"
    fi
        
	# collect binary file name for FaustGIDE
    BINARIES="$BINARIES$S/$P.app;"
done

echo $BINARIES