#! /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] " require Dplug echo "Compiles Faust programs to Dplug plugins" option options "-vendor " options "-vendorid " options "-pluginid " options "-homepage " options "-effectType " 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 < $SRCDIR/$dspName/$DUBFILE <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