File: faust2dplug

package info (click to toggle)
faust 2.79.3%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 397,496 kB
  • sloc: cpp: 278,433; ansic: 116,164; javascript: 18,529; vhdl: 14,052; sh: 13,884; java: 5,900; objc: 3,852; python: 3,222; makefile: 2,655; cs: 1,672; lisp: 1,146; ruby: 954; yacc: 586; xml: 471; lex: 247; awk: 110; tcl: 26
file content (211 lines) | stat: -rwxr-xr-x 5,800 bytes parent folder | download | duplicates (3)
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
#! /bin/bash -e

#####################################################################
#                                                                   #
#           Compiles Faust programs to Dplug plugin                 #
#           (c) Grame, 2020                                         #
#                                                                   #
#####################################################################

. faustpath
. faustoptflags
. usage.sh

DEBUG=false

# MIDI not yet supported in this file.  Needs to be connected in dplug.d architecture file
IS_MIDI="0"
VENDOR="Faust"
VENDORID="FaUs"
PLUGINID="PlUg"
HOMEPAGE="https://faust.grame.fr/"
EFFECTTYPE="effectOther"

echoHelp()
{
    usage faust2dplug "[options] [Faust options] <file.dsp>"
    require Dplug
    echo "Compiles Faust programs to Dplug plugins"
    option
    options "-vendor <My Company Name>"
    options "-vendorid <FaUs>"
    options "-pluginid <PlUg>"
    options "-homepage <https://faust.grame.fr/>"
    options "-effectType <effectDynamics>"
    option "Faust options"
    exit
}

if [ "$#" -eq 0 ]; then
    echo 'Please, provide a Faust file to process !'
    echo ''
    echoHelp
fi

while [ $1 ]
do
    p=$1

    if [ $p = "--help" ] || [ $p = "-help" ] || [ $p = "-h" ]; then
        echoHelp
    elif [ "$p" = -debug ]; then
        DEBUG=true
    elif [ $p = "-midi" ]; then
        IS_MIDI="1"
    elif [ $p = "-vendor" ]; then
        shift
        VENDOR=$1
    elif [ $p = "-vendorid" ]; then
        shift
        VENDORID=$1
    elif [ $p = "-pluginid" ]; then
        shift
        PLUGINID=$1
    elif [ $p = "-homepage" ]; then
        shift
        HOMEPAGE=$1
    elif [ $p = "-effectType" ]; then
        shift
        EFFECTTYPE=$1
    elif [[ -f "$p" ]]; then
        FILES="$FILES $p"
    else
        OPTIONS="$OPTIONS $p"
    fi

shift

done

if [ $IS_MIDI -eq 1 ]; then
    echo "MIDI not currently supported in Dplug architecture file."
    exit
fi

DUBFILE="dub.json"
PLUGFILE="plugin.json"

for p in $FILES; do
    CUR=$(pwd)
    f=$(basename "$p")
    SRCDIR=$(dirname "$p")

    # creates the dir
    dspName="${f%.dsp}"
    SUB_TYPE=$(shasum $p)
    SUB_TYPE=${SUB_TYPE:0:4}
    rm -rf "$SRCDIR/$dspName"
    mkdir $SRCDIR/$dspName
    mkdir $SRCDIR/$dspName/source

    sed -e"s?@vendor@?$VENDOR?g" -e"s?@vendorid@?$VENDORID?g"  -e"s?@name@?$dspName?g" -e"s?@plugid@?$PLUGINID?g" -e"s?@homepage@?$HOMEPAGE?g" -e"s?@effecttype@?$EFFECTTYPE?g" > $SRCDIR/$dspName/$PLUGFILE <<EOF
{
    "\$schema": "https://raw.githubusercontent.com/AuburnSounds/dplug/master/plugin-schema.json",

    "vendorName": "@vendor@",
    "vendorUniqueID": "@vendorid@",
    "vendorSupportEmail": "support@wittyaudio.com",
    "pluginName": "@name@",
    "pluginHomepage": "@homepage@",
    "pluginUniqueID": "@plugid@",
    "publicVersion": "1.0.0",
    "CFBundleIdentifierPrefix": "com.@vendorid@",
    "hasGUI": false,
    "isSynth": false,
    "receivesMIDI": false,
    "category": "@effecttype@"
}
EOF

    sed -e"s?@name@?$dspName?g" > $SRCDIR/$dspName/$DUBFILE <<EOF
{
    "\$schema": "https://raw.githubusercontent.com/Pure-D/code-d/master/json-validation/dub.schema.json",

    "name": "@name@",

    "license": "public domain",
    "importPaths": [ "." ],
    "sourcePaths": [ "." ],
    "stringImportPaths": ["gfx", "fonts", "."],

    "copyright": "none",

    "dflags-linux-dmd": ["-defaultlib=libphobos2.a"],
    "dflags-osx-ldc": ["-static"],
    "dflags-linux-ldc": ["-link-defaultlib-shared=false"],
    "dflags-linux-x86_64-ldc": ["-fvisibility=hidden"],
    "dflags-windows-ldc": ["-mscrtlib=libcmt"],

    "comment-WARNING-READ-THIS-IS-IMPORTANT": [
        "    When making your own plug-in you have to CHANGE THESE DEPENDENCY    ",
        "    SPECIFICATIONS below from path-based to ~>MAJOR.MINOR               ",
        "      Example: ~>7.0                                                    ",
        "    See also the DUB documentation:                                     ",
        "         https://code.dlang.org/package-format?lang=json#version-specs  "],
    "dependencies":
    {
        "dplug:dsp": "~>10",
        "dplug:vst3": "~>10",
        "dplug:vst": "~>10",
        "dplug:au": "~>10",
        "dplug:lv2": "~>10",
        "dplug:gui": "~>10",
        "dplug:pbr-widgets": "~>10"
    },

    "versions": ["futureMouseOver", "futurePBRNormals"],

    "configurations": [
        {
            "name": "VST3",
            "versions": ["VST3"],
            "targetType": "dynamicLibrary",
            "lflags-osx-ldc": [ "-exported_symbols_list", "module-vst3.lst", "-dead_strip" ]
        },
        {
            "name": "VST",
            "versions": ["VST"],
            "targetType": "dynamicLibrary",
            "lflags-osx-ldc": [ "-exported_symbols_list", "module-vst.lst", "-dead_strip" ]
        },
        {
            "name": "AU",
            "versions": ["AU"],
            "targetType": "dynamicLibrary",
            "lflags-osx-ldc": [ "-exported_symbols_list", "module-au.lst", "-dead_strip" ]
        },
        {
            "name": "LV2",
            "versions": ["LV2"],
            "targetType": "dynamicLibrary",
            "lflags-osx-ldc": [ "-exported_symbols_list", "module-lv2.lst", "-dead_strip" ]
        }
    ]
}
EOF

    cat > $SRCDIR/$dspName/module-au.lst << EndOfFile
_dplugAUEntryPoint
_dplugAUComponentFactoryFunction

EndOfFile

    cat > $SRCDIR/$dspName/module-lv2.lst << EndOfFile
_GenerateManifestFromClient
_lv2_descriptor
_lv2ui_descriptor

EndOfFile

    cat > $SRCDIR/$dspName/module-vst3.lst << EndOfFile
_InitDll
_ExitDll
_GetPluginFactory
_bundleEntry
_bundleExit

EndOfFile

    faust -i -lang dlang -a $FAUSTARCH/dplug.d $OPTIONS "$SRCDIR/$f" -o "$SRCDIR/$dspName/source/main.d"

done