Ejemplo n.º 1
0
 // @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
 }
        void Start()
        {
            osc = GetComponent <FaustPlugin_SimpleOsc>();

            var player = GetComponent <VideoPlayer>();

            data.LoadFile(SpectrumData.DataPath(player.clip));

            GetComponent <GLDrawer>().OnDraw += OnGLDraw;
        }