public static bool fJSONParser(ref string fJSON, out FaustUI faustUI) { faustUI = new FaustUI(); bool success = false; StringBuilder key, value; if (parseChar(ref fJSON, '{')) { do { if (parseDQString(ref fJSON, out key) && parseChar(ref fJSON, ':')) { switch (key.ToString()) { case "name": success = parseDQString(ref fJSON, out value); faustUI.name = value.ToString(); break; case "inputs": success = parseDQString(ref fJSON, out value); faustUI.inputs = Convert.ToInt32(value.ToString()); break; case "outputs": success = parseDQString(ref fJSON, out value); faustUI.outputs = Convert.ToInt32(value.ToString()); break; case "meta": success = parseGlobalMetaData(ref fJSON); break; case "library_list": success = parseGlobalMetaData(ref fJSON); break; case "include_pathnames": success = parseGlobalMetaData(ref fJSON); break; case "ui": faustUI.ui = new List <Group> (); int numitems = 0; success = parseUI(ref fJSON, ref faustUI.ui, ref numitems); break; default: // Unknown items should be parsed success = parseDQString(ref fJSON, out value); break; } } } while (parseChar(ref fJSON, ',')); } parseChar(ref fJSON, '}'); return(success); }
// @brief All instantiations have to be done in the OnEnable() method. private void OnEnable() { fJSON = "RELEVANTJSONFILE"; if (!FaustUI.fJSONParser(ref fJSON, out fUI)) // Parses the JSON file { UnityEngine.Debug.LogError("Error JSON Parser"); } param = fUI.getUI(0).setNumParams(param); // Sets the parameter number _dsp = (FaustPlugin_MODEL)target; // Sets which component will be edited in the inspector }
// @brief All instantiations have to be done in the OnEnable() method. private void OnEnable() { fJSON = "{ \"name\": \"KarplusStrong\", \"inputs\": \"0\", \"outputs\": \"2\", \"meta\": [ { \"name\": \"KarplusStrong\" }, { \"description\": \"Simple call of the Karplus-Strong model for the Faust physical modeling library\" }, { \"license\": \"MIT\" }, { \"copyright\": \"(c)Romain Michon, CCRMA (Stanford University), GRAME\" }, { \"signals.lib/name\": \"Faust Signal Routing Library\" }, { \"signals.lib/version\": \"0.0\" }, { \"basics.lib/name\": \"Faust Basic Element Library\" }, { \"basics.lib/version\": \"0.0\" }, { \"routes.lib/name\": \"Faust Signal Routing Library\" }, { \"routes.lib/version\": \"0.0\" }, { \"maths.lib/name\": \"Faust Math Library\" }, { \"maths.lib/version\": \"2.1\" }, { \"maths.lib/author\": \"GRAME\" }, { \"maths.lib/copyright\": \"GRAME\" }, { \"maths.lib/license\": \"LGPL with exception\" }, { \"delays.lib/name\": \"Faust Delay Library\" }, { \"delays.lib/version\": \"0.0\" } ], \"ui\": [ { \"type\": \"vgroup\", \"label\": \"karplus\", \"items\": [ { \"type\": \"hgroup\", \"label\": \"params\", \"meta\": [ { \"0\": \"\" } ], \"items\": [ { \"type\": \"hslider\", \"label\": \"freq\", \"address\": \"/karplus/params/freq\", \"meta\": [ { \"0\": \"\" }, { \"style\": \"knob\" } ], \"init\": \"440\", \"min\": \"50\", \"max\": \"1000\", \"step\": \"0.01\" }, { \"type\": \"hslider\", \"label\": \"bend\", \"address\": \"/karplus/params/bend\", \"meta\": [ { \"1\": \"\" }, { \"hidden\": \"1\" }, { \"midi\": \"pitchwheel\" }, { \"style\": \"knob\" } ], \"init\": \"1\", \"min\": \"0\", \"max\": \"10\", \"step\": \"0.01\" }, { \"type\": \"hslider\", \"label\": \"damping\", \"address\": \"/karplus/params/damping\", \"meta\": [ { \"1\": \"\" }, { \"midi\": \"ctrl 1\" }, { \"style\": \"knob\" } ], \"init\": \"0.01\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.01\" }, { \"type\": \"hslider\", \"label\": \"gain\", \"address\": \"/karplus/params/gain\", \"meta\": [ { \"2\": \"\" }, { \"style\": \"knob\" } ], \"init\": \"0.8\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.01\" }, { \"type\": \"hslider\", \"label\": \"sustain\", \"address\": \"/karplus/params/sustain\", \"meta\": [ { \"3\": \"\" }, { \"hidden\": \"1\" }, { \"midi\": \"ctrl 64\" }, { \"style\": \"knob\" } ], \"init\": \"0\", \"min\": \"0\", \"max\": \"1\", \"step\": \"1\" } ] }, { \"type\": \"button\", \"label\": \"gate\", \"address\": \"/karplus/gate\", \"meta\": [ { \"1\": \"\" } ] } ] } ]}"; if (!FaustUI.fJSONParser(ref fJSON, out fUI)) // Parses the JSON file { UnityEngine.Debug.LogError("Error JSON Parser"); } param = fUI.getUI(0).setNumParams(param); // Sets the parameter number _dsp = (FaustPlugin_karplus)target; // Sets which component will be edited in the inspector }
// @brief All instantiations have to be done in the OnEnable() method. private void OnEnable() { fJSON = "{ \"name\": \"SimpleOsc\", \"filename\": \"SimpleOsc\", \"version\": \"2.14.4\", \"compile_options\": \"-scal -ftz 0\", \"library_list\": [\"/Users/ibu/Applications/Faust-2.14.4/share/faust/stdfaust.lib\",\"/Users/ibu/Applications/Faust-2.14.4/share/faust/oscillators.lib\",\"/Users/ibu/Applications/Faust-2.14.4/share/faust/signals.lib\",\"/Users/ibu/Applications/Faust-2.14.4/share/faust/maths.lib\",\"/Users/ibu/Applications/Faust-2.14.4/share/faust/filters.lib\"], \"include_pathnames\": [\"/Users/ibu/Applications/Faust-2.14.4/share/faust\",\"/usr/local/share/faust\",\"/usr/share/faust\",\".\",\"/Users/ibu/Projects/honda-exp/faust-unity-playground/faust/.\"], \"inputs\": \"0\", \"outputs\": \"2\", \"meta\": [ { \"filename\": \"SimpleOsc\" }, { \"filters.lib/name\": \"Faust Filters Library\" }, { \"filters.lib/version\": \"0.0\" }, { \"maths.lib/author\": \"GRAME\" }, { \"maths.lib/copyright\": \"GRAME\" }, { \"maths.lib/license\": \"LGPL with exception\" }, { \"maths.lib/name\": \"Faust Math Library\" }, { \"maths.lib/version\": \"2.1\" }, { \"name\": \"SimpleOsc\" }, { \"oscillators.lib/name\": \"Faust Oscillator Library\" }, { \"oscillators.lib/version\": \"0.0\" }, { \"signals.lib/name\": \"Faust Signal Routing Library\" }, { \"signals.lib/version\": \"0.0\" } ], \"ui\": [ { \"type\": \"vgroup\", \"label\": \"SimpleOsc\", \"items\": [ { \"type\": \"hslider\", \"label\": \"Master Gain\", \"address\": \"/SimpleOsc/Master_Gain\", \"meta\": [ { \"-1\": \"\" } ], \"init\": \"1\", \"min\": \"0.1\", \"max\": \"100\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Freq 0\", \"address\": \"/SimpleOsc/Freq_0\", \"meta\": [ { \"0\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 0\", \"address\": \"/SimpleOsc/Gain_0\", \"meta\": [ { \"0\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 10\", \"address\": \"/SimpleOsc/Freq_10\", \"meta\": [ { \"10\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 10\", \"address\": \"/SimpleOsc/Gain_10\", \"meta\": [ { \"10\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 11\", \"address\": \"/SimpleOsc/Freq_11\", \"meta\": [ { \"11\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 11\", \"address\": \"/SimpleOsc/Gain_11\", \"meta\": [ { \"11\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 12\", \"address\": \"/SimpleOsc/Freq_12\", \"meta\": [ { \"12\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 12\", \"address\": \"/SimpleOsc/Gain_12\", \"meta\": [ { \"12\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 13\", \"address\": \"/SimpleOsc/Freq_13\", \"meta\": [ { \"13\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 13\", \"address\": \"/SimpleOsc/Gain_13\", \"meta\": [ { \"13\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 14\", \"address\": \"/SimpleOsc/Freq_14\", \"meta\": [ { \"14\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 14\", \"address\": \"/SimpleOsc/Gain_14\", \"meta\": [ { \"14\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 15\", \"address\": \"/SimpleOsc/Freq_15\", \"meta\": [ { \"15\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 15\", \"address\": \"/SimpleOsc/Gain_15\", \"meta\": [ { \"15\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 16\", \"address\": \"/SimpleOsc/Freq_16\", \"meta\": [ { \"16\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 16\", \"address\": \"/SimpleOsc/Gain_16\", \"meta\": [ { \"16\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 17\", \"address\": \"/SimpleOsc/Freq_17\", \"meta\": [ { \"17\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 17\", \"address\": \"/SimpleOsc/Gain_17\", \"meta\": [ { \"17\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 18\", \"address\": \"/SimpleOsc/Freq_18\", \"meta\": [ { \"18\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 18\", \"address\": \"/SimpleOsc/Gain_18\", \"meta\": [ { \"18\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 19\", \"address\": \"/SimpleOsc/Freq_19\", \"meta\": [ { \"19\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 19\", \"address\": \"/SimpleOsc/Gain_19\", \"meta\": [ { \"19\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 1\", \"address\": \"/SimpleOsc/Freq_1\", \"meta\": [ { \"1\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 1\", \"address\": \"/SimpleOsc/Gain_1\", \"meta\": [ { \"1\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 20\", \"address\": \"/SimpleOsc/Freq_20\", \"meta\": [ { \"20\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 20\", \"address\": \"/SimpleOsc/Gain_20\", \"meta\": [ { \"20\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 21\", \"address\": \"/SimpleOsc/Freq_21\", \"meta\": [ { \"21\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 21\", \"address\": \"/SimpleOsc/Gain_21\", \"meta\": [ { \"21\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 22\", \"address\": \"/SimpleOsc/Freq_22\", \"meta\": [ { \"22\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 22\", \"address\": \"/SimpleOsc/Gain_22\", \"meta\": [ { \"22\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 23\", \"address\": \"/SimpleOsc/Freq_23\", \"meta\": [ { \"23\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 23\", \"address\": \"/SimpleOsc/Gain_23\", \"meta\": [ { \"23\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 24\", \"address\": \"/SimpleOsc/Freq_24\", \"meta\": [ { \"24\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 24\", \"address\": \"/SimpleOsc/Gain_24\", \"meta\": [ { \"24\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 25\", \"address\": \"/SimpleOsc/Freq_25\", \"meta\": [ { \"25\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 25\", \"address\": \"/SimpleOsc/Gain_25\", \"meta\": [ { \"25\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 26\", \"address\": \"/SimpleOsc/Freq_26\", \"meta\": [ { \"26\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 26\", \"address\": \"/SimpleOsc/Gain_26\", \"meta\": [ { \"26\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 27\", \"address\": \"/SimpleOsc/Freq_27\", \"meta\": [ { \"27\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 27\", \"address\": \"/SimpleOsc/Gain_27\", \"meta\": [ { \"27\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 28\", \"address\": \"/SimpleOsc/Freq_28\", \"meta\": [ { \"28\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 28\", \"address\": \"/SimpleOsc/Gain_28\", \"meta\": [ { \"28\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 29\", \"address\": \"/SimpleOsc/Freq_29\", \"meta\": [ { \"29\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 29\", \"address\": \"/SimpleOsc/Gain_29\", \"meta\": [ { \"29\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 2\", \"address\": \"/SimpleOsc/Freq_2\", \"meta\": [ { \"2\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 2\", \"address\": \"/SimpleOsc/Gain_2\", \"meta\": [ { \"2\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 30\", \"address\": \"/SimpleOsc/Freq_30\", \"meta\": [ { \"30\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 30\", \"address\": \"/SimpleOsc/Gain_30\", \"meta\": [ { \"30\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 31\", \"address\": \"/SimpleOsc/Freq_31\", \"meta\": [ { \"31\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 31\", \"address\": \"/SimpleOsc/Gain_31\", \"meta\": [ { \"31\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 3\", \"address\": \"/SimpleOsc/Freq_3\", \"meta\": [ { \"3\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 3\", \"address\": \"/SimpleOsc/Gain_3\", \"meta\": [ { \"3\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 4\", \"address\": \"/SimpleOsc/Freq_4\", \"meta\": [ { \"4\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 4\", \"address\": \"/SimpleOsc/Gain_4\", \"meta\": [ { \"4\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 5\", \"address\": \"/SimpleOsc/Freq_5\", \"meta\": [ { \"5\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 5\", \"address\": \"/SimpleOsc/Gain_5\", \"meta\": [ { \"5\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 6\", \"address\": \"/SimpleOsc/Freq_6\", \"meta\": [ { \"6\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 6\", \"address\": \"/SimpleOsc/Gain_6\", \"meta\": [ { \"6\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 7\", \"address\": \"/SimpleOsc/Freq_7\", \"meta\": [ { \"7\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 7\", \"address\": \"/SimpleOsc/Gain_7\", \"meta\": [ { \"7\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 8\", \"address\": \"/SimpleOsc/Freq_8\", \"meta\": [ { \"8\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 8\", \"address\": \"/SimpleOsc/Gain_8\", \"meta\": [ { \"8\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" }, { \"type\": \"hslider\", \"label\": \"Freq 9\", \"address\": \"/SimpleOsc/Freq_9\", \"meta\": [ { \"9\": \"\" } ], \"init\": \"1000\", \"min\": \"50\", \"max\": \"20000\", \"step\": \"0.1\" }, { \"type\": \"hslider\", \"label\": \"Gain 9\", \"address\": \"/SimpleOsc/Gain_9\", \"meta\": [ { \"9\": \"\" } ], \"init\": \"0.1\", \"min\": \"0\", \"max\": \"1\", \"step\": \"0.001\" } ] } ]}"; if (!FaustUI.fJSONParser(ref fJSON, out fUI)) // Parses the JSON file { UnityEngine.Debug.LogError("Error JSON Parser"); } param = fUI.getUI(0).setNumParams(param); // Sets the parameter number _dsp = (FaustPlugin_SimpleOsc)target; // Sets which component will be edited in the inspector }
// @brief All instantiations have to be done in the OnEnable() method. private void OnEnable() { fJSON = "{ \"name\": \"AudioPluginTest\", \"inputs\": \"0\", \"outputs\": \"1\", \"meta\": [ { \"name\": \"AudioPluginTest\" }, { \"oscillators.lib/name\": \"Faust Oscillator Library\" }, { \"oscillators.lib/version\": \"0.0\" }, { \"maths.lib/name\": \"Faust Math Library\" }, { \"maths.lib/version\": \"2.1\" }, { \"maths.lib/author\": \"GRAME\" }, { \"maths.lib/copyright\": \"GRAME\" }, { \"maths.lib/license\": \"LGPL with exception\" } ], \"ui\": [ { \"type\": \"vgroup\", \"label\": \"0x00\", \"items\": [ ] } ]}"; if (!FaustUI.fJSONParser(ref fJSON, out fUI)) // Parses the JSON file { UnityEngine.Debug.LogError("Error JSON Parser"); } param = fUI.getUI(0).setNumParams(param); // Sets the parameter number _dsp = (FaustPlugin_AudioPluginTest)target; // Sets which component will be edited in the inspector }
// @brief All instantiations have to be done in the OnEnable() method. private void OnEnable() { fJSON = "{ \"name\": \"BPF\", \"filename\": \"BPF.dsp\", \"version\": \"2.34.4\", \"compile_options\": \"-lang cpp -es 1 -single -ftz 0\", \"library_list\": [\"/usr/local/share/faust/maxmsp.lib\",\"/usr/local/share/faust/maths.lib\",\"/usr/local/share/faust/platform.lib\"], \"include_pathnames\": [\"/usr/local/share/faust\",\"/usr/local/share/faust\",\"/usr/share/faust\",\".\",\"/tmp/sessions/E0283A91AE3F6480763525B5A543846F658186E3/unity/source/.\"], \"inputs\": 1, \"outputs\": 1, \"meta\": [ { \"compile_options\": \"-lang cpp -es 1 -single -ftz 0\" }, { \"filename\": \"BPF.dsp\" }, { \"maths.lib/author\": \"GRAME\" }, { \"maths.lib/copyright\": \"GRAME\" }, { \"maths.lib/license\": \"LGPL with exception\" }, { \"maths.lib/name\": \"Faust Math Library\" }, { \"maths.lib/version\": \"2.4\" }, { \"maxmsp.lib/author\": \"GRAME\" }, { \"maxmsp.lib/copyright\": \"GRAME\" }, { \"maxmsp.lib/license\": \"LGPL with exception\" }, { \"maxmsp.lib/name\": \"MaxMSP compatibility Library\" }, { \"maxmsp.lib/version\": \"1.1\" }, { \"name\": \"BPF\" }, { \"platform.lib/name\": \"Generic Platform Library\" }, { \"platform.lib/version\": \"0.1\" } ], \"ui\": [ { \"type\": \"vgroup\", \"label\": \"BPF\", \"items\": [ { \"type\": \"hslider\", \"label\": \"Freq\", \"address\": \"/BPF/Freq\", \"init\": 1000, \"min\": 100, \"max\": 10000, \"step\": 1 }, { \"type\": \"hslider\", \"label\": \"Q\", \"address\": \"/BPF/Q\", \"init\": 1, \"min\": 0.01, \"max\": 100, \"step\": 0.01 } ] } ]}"; if (!FaustUI.fJSONParser(ref fJSON, out fUI)) // Parses the JSON file { UnityEngine.Debug.LogError("Error JSON Parser"); } param = fUI.getUI(0).setNumParams(param); // Sets the parameter number _dsp = (FaustPlugin_BPF)target; // Sets which component will be edited in the inspector }