From 681b1b8fca6f22620650f69efae1eecb930d94fb Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 15 Nov 2021 15:32:02 -0700 Subject: [PATCH 001/100] Formatted and updated json --- source/daisy.field.json | 43 +++++---- source/daisy.patch.json | 183 +++++++++++++++++++------------------ source/daisy.patch_sm.json | 62 ++++++++----- source/daisy.petal.json | 31 ++++--- source/daisy.pod.json | 28 ++++-- source/daisy.versio.json | 41 +++++---- 6 files changed, 216 insertions(+), 172 deletions(-) diff --git a/source/daisy.field.json b/source/daisy.field.json index c508e8b..1185735 100644 --- a/source/daisy.field.json +++ b/source/daisy.field.json @@ -1,14 +1,21 @@ { - "max_apps":8, + "som": "seed", + "max_apps": 8, "defines": { "OOPSY_TARGET_FIELD": 1, "OOPSY_TARGET_HAS_OLED": 1, "OOPSY_TARGET_HAS_MIDI_INPUT": 1, "OOPSY_TARGET_HAS_MIDI_OUTPUT": 1 }, - "inserts": [ - { "where": "header", "code": "#include \"daisy_field.h\"" }, - { "where": "header", "code": "typedef daisy::DaisyField Daisy;" } + "inserts": [ + { + "where": "header", + "code": "#include \"daisy_field.h\"" + }, + { + "where": "header", + "code": "typedef daisy::DaisyField Daisy;" + } ], "labels": { "params": { @@ -43,7 +50,6 @@ "cv3": "cv3", "cv4": "cv4", "gate1": "gt1", - "key1": "kA1", "key2": "kA2", "key3": "kA3", @@ -70,7 +76,6 @@ "ctrl8": "kn8", "switch1": "sw1", "switch2": "sw2", - "knob": "kn", "key": "kA1", "ctrl": "kn", @@ -92,35 +97,35 @@ "inputs": { "kn1": { "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_1);" + "code": "hardware.GetKnobValue(hardware.KNOB_1);" }, "kn2": { "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_2);" + "code": "hardware.GetKnobValue(hardware.KNOB_2);" }, "kn3": { "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_3);" + "code": "hardware.GetKnobValue(hardware.KNOB_3);" }, "kn4": { "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_4);" + "code": "hardware.GetKnobValue(hardware.KNOB_4);" }, "kn5": { "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_5);" + "code": "hardware.GetKnobValue(hardware.KNOB_5);" }, "kn6": { "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_6);" + "code": "hardware.GetKnobValue(hardware.KNOB_6);" }, "kn7": { "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_7);" + "code": "hardware.GetKnobValue(hardware.KNOB_7);" }, "kn8": { "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_8);" + "code": "hardware.GetKnobValue(hardware.KNOB_8);" }, "kA1": { "code": "(hardware.KeyboardState(0)?1.f:0.f);" @@ -194,22 +199,22 @@ }, "outputs": { "cvout1": { - "where":"main", + "where": "main", "code": "hardware.SetCvOut1($ * 4095);" }, "cvout2": { - "where":"main", + "where": "main", "code": "hardware.SetCvOut2($ * 4095);" }, "gateout1": { - "where":"audio", + "where": "audio", "code": "dsy_gpio_write(&hardware.gate_out, $ > 0.f);" } }, "datahandlers": { "dsy_leds": { - "where":"display", + "where": "display", "code": "daisy.setFieldLedsFromData($);" } } -} +} \ No newline at end of file diff --git a/source/daisy.patch.json b/source/daisy.patch.json index 4e3fc0b..b1589ec 100644 --- a/source/daisy.patch.json +++ b/source/daisy.patch.json @@ -1,94 +1,99 @@ { - "max_apps":8, - "defines": { - "OOPSY_TARGET_PATCH": 1, - "OOPSY_TARGET_HAS_OLED": 1, - "OOPSY_IO_COUNT": 4, - "OOPSY_TARGET_HAS_MIDI_INPUT": 1, - "OOPSY_TARGET_HAS_MIDI_OUTPUT": 1, - "OOPSY_HAS_ENCODER": 1 + "som": "seed", + "max_apps": 8, + "defines": { + "OOPSY_TARGET_PATCH": 1, + "OOPSY_TARGET_HAS_OLED": 1, + "OOPSY_IO_COUNT": 4, + "OOPSY_TARGET_HAS_MIDI_INPUT": 1, + "OOPSY_TARGET_HAS_MIDI_OUTPUT": 1, + "OOPSY_HAS_ENCODER": 1 + }, + "inserts": [ + { + "where": "header", + "code": "#include \"daisy_patch.h\"" }, - "inserts": [ - { "where": "header", "code": "#include \"daisy_patch.h\"" }, - { "where": "header", "code": "typedef daisy::DaisyPatch Daisy;" } - ], - "labels": { - "params": { - "knob1": "kn1", - "knob2": "kn2", - "knob3": "kn3", - "knob4": "kn4", - "gate1": "gt1", - "gate2": "gt2", - - "knob": "kn1", - "cv": "kn1", - "cv1": "kn1", - "cv2": "kn2", - "cv3": "kn3", - "cv4": "kn4", - "ctrl": "kn1", - "ctrl1": "kn1", - "ctrl2": "kn2", - "ctrl3": "kn3", - "ctrl4": "kn4", - "gate": "gt1" - }, - "outs": { - "cv1": "cvout1", - "cv2": "cvout2", - "gate1": "gateout1", - - "cv": "cvout1", - "gate": "gateout1" - }, - "datas": { - "midi": "dsy_midi_out" - } + { + "where": "header", + "code": "typedef daisy::DaisyPatch Daisy;" + } + ], + "labels": { + "params": { + "knob1": "kn1", + "knob2": "kn2", + "knob3": "kn3", + "knob4": "kn4", + "gate1": "gt1", + "gate2": "gt2", + "knob": "kn1", + "cv": "kn1", + "cv1": "kn1", + "cv2": "kn2", + "cv3": "kn3", + "cv4": "kn4", + "ctrl": "kn1", + "ctrl1": "kn1", + "ctrl2": "kn2", + "ctrl3": "kn3", + "ctrl4": "kn4", + "gate": "gt1" + }, + "outs": { + "cv1": "cvout1", + "cv2": "cvout2", + "gate1": "gateout1", + "cv": "cvout1", + "gate": "gateout1" + }, + "datas": { + "midi": "dsy_midi_out" + } + }, + "inputs": { + "kn1": { + "automap": true, + "code": "hardware.GetKnobValue(hardware.CTRL_1);" + }, + "kn2": { + "automap": true, + "code": "hardware.GetKnobValue(hardware.CTRL_2);" + }, + "kn3": { + "automap": true, + "code": "hardware.GetKnobValue(hardware.CTRL_3);" }, - "inputs": { - "kn1": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.CTRL_1);" - }, - "kn2": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.CTRL_2);" - }, - "kn3": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.CTRL_3);" - }, - "kn4": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.CTRL_4);" - }, - "gt1": { - "code": "(hardware.gate_input[hardware.GATE_IN_1].State()?1.f:0.f);" - }, - "gt2": { - "code": "(hardware.gate_input[hardware.GATE_IN_2].State()?1.f:0.f);" - } + "kn4": { + "automap": true, + "code": "hardware.GetKnobValue(hardware.CTRL_4);" }, - "outputs": { - "cvout1": { - "where": "main", - "code": "hardware.seed.dac.WriteValue(daisy::DacHandle::Channel::ONE, $ * 4095);" - }, - "cvout2": { - "where": "main", - "code": "hardware.seed.dac.WriteValue(daisy::DacHandle::Channel::TWO, $ * 4095);" - }, - "gateout1": { - "where": "audio", - "code": "dsy_gpio_write(&hardware.gate_output, $ > 0.f);" - } - }, - "datahandlers": { - "dsy_midi_out": { - "where":"main", - "init": "daisy.midi_nullData($)", - "code": "daisy.midi_fromData($);" - } + "gt1": { + "code": "(hardware.gate_input[hardware.GATE_IN_1].State()?1.f:0.f);" + }, + "gt2": { + "code": "(hardware.gate_input[hardware.GATE_IN_2].State()?1.f:0.f);" + } + }, + "outputs": { + "cvout1": { + "where": "main", + "code": "hardware.seed.dac.WriteValue(daisy::DacHandle::Channel::ONE, $ * 4095);" + }, + "cvout2": { + "where": "main", + "code": "hardware.seed.dac.WriteValue(daisy::DacHandle::Channel::TWO, $ * 4095);" + }, + "gateout1": { + "where": "audio", + "code": "dsy_gpio_write(&hardware.gate_output, $ > 0.f);" + } + }, + "datahandlers": { + "dsy_midi_out": { + "where": "main", + "init": "daisy.midi_nullData($)", + "code": "daisy.midi_fromData($);" } -} + } +} \ No newline at end of file diff --git a/source/daisy.patch_sm.json b/source/daisy.patch_sm.json index 44167a3..4ddecc4 100644 --- a/source/daisy.patch_sm.json +++ b/source/daisy.patch_sm.json @@ -1,19 +1,43 @@ { - "max_apps":8, + "som": "patch_sm", + "max_apps": 8, "defines": { "OOPSY_TARGET_PATCH_SM": 1, "OOPSY_IO_COUNT": 2 }, "inserts": [ - { "where": "header", "code": "#include \"daisy_patch_sm.h\"" }, - { "where": "header", "code": "typedef daisy::patch_sm::DaisyPatchSM Daisy;" }, - { "where": "header", "code": "daisy::Switch sw_class;" }, - { "where": "init", "code": "sw_class.Init(oopsy::daisy.hardware.B8, 1000);"}, - { "where": "audio", "code": "sw_class.Debounce();" }, - - { "where": "header", "code": "daisy::Switch button_class;" }, - { "where": "init", "code": "button_class.Init(oopsy::daisy.hardware.B7, 1000);"}, - { "where": "audio", "code": "button_class.Debounce();" } + { + "where": "header", + "code": "#include \"daisy_patch_sm.h\"" + }, + { + "where": "header", + "code": "typedef daisy::patch_sm::DaisyPatchSM Daisy;" + }, + { + "where": "header", + "code": "daisy::Switch sw_class;" + }, + { + "where": "init", + "code": "sw_class.Init(oopsy::daisy.hardware.B8, 1000);" + }, + { + "where": "audio", + "code": "sw_class.Debounce();" + }, + { + "where": "header", + "code": "daisy::Switch button_class;" + }, + { + "where": "init", + "code": "button_class.Init(oopsy::daisy.hardware.B7, 1000);" + }, + { + "where": "audio", + "code": "button_class.Debounce();" + } ], "labels": { "params": { @@ -23,13 +47,11 @@ "knob4": "kn4", "gate1": "gt1", "gate2": "gt2", - "sw": "sw", "sw1": "sw", "sw2": "button", "button": "button", "press": "button", - "knob": "kn1", "cv": "kn1", "cv1": "kn1", @@ -40,15 +62,12 @@ "cv6": "cv6", "cv7": "cv7", "cv8": "cv8", - "ctrl": "kn1", "ctrl1": "kn1", "ctrl2": "kn2", "ctrl3": "kn3", "ctrl4": "kn4", - "gate": "gt1", - "CV_1": "kn1", "CV_2": "kn2", "CV_3": "kn3", @@ -57,10 +76,8 @@ "CV_6": "cv6", "CV_7": "cv7", "CV_8": "cv8", - "B7": "button", "B8": "sw", - "B10": "gt1", "B9": "gt2", "gate_in_1": "gt1", @@ -74,15 +91,12 @@ "cv2": "cvout2", "gate1": "gateout1", "gate2": "gateout2", - "cv": "cvout1", "led": "cvout2", "gate": "gateout1", - "CV_OUT_1": "cvout1", "C10": "cvout1", "CV_OUT_2": "cvout2", - "B5": "gateout1", "B6": "gateout2", "gate_out_1": "gateout1", @@ -145,14 +159,14 @@ "where": "main", "code": "hardware.WriteCvOut(daisy::patch_sm::CV_OUT_2, $ * 5.f);" }, - "gateout1": { + "gateout1": { "where": "audio", "code": "dsy_gpio_write(&hardware.gate_out_1, $ > 0.f);" }, - "gateout2": { + "gateout2": { "where": "audio", "code": "dsy_gpio_write(&hardware.gate_out_2, $ > 0.f);" } - }, + }, "datahandlers": {} -} +} \ No newline at end of file diff --git a/source/daisy.petal.json b/source/daisy.petal.json index c6eab52..f5234de 100644 --- a/source/daisy.petal.json +++ b/source/daisy.petal.json @@ -1,12 +1,19 @@ { - "max_apps":8, + "som": "seed", + "max_apps": 8, "defines": { "OOPSY_TARGET_PETAL": 1, "OOPSY_HAS_ENCODER": 1 }, - "inserts": [ - { "where": "header", "code": "#include \"daisy_petal.h\"" }, - { "where": "header", "code": "typedef daisy::DaisyPetal Daisy;" } + "inserts": [ + { + "where": "header", + "code": "#include \"daisy_petal.h\"" + }, + { + "where": "header", + "code": "typedef daisy::DaisyPetal Daisy;" + } ], "labels": { "params": { @@ -24,7 +31,6 @@ "sw6": "sw6", "sw7": "sw7", "exp1": "exp", - "ctrl1": "kn1", "ctrl2": "kn2", "ctrl3": "kn3", @@ -55,27 +61,27 @@ "inputs": { "kn1": { "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_1);" + "code": "hardware.GetKnobValue(hardware.KNOB_1);" }, "kn2": { "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_2);" + "code": "hardware.GetKnobValue(hardware.KNOB_2);" }, "kn3": { "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_3);" + "code": "hardware.GetKnobValue(hardware.KNOB_3);" }, "kn4": { "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_4);" + "code": "hardware.GetKnobValue(hardware.KNOB_4);" }, "kn5": { "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_5);" + "code": "hardware.GetKnobValue(hardware.KNOB_5);" }, "kn6": { "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_6);" + "code": "hardware.GetKnobValue(hardware.KNOB_6);" }, "sw1": { "code": "(hardware.switches[0].Pressed()?1.f:0.f);" @@ -120,6 +126,5 @@ "code": "hardware.SetFootswitchLed(daisy::DaisyPetal::FOOTSWITCH_LED_4, $);" } }, - "datahandlers": { - } + "datahandlers": {} } \ No newline at end of file diff --git a/source/daisy.pod.json b/source/daisy.pod.json index 4005887..42c5329 100644 --- a/source/daisy.pod.json +++ b/source/daisy.pod.json @@ -1,14 +1,24 @@ { - "max_apps":1, + "som": "seed", + "max_apps": 1, "defines": { "OOPSY_TARGET_POD": 1, "OOPSY_TARGET_HAS_MIDI_INPUT": 1, "OOPSY_HAS_ENCODER": 1 }, - "inserts": [ - { "where": "header", "code": "#include \"daisy_pod.h\"" }, - { "where": "header", "code": "typedef daisy::DaisyPod Daisy;" }, - { "where": "post_audio", "code": "hardware.UpdateLeds();" } + "inserts": [ + { + "where": "header", + "code": "#include \"daisy_pod.h\"" + }, + { + "where": "header", + "code": "typedef daisy::DaisyPod Daisy;" + }, + { + "where": "post_audio", + "code": "hardware.UpdateLeds();" + } ], "labels": { "params": { @@ -18,7 +28,6 @@ "sw2": "sw2", "sw3": "enp", "encoder": "enc", - "ctrl1": "kn1", "ctrl2": "kn2", "switch1": "sw1", @@ -32,7 +41,6 @@ "outs": { "led1": "led1", "led2": "led2", - "led": "led1" }, "datas": {} @@ -40,11 +48,11 @@ "inputs": { "kn1": { "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_1);" + "code": "hardware.GetKnobValue(hardware.KNOB_1);" }, "kn2": { "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_2);" + "code": "hardware.GetKnobValue(hardware.KNOB_2);" }, "sw1": { "code": "(hardware.button1.Pressed()?1.f:0.f);" @@ -69,5 +77,5 @@ "code": "hardware.led2.Set(clamp(-$, 0.f, 1.f), clamp($, 0.f, 1.f), 0.f);" } }, - "datahandlers": {} + "datahandlers": {} } \ No newline at end of file diff --git a/source/daisy.versio.json b/source/daisy.versio.json index 9f0a7bb..8fec263 100644 --- a/source/daisy.versio.json +++ b/source/daisy.versio.json @@ -1,12 +1,22 @@ { - "max_apps":1, + "som": "seed", + "max_apps": 1, "defines": { "OOPSY_TARGET_VERSIO": 1 }, - "inserts": [ - { "where": "header", "code": "#include \"daisy_versio.h\"" }, - { "where": "header", "code": "typedef daisy::DaisyVersio Daisy;" }, - { "where": "post_audio", "code": "hardware.UpdateLeds();" } + "inserts": [ + { + "where": "header", + "code": "#include \"daisy_versio.h\"" + }, + { + "where": "header", + "code": "typedef daisy::DaisyVersio Daisy;" + }, + { + "where": "post_audio", + "code": "hardware.UpdateLeds();" + } ], "labels": { "params": { @@ -21,7 +31,6 @@ "sw1": "sw1", "sw2": "sw2", "gate1": "gt1", - "cv1": "kn1", "cv2": "kn2", "cv3": "kn3", @@ -38,18 +47,16 @@ "ctrl7": "kn7", "switch1": "sw1", "switch2": "sw2", - "knob": "kn1", "button": "bt1", "ctrl": "kn1", "cv": "kn1", "switch": "sw1", "gate": "gt1", - "tap": "bt1", "fsu": "bt1", "abc": "sw1", - "xyz": "sw2" + "xyz": "sw2" }, "outs": { "led1": "led1", @@ -62,31 +69,31 @@ "inputs": { "kn1": { "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_0);" + "code": "hardware.GetKnobValue(hardware.KNOB_0);" }, "kn2": { "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_1);" + "code": "hardware.GetKnobValue(hardware.KNOB_1);" }, "kn3": { "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_2);" + "code": "hardware.GetKnobValue(hardware.KNOB_2);" }, "kn4": { "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_3);" + "code": "hardware.GetKnobValue(hardware.KNOB_3);" }, "kn5": { "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_4);" + "code": "hardware.GetKnobValue(hardware.KNOB_4);" }, "kn6": { "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_5);" + "code": "hardware.GetKnobValue(hardware.KNOB_5);" }, "kn7": { "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_6);" + "code": "hardware.GetKnobValue(hardware.KNOB_6);" }, "sw1": { "code": "(hardware.sw[0].Read()/2.f);" @@ -123,5 +130,5 @@ "code": "hardware.leds[3].Set(clamp(-$, 0.f, 1.f), clamp($, 0.f, 1.f), 0.f);" } }, - "datahandlers": {} + "datahandlers": {} } \ No newline at end of file From 0bc2b24d2cf8493608319b4f540ae5c73abf2d57 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Fri, 19 Nov 2021 17:30:31 -0700 Subject: [PATCH 002/100] Corrected patch_init json name --- source/{daisy.patch_sm.json => daisy.patch_init.json} | 1 - 1 file changed, 1 deletion(-) rename source/{daisy.patch_sm.json => daisy.patch_init.json} (99%) diff --git a/source/daisy.patch_sm.json b/source/daisy.patch_init.json similarity index 99% rename from source/daisy.patch_sm.json rename to source/daisy.patch_init.json index 4ddecc4..9f6a053 100644 --- a/source/daisy.patch_sm.json +++ b/source/daisy.patch_init.json @@ -2,7 +2,6 @@ "som": "patch_sm", "max_apps": 8, "defines": { - "OOPSY_TARGET_PATCH_SM": 1, "OOPSY_IO_COUNT": 2 }, "inserts": [ From 9d4f64149c55243a2c9aafa11cab9e70e9d9f091 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Fri, 19 Nov 2021 17:30:48 -0700 Subject: [PATCH 003/100] Integrated som field into generation --- source/genlib_daisy.h | 28 ++++++++++++++-------------- source/oopsy.js | 21 ++++++++++----------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index b905a8c..1a1017e 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -146,10 +146,10 @@ namespace oopsy { struct GenDaisy { Daisy hardware; - #ifdef OOPSY_TARGET_PATCH_SM - Daisy *sub_board = &hardware; + #ifdef OOPSY_SOM_PATCH_SM + Daisy *som = &hardware; #else - daisy::DaisySeed *sub_board = &hardware.seed; + daisy::DaisySeed *som = &hardware.seed; #endif AppDef * appdefs = nullptr; @@ -392,7 +392,7 @@ namespace oopsy { mainloopCallback = nullMainloopCallback; displayCallback = nullMainloopCallback; nullAudioCallbackRunning = false; - sub_board->ChangeAudioCallback(nullAudioCallback); + som->ChangeAudioCallback(nullAudioCallback); while (!nullAudioCallbackRunning) daisy::System::Delay(1); // reset memory oopsy::init(); @@ -406,9 +406,9 @@ namespace oopsy { paramCallback = newapp.staticParamCallback; #endif - sub_board->ChangeAudioCallback(newapp.staticAudioCallback); + som->ChangeAudioCallback(newapp.staticAudioCallback); log("gen~ %s", appdefs[app_selected].name); - log("SR %dkHz / %dHz", (int)(sub_board->AudioSampleRate()/1000), (int)sub_board->AudioCallbackRate()); + log("SR %dkHz / %dHz", (int)(som->AudioSampleRate()/1000), (int)som->AudioCallbackRate()); { log("%d%s/%dKB+%d%s/%dMB", oopsy::sram_used > 1024 ? oopsy::sram_used/1024 : oopsy::sram_used, @@ -453,9 +453,9 @@ namespace oopsy { mode = 0; #ifdef OOPSY_USE_USB_SERIAL_INPUT - sub_board->usb.Init(daisy::UsbHandle::FS_INTERNAL); + som->usb.Init(daisy::UsbHandle::FS_INTERNAL); daisy::System::Delay(500); - sub_board->usb.SetReceiveCallback(UsbCallback, daisy::UsbHandle::FS_INTERNAL); + som->usb.SetReceiveCallback(UsbCallback, daisy::UsbHandle::FS_INTERNAL); #endif #ifdef OOPSY_USE_LOGGING @@ -478,8 +478,8 @@ namespace oopsy { console_line = console_rows-1; #endif - sub_board->adc.Start(); - sub_board->StartAudio(nullAudioCallback); + som->adc.Start(); + som->StartAudio(nullAudioCallback); mainloopCallback = nullMainloopCallback; displayCallback = nullMainloopCallback; @@ -519,7 +519,7 @@ namespace oopsy { t = t1; // pulse seed LED for status according to CPU usage: - sub_board->SetLed((t % 1000)/10 <= uint32_t(audioCpuUsage)); + som->SetLed((t % 1000)/10 <= uint32_t(audioCpuUsage)); if (app_load_scheduled) { app_load_scheduled = 0; @@ -547,7 +547,7 @@ namespace oopsy { if (uitimer.ready(dt)) { #ifdef OOPSY_USE_LOGGING - sub_board->PrintLine("the time is"FLT_FMT3"", FLT_VAR3(t/1000.f)); + som->PrintLine("the time is"FLT_FMT3"", FLT_VAR3(t/1000.f)); #endif #ifdef OOPSY_USE_USB_SERIAL_INPUT if(update && rx_size > 0) { @@ -792,7 +792,7 @@ namespace oopsy { } break; case SCOPEOPTION_ZOOM: { // each pixel is zoom samples; zoom/samplerate seconds - float scope_duration = OOPSY_OLED_DISPLAY_WIDTH*(1000.f*zoomlevel/sub_board->AudioSampleRate()); + float scope_duration = OOPSY_OLED_DISPLAY_WIDTH*(1000.f*zoomlevel/som->AudioSampleRate()); int offset = snprintf(scope_label, console_cols, "%dx %dms", zoomlevel, (int)ceilf(scope_duration)); hardware.display.SetCursor(0, h - font.FontHeight); hardware.display.WriteString(scope_label, font, true); @@ -1082,7 +1082,7 @@ namespace oopsy { daisy.audio_postperform(buffers, size); // convert elapsed time (us) to CPU percentage (0-100) of available processing time // 100 (%) * (0.000001 * used_us) * callbackrateHz - float percent = (daisy::System::GetUs() - start)*0.0001f*daisy.sub_board->AudioCallbackRate(); + float percent = (daisy::System::GetUs() - start)*0.0001f*daisy.som->AudioCallbackRate(); percent = percent > 100.f ? 100.f : percent; // with a falling-only slew to capture spikes, since we care most about worst-case performance daisy.audioCpuUsage = (percent > daisy.audioCpuUsage) ? percent diff --git a/source/oopsy.js b/source/oopsy.js index cead987..17c6d73 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -465,7 +465,7 @@ function run() { case "field": case "petal": case "patch": - case "patch_sm": + case "patch_init": case "versio": target = arg; break; case "bluemchen": target_path = path.join(__dirname, "seed.bluemchen.json"); break; case "nehcmeulb": target_path = path.join(__dirname, "seed.nehcmeulb.json"); break; @@ -553,6 +553,7 @@ function run() { // At the point that the old one can be retired (because e.g. Patch, Petal etc can be defined in the new format) // this script should be revised to eliminate the old workflow { + hardware.som = hardware.som || "seed"; hardware.inputs = hardware.inputs || {} hardware.outputs = hardware.outputs || {} hardware.datahandlers = hardware.datahandlers || {} @@ -681,6 +682,9 @@ function run() { if (options.fastmath) { hardware.defines.GENLIB_USE_FASTMATH = 1; } + if (hardware.som == 'patch_sm') { + hardware.defines.OOPSY_SOM_PATCH_SM = 1; + } const makefile_path = path.join(build_path, `Makefile`) const bin_path = path.join(build_path, "build", build_name+".bin"); @@ -763,11 +767,7 @@ oopsy::AppDef appdefs[] = { }; int main(void) { - #ifdef OOPSY_TARGET_PATCH_SM - oopsy::daisy.hardware.Init(); - #else - oopsy::daisy.hardware.Init(${options.boost|false}); - #endif + oopsy::daisy.hardware.Init(${hardware.som == 'seed' ? options.boost|false : ``}); oopsy::daisy.hardware.SetAudioSampleRate(daisy::SaiHandle::Config::SampleRate::SAI_${hardware.samplerate}KHZ); oopsy::daisy.hardware.SetAudioBlockSize(${hardware.defines.OOPSY_BLOCK_SIZE}); ${hardware.inserts.filter(o => o.where == "init").map(o => o.code).join("\n\t")} @@ -1011,6 +1011,7 @@ function analyze_cpp(cpp, hardware, cpp_path) { function generate_daisy(hardware, nodes) { let daisy = { + som: hardware.som, // DEVICE INPUTS: device_inputs: Object.keys(hardware.inputs).map(v => { let name = v @@ -1547,11 +1548,9 @@ struct App_${name} : public oopsy::App { float ${name}[OOPSY_BLOCK_SIZE];`).join("")} void init(oopsy::GenDaisy& daisy) { - #ifdef OOPSY_TARGET_PATCH_SM - daisy.gen = ${name}::create(daisy.hardware.AudioSampleRate(), daisy.hardware.AudioBlockSize()); - #else - daisy.gen = ${name}::create(daisy.hardware.seed.AudioSampleRate(), daisy.hardware.seed.AudioBlockSize()); - #endif + daisy.gen = ${name}::create(${hardware.som == 'seed' + ? `daisy.hardware.seed.AudioSampleRate(), daisy.hardware.seed.AudioBlockSize()` + : `daisy.hardware.AudioSampleRate(), daisy.hardware.AudioBlockSize()`}); ${name}::State& gen = *(${name}::State *)daisy.gen; daisy.param_count = ${gen.params.length}; From 875d58bff2b0730178c8e90d350af742738d554e Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Fri, 19 Nov 2021 18:11:14 -0700 Subject: [PATCH 004/100] Updated max patchs / mappings for som --- init/oopsy-objectmappings.txt | 4 +-- patchers/oopsy.maxpat | 27 ++++++++++--------- ...atch_sm.maxpat => oopsy_patch_init.maxpat} | 11 ++++---- 3 files changed, 22 insertions(+), 20 deletions(-) rename templates/{oopsy_patch_sm.maxpat => oopsy_patch_init.maxpat} (99%) diff --git a/init/oopsy-objectmappings.txt b/init/oopsy-objectmappings.txt index be811ad..41aad83 100644 --- a/init/oopsy-objectmappings.txt +++ b/init/oopsy-objectmappings.txt @@ -6,8 +6,8 @@ max definesubstitution oopsy.petal bpatcher @name oopsy.maxpat @args petal; max objectfile oopsy.petal oopsy.petal; max definesubstitution oopsy.pod bpatcher @name oopsy.maxpat @args pod; max objectfile oopsy.pod oopsy.pod; -max definesubstitution oopsy.patch_sm bpatcher @name oopsy.maxpat @args patch_sm; -max objectfile oopsy.patch_sm oopsy.patch_sm; +max definesubstitution oopsy.patch_init bpatcher @name oopsy.maxpat @args patch_init; +max objectfile oopsy.patch_init oopsy.patch_init; max definesubstitution oopsy.bluemchen bpatcher @name oopsy.maxpat @args bluemchen; max objectfile oopsy.bluemchen oopsy.bluemchen; max definesubstitution oopsy.nehcmeulb bpatcher @name oopsy.maxpat @args nehcmeulb; diff --git a/patchers/oopsy.maxpat b/patchers/oopsy.maxpat index aed8cf3..3a3ccc9 100644 --- a/patchers/oopsy.maxpat +++ b/patchers/oopsy.maxpat @@ -4,13 +4,13 @@ "appversion" : { "major" : 8, "minor" : 1, - "revision" : 8, + "revision" : 11, "architecture" : "x64", "modernui" : 1 } , "classnamespace" : "box", - "rect" : [ 392.0, 105.0, 1246.0, 808.0 ], + "rect" : [ 140.0, 79.0, 1182.0, 558.0 ], "bglocked" : 0, "openinpresentation" : 1, "default_fontsize" : 12.0, @@ -353,7 +353,7 @@ "box" : { "fontsize" : 9.0, "id" : "obj-76", - "items" : [ "patch", ",", "patch_sm", ",", "field", ",", "petal", ",", "pod", ",", "versio", ",", "bluemchen", ",", "nehcmeulb" ], + "items" : [ "patch", ",", "patch_init", ",", "field", ",", "petal", ",", "pod", ",", "versio", ",", "bluemchen", ",", "nehcmeulb" ], "maxclass" : "umenu", "numinlets" : 1, "numoutlets" : 3, @@ -377,13 +377,13 @@ "appversion" : { "major" : 8, "minor" : 1, - "revision" : 8, + "revision" : 11, "architecture" : "x64", "modernui" : 1 } , "classnamespace" : "box", - "rect" : [ 613.0, 269.0, 918.0, 472.0 ], + "rect" : [ 488.0, 269.0, 918.0, 472.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -411,6 +411,7 @@ "style" : "", "subpatcher_template" : "", "assistshowspatchername" : 0, + "visible" : 1, "boxes" : [ { "box" : { "id" : "obj-31", @@ -430,8 +431,8 @@ "numinlets" : 9, "numoutlets" : 9, "outlettype" : [ "", "", "", "", "", "", "", "", "" ], - "patching_rect" : [ 17.0, 97.0, 387.0, 22.0 ], - "text" : "routepass patch patch_sm field petal pod versio bluemchen nehcmeulb" + "patching_rect" : [ 17.0, 97.0, 386.0, 22.0 ], + "text" : "routepass patch patch_init field petal pod versio bluemchen nehcmeulb" } } @@ -570,13 +571,13 @@ , { "box" : { "id" : "obj-2", - "linecount" : 2, + "linecount" : 3, "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 544.0, 329.0, 372.0, 35.0 ], - "text" : "clear, append patch, append patch_sm, append field, append petal, append pod, append versio, append bluemchen, append nehcmeulb" + "patching_rect" : [ 544.0, 329.0, 369.0, 49.0 ], + "text" : "clear, append patch, append patch_init, append field, append petal, append pod, append versio, append bluemchen, append nehcmeulb" } } @@ -1001,7 +1002,7 @@ "appversion" : { "major" : 8, "minor" : 1, - "revision" : 8, + "revision" : 11, "architecture" : "x64", "modernui" : 1 } @@ -1339,6 +1340,8 @@ "saved_object_attributes" : { "autostart" : 0, "defer" : 0, + "node_bin_path" : "", + "npm_bin_path" : "", "watch" : 0 } , @@ -1382,7 +1385,7 @@ "appversion" : { "major" : 8, "minor" : 1, - "revision" : 8, + "revision" : 11, "architecture" : "x64", "modernui" : 1 } diff --git a/templates/oopsy_patch_sm.maxpat b/templates/oopsy_patch_init.maxpat similarity index 99% rename from templates/oopsy_patch_sm.maxpat rename to templates/oopsy_patch_init.maxpat index e4d9b47..7b9919d 100644 --- a/templates/oopsy_patch_sm.maxpat +++ b/templates/oopsy_patch_init.maxpat @@ -340,12 +340,11 @@ "fontname" : "Arial Italic", "fontsize" : 18.0, "id" : "obj-24", - "linecount" : 2, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 24.0, 22.0, 221.0, 47.0 ], - "text" : "Template for DaisyPatch Submodule" + "patching_rect" : [ 24.0, 22.0, 221.0, 27.0 ], + "text" : "Template for patch.Init()" } } @@ -853,7 +852,7 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 320.5, 119.900900900363922, 67.0, 49.0 ], + "patching_rect" : [ 320.5, 119.900900900363922, 68.0, 49.0 ], "text" : "param cv3 @min 0.5 @max 1" } @@ -1013,11 +1012,11 @@ "patching_rect" : [ 47.0, 363.0, 195.0, 35.0 ], "saved_object_attributes" : { "exportfolder" : "macOS:/Users/corvus/Documents/Max 8/Packages/oopsy/templates/", - "exportname" : "oopsy_patch_sm" + "exportname" : "oopsy_patch_init" } , "text" : "gen~", - "varname" : "oopsy_patch_sm" + "varname" : "oopsy_patch_init" } } From 3e9845b5f70909cd05b5004e59064d83eae36e59 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 22 Nov 2021 13:49:31 -0700 Subject: [PATCH 005/100] Permitted negative inputs with input_max, input_min --- source/daisy.field.json | 8 ++++++++ source/daisy.patch_init.json | 14 ++++++++++---- source/oopsy.js | 18 ++++++++++++++++++ 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/source/daisy.field.json b/source/daisy.field.json index 1185735..2682957 100644 --- a/source/daisy.field.json +++ b/source/daisy.field.json @@ -182,15 +182,23 @@ "code": "(hardware.GetSwitch(1)->Pressed()?1.f:0.f);" }, "cv1": { + "input_min": -1, + "input_max": 1, "code": "hardware.GetCvValue(0);" }, "cv2": { + "input_min": -1, + "input_max": 1, "code": "hardware.GetCvValue(1);" }, "cv3": { + "input_min": -1, + "input_max": 1, "code": "hardware.GetCvValue(2);" }, "cv4": { + "input_min": -1, + "input_max": 1, "code": "hardware.GetCvValue(3);" }, "gt1": { diff --git a/source/daisy.patch_init.json b/source/daisy.patch_init.json index 9f6a053..5e45f01 100644 --- a/source/daisy.patch_init.json +++ b/source/daisy.patch_init.json @@ -46,6 +46,8 @@ "knob4": "kn4", "gate1": "gt1", "gate2": "gt2", + "switch": "sw", + "toggle": "sw", "sw": "sw", "sw1": "sw", "sw2": "button", @@ -121,19 +123,23 @@ "code": "hardware.GetAdcValue(daisy::patch_sm::CV_4);" }, "cv5": { - "automap": true, + "input_min": -1, + "input_max": 1, "code": "hardware.GetAdcValue(daisy::patch_sm::CV_5);" }, "cv6": { - "automap": true, + "input_min": -1, + "input_max": 1, "code": "hardware.GetAdcValue(daisy::patch_sm::CV_6);" }, "cv7": { - "automap": true, + "input_min": -1, + "input_max": 1, "code": "hardware.GetAdcValue(daisy::patch_sm::CV_7);" }, "cv8": { - "automap": true, + "input_min": -1, + "input_max": 1, "code": "hardware.GetAdcValue(daisy::patch_sm::CV_8);" }, "gt1": { diff --git a/source/oopsy.js b/source/oopsy.js index 17c6d73..7911dfb 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -1433,6 +1433,24 @@ function generate_app(app, hardware, target, config) { node.src = src; node.label = label; + // Apply input scaling + if (src in hardware.inputs) + { + let input = hardware.inputs[src]; + let input_min = input.input_min || 0; + let input_max = input.input_max || 1; + + // We ignore this step if the fields are empty + if (input_min != 0 || input_max != 1) + { + let new_range = node.range / (input_max - input_min); + node.range = new_range; + + let new_min = node.min - input_min * new_range; + node.min = new_min; + } + } + let ideal_steps = 100 // about 4 good twists of the encoder if (node.type == "bool" || node.type == "int") { node.stepsize = 1 From 74fdfbdb20792c173f4a227be2cbf9cb016f3627 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 22 Nov 2021 13:49:51 -0700 Subject: [PATCH 006/100] Updated patch init template --- templates/oopsy_patch_init.maxpat | 415 +++++++++++++++++++++++------- 1 file changed, 323 insertions(+), 92 deletions(-) diff --git a/templates/oopsy_patch_init.maxpat b/templates/oopsy_patch_init.maxpat index 7b9919d..516533e 100644 --- a/templates/oopsy_patch_init.maxpat +++ b/templates/oopsy_patch_init.maxpat @@ -39,6 +39,26 @@ "subpatcher_template" : "", "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "args" : [ "patch_init" ], + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-9", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "oopsy.maxpat", + "numinlets" : 1, + "numoutlets" : 0, + "offset" : [ 0.0, 0.0 ], + "patching_rect" : [ 752.0, 63.0, 128.0, 128.0 ], + "viewvisibility" : 1 + } + + } +, { "box" : { "attr" : "cv5", "id" : "obj-39", @@ -506,26 +526,6 @@ "viewvisibility" : 1 } - } -, { - "box" : { - "args" : [ "field", "@target", "patch_sm" ], - "bgmode" : 0, - "border" : 0, - "clickthrough" : 0, - "enablehscroll" : 0, - "enablevscroll" : 0, - "id" : "obj-9", - "lockeddragscroll" : 0, - "maxclass" : "bpatcher", - "name" : "oopsy.maxpat", - "numinlets" : 1, - "numoutlets" : 0, - "offset" : [ 0.0, 0.0 ], - "patching_rect" : [ 760.5, 63.0, 128.0, 128.0 ], - "viewvisibility" : 1 - } - } , { "box" : { @@ -575,6 +575,173 @@ "subpatcher_template" : "", "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "id" : "obj-48", + "linecount" : 5, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 870.0, 18.0, 150.0, 74.0 ], + "text" : "Toggling the switch with this patcher will switch between interface inputs and voltage inputs for gate2 and cvout2" + } + + } +, { + "box" : { + "id" : "obj-46", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 786.5, 312.0, 29.5, 22.0 ], + "text" : "+" + } + + } +, { + "box" : { + "id" : "obj-42", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 862.211711704730988, 228.5, 26.0, 22.0 ], + "text" : "!- 1" + } + + } +, { + "box" : { + "id" : "obj-43", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 797.0, 200.0, 49.0, 22.0 ], + "text" : "r switch" + } + + } +, { + "box" : { + "id" : "obj-44", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 851.711711704730988, 265.0, 29.5, 22.0 ], + "text" : "*" + } + + } +, { + "box" : { + "id" : "obj-45", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 786.5, 269.0, 29.5, 22.0 ], + "text" : "*" + } + + } +, { + "box" : { + "id" : "obj-41", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 870.0, 96.0, 79.0, 22.0 ], + "text" : "param switch" + } + + } +, { + "box" : { + "id" : "obj-40", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 870.0, 133.0, 51.0, 22.0 ], + "text" : "s switch" + } + + } +, { + "box" : { + "id" : "obj-36", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 955.211711704730988, 96.0, 79.0, 22.0 ], + "text" : "param button" + } + + } +, { + "box" : { + "id" : "obj-35", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 398.5, 312.0, 29.5, 22.0 ], + "text" : "+" + } + + } +, { + "box" : { + "id" : "obj-32", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 409.0, 232.5, 26.0, 22.0 ], + "text" : "!- 1" + } + + } +, { + "box" : { + "id" : "obj-30", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 409.0, 200.0, 49.0, 22.0 ], + "text" : "r switch" + } + + } +, { + "box" : { + "id" : "obj-21", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 451.5, 269.0, 29.5, 22.0 ], + "text" : "*" + } + + } +, { + "box" : { + "id" : "obj-20", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 398.5, 269.0, 29.5, 22.0 ], + "text" : "*" + } + + } +, { "box" : { "id" : "obj-24", "maxclass" : "newobj", @@ -593,7 +760,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 419.211711704730988, 312.0, 96.0, 33.0 ], + "patching_rect" : [ 459.211711704730988, 312.0, 96.0, 33.0 ], "text" : "\"out 4 led\" would also work" } @@ -688,7 +855,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 891.5, 96.0, 107.0, 22.0 ], + "patching_rect" : [ 1075.5, 96.0, 107.0, 22.0 ], "text" : "oopsy.suggestions" } @@ -847,13 +1014,12 @@ , { "box" : { "id" : "obj-14", - "linecount" : 3, "maxclass" : "newobj", "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 320.5, 119.900900900363922, 68.0, 49.0 ], - "text" : "param cv3 @min 0.5 @max 1" + "patching_rect" : [ 320.5, 119.900900900363922, 65.0, 22.0 ], + "text" : "param cv3" } } @@ -956,6 +1122,13 @@ "source" : [ "obj-1", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-21", 0 ], + "source" : [ "obj-10", 0 ] + } + } , { "patchline" : { @@ -966,7 +1139,7 @@ } , { "patchline" : { - "destination" : [ "obj-29", 0 ], + "destination" : [ "obj-20", 0 ], "source" : [ "obj-15", 0 ] } @@ -977,6 +1150,20 @@ "source" : [ "obj-2", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-35", 0 ], + "source" : [ "obj-20", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-35", 1 ], + "source" : [ "obj-21", 0 ] + } + } , { "patchline" : { @@ -987,7 +1174,7 @@ } , { "patchline" : { - "destination" : [ "obj-7", 0 ], + "destination" : [ "obj-45", 0 ], "source" : [ "obj-25", 0 ] } @@ -1005,6 +1192,94 @@ "source" : [ "obj-3", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-21", 1 ], + "order" : 0, + "source" : [ "obj-30", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-32", 0 ], + "order" : 1, + "source" : [ "obj-30", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-20", 1 ], + "source" : [ "obj-32", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-29", 0 ], + "source" : [ "obj-35", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-44", 0 ], + "source" : [ "obj-36", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-40", 0 ], + "source" : [ "obj-41", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-44", 1 ], + "source" : [ "obj-42", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-42", 0 ], + "order" : 0, + "source" : [ "obj-43", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-45", 1 ], + "order" : 1, + "source" : [ "obj-43", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-46", 1 ], + "source" : [ "obj-44", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-46", 0 ], + "source" : [ "obj-45", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-7", 0 ], + "source" : [ "obj-46", 0 ] + } + } ] } @@ -1186,20 +1461,6 @@ "source" : [ "obj-29", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-1", 0 ], - "source" : [ "obj-3", 2 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-11", 1 ], - "source" : [ "obj-3", 1 ] - } - } , { "patchline" : { @@ -1207,27 +1468,6 @@ "source" : [ "obj-3", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-14", 0 ], - "source" : [ "obj-3", 3 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-15", 0 ], - "source" : [ "obj-3", 5 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-20", 0 ], - "source" : [ "obj-3", 4 ] - } - } , { "patchline" : { @@ -1284,19 +1524,10 @@ "source" : [ "obj-6", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-3", 1 ], - "order" : 0, - "source" : [ "obj-7", 0 ] - } - } , { "patchline" : { "destination" : [ "obj-3", 0 ], - "order" : 1, "source" : [ "obj-7", 0 ] } @@ -1366,27 +1597,6 @@ "type" : "gDSP", "implicit" : 1 } -, { - "name" : "oopsy.maxpat", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", - "patcherrelativepath" : "../patchers", - "type" : "JSON", - "implicit" : 1 - } -, { - "name" : "oopsy.snoop.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", - "patcherrelativepath" : "../javascript", - "type" : "TEXT", - "implicit" : 1 - } -, { - "name" : "oopsy.node4max.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", - "patcherrelativepath" : "../javascript", - "type" : "TEXT", - "implicit" : 1 - } , { "name" : "demosound.maxpat", "bootpath" : "C74:/help/msp", @@ -1423,6 +1633,27 @@ "type" : "TEXT", "implicit" : 1 } +, { + "name" : "oopsy.maxpat", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", + "patcherrelativepath" : "../patchers", + "type" : "JSON", + "implicit" : 1 + } +, { + "name" : "oopsy.snoop.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "oopsy.node4max.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } ], "autosave" : 0 } From 6ac1ba4876d781a8d6f21898cae280a2c52bae3a Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Wed, 24 Nov 2021 16:03:38 -0700 Subject: [PATCH 007/100] Begin updating new json process --- source/oopsy.js | 70 ++++++++++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 30 deletions(-) diff --git a/source/oopsy.js b/source/oopsy.js index 7911dfb..f147f94 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -153,7 +153,7 @@ const component_defs = { polarity: "daisy::Switch::POLARITY_INVERTED", pull: "daisy::Switch::PULL_UP", process: "${name}.Debounce();", - updaterate: "${name}.SetUpdateRate(seed.AudioCallbackRate());", + updaterate: "${name}.SetUpdateRate(som.AudioCallbackRate());", mapping: [ { name: "${name}", get: "(hardware.${name}.Pressed()?1.f:0.f)", range: [0, 1] }, { @@ -184,11 +184,11 @@ const component_defs = { typename: "daisy::Encoder", pin: "a,b,click", process: "${name}.Debounce();", - updaterate: "${name}.SetUpdateRate(seed.AudioCallbackRate());", + updaterate: "${name}.SetUpdateRate(som.AudioCallbackRate());", mapping: [ { name: "${name}", - get: "(hardware.${name}.Increment()*0.5f+0.5f)", + get: "hardware.${name}.Increment()", range: [-1, 1] }, { @@ -226,9 +226,9 @@ const component_defs = { pin: "a", flip: false, invert: false, - slew: "1.0/seed.AudioCallbackRate()", + slew: "1.0/som.AudioCallbackRate()", process: "${name}.Process();", - updaterate: "${name}.SetSampleRate(seed.AudioCallbackRate());", + updaterate: "${name}.SetSampleRate(som.AudioCallbackRate());", mapping: [{ name: "${name}", get: "(hardware.${name}.Value())", range: [0, 1] }] }, Led: { @@ -270,12 +270,12 @@ const component_defs = { mapping: [ { name: "${name}1", - set: "hardware.seed.dac.WriteValue(daisy::DacHandle::Channel::ONE, $ * 4095);", + set: "hardware.som.dac.WriteValue(daisy::DacHandle::Channel::ONE, $ * 4095);", where: "main" }, { name: "${name}2", - set: "hardware.seed.dac.WriteValue(daisy::DacHandle::Channel::TWO, $ * 4095);", + set: "hardware.som.dac.WriteValue(daisy::DacHandle::Channel::TWO, $ * 4095);", where: "main" } ] @@ -325,48 +325,48 @@ function generate_target_struct(target) { } return ` -#include "daisy_seed.h" +#include "daisy_${target.som}.h" ${target.display ? `#include "dev/oled_ssd130x.h"` : ""} // name: ${target.name} struct Daisy { void Init(bool boost = false) { - seed.Configure(); - seed.Init(boost); + ${target.som == 'seed' ? 'som.Configure();' : ''} + som.Init(${target.som == 'seed' ? 'boost' : ''}); ${components.filter((e) => e.init) .map((e) => ` ${template(e.init, e)}` ).join("")} ${components.filter((e) => e.typename == "daisy::Switch") .map((e, i) => ` - ${e.name}.Init(seed.GetPin(${e.pin}), seed.AudioCallbackRate(), ${e.type}, ${e.polarity}, ${e.pull});` + ${e.name}.Init(som.GetPin(${e.pin}), som.AudioCallbackRate(), ${e.type}, ${e.polarity}, ${e.pull});` ).join("")} ${components.filter((e) => e.typename == "daisy::Switch3").map((e, i) => ` - ${e.name}.Init(seed.GetPin(${e.pin.a}), seed.GetPin(${e.pin.b}));` + ${e.name}.Init(som.GetPin(${e.pin.a}), som.GetPin(${e.pin.b}));` ).join("")} ${components.filter((e) => e.typename == "daisy::GateIn").map((e, i) => ` - dsy_gpio_pin ${e.name}_pin = seed.GetPin(${e.pin}); + dsy_gpio_pin ${e.name}_pin = som.GetPin(${e.pin}); ${e.name}.Init(&${e.name}_pin);` ).join("")} ${components.filter((e) => e.typename == "daisy::Encoder").map((e, i) => ` - ${e.name}.Init(seed.GetPin(${e.pin.a}), seed.GetPin(${e.pin.b}), seed.GetPin(${e.pin.click}), seed.AudioCallbackRate());` + ${e.name}.Init(som.GetPin(${e.pin.a}), som.GetPin(${e.pin.b}), som.GetPin(${e.pin.click}), som.AudioCallbackRate());` ).join("")} static const int ANALOG_COUNT = ${ components.filter((e) => e.typename == "daisy::AnalogControl").length}; daisy::AdcChannelConfig cfg[ANALOG_COUNT]; ${components.filter((e) => e.typename == "daisy::AnalogControl").map((e, i) => ` - cfg[${i}].InitSingle(seed.GetPin(${e.pin}));`).join("")} - seed.adc.Init(cfg, ANALOG_COUNT); + cfg[${i}].InitSingle(som.GetPin(${e.pin}));`).join("")} + som.adc.Init(cfg, ANALOG_COUNT); ${components.filter((e) => e.typename == "daisy::AnalogControl").map((e, i) => ` - ${e.name}.Init(seed.adc.GetPtr(${i}), seed.AudioCallbackRate(), ${e.flip}, ${e.invert});`).join("")} + ${e.name}.Init(som.adc.GetPtr(${i}), som.AudioCallbackRate(), ${e.flip}, ${e.invert});`).join("")} ${components.filter((e) => e.typename == "daisy::Led").map((e, i) => ` - ${e.name}.Init(seed.GetPin(${e.pin}), ${e.invert}); + ${e.name}.Init(som.GetPin(${e.pin}), ${e.invert}); ${e.name}.Set(0.0f);`).join("")} ${components.filter((e) => e.typename == "daisy::RgbLed").map((e, i) => ` - ${e.name}.Init(seed.GetPin(${e.pin.r}), seed.GetPin(${e.pin.g}), seed.GetPin(${e.pin.b}), ${e.invert}); + ${e.name}.Init(som.GetPin(${e.pin.r}), som.GetPin(${e.pin.g}), som.GetPin(${e.pin.b}), ${e.invert}); ${e.name}.Set(0.0f, 0.0f, 0.0f);`).join("")} ${components.filter((e) => e.typename == "daisy::dsy_gpio").map((e, i) => ` - ${e.name}.pin = seed.GetPin(${e.pin}); + ${e.name}.pin = som.GetPin(${e.pin}); ${e.name}.mode = ${e.mode}; ${e.name}.pull = ${e.pull}; dsy_gpio_init(&${e.name});`).join("")} @@ -375,8 +375,8 @@ struct Daisy { ${e.name}.buff_state = ${e.buff_state}; ${e.name}.mode = ${e.mode}; ${e.name}.chn = ${e.channel}; - seed.dac.Init(${e.name}); - seed.dac.WriteValue(${e.channel}, 0);`).join("")} + som.dac.Init(${e.name}); + som.dac.WriteValue(${e.channel}, 0);`).join("")} ${target.display ? ` daisy::OledDisplay<${target.display.driver}>::Config display_config; display_config.driver_config.transport_config.Defaults(); ${(target.display.config || []).map(e=>` @@ -402,12 +402,12 @@ struct Daisy { } void SetAudioSampleRate(daisy::SaiHandle::Config::SampleRate samplerate) { - seed.SetAudioSampleRate(samplerate); + som.SetAudioSampleRate(samplerate); SetHidUpdateRates(); } void SetAudioBlockSize(size_t size) { - seed.SetAudioBlockSize(size); + som.SetAudioBlockSize(size); SetHidUpdateRates(); } @@ -416,7 +416,7 @@ struct Daisy { ${template(e.updaterate, e)}`).join("")} } - daisy::DaisySeed seed; + ${target.som == 'seed' ? 'daisy::DaisySeed' : 'daisy::patch_sm::DaisyPatchInit'} som; ${components.map((e) => ` ${e.typename} ${e.name};`).join("")} ${target.display ? `daisy::OledDisplay<${target.display.driver}> display;`:`// no display`} @@ -461,7 +461,6 @@ function run() { case "upload": case "up": action="upload"; break; - case "pod": case "field": case "petal": case "patch": @@ -469,6 +468,7 @@ function run() { case "versio": target = arg; break; case "bluemchen": target_path = path.join(__dirname, "seed.bluemchen.json"); break; case "nehcmeulb": target_path = path.join(__dirname, "seed.nehcmeulb.json"); break; + case "pod": target_path = path.join(__dirname, "seed.pod.json"); break; case "watch": watch=true; break; @@ -536,6 +536,9 @@ function run() { let OOPSY_TARGET_SEED = 0 + let valid_soms = ['seed', 'patch_sm']; + let som = 'seed'; + // configure target: if (!target && !target_path) target = "patch"; if (!target_path) { @@ -543,11 +546,16 @@ function run() { } else { OOPSY_TARGET_SEED = 1 target = path.parse(target_path).name.replace(".", "_") + som_match = path.parse(target_path).name.match(/([A-Za-z_0-9\-]+)\./) + assert(som_match != null, `Daisy SOM undefined. Provide the SOM as in the following: "som.MyBoard.json"`); + assert(valid_soms.includes(som_match[1]), `unkown SOM ${som_match[1]}. Valid SOMs: ${valid_soms.join(', ')}`); + som = som_match[1]; } console.log(`Target ${target} configured in path ${target_path}`) assert(fs.existsSync(target_path), `couldn't find target configuration file ${target_path}`); const hardware = JSON.parse(fs.readFileSync(target_path, "utf8")); hardware.max_apps = hardware.max_apps || 1 + hardware.som = som; // The following is compatibility code, so that the new JSON structure will generate the old JSON structure // At the point that the old one can be retired (because e.g. Patch, Petal etc can be defined in the new format) @@ -767,7 +775,7 @@ oopsy::AppDef appdefs[] = { }; int main(void) { - oopsy::daisy.hardware.Init(${hardware.som == 'seed' ? options.boost|false : ``}); + oopsy::daisy.hardware.Init(${options.boost|false}); oopsy::daisy.hardware.SetAudioSampleRate(daisy::SaiHandle::Config::SampleRate::SAI_${hardware.samplerate}KHZ); oopsy::daisy.hardware.SetAudioBlockSize(${hardware.defines.OOPSY_BLOCK_SIZE}); ${hardware.inserts.filter(o => o.where == "init").map(o => o.code).join("\n\t")} @@ -1566,9 +1574,11 @@ struct App_${name} : public oopsy::App { float ${name}[OOPSY_BLOCK_SIZE];`).join("")} void init(oopsy::GenDaisy& daisy) { - daisy.gen = ${name}::create(${hardware.som == 'seed' - ? `daisy.hardware.seed.AudioSampleRate(), daisy.hardware.seed.AudioBlockSize()` - : `daisy.hardware.AudioSampleRate(), daisy.hardware.AudioBlockSize()`}); + ${ + hardware.som == 'seed' + ? `daisy.gen = ${name}::create(daisy.hardware.seed.AudioSampleRate(), daisy.hardware.seed.AudioBlockSize());` + : `daisy.gen = ${name}::create(daisy.hardware.AudioSampleRate(), daisy.hardware.AudioBlockSize());` + } ${name}::State& gen = *(${name}::State *)daisy.gen; daisy.param_count = ${gen.params.length}; From b2223ef96d11d793cc7f6b96defcd4db0cd98752 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 29 Nov 2021 10:05:16 -0700 Subject: [PATCH 008/100] Updated seed references to som --- source/genlib_daisy.h | 2 +- source/oopsy.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 1a1017e..8c5d8f5 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -149,7 +149,7 @@ namespace oopsy { #ifdef OOPSY_SOM_PATCH_SM Daisy *som = &hardware; #else - daisy::DaisySeed *som = &hardware.seed; + daisy::DaisySeed *som = &hardware.som; #endif AppDef * appdefs = nullptr; diff --git a/source/oopsy.js b/source/oopsy.js index f147f94..2eb88ad 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -775,7 +775,7 @@ oopsy::AppDef appdefs[] = { }; int main(void) { - oopsy::daisy.hardware.Init(${options.boost|false}); + oopsy::daisy.hardware.Init(${hardware.som == 'seed' ? options.boost|false : ''}); oopsy::daisy.hardware.SetAudioSampleRate(daisy::SaiHandle::Config::SampleRate::SAI_${hardware.samplerate}KHZ); oopsy::daisy.hardware.SetAudioBlockSize(${hardware.defines.OOPSY_BLOCK_SIZE}); ${hardware.inserts.filter(o => o.where == "init").map(o => o.code).join("\n\t")} @@ -1576,7 +1576,7 @@ struct App_${name} : public oopsy::App { void init(oopsy::GenDaisy& daisy) { ${ hardware.som == 'seed' - ? `daisy.gen = ${name}::create(daisy.hardware.seed.AudioSampleRate(), daisy.hardware.seed.AudioBlockSize());` + ? `daisy.gen = ${name}::create(daisy.hardware.som.AudioSampleRate(), daisy.hardware.som.AudioBlockSize());` : `daisy.gen = ${name}::create(daisy.hardware.AudioSampleRate(), daisy.hardware.AudioBlockSize());` } ${name}::State& gen = *(${name}::State *)daisy.gen; From 400d1995a1ae916f26a67fd735e18ae8eca11192 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 29 Nov 2021 10:46:38 -0700 Subject: [PATCH 009/100] Made som work for old and new JSON --- source/genlib_daisy.h | 6 +++++- source/oopsy.js | 15 +++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 8c5d8f5..c6b7f87 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -149,7 +149,11 @@ namespace oopsy { #ifdef OOPSY_SOM_PATCH_SM Daisy *som = &hardware; #else - daisy::DaisySeed *som = &hardware.som; + #ifdef OOPSY_OLD_JSON + daisy::DaisySeed *som = &hardware.seed; + #else + daisy::DaisySeed *som = &hardware.som; + #endif #endif AppDef * appdefs = nullptr; diff --git a/source/oopsy.js b/source/oopsy.js index 2eb88ad..ae203ba 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -323,6 +323,10 @@ function generate_target_struct(target) { target.defines.OOPSY_OLED_DISPLAY_WIDTH = target.display.dim[0] target.defines.OOPSY_OLED_DISPLAY_HEIGHT = target.display.dim[1] } + + if (target.som == 'patch_sm') { + target.defines.OOPSY_SOM_PATCH_SM = 1 + } return ` #include "daisy_${target.som}.h" @@ -539,10 +543,13 @@ function run() { let valid_soms = ['seed', 'patch_sm']; let som = 'seed'; + let old_json = false; + // configure target: if (!target && !target_path) target = "patch"; if (!target_path) { target_path = path.join(__dirname, `daisy.${target}.json`); + old_json = true; } else { OOPSY_TARGET_SEED = 1 target = path.parse(target_path).name.replace(".", "_") @@ -556,7 +563,6 @@ function run() { const hardware = JSON.parse(fs.readFileSync(target_path, "utf8")); hardware.max_apps = hardware.max_apps || 1 hardware.som = som; - // The following is compatibility code, so that the new JSON structure will generate the old JSON structure // At the point that the old one can be retired (because e.g. Patch, Petal etc can be defined in the new format) // this script should be revised to eliminate the old workflow @@ -612,6 +618,9 @@ function run() { } } + if (old_json) + hardware.defines.OOPSY_OLD_JSON = 1 + for (let alias in hardware.aliases) { let map = hardware.aliases[alias] if (hardware.labels.params[map]) hardware.labels.params[alias] = map @@ -1554,6 +1563,8 @@ function generate_app(app, hardware, target, config) { }); } + let som_or_seed = hardware.defines.OOPSY_OLD_JSON ? 'seed' : 'som'; + const struct = ` struct App_${name} : public oopsy::App { @@ -1576,7 +1587,7 @@ struct App_${name} : public oopsy::App { void init(oopsy::GenDaisy& daisy) { ${ hardware.som == 'seed' - ? `daisy.gen = ${name}::create(daisy.hardware.som.AudioSampleRate(), daisy.hardware.som.AudioBlockSize());` + ? `daisy.gen = ${name}::create(daisy.hardware.${som_or_seed}.AudioSampleRate(), daisy.hardware.${som_or_seed}.AudioBlockSize());` : `daisy.gen = ${name}::create(daisy.hardware.AudioSampleRate(), daisy.hardware.AudioBlockSize());` } ${name}::State& gen = *(${name}::State *)daisy.gen; From 68c833a658de12123d33d39de63f7ee3917604ba Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 29 Nov 2021 14:03:57 -0700 Subject: [PATCH 010/100] Started implementing json2daisy.js --- source/json2daisy.js | 101 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 source/json2daisy.js diff --git a/source/json2daisy.js b/source/json2daisy.js new file mode 100644 index 0000000..5b79b29 --- /dev/null +++ b/source/json2daisy.js @@ -0,0 +1,101 @@ +#!/usr/bin/env node + +// TODO -- we'll reimplement the filter / map stuff here if just for the exclusion capabilities + +const seed_definitions = { + +}; + +const patchsm_definitions = { + +}; + +function generate_header(board_description_object) +{ + let target = board_description_object; + + let components = target.components; + let parents = target.parents || {}; + + for (let comp in parents) + { + parents[comp].is_parent = true; + } + Object.assign(components, components, parents); + + som = target.som || 'seed'; + + let temp_defs = { + seed: seed_definitions, + patch_sm: patchsm_definitions, + }; + + assert(som in temp_defs, `Unkown som "${som}"`); + + definitions = temp_defs[som]; + + target.components = components; + target.name = target.name || 'custom'; + target.aliases = target.aliases || {}; + + if ("display" in target) + { + // shouldn't this only be done if the display property is empty? + target.display = { + driver: "daisy::SSD130x4WireSpi128x64Driver", + config: [], + dim: [128, 64], + }; + + target.defines.OOPSY_TARGET_HAS_OLED = 1; + target.defines.OOPSY_OLED_DISPLAY_WIDTH = target.display.dim[0] + target.defines.OOPSY_OLED_DISPLAY_HEIGHT = target.display.dim[1] + } + + let replacements = {} + replacements.name = target.name; + replacements.som = som; + replacements.external_codecs = target.external_codecs || []; + replacements.som_class = som == 'seed' ? 'daisy::DaisySeed' : 'daisy::patch_sm::DaisyPatchSM'; + + replacements.display_conditional = 'display' in target ? '#include "dev/oled_ssd130x.h' : ''; + replacements.target_name = target.name; // TODO -- redundant? + replacements.init = filter_map_template(components, 'init', 'default', true); + + replacements.cd4021 = filter_map_init(components, 'component', 'CD4021', key_exclude='default', match_exclude=True) + replacements.i2c = filter_map_init(components, 'component', 'i2c', key_exclude='default', match_exclude=True) + replacements.pca9685 = filter_map_init(components, 'component', 'PCA9685', key_exclude='default', match_exclude=True) + replacements.switch = filter_map_init(components, 'component', 'Switch', key_exclude='default', match_exclude=True) + replacements.gatein = filter_map_init(components, 'component', 'GateIn', key_exclude='default', match_exclude=True) + replacements.encoder = filter_map_init(components, 'component', 'Encoder', key_exclude='default', match_exclude=True) + replacements.switch3 = filter_map_init(components, 'component', 'Switch3', key_exclude='default', match_exclude=True) + replacements.analogcount = len(list(filter_matches(components, 'component', ['AnalogControl', 'AnalogControlBipolar', 'CD4051'], key_exclude='default', match_exclude=True))) + + replacements.init_single = filter_map_ctrl(components, 'component', ['AnalogControl', 'AnalogControlBipolar', 'CD4051'], 'init_single', key_exclude='default', match_exclude=True) + replacements.ctrl_init = filter_map_ctrl(components, 'component', ['AnalogControl', 'AnalogControlBipolar'], 'map_init', key_exclude='default', match_exclude=True) + + replacements.ctrl_mux_init = filter_map_init(components, 'component', 'CD4051AnalogControl', key_exclude='default', match_exclude=True) + + replacements.led = filter_map_init(components, 'component', 'Led', key_exclude='default', match_exclude=True) + replacements.rgbled = filter_map_init(components, 'component', 'RgbLed', key_exclude='default', match_exclude=True) + replacements.gateout = filter_map_init(components, 'component', 'GateOut', key_exclude='default', match_exclude=True) + replacements.dachandle = filter_map_init(components, 'component', 'CVOuts', key_exclude='default', match_exclude=True) + + replacements.display = !('display' in target) ? '' : ` + daisy::OledDisplay<${target.display.driver}>::Config display_config; + display_config.driver_config.transport_config.Defaults(); + display.Init(display_config); + display.Fill(0); + display.Update(); + ` + + replacements.process = filter_map_template(components, 'process', key_exclude='default', match_exclude=True) + // There's also this after {process}. I don't see any meta in the defaults json at this time. Is this needed? + // ${components.filter((e) => e.meta).map((e) => e.meta.map(m=>`${template(m, e)}`).join("")).join("")} + replacements.loopprocess = filter_map_template(components, 'loopprocess', key_exclude='default', match_exclude=True) + + replacements.postprocess = filter_map_template(components, 'postprocess', key_exclude='default', match_exclude=True) + replacements.displayprocess = filter_map_template(components, 'display', key_exclude='default', match_exclude=True) + replacements.hidupdaterates = filter_map_template(components, 'updaterate', key_exclude='default', match_exclude=True) + +} \ No newline at end of file From a81711bb14712930f34e02ebb304e7ec9c8e1044 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Wed, 1 Dec 2021 11:04:05 -0700 Subject: [PATCH 011/100] Fleshed out json2daisy.js --- source/json2daisy.js | 387 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 366 insertions(+), 21 deletions(-) diff --git a/source/json2daisy.js b/source/json2daisy.js index 5b79b29..0dd3f92 100644 --- a/source/json2daisy.js +++ b/source/json2daisy.js @@ -2,6 +2,10 @@ // TODO -- we'll reimplement the filter / map stuff here if just for the exclusion capabilities +const { assert } = require("console"); + +var global_definitions; + const seed_definitions = { }; @@ -10,6 +14,215 @@ const patchsm_definitions = { }; +function generateCodecs(external_codecs) +{ + codec_string = ` + // External Codec Initialization + daisy::SaiHandle::Config sai_config[${1 + external_codecs.length}]; + + // Internal Codec + sai_config[0].periph = daisy::SaiHandle::Config::Peripheral::SAI_1; + sai_config[0].sr = daisy::SaiHandle::Config::SampleRate::SAI_48KHZ; + sai_config[0].bit_depth = daisy::SaiHandle::Config::BitDepth::SAI_24BIT; + sai_config[0].a_sync = daisy::SaiHandle::Config::Sync::MASTER; + sai_config[0].b_sync = daisy::SaiHandle::Config::Sync::SLAVE; + sai_config[0].a_dir = daisy::SaiHandle::Config::Direction::TRANSMIT; + sai_config[0].b_dir = daisy::SaiHandle::Config::Direction::RECEIVE; + sai_config[0].pin_config.fs = {DSY_GPIOE, 4}; + sai_config[0].pin_config.mclk = {DSY_GPIOE, 2}; + sai_config[0].pin_config.sck = {DSY_GPIOE, 5}; + sai_config[0].pin_config.sa = {DSY_GPIOE, 6}; + sai_config[0].pin_config.sb = {DSY_GPIOE, 3}; + ` + + for (let i = 0; i < external_codecs.length; i++) + { + codec_string += ` + sai_config[${i + 1}].periph = daisy::SaiHandle::Config::Peripheral::${external_codecs[i].periph}; + sai_config[${i + 1}].sr = daisy::SaiHandle::Config::SampleRate::SAI_48KHZ; + sai_config[${i + 1}].bit_depth = daisy::SaiHandle::Config::BitDepth::SAI_24BIT; + sai_config[${i + 1}].a_sync = daisy::SaiHandle::Config::Sync::${external_codecs[i].a_sync}; + sai_config[${i + 1}].b_sync = daisy::SaiHandle::Config::Sync::${external_codecs[i].b_sync}; + sai_config[${i + 1}].a_dir = daisy::SaiHandle::Config::Direction::${external_codecs[i].a_dir}; + sai_config[${i + 1}].b_dir = daisy::SaiHandle::Config::Direction::${external_codecs[i].b_dir}; + sai_config[${i + 1}].pin_config.fs = som.GetPin(${external_codecs[i].pin.fs}); + sai_config[${i + 1}].pin_config.mclk = som.GetPin(${external_codecs[i].pin.mclk}); + sai_config[${i + 1}].pin_config.sck = som.GetPin(${external_codecs[i].pin.sck}); + sai_config[${i + 1}].pin_config.sa = som.GetPin(${external_codecs[i].pin.sa}); + sai_config[${i + 1}].pin_config.sb = som.GetPin(${external_codecs[i].pin.sb}); + `; + } + + codec_string += ` + daisy::SaiHandle sai_handle[${external_codecs.length + 1}]; + sai_handle[0].Init(sai_config[0]); + `; + + for (let i = 0; i < external_codecs.length; i++) + { + codec_string += ` + sai_handle[${i + 1}].Init(sai_config[${i + 1}]); + `; + } + + codec_string += ` + dsy_gpio_pin codec_reset_pin = som.GetPin(29); + daisy::Ak4556::Init(codec_reset_pin); + + daisy::AudioHandle::Config cfg; + cfg.blocksize = 48; + cfg.samplerate = daisy::SaiHandle::Config::SampleRate::SAI_48KHZ; + cfg.postgain = 0.5f; + som.audio_handle.Init( + cfg, + sai_handle[0] + `; + + for (let i = 0; i < external_codecs.length; i++) + { + if (i < external_codecs.length - 1) + codec_string += ",\n "; + codec_string += `sai_handle[${i + 1}]`; + } + + codec_string += ` + ); + `; + + return codec_string; +} + +function stringFormatMap(template, formatMap) +{ + const format_match = /{\s*([^{}\s]*)\s*}/g; + const open_curly = /{{/g; + const close_curly = /}}/g; + let pass1 = template.replace(open_curly, () => { + return '{' + }); + let pass2 = pass1.replace(close_curly, () => { + return '}' + }); + let pass3 = pass2.replace(format_match, (substring, value, index) => { + return formatMap[value] || ''; + }); + return pass3; +} + +function map_load(key_item) +{ + key = key_item[0] + item = key_item[1] + + item.name = key; + component = global_definitions[item.component] || undefined; + assert(component !== undefined, `Undefined component kind "${item.component}"`); + for (property in component) + { + if (!(property in item)) + item[property] = component[property]; + } + + return item; +} + +function filter_match(sequence, key, match, key_exclude = null, match_exclude = null) +{ + if (key_exclude !== null && match_exclude !== null) + { + return sequence.filter(item => key in item && key == match && (!(key_exclude in item) || (key_exclude in item && key_exclude != match_exclude))); + } + else + return sequence.filter(item => key in item && key == match); +} + +function filter_matches(set, key, matches, key_exclude=null, match_exclude=null) +{ + if (key_exclude !== null && match_exclude !== null) + { + return sequence.filter(item => { + let items_key = item[key] || ''; + let items_key_exclude = item[key_exclude] || ''; + return matches.includes(items_key) && items_key_exclude != match_exclude; + }); + } + else + { + return sequence.filter(item => { + let items_key = item[key] || ''; + return matches.includes(items_key); + }); + } +} + +function filter_has(set, key, key_exclude=null, match_exclude=null) +{ + if (key_exclude !== null && match_exclude !== null) + { + return sequence.filter(item => { + let items_key_exclude = item[key_exclude] || ''; + return key in item && items_key_exclude != match_exclude; + }); + } + else + { + return sequence.filter(item => key in item); + } +} + +function filter_map_init(set, key, match, key_exclude=null, match_exclude=null) +{ + filtered = filter_match(set, key, match, key_exclude, match_exclude); + return filtered.map(item => stringFormatMap(item.map_init, item)).join("\n "); +} + +function filter_map_set(set, key, match, key_exclude=null, match_exclude=null) +{ + filtered = filter_match(set, key, match, key_exclude, match_exclude); + return filtered.map(item => stringFormatMap(stringFormatMap(item.mapping[0].set, item.mapping[0].name, item))).join("\n "); +} + +function filter_map_ctrl(set, key, matches, init_key, key_exclude=null, match_exclude=null) +{ + set = filter_matches(set, key, matches, key_exclude, match_exclude); + set = set.map((item, i) => Object.assign(item, item, {i: i})); + return set.map(item => stringFormatMap(item[init_key], item)).join("\n "); +} + +function filter_map_template(set, name, key_exclude=null, match_exclude=null) +{ + filtered = filter_has(set, name, key_exclude, match_exclude); + return filtered.map(item => stringFormatMap(item.name, item)).join("\n "); +} + +function flatten_pin_dicts(comp) +{ + flattened = {}; + Object.assign(flattened, comp); // maybe not actually necessary to copy + if ('pin' in comp && typeof comp.pin === 'object') + { + for (property in comp.pin) + { + flattened[`pin_${property}`] = comp.pin[property]; + } + } + return flattened; +} + +function flatten_index_dicts(comp) +{ + flattened = {}; + Object.assign(flattened, comp); // maybe not actually necessary to copy + if ('index' in comp && typeof comp.pin === 'object') + { + for (property in comp.pin) + { + flattened[`index_${property}`] = comp.pin[property]; + } + } + return flattened; +} + function generate_header(board_description_object) { let target = board_description_object; @@ -33,6 +246,7 @@ function generate_header(board_description_object) assert(som in temp_defs, `Unkown som "${som}"`); definitions = temp_defs[som]; + global_definitions = definitions; target.components = components; target.name = target.name || 'custom'; @@ -62,24 +276,24 @@ function generate_header(board_description_object) replacements.target_name = target.name; // TODO -- redundant? replacements.init = filter_map_template(components, 'init', 'default', true); - replacements.cd4021 = filter_map_init(components, 'component', 'CD4021', key_exclude='default', match_exclude=True) - replacements.i2c = filter_map_init(components, 'component', 'i2c', key_exclude='default', match_exclude=True) - replacements.pca9685 = filter_map_init(components, 'component', 'PCA9685', key_exclude='default', match_exclude=True) - replacements.switch = filter_map_init(components, 'component', 'Switch', key_exclude='default', match_exclude=True) - replacements.gatein = filter_map_init(components, 'component', 'GateIn', key_exclude='default', match_exclude=True) - replacements.encoder = filter_map_init(components, 'component', 'Encoder', key_exclude='default', match_exclude=True) - replacements.switch3 = filter_map_init(components, 'component', 'Switch3', key_exclude='default', match_exclude=True) - replacements.analogcount = len(list(filter_matches(components, 'component', ['AnalogControl', 'AnalogControlBipolar', 'CD4051'], key_exclude='default', match_exclude=True))) + replacements.cd4021 = filter_map_init(components, 'component', 'CD4021', key_exclude='default', match_exclude=True); + replacements.i2c = filter_map_init(components, 'component', 'i2c', key_exclude='default', match_exclude=True); + replacements.pca9685 = filter_map_init(components, 'component', 'PCA9685', key_exclude='default', match_exclude=True); + replacements.switch = filter_map_init(components, 'component', 'Switch', key_exclude='default', match_exclude=True); + replacements.gatein = filter_map_init(components, 'component', 'GateIn', key_exclude='default', match_exclude=True); + replacements.encoder = filter_map_init(components, 'component', 'Encoder', key_exclude='default', match_exclude=True); + replacements.switch3 = filter_map_init(components, 'component', 'Switch3', key_exclude='default', match_exclude=True); + replacements.analogcount = filter_matches(components, 'component', ['AnalogControl', 'AnalogControlBipolar', 'CD4051'], key_exclude='default', match_exclude=True).length; - replacements.init_single = filter_map_ctrl(components, 'component', ['AnalogControl', 'AnalogControlBipolar', 'CD4051'], 'init_single', key_exclude='default', match_exclude=True) - replacements.ctrl_init = filter_map_ctrl(components, 'component', ['AnalogControl', 'AnalogControlBipolar'], 'map_init', key_exclude='default', match_exclude=True) + replacements.init_single = filter_map_ctrl(components, 'component', ['AnalogControl', 'AnalogControlBipolar', 'CD4051'], 'init_single', key_exclude='default', match_exclude=True); + replacements.ctrl_init = filter_map_ctrl(components, 'component', ['AnalogControl', 'AnalogControlBipolar'], 'map_init', key_exclude='default', match_exclude=True); - replacements.ctrl_mux_init = filter_map_init(components, 'component', 'CD4051AnalogControl', key_exclude='default', match_exclude=True) + replacements.ctrl_mux_init = filter_map_init(components, 'component', 'CD4051AnalogControl', key_exclude='default', match_exclude=True); - replacements.led = filter_map_init(components, 'component', 'Led', key_exclude='default', match_exclude=True) - replacements.rgbled = filter_map_init(components, 'component', 'RgbLed', key_exclude='default', match_exclude=True) - replacements.gateout = filter_map_init(components, 'component', 'GateOut', key_exclude='default', match_exclude=True) - replacements.dachandle = filter_map_init(components, 'component', 'CVOuts', key_exclude='default', match_exclude=True) + replacements.led = filter_map_init(components, 'component', 'Led', key_exclude='default', match_exclude=True); + replacements.rgbled = filter_map_init(components, 'component', 'RgbLed', key_exclude='default', match_exclude=True); + replacements.gateout = filter_map_init(components, 'component', 'GateOut', key_exclude='default', match_exclude=True); + replacements.dachandle = filter_map_init(components, 'component', 'CVOuts', key_exclude='default', match_exclude=True); replacements.display = !('display' in target) ? '' : ` daisy::OledDisplay<${target.display.driver}>::Config display_config; @@ -87,15 +301,146 @@ function generate_header(board_description_object) display.Init(display_config); display.Fill(0); display.Update(); - ` + `; - replacements.process = filter_map_template(components, 'process', key_exclude='default', match_exclude=True) + replacements.process = filter_map_template(components, 'process', key_exclude='default', match_exclude=True); // There's also this after {process}. I don't see any meta in the defaults json at this time. Is this needed? // ${components.filter((e) => e.meta).map((e) => e.meta.map(m=>`${template(m, e)}`).join("")).join("")} - replacements.loopprocess = filter_map_template(components, 'loopprocess', key_exclude='default', match_exclude=True) + replacements.loopprocess = filter_map_template(components, 'loopprocess', key_exclude='default', match_exclude=True); + + replacements.postprocess = filter_map_template(components, 'postprocess', key_exclude='default', match_exclude=True); + replacements.displayprocess = filter_map_template(components, 'display', key_exclude='default', match_exclude=True); + replacements.hidupdaterates = filter_map_template(components, 'updaterate', key_exclude='default', match_exclude=True); + + component_decls = components.filter(item => item.default || false); + component_decls = component_decls.filter(item => 'typename' in item); + replacements.comps = component_decls.map(item => `${stringFormatMap(item.typename, item)} ${item.name}`).join(";\n ") + ';'; + non_class_decls = component_decls.filter(item => 'non_class_decl' in item); + replacements.non_class_declarations = non_class_decls.map(item => stringFormatMap(item.non_class_decl, item)).join("\n"); + + replacements.dispdec = 'display' in target ? `daisy::OledDisplay<${target.display.driver}> display;` : ""; + + return ` +#ifndef __JSON2DAISY_${replacements.name.toUpperCase()}_H__ +#define __JSON2DAISY_${replacements.name.toUpperCase()}_H__ + +#include "daisy_${replacements.som}" +${replacements.som == 'seed' ? '#include "dev/codec_ak4556.h"' : ''} + +#define ANALOG_COUNT ${replacements.analogcount} + +namespace json2daisy { + +${replacements.non_class_declarations} + +struct Daisy${replacements.name[0].toUpperCase()}${replacements.name.slice(1)} { + + /** Initializes the board according to the JSON board description + * \\param boost boosts the clock speed from 400 to 480 MHz + */ + void Init(bool boost=true) + { + ${replacements.som == 'seed' ? `som.Configure(); + som.Init(boost);` : `som.Init();`} + ${replacements.init} + ${replacements.i2c != '' ? ' // i2c\n ' + replacements.i2c : ''} + ${replacements.pca9685 != '' ? ' // LED Drivers\n ' + replacements.pca9685 : ''} + ${replacements.switch != '' ? ' // Switches\n ' + replacements.switch : ''} + ${replacements.switch3 != '' ? ' // SPDT Switches\n ' + replacements.switch3 : ''} + ${replacements.cd4021 != '' ? ' // Muxes\n ' + replacements.cd4021 : ''} + ${replacements.gatein != '' ? ' // Gate ins\n ' + replacements.gatein : ''} + ${replacements.encoder != '' ? ' // Rotary encoders\n ' + replacements.encoder : ''} + ${replacements.init_single != '' ? ' // Single channel ADC initialization\n ' + replacements.init_single : ''} + ${replacements.som == 'seed' ? 'som.adc.Init(cfg, ANALOG_COUNT);' : ''} + ${replacements.ctrl_init != '' ? ' // AnalogControl objects\n ' + replacements.ctrl_init : ''} + ${replacements.ctrl_mux_init != '' ? ' // Multiplexed AnlogControl objects\n ' + replacements.ctrl_mux_init : ''} + ${replacements.led != '' ? ' // LEDs\n ' + replacements.led : ''} + ${replacements.rgbled != '' ? ' // RBG LEDs \n ' + replacements.rgbled : ''} + ${replacements.gateout != '' ? ' // Gate outs\n ' + replacements.gateout : ''} + ${replacements.dachandle != '' ? ' // DAC\n ' + replacements.dachandle : ''} + ${replacements.display != '' ? ' // Display\n ' + replacements.display : ''} + + ${som == 'seed' && replacements.external_codecs.length == 0 ? '' : generateCodecs(replacements.external_codecs)} + + ${replacements.som == 'seed' ? ' som.adc.Start();' : ''} + } + + /** Handles all the controls processing that needs to occur at the block rate + * + */ + void ProcessAllControls() + { + ${replacements.process} + ${replacements.som == 'patch_sm' ? 'som.ProcessAllControls();' : ''} + } + + /** Handles all the maintenance processing. This should be run last within the audio callback. + * + */ + void PostProcess() + { + ${replacements.postprocess} + } + + /** Handles processing that shouldn't occur in the audio block, such as blocking transfers + * + */ + void LoopProcess() + { + ${replacements.loopprocess} + } + + /** Sets the audio sample rate + * \\param sample_rate the new sample rate in Hz + */ + void SetAudioSampleRate(size_t sample_rate) + { + ${som == 'patch_sm' ? 'som.SetAudioSampleRate(sample_rate);' : + `daisy::SaiHandle::Config::SampleRate enum_rate; + if (sample_rate >= 96000) + enum_rate = daisy::SaiHandle::Config::SampleRate::SAI_96KHZ; + else if (sample_rate >= 48000) + enum_rate = daisy::SaiHandle::Config::SampleRate::SAI_48KHZ; + else if (sample_rate >= 32000) + enum_rate = daisy::SaiHandle::Config::SampleRate::SAI_32KHZ; + else if (sample_rate >= 16000) + enum_rate = daisy::SaiHandle::Config::SampleRate::SAI_16KHZ; + else + enum_rate = daisy::SaiHandle::Config::SampleRate::SAI_8KHZ; + som.SetAudioSampleRate(enum_rate); + `} + ${replacements.hidupdaterates} + } + + /** Sets the audio block size + * \\param block_size the new block size in words + */ + inline void SetAudioBlockSize(size_t block_size) + { + som.SetAudioBlockSize(block_size); + } + + /** Starts up the audio callback process with the given callback + * + */ + inline void StartAudio(daisy::AudioHandle::AudioCallback cb) + { + som.StartAudio(cb); + } + + /** This is the board's "System On Module" + */ + ${replacements.som_class} som; + ${replacements.som == 'seed' ? 'daisy::AdcChannelConfig cfg[ANALOG_COUNT]' : ''} + + // I/O Components + ${replacements.comps} + ${replacements.dispdec} +}; + +} // namespace json2daisy - replacements.postprocess = filter_map_template(components, 'postprocess', key_exclude='default', match_exclude=True) - replacements.displayprocess = filter_map_template(components, 'display', key_exclude='default', match_exclude=True) - replacements.hidupdaterates = filter_map_template(components, 'updaterate', key_exclude='default', match_exclude=True) +#endif // __JSON2DAISY_${replacements.name.toUpperCase()}_H__ +`; } \ No newline at end of file From 9793fc9e7f1c0fad2f8d2d2335eb3d0728e294d7 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Wed, 1 Dec 2021 11:39:08 -0700 Subject: [PATCH 012/100] Added proper return object --- source/json2daisy.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/source/json2daisy.js b/source/json2daisy.js index 0dd3f92..f515247 100644 --- a/source/json2daisy.js +++ b/source/json2daisy.js @@ -320,7 +320,7 @@ function generate_header(board_description_object) replacements.dispdec = 'display' in target ? `daisy::OledDisplay<${target.display.driver}> display;` : ""; - return ` + let header = ` #ifndef __JSON2DAISY_${replacements.name.toUpperCase()}_H__ #define __JSON2DAISY_${replacements.name.toUpperCase()}_H__ @@ -443,4 +443,17 @@ struct Daisy${replacements.name[0].toUpperCase()}${replacements.name.slice(1)} { #endif // __JSON2DAISY_${replacements.name.toUpperCase()}_H__ `; + let audio_info = target.audio || null; + let audio_channels = audio_info != null ? audio_info.channels || 2 : 2; + + let board_info = { + header: header, + name: target.name, + components: components, + aliases: target.aliases, + channels: audio_channels + }; + + return board_info; + } \ No newline at end of file From cd6a785d551eff7c4040ba2c0929b8c85e218a51 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Wed, 1 Dec 2021 14:40:38 -0700 Subject: [PATCH 013/100] Corrected object vs array operations --- source/json2daisy.js | 119 +++++++++++++++++++++++-------------------- 1 file changed, 64 insertions(+), 55 deletions(-) diff --git a/source/json2daisy.js b/source/json2daisy.js index f515247..c7a9e5a 100644 --- a/source/json2daisy.js +++ b/source/json2daisy.js @@ -2,17 +2,17 @@ // TODO -- we'll reimplement the filter / map stuff here if just for the exclusion capabilities -const { assert } = require("console"); +const assert = require("assert"); +const path = require("path"); +const seed_defs = require(path.join(__dirname, "component_defs.json")); +const patchsm_defs = require(path.join(__dirname, "component_defs_patchsm.json")); var global_definitions; -const seed_definitions = { - -}; - -const patchsm_definitions = { - -}; +// .filter for objects that returns array +Object.filter = (obj, predicate) => + Object.keys(obj).filter(key => predicate(obj[key])) + .map(key => obj[key]); function generateCodecs(external_codecs) { @@ -94,6 +94,8 @@ function generateCodecs(external_codecs) function stringFormatMap(template, formatMap) { + if (typeof template === 'undefined') + return ''; const format_match = /{\s*([^{}\s]*)\s*}/g; const open_curly = /{{/g; const close_curly = /}}/g; @@ -109,14 +111,14 @@ function stringFormatMap(template, formatMap) return pass3; } -function map_load(key_item) -{ - key = key_item[0] - item = key_item[1] +exports.format_map = stringFormatMap; +function map_load(key, item) +{ item.name = key; - component = global_definitions[item.component] || undefined; - assert(component !== undefined, `Undefined component kind "${item.component}"`); + assert(item.component in global_definitions, `Undefined component kind "${item.component}"`); + component = global_definitions[item.component]; + for (property in component) { if (!(property in item)) @@ -130,17 +132,17 @@ function filter_match(sequence, key, match, key_exclude = null, match_exclude = { if (key_exclude !== null && match_exclude !== null) { - return sequence.filter(item => key in item && key == match && (!(key_exclude in item) || (key_exclude in item && key_exclude != match_exclude))); + return Object.filter(sequence, item => key in item && key == match && (!(key_exclude in item) || (key_exclude in item && key_exclude != match_exclude))); } else - return sequence.filter(item => key in item && key == match); + return Object.filter(sequence, item => key in item && key == match); } -function filter_matches(set, key, matches, key_exclude=null, match_exclude=null) +function filter_matches(sequence, key, matches, key_exclude=null, match_exclude=null) { if (key_exclude !== null && match_exclude !== null) { - return sequence.filter(item => { + return Object.filter(sequence, item => { let items_key = item[key] || ''; let items_key_exclude = item[key_exclude] || ''; return matches.includes(items_key) && items_key_exclude != match_exclude; @@ -148,25 +150,25 @@ function filter_matches(set, key, matches, key_exclude=null, match_exclude=null) } else { - return sequence.filter(item => { + return Object.filter(sequence, item => { let items_key = item[key] || ''; return matches.includes(items_key); }); } } -function filter_has(set, key, key_exclude=null, match_exclude=null) +function filter_has(sequence, key, key_exclude=null, match_exclude=null) { if (key_exclude !== null && match_exclude !== null) { - return sequence.filter(item => { + return Object.filter(sequence, item => { let items_key_exclude = item[key_exclude] || ''; return key in item && items_key_exclude != match_exclude; }); } else { - return sequence.filter(item => key in item); + return Object.filter(sequence, item => key in item); } } @@ -223,7 +225,7 @@ function flatten_index_dicts(comp) return flattened; } -function generate_header(board_description_object) +exports.generate_header = function generate_header(board_description_object) { let target = board_description_object; @@ -239,8 +241,8 @@ function generate_header(board_description_object) som = target.som || 'seed'; let temp_defs = { - seed: seed_definitions, - patch_sm: patchsm_definitions, + seed: seed_defs, + patch_sm: patchsm_defs, }; assert(som in temp_defs, `Unkown som "${som}"`); @@ -248,6 +250,13 @@ function generate_header(board_description_object) definitions = temp_defs[som]; global_definitions = definitions; + for (let comp in components) + { + components[comp] = map_load(comp, components[comp]); + components[comp] = flatten_pin_dicts(components[comp]); + components[comp] = flatten_index_dicts(components[comp]); + } + target.components = components; target.name = target.name || 'custom'; target.aliases = target.aliases || {}; @@ -274,26 +283,26 @@ function generate_header(board_description_object) replacements.display_conditional = 'display' in target ? '#include "dev/oled_ssd130x.h' : ''; replacements.target_name = target.name; // TODO -- redundant? - replacements.init = filter_map_template(components, 'init', 'default', true); - - replacements.cd4021 = filter_map_init(components, 'component', 'CD4021', key_exclude='default', match_exclude=True); - replacements.i2c = filter_map_init(components, 'component', 'i2c', key_exclude='default', match_exclude=True); - replacements.pca9685 = filter_map_init(components, 'component', 'PCA9685', key_exclude='default', match_exclude=True); - replacements.switch = filter_map_init(components, 'component', 'Switch', key_exclude='default', match_exclude=True); - replacements.gatein = filter_map_init(components, 'component', 'GateIn', key_exclude='default', match_exclude=True); - replacements.encoder = filter_map_init(components, 'component', 'Encoder', key_exclude='default', match_exclude=True); - replacements.switch3 = filter_map_init(components, 'component', 'Switch3', key_exclude='default', match_exclude=True); - replacements.analogcount = filter_matches(components, 'component', ['AnalogControl', 'AnalogControlBipolar', 'CD4051'], key_exclude='default', match_exclude=True).length; - - replacements.init_single = filter_map_ctrl(components, 'component', ['AnalogControl', 'AnalogControlBipolar', 'CD4051'], 'init_single', key_exclude='default', match_exclude=True); - replacements.ctrl_init = filter_map_ctrl(components, 'component', ['AnalogControl', 'AnalogControlBipolar'], 'map_init', key_exclude='default', match_exclude=True); - - replacements.ctrl_mux_init = filter_map_init(components, 'component', 'CD4051AnalogControl', key_exclude='default', match_exclude=True); - - replacements.led = filter_map_init(components, 'component', 'Led', key_exclude='default', match_exclude=True); - replacements.rgbled = filter_map_init(components, 'component', 'RgbLed', key_exclude='default', match_exclude=True); - replacements.gateout = filter_map_init(components, 'component', 'GateOut', key_exclude='default', match_exclude=True); - replacements.dachandle = filter_map_init(components, 'component', 'CVOuts', key_exclude='default', match_exclude=True); + replacements.init = filter_map_template(components, 'init', 'is_default', true); + + replacements.cd4021 = filter_map_init(components, 'component', 'CD4021', key_exclude='is_default', match_exclude=true); + replacements.i2c = filter_map_init(components, 'component', 'i2c', key_exclude='is_default', match_exclude=true); + replacements.pca9685 = filter_map_init(components, 'component', 'PCA9685', key_exclude='is_default', match_exclude=true); + replacements.switch = filter_map_init(components, 'component', 'Switch', key_exclude='is_default', match_exclude=true); + replacements.gatein = filter_map_init(components, 'component', 'GateIn', key_exclude='is_default', match_exclude=true); + replacements.encoder = filter_map_init(components, 'component', 'Encoder', key_exclude='is_default', match_exclude=true); + replacements.switch3 = filter_map_init(components, 'component', 'Switch3', key_exclude='is_default', match_exclude=true); + replacements.analogcount = filter_matches(components, 'component', ['AnalogControl', 'AnalogControlBipolar', 'CD4051'], key_exclude='is_default', match_exclude=true).length; + + replacements.init_single = filter_map_ctrl(components, 'component', ['AnalogControl', 'AnalogControlBipolar', 'CD4051'], 'init_single', key_exclude='is_default', match_exclude=true); + replacements.ctrl_init = filter_map_ctrl(components, 'component', ['AnalogControl', 'AnalogControlBipolar'], 'map_init', key_exclude='is_default', match_exclude=true); + + replacements.ctrl_mux_init = filter_map_init(components, 'component', 'CD4051AnalogControl', key_exclude='is_default', match_exclude=true); + + replacements.led = filter_map_init(components, 'component', 'Led', key_exclude='is_default', match_exclude=true); + replacements.rgbled = filter_map_init(components, 'component', 'RgbLed', key_exclude='is_default', match_exclude=true); + replacements.gateout = filter_map_init(components, 'component', 'GateOut', key_exclude='is_default', match_exclude=true); + replacements.dachandle = filter_map_init(components, 'component', 'CVOuts', key_exclude='is_default', match_exclude=true); replacements.display = !('display' in target) ? '' : ` daisy::OledDisplay<${target.display.driver}>::Config display_config; @@ -303,19 +312,19 @@ function generate_header(board_description_object) display.Update(); `; - replacements.process = filter_map_template(components, 'process', key_exclude='default', match_exclude=True); + replacements.process = filter_map_template(components, 'process', key_exclude='is_default', match_exclude=true); // There's also this after {process}. I don't see any meta in the defaults json at this time. Is this needed? // ${components.filter((e) => e.meta).map((e) => e.meta.map(m=>`${template(m, e)}`).join("")).join("")} - replacements.loopprocess = filter_map_template(components, 'loopprocess', key_exclude='default', match_exclude=True); + replacements.loopprocess = filter_map_template(components, 'loopprocess', key_exclude='is_default', match_exclude=true); - replacements.postprocess = filter_map_template(components, 'postprocess', key_exclude='default', match_exclude=True); - replacements.displayprocess = filter_map_template(components, 'display', key_exclude='default', match_exclude=True); - replacements.hidupdaterates = filter_map_template(components, 'updaterate', key_exclude='default', match_exclude=True); + replacements.postprocess = filter_map_template(components, 'postprocess', key_exclude='is_default', match_exclude=true); + replacements.displayprocess = filter_map_template(components, 'display', key_exclude='is_default', match_exclude=true); + replacements.hidupdaterates = filter_map_template(components, 'updaterate', key_exclude='is_default', match_exclude=true); - component_decls = components.filter(item => item.default || false); - component_decls = component_decls.filter(item => 'typename' in item); + component_decls = Object.filter(components, item => item.default || false); + component_decls = Object.filter(component_decls, item => 'typename' in item); replacements.comps = component_decls.map(item => `${stringFormatMap(item.typename, item)} ${item.name}`).join(";\n ") + ';'; - non_class_decls = component_decls.filter(item => 'non_class_decl' in item); + non_class_decls = Object.filter(component_decls, item => 'non_class_decl' in item); replacements.non_class_declarations = non_class_decls.map(item => stringFormatMap(item.non_class_decl, item)).join("\n"); replacements.dispdec = 'display' in target ? `daisy::OledDisplay<${target.display.driver}> display;` : ""; @@ -324,7 +333,7 @@ function generate_header(board_description_object) #ifndef __JSON2DAISY_${replacements.name.toUpperCase()}_H__ #define __JSON2DAISY_${replacements.name.toUpperCase()}_H__ -#include "daisy_${replacements.som}" +#include "daisy_${replacements.som}.h" ${replacements.som == 'seed' ? '#include "dev/codec_ak4556.h"' : ''} #define ANALOG_COUNT ${replacements.analogcount} @@ -360,7 +369,7 @@ struct Daisy${replacements.name[0].toUpperCase()}${replacements.name.slice(1)} { ${replacements.dachandle != '' ? ' // DAC\n ' + replacements.dachandle : ''} ${replacements.display != '' ? ' // Display\n ' + replacements.display : ''} - ${som == 'seed' && replacements.external_codecs.length == 0 ? '' : generateCodecs(replacements.external_codecs)} + ${replacements.external_codecs.length == 0 ? '' : generateCodecs(replacements.external_codecs)} ${replacements.som == 'seed' ? ' som.adc.Start();' : ''} } From a424cf15412e8687ccbd289c820e5a518a7d9283 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Wed, 1 Dec 2021 14:40:54 -0700 Subject: [PATCH 014/100] Added component definition json from json2daisy --- source/component_defs.json | 399 +++++++++++++++++++++++++++++ source/component_defs_patchsm.json | 248 ++++++++++++++++++ 2 files changed, 647 insertions(+) create mode 100644 source/component_defs.json create mode 100644 source/component_defs_patchsm.json diff --git a/source/component_defs.json b/source/component_defs.json new file mode 100644 index 0000000..25034de --- /dev/null +++ b/source/component_defs.json @@ -0,0 +1,399 @@ +{ + "Switch": { + "map_init": "{name}.Init(som.GetPin({pin}), som.AudioCallbackRate(), {type}, {polarity}, {pull});", + "typename": "daisy::Switch", + "direction": "in", + "pin": "a", + "type": "daisy::Switch::TYPE_MOMENTARY", + "polarity": "daisy::Switch::POLARITY_INVERTED", + "pull": "daisy::Switch::PULL_UP", + "process": "{name}.Debounce();", + "updaterate": "{name}.SetUpdateRate(som.AudioCallbackRate());", + "mapping": [ + { + "name": "{name}_press", + "get": "({class_name}.{name}.Pressed()?1.f:0.f)", + "range": [ + 0, + 1 + ], + "bool": false + }, + { + "name": "{name}", + "get": "({class_name}.{name}.RisingEdge()?1.f:0.f)", + "range": [ + 0, + 1 + ], + "bool": true + }, + { + "name": "{name}_fall", + "get": "({class_name}.{name}.FallingEdge()?1.f:0.f)", + "range": [ + 0, + 1 + ], + "bool": true + }, + { + "name": "{name}_seconds", + "get": "({class_name}.{name}.TimeHeldMs()*0.001f)", + "range": null, + "bool": false + } + ] + }, + "Switch3": { + "map_init": "{name}.Init(som.GetPin({pin_a}), som.GetPin({pin_b}));", + "typename": "daisy::Switch3", + "direction": "in", + "pin": "a,b", + "mapping": [ + { + "name": "{name}", + "get": "({class_name}.{name}.Read()*0.5f+0.5f)", + "range": [ + 0, + 2 + ], + "bool": false + } + ] + }, + "Encoder": { + "map_init": "{name}.Init(som.GetPin({pin_a}), som.GetPin({pin_b}), som.GetPin({pin_click}), som.AudioCallbackRate());", + "typename": "daisy::Encoder", + "direction": "in", + "pin": "a,b,click", + "process": "{name}.Debounce();", + "updaterate": "{name}.SetUpdateRate(som.AudioCallbackRate());", + "mapping": [ + { + "name": "{name}", + "get": "({class_name}.{name}.Increment())", + "range": [ + -1, + 1 + ], + "bool": false + }, + { + "name": "{name}_press", + "get": "({class_name}.{name}.Pressed()?1.f:0.f)", + "range": [ + 0, + 1 + ], + "bool": false + }, + { + "name": "{name}_rise", + "get": "({class_name}.{name}.RisingEdge()?1.f:0.f)", + "range": [ + 0, + 1 + ], + "bool": true + }, + { + "name": "{name}_fall", + "get": "({class_name}.{name}.FallingEdge()?1.f:0.f)", + "range": [ + 0, + 1 + ], + "bool": true + }, + { + "name": "{name}_seconds", + "get": "({class_name}.{name}.TimeHeldMs()*0.001f)", + "range": null, + "bool": false + } + ] + }, + "GateIn": { + "map_init": "dsy_gpio_pin {name}_pin = som.GetPin({pin});\n {name}.Init(&{name}_pin);", + "typename": "daisy::GateIn", + "direction": "in", + "pin": "a", + "mapping": [ + { + "name": "{name}", + "get": "({class_name}.{name}.State()?1.f:0.f)", + "range": [ + 0, + 1 + ], + "bool": false + }, + { + "name": "{name}_trig", + "get": "({class_name}.{name}.Trig()?1.f:0.f)", + "range": [ + 0, + 1 + ], + "bool": true + } + ] + }, + "AnalogControl": { + "init_single": "cfg[{i}].InitSingle(som.GetPin({pin}));", + "map_init": "{name}.Init(som.adc.GetPtr({i}), som.AudioCallbackRate(), {flip}, {invert});", + "typename": "daisy::AnalogControl", + "direction": "in", + "pin": "a", + "flip": "false", + "invert": "false", + "slew": "1.0/som.AudioCallbackRate()", + "process": "{name}.Process();", + "updaterate": "{name}.SetSampleRate(som.AudioCallbackRate());", + "mapping": [ + { + "name": "{name}", + "get": "({class_name}.{name}.Value())", + "range": [ + 0, + 1 + ], + "bool": false + } + ] + }, + "Led": { + "map_init": "{name}.Init(som.GetPin({pin}), {invert});\n {name}.Set(0.0f);", + "typename": "daisy::Led", + "direction": "out", + "pin": "a", + "invert": "true", + "postprocess": "{name}.Update();", + "mapping": [ + { + "name": "{name}", + "set": "{class_name}.{name}.Set({value});" + } + ] + }, + "RgbLed": { + "map_init": "{name}.Init(som.GetPin({pin_r}), som.GetPin({pin_g}), som.GetPin({pin_b}), {invert});\n {name}.Set(0.0f, 0.0f, 0.0f);", + "typename": "daisy::RgbLed", + "direction": "out", + "pin": "r,g,b", + "invert": "true", + "postprocess": "{name}.Update();", + "mapping": [ + { + "name": "{name}_red", + "set": "{class_name}.{name}.SetRed({value});" + }, + { + "name": "{name}_green", + "set": "{class_name}.{name}.SetGreen({value});" + }, + { + "name": "{name}_blue", + "set": "{class_name}.{name}.SetBlue({value});" + }, + { + "name": "{name}", + "set": "{class_name}.{name}.Set(clamp(-{value}, 0.f, 1.f), 0.f, clamp({value}, 0.f, 1.f));" + }, + { + "name": "{name}_white", + "set": "{class_name}.{name}.Set({value},{value},{value});" + } + ] + }, + "GateOut": { + "map_init": "{name}.pin = som.GetPin({pin});\n {name}.mode = {mode};\n {name}.pull = {pull};\n dsy_gpio_init(&{name});", + "typename": "dsy_gpio", + "direction": "out", + "pin": "a", + "mode": "DSY_GPIO_MODE_OUTPUT_PP", + "pull": "DSY_GPIO_NOPULL", + "mapping": [ + { + "name": "{name}", + "set": "dsy_gpio_write(&{class_name}.{name}, {value});" + } + ] + }, + "CVOuts": { + "map_init": "{name}.bitdepth = {bitdepth};\n {name}.buff_state = {buff_state};\n {name}.mode = {mode};\n {name}.chn = {channel};\n som.dac.Init({name});\n som.dac.WriteValue({channel}, 0);", + "typename": "daisy::DacHandle::Config", + "direction": "out", + "pin": "", + "bitdepth": "daisy::DacHandle::BitDepth::BITS_12", + "buff_state": "daisy::DacHandle::BufferState::ENABLED", + "mode": "daisy::DacHandle::Mode::POLLING", + "channel": "daisy::DacHandle::Channel::BOTH", + "mapping": [ + { + "name": "{name}1", + "set": "{class_name}.som.dac.WriteValue(daisy::DacHandle::Channel::ONE, {value} * 4095);", + "where": "main" + }, + { + "name": "{name}2", + "set": "{class_name}.som.dac.WriteValue(daisy::DacHandle::Channel::TWO, {value} * 4095);", + "where": "main" + } + ] + }, + "i2c": { + "map_init": "{name}.Init({{{peripheral}, {{som.GetPin({pin_scl}), som.GetPin({pin_sda})}}, {speed}, {mode}}});", + "typename": "daisy::I2CHandle", + "pin": "scl,sda", + "peripheral": "daisy::I2CHandle::Config::Peripheral::I2C_1", + "speed": "daisy::I2CHandle::Config::Speed::I2C_1MHZ", + "mode": "daisy::I2CHandle::Config::Mode::I2C_MASTER", + "mapping": [] + }, + "PCA9685": { + "map_init": "{name}.Init({parent}, {address}, {name}_dma_buffer_a, {name}_dma_buffer_b);", + "typename": "daisy::LedDriverPca9685<{driver_count}, true>", + "non_class_decl": "daisy::LedDriverPca9685<{driver_count}, true>::DmaBuffer DMA_BUFFER_MEM_SECTION {name}_dma_buffer_a, {name}_dma_buffer_b;", + "driver_count": 1, + "address": "{0x00}", + "parent": "", + "pin": "", + "loopprocess": "{name}.SwapBuffersAndTransmit();", + "mapping": [] + }, + "PCA9685Led": { + "map_init": "", + "pin": "", + "typename": "", + "parent": "", + "direction": "out", + "index": 0, + "mapping": [ + { + "name": "{name}", + "set": "{class_name}.{parent}.SetLed({index}, {value});" + } + ] + }, + "PCA9685RgbLed": { + "map_init": "", + "typename": "", + "direction": "out", + "parent": "", + "pin": "", + "index": { + "red": 0, + "green": 1, + "blue": 2 + }, + "mapping": [ + { + "name": "{name}_red", + "set": "{class_name}.{parent}.SetLed({index_red}, {value});" + }, + { + "name": "{name}_green", + "set": "{class_name}.{parent}.SetLed({index_green}, {value});" + }, + { + "name": "{name}_blue", + "set": "{class_name}.{parent}.SetLed({index_blue}, {value});" + }, + { + "name": "{name}", + "set": "{class_name}.{parent}.SetLed({index_red}, {value});\n {class_name}.{parent}.SetLed({index_green}, {value});\n {class_name}.{parent}.SetLed({index_blue}, {value});" + }, + { + "name": "{name}_white", + "set": "{class_name}.{parent}.SetLed({index_red}, {value});\n {class_name}.{parent}.SetLed({index_green}, {value});\n {class_name}.{parent}.SetLed({index_blue}, {value});" + } + ] + }, + "CD4021": { + "map_init": "{name}.Init({{ som.GetPin({pin_clk}), som.GetPin({pin_cs}), {{ som.GetPin({pin_data}) }} }});", + "typename": "daisy::ShiftRegister4021<{driver_count}>", + "non_class_decl": "uint8_t {name}_debounced[8*{driver_count}];", + "driver_count": 1, + "pin": "clk,cs,data", + "postprocess": "{name}.Update();", + "mapping": [] + }, + "CD4021Switch": { + "map_init": "", + "typename": "", + "direction": "in", + "parent": "", + "index": 0, + "postprocess": "{parent}_debounced[{index}] = {parent}.State({index}) | ({parent}_debounced[{index}] << 1);", + "mapping": [ + { + "name": "{name}", + "get": "(json2daisy::{parent}_debounced[{index}] == 0xFE)", + "bool": true + }, + { + "name": "{name}_press", + "get": "(json2daisy::{parent}_debounced[{index}] != 0xFF)", + "bool": false + }, + { + "name": "{name}_fall", + "get": "(json2daisy::{parent}_debounced[{index}] == 0x7F)", + "bool": true + } + ] + }, + "CD4051": { + "init_single": "size_t {name}_index = {i};\n cfg[{name}_index].InitMux(som.GetPin({pin_adc}), {mux_count}, som.GetPin({pin_sel0}), som.GetPin({pin_sel1}), som.GetPin({pin_sel2}));", + "typename": "", + "mux_count": 1, + "pin": "adc,sel0,sel1,sel2", + "mapping": [] + }, + "CD4051AnalogControl": { + "map_init": "{name}.Init(som.adc.GetMuxPtr({parent}_index, {index}), som.AudioCallbackRate(), {flip}, {invert});", + "parent": "", + "index": 0, + "typename": "daisy::AnalogControl", + "direction": "in", + "flip": "false", + "invert": "false", + "slew": "1.0/som.AudioCallbackRate()", + "process": "{name}.Process();", + "updaterate": "{name}.SetSampleRate(som.AudioCallbackRate());", + "mapping": [ + { + "name": "{name}", + "get": "({class_name}.{name}.Value())", + "range": [ + 0, + 1 + ], + "bool": false + } + ] + }, + "AnalogControlBipolar": { + "init_single": "cfg[{i}].InitSingle(som.GetPin({pin}));", + "map_init": "{name}.InitBipolarCv(som.adc.GetPtr({i}), som.AudioCallbackRate());", + "typename": "daisy::AnalogControl", + "direction": "in", + "pin": "a", + "slew": "1.0/som.AudioCallbackRate()", + "process": "{name}.Process();", + "updaterate": "{name}.SetSampleRate(som.AudioCallbackRate());", + "mapping": [ + { + "name": "{name}", + "get": "({class_name}.{name}.Value())", + "range": [ + 0, + 1 + ], + "bool": false + } + ] + } +} \ No newline at end of file diff --git a/source/component_defs_patchsm.json b/source/component_defs_patchsm.json new file mode 100644 index 0000000..cee95e6 --- /dev/null +++ b/source/component_defs_patchsm.json @@ -0,0 +1,248 @@ +{ + "Switch": { + "map_init": "{name}.Init(daisy::patch_sm::DaisyPatchSM::{pin}, som.AudioCallbackRate(), {type}, {polarity}, {pull});", + "typename": "daisy::Switch", + "direction": "in", + "pin": "a", + "type": "daisy::Switch::TYPE_MOMENTARY", + "polarity": "daisy::Switch::POLARITY_INVERTED", + "pull": "daisy::Switch::PULL_UP", + "process": "{name}.Debounce();", + "updaterate": "{name}.SetUpdateRate(som.AudioCallbackRate());", + "mapping": [ + { + "name": "{name}_press", + "get": "({class_name}.{name}.Pressed()?1.f:0.f)", + "range": [ + 0, + 1 + ], + "bool": false + }, + { + "name": "{name}", + "get": "({class_name}.{name}.RisingEdge()?1.f:0.f)", + "range": [ + 0, + 1 + ], + "bool": true + }, + { + "name": "{name}_fall", + "get": "({class_name}.{name}.FallingEdge()?1.f:0.f)", + "range": [ + 0, + 1 + ], + "bool": true + }, + { + "name": "{name}_seconds", + "get": "({class_name}.{name}.TimeHeldMs()*0.001f)", + "range": null, + "bool": false + } + ] + }, + "Switch3": { + "map_init": "{name}.Init(daisy::patch_sm::DaisyPatchSM::{pin_a}, daisy::patch_sm::DaisyPatchSM::{pin_b}));", + "typename": "daisy::Switch3", + "direction": "in", + "pin": "a,b", + "mapping": [ + { + "name": "{name}", + "get": "({class_name}.{name}.Read()*0.5f+0.5f)", + "range": [ + 0, + 2 + ], + "bool": false + } + ] + }, + "Encoder": { + "map_init": "{name}.Init(daisy::patch_sm::DaisyPatchSM::{pin_a}, daisy::patch_sm::DaisyPatchSM::{pin_b}, daisy::patch_sm::DaisyPatchSM::{pin_click}, som.AudioCallbackRate());", + "typename": "daisy::Encoder", + "direction": "in", + "pin": "a,b,click", + "process": "{name}.Debounce();", + "updaterate": "{name}.SetUpdateRate(som.AudioCallbackRate());", + "mapping": [ + { + "name": "{name}", + "get": "({class_name}.{name}.Increment())", + "range": [ + -1, + 1 + ], + "bool": false + }, + { + "name": "{name}_press", + "get": "({class_name}.{name}.Pressed()?1.f:0.f)", + "range": [ + 0, + 1 + ], + "bool": false + }, + { + "name": "{name}_rise", + "get": "({class_name}.{name}.RisingEdge()?1.f:0.f)", + "range": [ + 0, + 1 + ], + "bool": true + }, + { + "name": "{name}_fall", + "get": "({class_name}.{name}.FallingEdge()?1.f:0.f)", + "range": [ + 0, + 1 + ], + "bool": true + }, + { + "name": "{name}_seconds", + "get": "({class_name}.{name}.TimeHeldMs()*0.001f)", + "range": null, + "bool": false + } + ] + }, + "GateIn": { + "map_init": "{name}.Init(&daisy::patch_sm::DaisyPatchSM::{pin});", + "typename": "daisy::GateIn", + "direction": "in", + "pin": "a", + "default_prefix": "som.", + "mapping": [ + { + "name": "{name}", + "get": "({class_name}.{default_prefix}{name}.State()?1.f:0.f)", + "range": [ + 0, + 1 + ], + "bool": false + }, + { + "name": "{name}_trig", + "get": "({class_name}.{default_prefix}{name}.Trig()?1.f:0.f)", + "range": [ + 0, + 1 + ], + "bool": true + } + ] + }, + "AnalogControl": { + "init_single": "cfg[{i}].InitSingle(daisy::patch_sm::DaisyPatchSM::{pin});", + "map_init": "{name}.Init(som.adc.GetPtr({i}), som.AudioCallbackRate(), {flip}, {invert});", + "typename": "daisy::AnalogControl", + "direction": "in", + "pin": "a", + "flip": "false", + "invert": "false", + "slew": "1.0/som.AudioCallbackRate()", + "process": "{name}.Process();", + "updaterate": "{name}.SetSampleRate(som.AudioCallbackRate());", + "mapping": [ + { + "name": "{name}", + "get": "({class_name}.som.GetAdcValue((int)daisy::patch_sm::{name_upper}))", + "range": [ + 0, + 1 + ], + "bool": false + } + ] + }, + "Led": { + "map_init": "{name}.Init(daisy::patch_sm::DaisyPatchSM::{pin}), {invert});\n\t\t{name}.Set(0.0f);", + "typename": "daisy::Led", + "direction": "out", + "pin": "a", + "invert": "true", + "postprocess": "{name}.Update();", + "mapping": [ + { + "name": "{name}", + "set": "{class_name}.{name}.Set({value});" + } + ] + }, + "RgbLed": { + "map_init": "{name}.Init(daisy::patch_sm::DaisyPatchSM::{pin_r}, daisy::patch_sm::DaisyPatchSM::{pin_g}, daisy::patch_sm::DaisyPatchSM::{pin_b}, {invert});\n\t\t{name}.Set(0.0f, 0.0f, 0.0f);", + "typename": "daisy::RgbLed", + "direction": "out", + "pin": "r,g,b", + "invert": "true", + "postprocess": "{name}.Update();", + "mapping": [ + { + "name": "{name}_red", + "set": "{class_name}.{name}.SetRed({value});" + }, + { + "name": "{name}_green", + "set": "{class_name}.{name}.SetGreen({value});" + }, + { + "name": "{name}_blue", + "set": "{class_name}.{name}.SetBlue({value});" + }, + { + "name": "{name}", + "set": "{class_name}.{name}.Set(clamp(-{value}, 0.f, 1.f), 0.f, clamp({value}, 0.f, 1.f));" + }, + { + "name": "{name}_white", + "set": "{class_name}.{name}.Set({value},{value},{value});" + } + ] + }, + "GateOut": { + "map_init": "{name}.pin = daisy::patch_sm::DaisyPatchSM::{pin};\n\t\t{name}.mode = {mode};\n\t\t{name}.pull = {pull};\n\t\tdsy_gpio_init(&{name});", + "typename": "dsy_gpio", + "direction": "out", + "pin": "a", + "default_prefix": "som.", + "mode": "DSY_GPIO_MODE_OUTPUT_PP", + "pull": "DSY_GPIO_NOPULL", + "mapping": [ + { + "name": "{name}", + "set": "dsy_gpio_write(&{class_name}.{default_prefix}{name}, {value});" + } + ] + }, + "CVOuts": { + "map_init": "{name}.bitdepth = {bitdepth};\n\t\t{name}.buff_state = {buff_state};\n\t\t{name}.mode = {mode};\n\t\t{name}.chn = {channel};\n\t\tsom.dac.Init({name});\n\t\tsom.dac.WriteValue({channel}, 0);", + "typename": "daisy::DacHandle::Config", + "direction": "out", + "pin": "", + "bitdepth": "daisy::DacHandle::BitDepth::BITS_12", + "buff_state": "daisy::DacHandle::BufferState::ENABLED", + "mode": "daisy::DacHandle::Mode::POLLING", + "channel": "daisy::DacHandle::Channel::BOTH", + "mapping": [ + { + "name": "{name}1", + "set": "{class_name}.som.WriteCvOut(daisy::patch_sm::CV_OUT_1, {value} * 5.f);", + "where": "main" + }, + { + "name": "{name}2", + "set": "{class_name}.som.WriteCvOut(daisy::patch_sm::CV_OUT_2, {value} * 5.f);", + "where": "main" + } + ] + } +} \ No newline at end of file From 9bf5dd24800c8109d813101beb0b1a24ff9e1706 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Wed, 1 Dec 2021 14:41:29 -0700 Subject: [PATCH 015/100] Added patch_init new-style json --- source/patch_sm.patch_init.json | 138 ++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 source/patch_sm.patch_init.json diff --git a/source/patch_sm.patch_init.json b/source/patch_sm.patch_init.json new file mode 100644 index 0000000..554b2c0 --- /dev/null +++ b/source/patch_sm.patch_init.json @@ -0,0 +1,138 @@ +{ + "name": "patch_init", + "defines": {}, + "components": { + "cv_1": { + "component": "AnalogControl", + "pin": "C5", + "is_default": true + }, + "cv_2": { + "component": "AnalogControl", + "pin": "C4", + "is_default": true + }, + "cv_3": { + "component": "AnalogControl", + "pin": "C3", + "is_default": true + }, + "cv_4": { + "component": "AnalogControl", + "pin": "C2", + "is_default": true + }, + "cv_5": { + "component": "AnalogControl", + "pin": "C6", + "is_default": true + }, + "cv_6": { + "component": "AnalogControl", + "pin": "C7", + "is_default": true + }, + "cv_7": { + "component": "AnalogControl", + "pin": "C8", + "is_default": true + }, + "cv_8": { + "component": "AnalogControl", + "pin": "C9", + "is_default": true + }, + "adc_9": { + "component": "AnalogControl", + "pin": "A2", + "is_default": true + }, + "adc_10": { + "component": "AnalogControl", + "pin": "A3", + "is_default": true + }, + "adc_11": { + "component": "AnalogControl", + "pin": "D9", + "is_default": true + }, + "adc_12": { + "component": "AnalogControl", + "pin": "D8", + "is_default": true + }, + "gate_out_1": { + "component": "GateOut", + "pin": "B5", + "display": "", + "is_default": true + }, + "gate_out_2": { + "component": "GateOut", + "pin": "B6", + "display": "", + "is_default": true + }, + "cvout1": { + "component": "CVOuts", + "is_default": true + }, + "cvout2": { + "component": "CVOuts", + "is_default": true + }, + "gate_in_1": { + "component": "GateIn", + "pin": "B10", + "is_default": true + }, + "gate_in_2": { + "component": "GateIn", + "pin": "B9", + "is_default": true + }, + "sw1": { + "component": "Switch", + "pin": "B7" + }, + "sw2": { + "component": "Switch", + "pin": "B8" + } + }, + "aliases": { + "switch": "sw1", + "switch1": "sw1", + "switch2": "sw2", + "button": "sw1", + "toggle": "sw2", + "gate": "gate_in_1", + "gate1": "gate_in_1", + "gate2": "gate_in_2", + "gateout": "gate_out_1", + "gateout1": "gate_out_1", + "gateout2": "gate_out_2", + "cvout": "cvout1", + "cv_out_1": "cvout1", + "cv_out_2": "cvout2", + "knob": "cv_1", + "knob1": "cv_1", + "knob2": "cv_2", + "knob3": "cv_3", + "knob4": "cv_4", + "knob5": "cv_5", + "knob6": "cv_6", + "knob7": "cv_7", + "knob8": "cv_8", + "ctrl": "cv_1", + "ctrl1": "cv_1", + "ctrl2": "cv_2", + "ctrl3": "cv_3", + "ctrl4": "cv_4", + "ctrl5": "cv_5", + "ctrl6": "cv_6", + "ctrl7": "cv_7", + "ctrl8": "cv_8" + } +} \ No newline at end of file From f792db08c9f2539dee838d37243e7abb21d5e64d Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Wed, 1 Dec 2021 18:30:05 -0700 Subject: [PATCH 016/100] Translated glue from hvcc --- source/daisy_glue.js | 255 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 255 insertions(+) create mode 100644 source/daisy_glue.js diff --git a/source/daisy_glue.js b/source/daisy_glue.js new file mode 100644 index 0000000..71f0618 --- /dev/null +++ b/source/daisy_glue.js @@ -0,0 +1,255 @@ +const assert = require("assert"); + +function stringFormatMap(template, formatMap) +{ + if (typeof template === 'undefined') + return ''; + const format_match = /{\s*([^{}\s]*)\s*}/g; + const open_curly = /{{/g; + const close_curly = /}}/g; + let pass1 = template.replace(open_curly, () => { + return '{' + }); + let pass2 = pass1.replace(close_curly, () => { + return '}' + }); + let pass3 = pass2.replace(format_match, (substring, value, index) => { + return formatMap[value] || ''; + }); + return pass3; +} + +// .filter for objects that returns object +Object.filter = (obj, predicate) => + Object.keys(obj).filter(key => predicate(obj[key])) + .map(key => obj[key]); + +function filter_match(sequence, key, match, key_exclude = null, match_exclude = null) +{ + if (key_exclude !== null && match_exclude !== null) + { + return Object.filter(sequence, item => key in item && item[key] == match && ((item[key_exclude] || null) != match_exclude)); + } + else + return Object.filter(sequence, item => key in item && item[key] == match); +} + +function verify_param_exists(name, original_name, components, input=true) +{ + for (let comp of components) + { + if (comp.component == 'CVOuts') + { + if (name == comp.name) + { + assert(!input, `Parameter ${original_name} cannot be used as an ${input ? 'input' : 'output'}`); + return; + } + } + else + { + let variants = comp.mapping.map(item => stringFormatMap(item.name, comp)); + if (variants.includes(name)) + { + assert((input && comp.direction == 'input') || (!input && comp.direction == 'output'), + `Parameter ${original_name} cannot be used as an ${input ? 'input' : 'output'}`); + return; + } + } + } + assert(false, `Unkown parameter ${original_name}`); +} + +function verify_param_direction(name, components) +{ + for (let comp of components) + { + if (comp.component == 'CVOuts') + { + if (name == comp.name) + return true; + } + else + { + let variants = comp.mapping.map(item => stringFormatMap(item.name, comp)); + if (variants.includes(name)) + return true; + } + } + return false; +} + +function get_root_component(variant, original_name, components) +{ + for (let comp of components) + { + if (comp.component == 'CVOuts') + { + if (variant == comp.name) + return variant; + } + else + { + let variants = comp.mapping.map(item => stringFormatMap(item.name, comp)); + if (variants.includes(variant)) + return comp.name; + } + } + assert(false, `Unkown parameter ${original_name}`); +} + +function get_component_mapping(component_variant, original_name, component, components) +{ + for (let variant of component.mapping) + { + if (component.component == 'CVOuts') + { + let stripped = stringFormatMap(variant.name, {name: ''}); + if (component.name.includes(stripped)) + return variant; + } + else if (stringFormatMap(variant.name, component) == component_variant) + return variant; + } + assert(false, `Unkown parameter ${original_name}`); +} + + +function verify_param_used(component, params_in, params_out, params_in_original_name, params_out_original_name, components) +{ + // Exclude parents, since they don't have 1-1 i/o mapping + if (component.is_parent || false) + return true; + + let combined_params; + Object.assign(combined_params, params_in, params_out); + let combined_names; + Object.assign(combined_names, params_in_original_name, params_out_original_name); + for (let param in combined_params) + { + let root = get_root_component(param, combined_names[param], components); + if (root == component.name) + return true; + } + return false; +} + +function de_alias(name, aliases, components) +{ + let low = name.toLowerCase(); + // simple case + if (aliases.includes(low)) + return aliases[low]; + // aliased variant + let potential_aliases = Object.filter(aliases, item => low.includes(item)); + for (let alias of potential_aliases) + { + target_component = filter_match(components, 'name', aliases[alias])[0] || undefined; + if (typeof target_component === 'undefined') + continue; + if (target_component.component != 'CVOuts') + { + for (let mapping of target_component.mapping) + { + if (stringFormatMap(mapping.name, {name: alias}) == low) + return stringFormatMap(mapping.name, {name: aliases[alias]}); + } + } + } + // otherwise, it's a direct parameter or unkown one + return low; +} + +// Parses the `parameters` passed from oopsy and generates getters and setters +// according to the info in `components`. The `aliases` help disambiguate parameters +// and the `object_name` sets the identifier for the generated Daisy hardware class. +function parse_parameters(parameters, components, aliases, object_name) +{ + // Verify that the params are valid and remove unused components + let replacements = {}; + + let params_in = {}; + let params_in_original_names = {}; + for (property in parameters.in) + { + let de_aliased = de_alias(property, aliases, components); + params_in[de_aliased] = parameters.in[property]; + params_in_original_names[de_aliased] = property; + } + + let params_out = {}; + let params_out_original_names = {}; + for (property in parameters.out) + { + let de_aliased = de_alias(property, aliases, components); + params_out[de_aliased] = parameters.out[property]; + params_out_original_names[de_aliased] = property; + } + + for (property in params_in) + verify_param_exists(property, params_in_original_names[property], components, input=true); + for (property in params_out) + verify_param_exists(property, params_out_original_names[property], components, input=false); + + for (let i = components.length - 1; i > -1; i--) + { + let used = verify_param_used(components[i], params_in, params_out, + params_in_original_names, params_out_original_names, components); + if (!used) + components.splice(i, 1); + } + + let out_idx = 0; + replacements.parameters = []; + replacements.output_parameters = []; + replacements.callback_write_out = []; + replacements.loop_write_out = ''; + replacements.callback_write_in = []; + + for (let param_name in params_in) + { + root = get_root_component(param_name, params_in_original_names[param_name], components); + let component = filter_match(components, 'name', root)[0]; + let param_struct = { + name: root, + type: component.component.toUpperCase() + }; + replacements.parameters.push(param_struct); + let mapping = get_component_mapping(param_name, params_in_original_names[param_name], component, components); + + let component_info; + Object.assign(component_info, component); + component_info.name = root; + component_info.class_name = object_name; + component_info.name_upper = root.toUpperCase(); + component_info.value = `output_data[${out_idx}]`; + component_info.default_prefix = (component.is_default || false) ? component.default_prefix || '' : ''; + let process = stringFormatMap(mapping.get, component_info); + replacements.callback_write_in.push({process: process, bool: mapping.bool}); + } + + for (let param_name in params_out) + { + root = get_root_component(param_name, params_in_original_names[param_name], components); + let component = filter_match(components, 'name', root)[0]; + let param_struct = { + name: root, + index: out_idx + }; + replacements.output_parameters.push(param_struct); + let mapping = get_component_mapping(param_name, params_out_original_names[param_name], component, components); + let write_location = (mapping.where || 'callback') == 'callback' ? 'callback_write_out' : 'loop_write_out'; + let component_info; + Object.assign(component_info, component); + component_info.name = root; + component_info.class_name = object_name; + component_info.value = `output_data[${out_idx}]`; + component_info.default_prefix = (component.is_default || false) ? component.default_prefix || '' : ''; + let write = stringFormatMap(mapping.set, component_info); + replacements[write_location] += `\n ${write}`; + } + + replacements.output_comps = replacements.output_parameters.length; + + return replacements; +} \ No newline at end of file From e850a40d62f69219717b1b1ac35aba8cf03b0836 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Wed, 1 Dec 2021 18:30:18 -0700 Subject: [PATCH 017/100] Corrected helper function errors --- source/json2daisy.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/json2daisy.js b/source/json2daisy.js index c7a9e5a..4eba979 100644 --- a/source/json2daisy.js +++ b/source/json2daisy.js @@ -132,10 +132,10 @@ function filter_match(sequence, key, match, key_exclude = null, match_exclude = { if (key_exclude !== null && match_exclude !== null) { - return Object.filter(sequence, item => key in item && key == match && (!(key_exclude in item) || (key_exclude in item && key_exclude != match_exclude))); + return Object.filter(sequence, item => key in item && item[key] == match && ((item[key_exclude] || null) != match_exclude)); } else - return Object.filter(sequence, item => key in item && key == match); + return Object.filter(sequence, item => key in item && item[key] == match); } function filter_matches(sequence, key, matches, key_exclude=null, match_exclude=null) @@ -194,7 +194,7 @@ function filter_map_ctrl(set, key, matches, init_key, key_exclude=null, match_ex function filter_map_template(set, name, key_exclude=null, match_exclude=null) { filtered = filter_has(set, name, key_exclude, match_exclude); - return filtered.map(item => stringFormatMap(item.name, item)).join("\n "); + return filtered.map(item => stringFormatMap(item[name], item)).join("\n "); } function flatten_pin_dicts(comp) @@ -321,10 +321,10 @@ exports.generate_header = function generate_header(board_description_object) replacements.displayprocess = filter_map_template(components, 'display', key_exclude='is_default', match_exclude=true); replacements.hidupdaterates = filter_map_template(components, 'updaterate', key_exclude='is_default', match_exclude=true); - component_decls = Object.filter(components, item => item.default || false); - component_decls = Object.filter(component_decls, item => 'typename' in item); + component_decls = Object.filter(components, item => !(item.is_default || false)); + component_decls = component_decls.filter(item => 'typename' in item); replacements.comps = component_decls.map(item => `${stringFormatMap(item.typename, item)} ${item.name}`).join(";\n ") + ';'; - non_class_decls = Object.filter(component_decls, item => 'non_class_decl' in item); + non_class_decls = component_decls.filter(item => 'non_class_decl' in item); replacements.non_class_declarations = non_class_decls.map(item => stringFormatMap(item.non_class_decl, item)).join("\n"); replacements.dispdec = 'display' in target ? `daisy::OledDisplay<${target.display.driver}> display;` : ""; From 603d8be480ef7968af318dfd773ba3b08fb2352a Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Thu, 2 Dec 2021 15:18:44 -0700 Subject: [PATCH 018/100] Added parse_parameters to exports --- source/daisy_glue.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/daisy_glue.js b/source/daisy_glue.js index 71f0618..a446467 100644 --- a/source/daisy_glue.js +++ b/source/daisy_glue.js @@ -163,7 +163,7 @@ function de_alias(name, aliases, components) // Parses the `parameters` passed from oopsy and generates getters and setters // according to the info in `components`. The `aliases` help disambiguate parameters // and the `object_name` sets the identifier for the generated Daisy hardware class. -function parse_parameters(parameters, components, aliases, object_name) +exports.parse_parameters = function parse_parameters(parameters, components, aliases, object_name) { // Verify that the params are valid and remove unused components let replacements = {}; From 9e8283f1312e72f37d17d01e8228690bb4946e55 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Thu, 2 Dec 2021 18:16:15 -0700 Subject: [PATCH 019/100] Permitted basic build --- source/genlib_daisy.h | 2 +- source/json2daisy.js | 47 ++++- source/oopsy.js | 323 +++++++++++++++++--------------- source/patch_sm.patch_init.json | 6 +- 4 files changed, 220 insertions(+), 158 deletions(-) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index c6b7f87..16dbc15 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -147,7 +147,7 @@ namespace oopsy { Daisy hardware; #ifdef OOPSY_SOM_PATCH_SM - Daisy *som = &hardware; + daisy::patch_sm::DaisyPatchSM *som = &hardware.som; #else #ifdef OOPSY_OLD_JSON daisy::DaisySeed *som = &hardware.seed; diff --git a/source/json2daisy.js b/source/json2daisy.js index 4eba979..8f85042 100644 --- a/source/json2daisy.js +++ b/source/json2daisy.js @@ -258,7 +258,7 @@ exports.generate_header = function generate_header(board_description_object) } target.components = components; - target.name = target.name || 'custom'; + target.name = target.name || ''; // For now we'll allow it to be nothing target.aliases = target.aliases || {}; if ("display" in target) @@ -342,7 +342,8 @@ namespace json2daisy { ${replacements.non_class_declarations} -struct Daisy${replacements.name[0].toUpperCase()}${replacements.name.slice(1)} { +${replacements.name != '' ? `struct Daisy${replacements.name[0].toUpperCase()}${replacements.name.slice(1)} {` + : `struct Daisy {`} /** Initializes the board according to the JSON board description * \\param boost boosts the clock speed from 400 to 480 MHz @@ -399,6 +400,14 @@ struct Daisy${replacements.name[0].toUpperCase()}${replacements.name.slice(1)} { ${replacements.loopprocess} } + /** Handles display-related processing + * + */ + void Display() + { + + } + /** Sets the audio sample rate * \\param sample_rate the new sample rate in Hz */ @@ -421,6 +430,37 @@ struct Daisy${replacements.name[0].toUpperCase()}${replacements.name.slice(1)} { ${replacements.hidupdaterates} } + /** Sets the audio sample rate + * \\param sample_rate the new sample rate as an enum + */ + void SetAudioSampleRate(daisy::SaiHandle::Config::SampleRate sample_rate) + { + ${som == 'seed' ? 'som.SetAudioSampleRate(sample_rate);' : + `size_t hz_rate; + switch (sample_rate) + { + case (daisy::SaiHandle::Config::SampleRate::SAI_96KHZ): + hz_rate = 96000; + break; + default: + case (daisy::SaiHandle::Config::SampleRate::SAI_48KHZ): + hz_rate = 48000; + break; + case (daisy::SaiHandle::Config::SampleRate::SAI_32KHZ): + hz_rate = 32000; + break; + case (daisy::SaiHandle::Config::SampleRate::SAI_16KHZ): + hz_rate = 16000; + break; + case (daisy::SaiHandle::Config::SampleRate::SAI_8KHZ): + hz_rate = 8000; + break; + } + som.SetAudioSampleRate(hz_rate); + `} + ${replacements.hidupdaterates} + } + /** Sets the audio block size * \\param block_size the new block size in words */ @@ -445,6 +485,9 @@ struct Daisy${replacements.name[0].toUpperCase()}${replacements.name.slice(1)} { // I/O Components ${replacements.comps} ${replacements.dispdec} + + // Menu variables + int menu_click = 0, menu_hold = 0, menu_rotate = 0; }; } // namespace json2daisy diff --git a/source/oopsy.js b/source/oopsy.js index ae203ba..0b1db49 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -39,6 +39,9 @@ const fs = require("fs"), assert = require("assert"); const {exec, execSync, spawn} = require("child_process"); +const json2daisy = require(path.join(__dirname, "json2daisy.js")); +const daisy_glue = require(path.join(__dirname, "daisy_glue.js")); + // returns the path `str` with posix path formatting: function posixify_path(str) { return str.split(path.sep).join(path.posix.sep); @@ -285,148 +288,152 @@ const component_defs = { // generate the struct function generate_target_struct(target) { - // flesh out target components: - let components = Object.entries(target.components) - .sort((a, b) => - a[1].component < b[1].component - ? -1 - : a[1].component > b[1].component - ? 1 - : 0 - ) - .map((pair) => { - let [name, def] = pair; - def.name = name; - let component = component_defs[def.component]; - if (component) { - // copy component defaults into the def - // TODO this should be recursive for object structures... - for (let k of Object.keys(component)) { - if (def[k] == undefined) def[k] = component[k]; - } - } else { - throw new Error("undefined component kind: " + def.component); - } - return def; - }); - target.components = components; - target.name = target.name || "custom" - - if (target.display) { - // apply defaults: - target.display = Object.assign({ - driver: "daisy::SSD130x4WireSpi128x64Driver", - config: [], - dim: [128, 64] - }, target.display) - target.defines.OOPSY_TARGET_HAS_OLED = 1 - target.defines.OOPSY_OLED_DISPLAY_WIDTH = target.display.dim[0] - target.defines.OOPSY_OLED_DISPLAY_HEIGHT = target.display.dim[1] - } - - if (target.som == 'patch_sm') { - target.defines.OOPSY_SOM_PATCH_SM = 1 - } + let board_info = json2daisy.generate_header(target); +// // flesh out target components: +// let components = Object.entries(target.components) +// .sort((a, b) => +// a[1].component < b[1].component +// ? -1 +// : a[1].component > b[1].component +// ? 1 +// : 0 +// ) +// .map((pair) => { +// let [name, def] = pair; +// def.name = name; +// let component = component_defs[def.component]; +// if (component) { +// // copy component defaults into the def +// // TODO this should be recursive for object structures... +// for (let k of Object.keys(component)) { +// if (def[k] == undefined) def[k] = component[k]; +// } +// } else { +// throw new Error("undefined component kind: " + def.component); +// } +// return def; +// }); +// target.components = components; +// target.name = target.name || "custom" + +// if (target.display) { +// // apply defaults: +// target.display = Object.assign({ +// driver: "daisy::SSD130x4WireSpi128x64Driver", +// config: [], +// dim: [128, 64] +// }, target.display) +// target.defines.OOPSY_TARGET_HAS_OLED = 1 +// target.defines.OOPSY_OLED_DISPLAY_WIDTH = target.display.dim[0] +// target.defines.OOPSY_OLED_DISPLAY_HEIGHT = target.display.dim[1] +// } + +// if (target.som == 'patch_sm') { +// target.defines.OOPSY_SOM_PATCH_SM = 1 +// } + +// console.log(json2daisy.format_map("Hello, {{{world}}}!", {world: 'guys ^.^'})); - return ` -#include "daisy_${target.som}.h" -${target.display ? `#include "dev/oled_ssd130x.h"` : ""} -// name: ${target.name} -struct Daisy { +// return ` +// #include "daisy_${target.som}.h" +// ${target.display ? `#include "dev/oled_ssd130x.h"` : ""} +// // name: ${target.name} +// struct Daisy { - void Init(bool boost = false) { - ${target.som == 'seed' ? 'som.Configure();' : ''} - som.Init(${target.som == 'seed' ? 'boost' : ''}); - ${components.filter((e) => e.init) - .map((e) => ` - ${template(e.init, e)}` - ).join("")} - ${components.filter((e) => e.typename == "daisy::Switch") - .map((e, i) => ` - ${e.name}.Init(som.GetPin(${e.pin}), som.AudioCallbackRate(), ${e.type}, ${e.polarity}, ${e.pull});` - ).join("")} - ${components.filter((e) => e.typename == "daisy::Switch3").map((e, i) => ` - ${e.name}.Init(som.GetPin(${e.pin.a}), som.GetPin(${e.pin.b}));` - ).join("")} - ${components.filter((e) => e.typename == "daisy::GateIn").map((e, i) => ` - dsy_gpio_pin ${e.name}_pin = som.GetPin(${e.pin}); - ${e.name}.Init(&${e.name}_pin);` - ).join("")} - ${components.filter((e) => e.typename == "daisy::Encoder").map((e, i) => ` - ${e.name}.Init(som.GetPin(${e.pin.a}), som.GetPin(${e.pin.b}), som.GetPin(${e.pin.click}), som.AudioCallbackRate());` - ).join("")} - static const int ANALOG_COUNT = ${ - components.filter((e) => e.typename == "daisy::AnalogControl").length}; - daisy::AdcChannelConfig cfg[ANALOG_COUNT]; - ${components.filter((e) => e.typename == "daisy::AnalogControl").map((e, i) => ` - cfg[${i}].InitSingle(som.GetPin(${e.pin}));`).join("")} - som.adc.Init(cfg, ANALOG_COUNT); - ${components.filter((e) => e.typename == "daisy::AnalogControl").map((e, i) => ` - ${e.name}.Init(som.adc.GetPtr(${i}), som.AudioCallbackRate(), ${e.flip}, ${e.invert});`).join("")} - ${components.filter((e) => e.typename == "daisy::Led").map((e, i) => ` - ${e.name}.Init(som.GetPin(${e.pin}), ${e.invert}); - ${e.name}.Set(0.0f);`).join("")} - ${components.filter((e) => e.typename == "daisy::RgbLed").map((e, i) => ` - ${e.name}.Init(som.GetPin(${e.pin.r}), som.GetPin(${e.pin.g}), som.GetPin(${e.pin.b}), ${e.invert}); - ${e.name}.Set(0.0f, 0.0f, 0.0f);`).join("")} - ${components.filter((e) => e.typename == "daisy::dsy_gpio").map((e, i) => ` - ${e.name}.pin = som.GetPin(${e.pin}); - ${e.name}.mode = ${e.mode}; - ${e.name}.pull = ${e.pull}; - dsy_gpio_init(&${e.name});`).join("")} - ${components.filter((e) => e.typename == "daisy::DacHandle::Config").map((e, i) => ` - ${e.name}.bitdepth = ${e.bitdepth}; - ${e.name}.buff_state = ${e.buff_state}; - ${e.name}.mode = ${e.mode}; - ${e.name}.chn = ${e.channel}; - som.dac.Init(${e.name}); - som.dac.WriteValue(${e.channel}, 0);`).join("")} - ${target.display ? ` - daisy::OledDisplay<${target.display.driver}>::Config display_config; - display_config.driver_config.transport_config.Defaults(); ${(target.display.config || []).map(e=>` - ${e}`).join("")} - display.Init(display_config);`:`// no display`} - } +// void Init(bool boost = false) { +// ${target.som == 'seed' ? 'som.Configure();' : ''} +// som.Init(${target.som == 'seed' ? 'boost' : ''}); +// ${components.filter((e) => e.init) +// .map((e) => ` +// ${template(e.init, e)}` +// ).join("")} +// ${components.filter((e) => e.typename == "daisy::Switch") +// .map((e, i) => ` +// ${e.name}.Init(som.GetPin(${e.pin}), som.AudioCallbackRate(), ${e.type}, ${e.polarity}, ${e.pull});` +// ).join("")} +// ${components.filter((e) => e.typename == "daisy::Switch3").map((e, i) => ` +// ${e.name}.Init(som.GetPin(${e.pin.a}), som.GetPin(${e.pin.b}));` +// ).join("")} +// ${components.filter((e) => e.typename == "daisy::GateIn").map((e, i) => ` +// dsy_gpio_pin ${e.name}_pin = som.GetPin(${e.pin}); +// ${e.name}.Init(&${e.name}_pin);` +// ).join("")} +// ${components.filter((e) => e.typename == "daisy::Encoder").map((e, i) => ` +// ${e.name}.Init(som.GetPin(${e.pin.a}), som.GetPin(${e.pin.b}), som.GetPin(${e.pin.click}), som.AudioCallbackRate());` +// ).join("")} +// static const int ANALOG_COUNT = ${ +// components.filter((e) => e.typename == "daisy::AnalogControl").length}; +// daisy::AdcChannelConfig cfg[ANALOG_COUNT]; +// ${components.filter((e) => e.typename == "daisy::AnalogControl").map((e, i) => ` +// cfg[${i}].InitSingle(som.GetPin(${e.pin}));`).join("")} +// som.adc.Init(cfg, ANALOG_COUNT); +// ${components.filter((e) => e.typename == "daisy::AnalogControl").map((e, i) => ` +// ${e.name}.Init(som.adc.GetPtr(${i}), som.AudioCallbackRate(), ${e.flip}, ${e.invert});`).join("")} +// ${components.filter((e) => e.typename == "daisy::Led").map((e, i) => ` +// ${e.name}.Init(som.GetPin(${e.pin}), ${e.invert}); +// ${e.name}.Set(0.0f);`).join("")} +// ${components.filter((e) => e.typename == "daisy::RgbLed").map((e, i) => ` +// ${e.name}.Init(som.GetPin(${e.pin.r}), som.GetPin(${e.pin.g}), som.GetPin(${e.pin.b}), ${e.invert}); +// ${e.name}.Set(0.0f, 0.0f, 0.0f);`).join("")} +// ${components.filter((e) => e.typename == "daisy::dsy_gpio").map((e, i) => ` +// ${e.name}.pin = som.GetPin(${e.pin}); +// ${e.name}.mode = ${e.mode}; +// ${e.name}.pull = ${e.pull}; +// dsy_gpio_init(&${e.name});`).join("")} +// ${components.filter((e) => e.typename == "daisy::DacHandle::Config").map((e, i) => ` +// ${e.name}.bitdepth = ${e.bitdepth}; +// ${e.name}.buff_state = ${e.buff_state}; +// ${e.name}.mode = ${e.mode}; +// ${e.name}.chn = ${e.channel}; +// som.dac.Init(${e.name}); +// som.dac.WriteValue(${e.channel}, 0);`).join("")} +// ${target.display ? ` +// daisy::OledDisplay<${target.display.driver}>::Config display_config; +// display_config.driver_config.transport_config.Defaults(); ${(target.display.config || []).map(e=>` +// ${e}`).join("")} +// display.Init(display_config);`:`// no display`} +// } - void ProcessAllControls() { - ${components.filter((e) => e.process).map((e) => ` - ${template(e.process, e)}`).join("")} - ${components.filter((e) => e.meta).map((e) => e.meta.map(m=>` - ${template(m, e)}`).join("")).join("")} - } +// void ProcessAllControls() { +// ${components.filter((e) => e.process).map((e) => ` +// ${template(e.process, e)}`).join("")} +// ${components.filter((e) => e.meta).map((e) => e.meta.map(m=>` +// ${template(m, e)}`).join("")).join("")} +// } - void PostProcess() { - ${components.filter((e) => e.postprocess).map((e) => ` - ${template(e.postprocess, e)}`).join("")} - } +// void PostProcess() { +// ${components.filter((e) => e.postprocess).map((e) => ` +// ${template(e.postprocess, e)}`).join("")} +// } - void Display() { - ${components.filter((e) => e.display).map((e) => ` - ${template(e.display, e)}`).join("")} - } +// void Display() { +// ${components.filter((e) => e.display).map((e) => ` +// ${template(e.display, e)}`).join("")} +// } - void SetAudioSampleRate(daisy::SaiHandle::Config::SampleRate samplerate) { - som.SetAudioSampleRate(samplerate); - SetHidUpdateRates(); - } - - void SetAudioBlockSize(size_t size) { - som.SetAudioBlockSize(size); - SetHidUpdateRates(); - } - - void SetHidUpdateRates() { - ${components.filter((e) => e.updaterate).map((e) => ` - ${template(e.updaterate, e)}`).join("")} - } +// void SetAudioSampleRate(daisy::SaiHandle::Config::SampleRate samplerate) { +// som.SetAudioSampleRate(samplerate); +// SetHidUpdateRates(); +// } + +// void SetAudioBlockSize(size_t size) { +// som.SetAudioBlockSize(size); +// SetHidUpdateRates(); +// } + +// void SetHidUpdateRates() { +// ${components.filter((e) => e.updaterate).map((e) => ` +// ${template(e.updaterate, e)}`).join("")} +// } - ${target.som == 'seed' ? 'daisy::DaisySeed' : 'daisy::patch_sm::DaisyPatchInit'} som; - ${components.map((e) => ` - ${e.typename} ${e.name};`).join("")} - ${target.display ? `daisy::OledDisplay<${target.display.driver}> display;`:`// no display`} - int menu_click = 0, menu_hold = 0, menu_rotate = 0; - -};`; +// ${target.som == 'seed' ? 'daisy::DaisySeed' : 'daisy::patch_sm::DaisyPatchInit'} som; +// ${components.map((e) => ` +// ${e.typename} ${e.name};`).join("")} +// ${target.display ? `daisy::OledDisplay<${target.display.driver}> display;`:`// no display`} +// int menu_click = 0, menu_hold = 0, menu_rotate = 0; + +// };`; + return board_info; } let watchers = [] @@ -467,12 +474,12 @@ function run() { case "field": case "petal": - case "patch": - case "patch_init": + case "patch": case "versio": target = arg; break; case "bluemchen": target_path = path.join(__dirname, "seed.bluemchen.json"); break; case "nehcmeulb": target_path = path.join(__dirname, "seed.nehcmeulb.json"); break; case "pod": target_path = path.join(__dirname, "seed.pod.json"); break; + case "patch_init": target_path = path.join(__dirname, "patch_sm.patch_init.json"); break; case "watch": watch=true; break; @@ -580,11 +587,20 @@ function run() { hardware.defines = hardware.defines || {} hardware.struct = ""; + let tempname = hardware.name; + hardware.name = ''; + let board_info = json2daisy.generate_header(hardware); + hardware.name = tempname; + + hardware.struct = board_info.header; + hardware.components = board_info.components; + hardware.aliases = board_info.aliases; + if (hardware.components) { - hardware.struct = generate_target_struct(hardware); + // hardware.struct = generate_target_struct(hardware); // generate IO - for (let component of hardware.components) { - + for (let comp in hardware.components) { + let component = hardware.components[comp]; // meta-elements are handled separately if (component.meta) { @@ -592,11 +608,14 @@ function run() { // else it is available for gen mapping: for (let mapping of component.mapping) { - let name = template(mapping.name, component); + // let name = template(mapping.name, component); + component.class_name = 'hardware'; + let name = json2daisy.format_map(mapping.name, component); + component.value = name.toLowerCase(); if (mapping.get) { // an input hardware.inputs[name] = { - code: template(mapping.get, component), + code: json2daisy.format_map(mapping.get, component), automap: component.automap && name == component.name, range: mapping.range, where: mapping.where @@ -606,7 +625,7 @@ function run() { if (mapping.set) { // an output hardware.outputs[name] = { - code: template(mapping.set, component), + code: json2daisy.format_map(mapping.set, component), automap: component.automap && name == component.name, range: mapping.range, where: mapping.where || "audio" @@ -767,6 +786,8 @@ ${Object.keys(hardware.defines).map(k=>` #define ${k} (${hardware.defines[k]})`).join("")} ${hardware.struct} +using json2daisy::Daisy; + ${hardware.inserts.filter(o => o.where == "header").map(o => o.code).join("\n")} #include "../genlib_daisy.h" #include "../genlib_daisy.cpp" @@ -1495,7 +1516,7 @@ function generate_app(app, hardware, target, config) { } return varname; }) - + // TODO -- need to figure out why gate outs are being omitted gen.datas = app.patch.datas.map((param, i)=>{ const varname = "gen_data_"+param.name; let src, label; @@ -1542,13 +1563,16 @@ function generate_app(app, hardware, target, config) { // find next param without a src: while (param && !!nodes[param].src) param = gen.params[++upi]; if (param) { - //console.log(name, "map to", param) + // console.log(name, "map to", param) nodes[param].src = name; node.to.push(param); } } }) + // console.log(nodes); + let board_glue = daisy_glue.parse_parameters(nodes, hardware.components, hardware.aliases, 'hardware'); + // normal any audio outs from earlier (non cv/gate/midi) audio outs { let available = [] @@ -1563,6 +1587,8 @@ function generate_app(app, hardware, target, config) { }); } + console.log(daisy.device_outs.map(name => nodes[name]).filter(node => node.src)); + let som_or_seed = hardware.defines.OOPSY_OLD_JSON ? 'seed' : 'som'; const struct = ` @@ -1585,11 +1611,7 @@ struct App_${name} : public oopsy::App { float ${name}[OOPSY_BLOCK_SIZE];`).join("")} void init(oopsy::GenDaisy& daisy) { - ${ - hardware.som == 'seed' - ? `daisy.gen = ${name}::create(daisy.hardware.${som_or_seed}.AudioSampleRate(), daisy.hardware.${som_or_seed}.AudioBlockSize());` - : `daisy.gen = ${name}::create(daisy.hardware.AudioSampleRate(), daisy.hardware.AudioBlockSize());` - } + daisy.gen = ${name}::create(daisy.hardware.${som_or_seed}.AudioSampleRate(), daisy.hardware.${som_or_seed}.AudioBlockSize()); ${name}::State& gen = *(${name}::State *)daisy.gen; daisy.param_count = ${gen.params.length}; @@ -1758,6 +1780,7 @@ struct App_${name} : public oopsy::App { }` : ""} daisy.midi_in_active = 1; }` : "// no midi input handling"} + hardware.LoopProcess(); } void displayCallback(oopsy::GenDaisy& daisy, uint32_t t, uint32_t dt) { diff --git a/source/patch_sm.patch_init.json b/source/patch_sm.patch_init.json index 554b2c0..ffbb392 100644 --- a/source/patch_sm.patch_init.json +++ b/source/patch_sm.patch_init.json @@ -74,11 +74,7 @@ "display": "", "is_default": true }, - "cvout1": { - "component": "CVOuts", - "is_default": true - }, - "cvout2": { + "cvout": { "component": "CVOuts", "is_default": true }, From c13ed336ea337450f4f9c6a71cb58e43b820432b Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Fri, 3 Dec 2021 11:34:42 -0700 Subject: [PATCH 020/100] Corrected format function --- source/daisy_glue.js | 2 +- source/json2daisy.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/daisy_glue.js b/source/daisy_glue.js index a446467..f751471 100644 --- a/source/daisy_glue.js +++ b/source/daisy_glue.js @@ -14,7 +14,7 @@ function stringFormatMap(template, formatMap) return '}' }); let pass3 = pass2.replace(format_match, (substring, value, index) => { - return formatMap[value] || ''; + return value in formatMap ? formatMap[value] : ''; }); return pass3; } diff --git a/source/json2daisy.js b/source/json2daisy.js index 8f85042..e5f2d38 100644 --- a/source/json2daisy.js +++ b/source/json2daisy.js @@ -106,7 +106,7 @@ function stringFormatMap(template, formatMap) return '}' }); let pass3 = pass2.replace(format_match, (substring, value, index) => { - return formatMap[value] || ''; + return value in formatMap ? formatMap[value] : ''; }); return pass3; } @@ -480,7 +480,7 @@ ${replacements.name != '' ? `struct Daisy${replacements.name[0].toUpperCase()}${ /** This is the board's "System On Module" */ ${replacements.som_class} som; - ${replacements.som == 'seed' ? 'daisy::AdcChannelConfig cfg[ANALOG_COUNT]' : ''} + ${replacements.som == 'seed' ? 'daisy::AdcChannelConfig cfg[ANALOG_COUNT];' : ''} // I/O Components ${replacements.comps} From 658dc2d789c5093050aae06042875bd680fe79da Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Wed, 24 Nov 2021 14:37:56 -0700 Subject: [PATCH 021/100] Change `input_min/max` to range --- source/oopsy.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/source/oopsy.js b/source/oopsy.js index 0b1db49..284dccc 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -1475,17 +1475,21 @@ function generate_app(app, hardware, target, config) { if (src in hardware.inputs) { let input = hardware.inputs[src]; - let input_min = input.input_min || 0; - let input_max = input.input_max || 1; - // We ignore this step if the fields are empty - if (input_min != 0 || input_max != 1) + if ('range' in input) { - let new_range = node.range / (input_max - input_min); - node.range = new_range; + let input_min = input.range[0] || 0; + let input_max = input.range[1] || 1; - let new_min = node.min - input_min * new_range; - node.min = new_min; + // We ignore this step if the fields are default + if (input_min != 0 || input_max != 1) + { + let new_range = node.range / (input_max - input_min); + node.range = new_range; + + let new_min = node.min - input_min * new_range; + node.min = new_min; + } } } From 3d1212465577d131e72cea53b14f9015bfd8ab9e Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Fri, 3 Dec 2021 14:25:53 -0700 Subject: [PATCH 022/100] Dropped in json2daisy board json --- source/seed.field.json | 355 +++++++++++++++++++++++++++++++++++++++++ source/seed.patch.json | 87 ++++++++++ source/seed.petal.json | 201 +++++++++++++++++++++++ source/seed.pod.json | 52 +++++- 4 files changed, 689 insertions(+), 6 deletions(-) create mode 100644 source/seed.field.json create mode 100644 source/seed.patch.json create mode 100644 source/seed.petal.json diff --git a/source/seed.field.json b/source/seed.field.json new file mode 100644 index 0000000..9f0f560 --- /dev/null +++ b/source/seed.field.json @@ -0,0 +1,355 @@ +{ + "name": "field", + "som": "seed", + "defines": { + "OOPSY_TARGET_HAS_OLED": 1, + "OOPSY_TARGET_HAS_MIDI_INPUT": 1, + "OOPSY_TARGET_HAS_MIDI_OUTPUT": 1 + }, + "display": {}, + "audio": { + "channels": 2 + }, + "parents": { + "i2c": { + "component": "i2c", + "pin": { + "scl": 11, + "sda": 12 + } + }, + "led_driver": { + "component": "PCA9685", + "address": "{0x00, 0x02}", + "parent": "i2c", + "driver_count": 2 + }, + "pad_shift": { + "component": "CD4021", + "driver_count": 2, + "pin": { + "clk": 28, + "cs": 27, + "data": 26 + } + }, + "pot_mux": { + "component": "CD4051", + "mux_count": 8, + "pin": { + "adc": 16, + "sel0": 21, + "sel1": 20, + "sel2": 19 + } + } + }, + "components": { + "sw1": { + "component": "Switch", + "pin": 30 + }, + "sw2": { + "component": "Switch", + "pin": 29 + }, + "cv1": { + "component": "AnalogControlBipolar", + "pin": 17 + }, + "cv2": { + "component": "AnalogControlBipolar", + "pin": 18 + }, + "cv3": { + "component": "AnalogControlBipolar", + "pin": 25 + }, + "cv4": { + "component": "AnalogControlBipolar", + "pin": 24 + }, + "knob1": { + "component": "CD4051AnalogControl", + "index": 0, + "parent": "pot_mux" + }, + "knob2": { + "component": "CD4051AnalogControl", + "index": 3, + "parent": "pot_mux" + }, + "knob3": { + "component": "CD4051AnalogControl", + "index": 1, + "parent": "pot_mux" + }, + "knob4": { + "component": "CD4051AnalogControl", + "index": 4, + "parent": "pot_mux" + }, + "knob5": { + "component": "CD4051AnalogControl", + "index": 2, + "parent": "pot_mux" + }, + "knob6": { + "component": "CD4051AnalogControl", + "index": 5, + "parent": "pot_mux" + }, + "knob7": { + "component": "CD4051AnalogControl", + "index": 6, + "parent": "pot_mux" + }, + "knob8": { + "component": "CD4051AnalogControl", + "index": 7, + "parent": "pot_mux" + }, + "cvout1": { + "component": "CVOuts" + }, + "cvout2": { + "component": "CVOuts" + }, + "gatein": { + "component": "GateIn", + "pin": 0 + }, + "gateout": { + "component": "GateOut", + "pin": 15 + }, + "pada1": { + "component": "CD4021Switch", + "parent": "pad_shift", + "index": 0 + }, + "pada2": { + "component": "CD4021Switch", + "parent": "pad_shift", + "index": 1 + }, + "pada3": { + "component": "CD4021Switch", + "parent": "pad_shift", + "index": 2 + }, + "pada4": { + "component": "CD4021Switch", + "parent": "pad_shift", + "index": 3 + }, + "pada5": { + "component": "CD4021Switch", + "parent": "pad_shift", + "index": 4 + }, + "pada6": { + "component": "CD4021Switch", + "parent": "pad_shift", + "index": 5 + }, + "pada7": { + "component": "CD4021Switch", + "parent": "pad_shift", + "index": 6 + }, + "pada8": { + "component": "CD4021Switch", + "parent": "pad_shift", + "index": 7 + }, + "padb1": { + "component": "CD4021Switch", + "parent": "pad_shift", + "index": 15 + }, + "padb2": { + "component": "CD4021Switch", + "parent": "pad_shift", + "index": 14 + }, + "padb3": { + "component": "CD4021Switch", + "parent": "pad_shift", + "index": 13 + }, + "padb4": { + "component": "CD4021Switch", + "parent": "pad_shift", + "index": 12 + }, + "padb5": { + "component": "CD4021Switch", + "parent": "pad_shift", + "index": 11 + }, + "padb6": { + "component": "CD4021Switch", + "parent": "pad_shift", + "index": 10 + }, + "padb7": { + "component": "CD4021Switch", + "parent": "pad_shift", + "index": 9 + }, + "padb8": { + "component": "CD4021Switch", + "parent": "pad_shift", + "index": 8 + }, + "led_key_b1": { + "component": "PCA9685Led", + "index": 0, + "parent": "led_driver" + }, + "led_key_b2": { + "component": "PCA9685Led", + "index": 1, + "parent": "led_driver" + }, + "led_key_b3": { + "component": "PCA9685Led", + "index": 2, + "parent": "led_driver" + }, + "led_key_b4": { + "component": "PCA9685Led", + "index": 3, + "parent": "led_driver" + }, + "led_key_b5": { + "component": "PCA9685Led", + "index": 4, + "parent": "led_driver" + }, + "led_key_b6": { + "component": "PCA9685Led", + "index": 5, + "parent": "led_driver" + }, + "led_key_b7": { + "component": "PCA9685Led", + "index": 6, + "parent": "led_driver" + }, + "led_key_b8": { + "component": "PCA9685Led", + "index": 7, + "parent": "led_driver" + }, + "led_key_a1": { + "component": "PCA9685Led", + "index": 15, + "parent": "led_driver" + }, + "led_key_a2": { + "component": "PCA9685Led", + "index": 14, + "parent": "led_driver" + }, + "led_key_a3": { + "component": "PCA9685Led", + "index": 13, + "parent": "led_driver" + }, + "led_key_a4": { + "component": "PCA9685Led", + "index": 12, + "parent": "led_driver" + }, + "led_key_a5": { + "component": "PCA9685Led", + "index": 11, + "parent": "led_driver" + }, + "led_key_a6": { + "component": "PCA9685Led", + "index": 10, + "parent": "led_driver" + }, + "led_key_a7": { + "component": "PCA9685Led", + "index": 9, + "parent": "led_driver" + }, + "led_key_a8": { + "component": "PCA9685Led", + "index": 8, + "parent": "led_driver" + }, + "led_knob_1": { + "component": "PCA9685Led", + "index": 16, + "parent": "led_driver" + }, + "led_knob_2": { + "component": "PCA9685Led", + "index": 17, + "parent": "led_driver" + }, + "led_knob_3": { + "component": "PCA9685Led", + "index": 18, + "parent": "led_driver" + }, + "led_knob_4": { + "component": "PCA9685Led", + "index": 19, + "parent": "led_driver" + }, + "led_knob_5": { + "component": "PCA9685Led", + "index": 20, + "parent": "led_driver" + }, + "led_knob_6": { + "component": "PCA9685Led", + "index": 21, + "parent": "led_driver" + }, + "led_knob_7": { + "component": "PCA9685Led", + "index": 22, + "parent": "led_driver" + }, + "led_knob_8": { + "component": "PCA9685Led", + "index": 23, + "parent": "led_driver" + }, + "led_sw_1": { + "component": "PCA9685Led", + "index": 24, + "parent": "led_driver" + }, + "led_sw_2": { + "component": "PCA9685Led", + "index": 25, + "parent": "led_driver" + } + }, + "aliases": { + "cvout": "cvout1", + "switch": "sw1", + "button": "sw1", + "switch1": "sw1", + "button1": "sw1", + "switch2": "sw2", + "button2": "sw2", + "encswitch": "encoder_rise", + "enp": "encoder_press", + "switch3": "encoder_rise", + "press": "encoder_press", + "knob": "knob1", + "ctrl": "knob1", + "ctrl1": "knob1", + "ctrl2": "knob2", + "led": "led1" + } +} diff --git a/source/seed.patch.json b/source/seed.patch.json new file mode 100644 index 0000000..acaa2e4 --- /dev/null +++ b/source/seed.patch.json @@ -0,0 +1,87 @@ +{ + "name": "patch", + "som": "seed", + "defines": { + "OOPSY_TARGET_HAS_MIDI_INPUT": 1 + }, + "display": {}, + "audio": { + "channels": 4 + }, + "external_codecs": [ + { + "periph": "SAI_2", + "a_sync": "SLAVE", + "b_sync": "MASTER", + "a_dir": "TRANSMIT", + "b_dir": "RECEIVE", + "pin": { + "fs": 27, + "mclk": 24, + "sck": 28, + "sb": 25, + "sa": 26 + } + } + ], + "components": { + "knob1": { + "component": "AnalogControl", + "pin": 15 + }, + "knob2": { + "component": "AnalogControl", + "pin": 16 + }, + "knob3": { + "component": "AnalogControl", + "pin": 21 + }, + "knob4": { + "component": "AnalogControl", + "pin": 18 + }, + "encoder": { + "component": "Encoder", + "pin": { + "a": 12, + "b": 11, + "click": 0 + } + }, + "gateout": { + "component": "GateOut", + "pin": 17, + "display": "" + }, + "cvout1": { + "component": "CVOuts" + }, + "cvout2": { + "component": "CVOuts" + }, + "gatein1": { + "component": "GateIn", + "pin": 20 + }, + "gatein2": { + "component": "GateIn", + "pin": 19 + } + }, + "aliases": { + "gate": "gatein1", + "gate1": "gatein1", + "gate2": "gatein2", + "cvout": "cvout1", + "encswitch": "encoder_rise", + "enp": "encoder_press", + "press": "encoder_press", + "knob": "knob1", + "ctrl": "knob1", + "ctrl1": "knob1", + "ctrl2": "knob2", + "ctrl3": "knob3", + "ctrl4": "knob4" + } +} diff --git a/source/seed.petal.json b/source/seed.petal.json new file mode 100644 index 0000000..8afa70a --- /dev/null +++ b/source/seed.petal.json @@ -0,0 +1,201 @@ +{ + "name": "petal", + "som": "seed", + "parents": { + "i2c": { + "component": "i2c", + "pin": { + "scl": 11, + "sda": 12 + } + }, + "led_driver": { + "component": "PCA9685", + "address": "{0x00, 0x02}", + "parent": "i2c", + "driver_count": 2 + } + }, + "audio": { + "channels": 2 + }, + "components": { + "sw1": { + "component": "Switch", + "pin": 8 + }, + "sw2": { + "component": "Switch", + "pin": 9 + }, + "sw3": { + "component": "Switch", + "pin": 10 + }, + "sw4": { + "component": "Switch", + "pin": 13 + }, + "sw5": { + "component": "Switch", + "pin": 25 + }, + "sw6": { + "component": "Switch", + "pin": 26 + }, + "sw7": { + "component": "Switch", + "pin": 7 + }, + "encoder": { + "component": "Encoder", + "pin": { + "a": 28, + "b": 27, + "click": 14 + } + }, + "knob1": { + "component": "AnalogControl", + "pin": 16 + }, + "knob2": { + "component": "AnalogControl", + "pin": 19 + }, + "knob3": { + "component": "AnalogControl", + "pin": 17 + }, + "knob4": { + "component": "AnalogControl", + "pin": 20 + }, + "knob5": { + "component": "AnalogControl", + "pin": 18 + }, + "knob6": { + "component": "AnalogControl", + "pin": 21 + }, + "expression": { + "component": "AnalogControl", + "pin": 15 + }, + "led_ring_1": { + "component": "PCA9685RgbLed", + "index": { + "red": 0, + "green": 1, + "blue": 2 + }, + "parent": "led_driver" + }, + "led_ring_2": { + "component": "PCA9685RgbLed", + "index": { + "red": 6, + "green": 7, + "blue": 8 + }, + "parent": "led_driver" + }, + "led_ring_3": { + "component": "PCA9685RgbLed", + "index": { + "red": 12, + "green": 13, + "blue": 14 + }, + "parent": "led_driver" + }, + "led_ring_4": { + "component": "PCA9685RgbLed", + "index": { + "red": 16, + "green": 17, + "blue": 18 + }, + "parent": "led_driver" + }, + "led_ring_5": { + "component": "PCA9685RgbLed", + "index": { + "red": 3, + "green": 4, + "blue": 5 + }, + "parent": "led_driver" + }, + "led_ring_6": { + "component": "PCA9685RgbLed", + "index": { + "red": 9, + "green": 10, + "blue": 11 + }, + "parent": "led_driver" + }, + "led_ring_7": { + "component": "PCA9685RgbLed", + "index": { + "red": 19, + "green": 20, + "blue": 21 + }, + "parent": "led_driver" + }, + "led_ring_8": { + "component": "PCA9685RgbLed", + "index": { + "red": 22, + "green": 23, + "blue": 24 + }, + "parent": "led_driver" + }, + "led_fs_1": { + "component": "PCA9685Led", + "index": 15, + "parent": "led_driver" + }, + "led_fs_2": { + "component": "PCA9685Led", + "index": 25, + "parent": "led_driver" + }, + "led_fs_3": { + "component": "PCA9685Led", + "index": 26, + "parent": "led_driver" + }, + "led_fs_4": { + "component": "PCA9685Led", + "index": 27, + "parent": "led_driver" + } + }, + "aliases": { + "switch": "sw1", + "switch1": "sw1", + "switch2": "sw2", + "switch3": "sw3", + "switch4": "sw4", + "switch5": "sw5", + "switch6": "sw6", + "switch7": "sw7", + "encswitch": "encoder_rise", + "enp": "encoder_press", + "press": "encoder_press", + "knob": "knob1", + "ctrl": "knob1", + "ctrl1": "knob1", + "ctrl2": "knob2", + "ctrl3": "knob3", + "ctrl4": "knob4", + "ctrl5": "knob5", + "ctrl6": "knob6" + } +} diff --git a/source/seed.pod.json b/source/seed.pod.json index 23721dd..08712c4 100644 --- a/source/seed.pod.json +++ b/source/seed.pod.json @@ -1,8 +1,13 @@ { - "name":"pod", + "name": "pod", + "som": "seed", "defines": { "OOPSY_TARGET_HAS_MIDI_INPUT": 1 }, + "display": {}, + "audio": { + "channels": 2 + }, "components": { "sw1": { "component": "Switch", @@ -22,26 +27,61 @@ }, "encoder": { "component": "Encoder", - "pin": {"a":26, "b":25, "click":13 } + "pin": { + "a": 26, + "b": 25, + "click": 13 + } }, "led1": { "component": "RgbLed", - "pin": {"r":20, "g":19, "b":18 } + "pin": { + "r": 20, + "g": 19, + "b": 18 + } }, "led2": { "component": "RgbLed", - "pin": {"r":17, "g":24, "b":23 } + "pin": { + "r": 17, + "g": 24, + "b": 23 + } + }, + "led3": { + "component": "Led", + "pin": 10, + "display": "" + }, + "cvout1": { + "component": "CVOuts" + }, + "gatein": { + "component": "GateIn", + "pin": 12 + }, + "sw3": { + "component": "Switch3", + "pin": { + "a": 1, + "b": 2 + } } }, "aliases": { + "cvout": "cvout1", "switch": "sw1", "button": "sw1", "switch1": "sw1", "button1": "sw1", "switch2": "sw2", "button2": "sw2", + "switch3": "sw3", + "gate": "gatein", + "gate1": "gatein", + "encswitch": "encoder_rise", "enp": "encoder_press", - "switch3": "encoder_press", "press": "encoder_press", "knob": "knob1", "ctrl": "knob1", @@ -49,4 +89,4 @@ "ctrl2": "knob2", "led": "led1" } -} \ No newline at end of file +} From 0ea48d56b1ab9b6244a52c0dd33935ce05978d49 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Wed, 8 Dec 2021 13:35:30 -0800 Subject: [PATCH 023/100] Swapped default switch behavior --- source/component_defs.json | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/source/component_defs.json b/source/component_defs.json index 25034de..a6c845b 100644 --- a/source/component_defs.json +++ b/source/component_defs.json @@ -11,22 +11,22 @@ "updaterate": "{name}.SetUpdateRate(som.AudioCallbackRate());", "mapping": [ { - "name": "{name}_press", - "get": "({class_name}.{name}.Pressed()?1.f:0.f)", + "name": "{name}", + "get": "({class_name}.{name}.RisingEdge()?1.f:0.f)", "range": [ 0, 1 ], - "bool": false + "bool": true }, { - "name": "{name}", - "get": "({class_name}.{name}.RisingEdge()?1.f:0.f)", + "name": "{name}_press", + "get": "({class_name}.{name}.Pressed()?1.f:0.f)", "range": [ 0, 1 ], - "bool": true + "bool": false }, { "name": "{name}_fall", @@ -109,7 +109,6 @@ { "name": "{name}_seconds", "get": "({class_name}.{name}.TimeHeldMs()*0.001f)", - "range": null, "bool": false } ] @@ -330,14 +329,14 @@ "mapping": [ { "name": "{name}", - "get": "(json2daisy::{parent}_debounced[{index}] == 0xFE)", - "bool": true - }, - { - "name": "{name}_press", "get": "(json2daisy::{parent}_debounced[{index}] != 0xFF)", "bool": false }, + { + "name": "{name}_rise", + "get": "(json2daisy::{parent}_debounced[{index}] == 0xFE)", + "bool": true + }, { "name": "{name}_fall", "get": "(json2daisy::{parent}_debounced[{index}] == 0x7F)", From ee7235dd29abeba566fc86ed10b35202c9bc3c5d Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Wed, 8 Dec 2021 13:35:51 -0800 Subject: [PATCH 024/100] Updated hardcode for field --- source/genlib_daisy.h | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 16dbc15..c924237 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -39,6 +39,11 @@ static uint32_t rx_size = 0; static bool update = false; #endif +// A temproary measure to preserve Field compatibility +#ifdef OOPSY_TARGET_FIELD +#include "daisy_field.h" +#endif + ////////////////////////// DAISY EXPORT INTERFACING ////////////////////////// #define OOPSY_MIDI_BUFFER_SIZE (1024) @@ -482,7 +487,6 @@ namespace oopsy { console_line = console_rows-1; #endif - som->adc.Start(); som->StartAudio(nullAudioCallback); mainloopCallback = nullMainloopCallback; displayCallback = nullMainloopCallback; @@ -867,9 +871,9 @@ namespace oopsy { if (hardware.menu_click) menu_button_released = hardware.menu_click; #elif defined(OOPSY_TARGET_FIELD) //menu_button_held = hardware.GetSwitch(0)->Pressed(); - menu_button_incr += hardware.GetSwitch(1)->FallingEdge(); - menu_button_held_ms = hardware.GetSwitch(0)->TimeHeldMs(); - if (hardware.GetSwitch(0)->FallingEdge()) menu_button_released = 1; + menu_button_incr += hardware.sw2.FallingEdge(); + menu_button_held_ms = hardware.sw1.TimeHeldMs(); + if (hardware.sw1.FallingEdge()) menu_button_released = 1; #elif defined(OOPSY_TARGET_VERSIO) // menu_button_held = hardware.tap.Pressed(); // menu_button_incr += hardware.GetKnobValue(6) * app_count; @@ -1031,16 +1035,22 @@ namespace oopsy { } #endif //OOPSY_TARGET_USES_MIDI_UART + // TODO -- need better way to handle this to avoid hardcoding #if (OOPSY_TARGET_FIELD) void setFieldLedsFromData(Data& data) { for(long i = 0; i < daisy::DaisyField::LED_LAST && i < data.dim; i++) { // LED indices run A1..8, B8..1, Knob1..8 // switch here to re-order the B8-1 to B1-8 - long idx=i; - if (idx > 7 && idx < 16) idx = 23-i; + // long idx=i; + // if (idx > 7 && idx < 16) idx = 23-i; + long idx = i; + if (idx < 8) + idx += 8; + else if (idx < 16) + idx -= 8; hardware.led_driver.SetLed(idx, data.read(i, 0)); } - hardware.led_driver.SwapBuffersAndTransmit(); + // hardware.led_driver.SwapBuffersAndTransmit(); // now handled by hardware class }; #endif From 63dea68aa7ded19175aaf5221c6ecba2a240a190 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Wed, 8 Dec 2021 13:36:11 -0800 Subject: [PATCH 025/100] Improved formatting --- source/json2daisy.js | 50 +++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/source/json2daisy.js b/source/json2daisy.js index e5f2d38..4bbd4b4 100644 --- a/source/json2daisy.js +++ b/source/json2daisy.js @@ -275,13 +275,14 @@ exports.generate_header = function generate_header(board_description_object) target.defines.OOPSY_OLED_DISPLAY_HEIGHT = target.display.dim[1] } + let has_display = target.defines.OOPSY_TARGET_HAS_OLED || false; + let replacements = {} replacements.name = target.name; replacements.som = som; replacements.external_codecs = target.external_codecs || []; replacements.som_class = som == 'seed' ? 'daisy::DaisySeed' : 'daisy::patch_sm::DaisyPatchSM'; - replacements.display_conditional = 'display' in target ? '#include "dev/oled_ssd130x.h' : ''; replacements.target_name = target.name; // TODO -- redundant? replacements.init = filter_map_template(components, 'init', 'is_default', true); @@ -304,12 +305,12 @@ exports.generate_header = function generate_header(board_description_object) replacements.gateout = filter_map_init(components, 'component', 'GateOut', key_exclude='is_default', match_exclude=true); replacements.dachandle = filter_map_init(components, 'component', 'CVOuts', key_exclude='is_default', match_exclude=true); - replacements.display = !('display' in target) ? '' : ` - daisy::OledDisplay<${target.display.driver}>::Config display_config; - display_config.driver_config.transport_config.Defaults(); - display.Init(display_config); - display.Fill(0); - display.Update(); + replacements.display = !(has_display) ? '' : ` + daisy::OledDisplay<${target.display.driver}>::Config display_config; + display_config.driver_config.transport_config.Defaults(); + display.Init(display_config); + display.Fill(0); + display.Update(); `; replacements.process = filter_map_template(components, 'process', key_exclude='is_default', match_exclude=true); @@ -322,7 +323,7 @@ exports.generate_header = function generate_header(board_description_object) replacements.hidupdaterates = filter_map_template(components, 'updaterate', key_exclude='is_default', match_exclude=true); component_decls = Object.filter(components, item => !(item.is_default || false)); - component_decls = component_decls.filter(item => 'typename' in item); + component_decls = component_decls.filter(item => 'typename' in item && item.typename != ""); replacements.comps = component_decls.map(item => `${stringFormatMap(item.typename, item)} ${item.name}`).join(";\n ") + ';'; non_class_decls = component_decls.filter(item => 'non_class_decl' in item); replacements.non_class_declarations = non_class_decls.map(item => stringFormatMap(item.non_class_decl, item)).join("\n"); @@ -335,6 +336,7 @@ exports.generate_header = function generate_header(board_description_object) #include "daisy_${replacements.som}.h" ${replacements.som == 'seed' ? '#include "dev/codec_ak4556.h"' : ''} +${has_display ? '#include "dev/oled_ssd130x.h"' : ''} #define ANALOG_COUNT ${replacements.analogcount} @@ -353,26 +355,26 @@ ${replacements.name != '' ? `struct Daisy${replacements.name[0].toUpperCase()}${ ${replacements.som == 'seed' ? `som.Configure(); som.Init(boost);` : `som.Init();`} ${replacements.init} - ${replacements.i2c != '' ? ' // i2c\n ' + replacements.i2c : ''} - ${replacements.pca9685 != '' ? ' // LED Drivers\n ' + replacements.pca9685 : ''} - ${replacements.switch != '' ? ' // Switches\n ' + replacements.switch : ''} - ${replacements.switch3 != '' ? ' // SPDT Switches\n ' + replacements.switch3 : ''} - ${replacements.cd4021 != '' ? ' // Muxes\n ' + replacements.cd4021 : ''} - ${replacements.gatein != '' ? ' // Gate ins\n ' + replacements.gatein : ''} - ${replacements.encoder != '' ? ' // Rotary encoders\n ' + replacements.encoder : ''} - ${replacements.init_single != '' ? ' // Single channel ADC initialization\n ' + replacements.init_single : ''} + ${replacements.i2c != '' ? '// i2c\n ' + replacements.i2c : ''} + ${replacements.pca9685 != '' ? '// LED Drivers\n ' + replacements.pca9685 : ''} + ${replacements.switch != '' ? '// Switches\n ' + replacements.switch : ''} + ${replacements.switch3 != '' ? '// SPDT Switches\n ' + replacements.switch3 : ''} + ${replacements.cd4021 != '' ? '// Muxes\n ' + replacements.cd4021 : ''} + ${replacements.gatein != '' ? '// Gate ins\n ' + replacements.gatein : ''} + ${replacements.encoder != '' ? '// Rotary encoders\n ' + replacements.encoder : ''} + ${replacements.init_single != '' ? '// Single channel ADC initialization\n ' + replacements.init_single : ''} ${replacements.som == 'seed' ? 'som.adc.Init(cfg, ANALOG_COUNT);' : ''} - ${replacements.ctrl_init != '' ? ' // AnalogControl objects\n ' + replacements.ctrl_init : ''} - ${replacements.ctrl_mux_init != '' ? ' // Multiplexed AnlogControl objects\n ' + replacements.ctrl_mux_init : ''} - ${replacements.led != '' ? ' // LEDs\n ' + replacements.led : ''} - ${replacements.rgbled != '' ? ' // RBG LEDs \n ' + replacements.rgbled : ''} - ${replacements.gateout != '' ? ' // Gate outs\n ' + replacements.gateout : ''} - ${replacements.dachandle != '' ? ' // DAC\n ' + replacements.dachandle : ''} - ${replacements.display != '' ? ' // Display\n ' + replacements.display : ''} + ${replacements.ctrl_init != '' ? '// AnalogControl objects\n ' + replacements.ctrl_init : ''} + ${replacements.ctrl_mux_init != '' ? '// Multiplexed AnlogControl objects\n ' + replacements.ctrl_mux_init : ''} + ${replacements.led != '' ? '// LEDs\n ' + replacements.led : ''} + ${replacements.rgbled != '' ? '// RBG LEDs \n ' + replacements.rgbled : ''} + ${replacements.gateout != '' ? '// Gate outs\n ' + replacements.gateout : ''} + ${replacements.dachandle != '' ? '// DAC\n ' + replacements.dachandle : ''} + ${replacements.display != '' ? '// Display\n ' + replacements.display : ''} ${replacements.external_codecs.length == 0 ? '' : generateCodecs(replacements.external_codecs)} - ${replacements.som == 'seed' ? ' som.adc.Start();' : ''} + ${replacements.som == 'seed' ? 'som.adc.Start();' : ''} } /** Handles all the controls processing that needs to occur at the block rate From 6865883350692318f8515b4127b9cae14629a1b0 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Wed, 8 Dec 2021 13:36:26 -0800 Subject: [PATCH 026/100] Fixed small issues + cleanup --- source/oopsy.js | 176 ++++-------------------------------------------- 1 file changed, 12 insertions(+), 164 deletions(-) diff --git a/source/oopsy.js b/source/oopsy.js index 284dccc..7e1f6df 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -285,157 +285,6 @@ const component_defs = { } }; -// generate the struct -function generate_target_struct(target) { - - let board_info = json2daisy.generate_header(target); -// // flesh out target components: -// let components = Object.entries(target.components) -// .sort((a, b) => -// a[1].component < b[1].component -// ? -1 -// : a[1].component > b[1].component -// ? 1 -// : 0 -// ) -// .map((pair) => { -// let [name, def] = pair; -// def.name = name; -// let component = component_defs[def.component]; -// if (component) { -// // copy component defaults into the def -// // TODO this should be recursive for object structures... -// for (let k of Object.keys(component)) { -// if (def[k] == undefined) def[k] = component[k]; -// } -// } else { -// throw new Error("undefined component kind: " + def.component); -// } -// return def; -// }); -// target.components = components; -// target.name = target.name || "custom" - -// if (target.display) { -// // apply defaults: -// target.display = Object.assign({ -// driver: "daisy::SSD130x4WireSpi128x64Driver", -// config: [], -// dim: [128, 64] -// }, target.display) -// target.defines.OOPSY_TARGET_HAS_OLED = 1 -// target.defines.OOPSY_OLED_DISPLAY_WIDTH = target.display.dim[0] -// target.defines.OOPSY_OLED_DISPLAY_HEIGHT = target.display.dim[1] -// } - -// if (target.som == 'patch_sm') { -// target.defines.OOPSY_SOM_PATCH_SM = 1 -// } - -// console.log(json2daisy.format_map("Hello, {{{world}}}!", {world: 'guys ^.^'})); - -// return ` -// #include "daisy_${target.som}.h" -// ${target.display ? `#include "dev/oled_ssd130x.h"` : ""} -// // name: ${target.name} -// struct Daisy { - -// void Init(bool boost = false) { -// ${target.som == 'seed' ? 'som.Configure();' : ''} -// som.Init(${target.som == 'seed' ? 'boost' : ''}); -// ${components.filter((e) => e.init) -// .map((e) => ` -// ${template(e.init, e)}` -// ).join("")} -// ${components.filter((e) => e.typename == "daisy::Switch") -// .map((e, i) => ` -// ${e.name}.Init(som.GetPin(${e.pin}), som.AudioCallbackRate(), ${e.type}, ${e.polarity}, ${e.pull});` -// ).join("")} -// ${components.filter((e) => e.typename == "daisy::Switch3").map((e, i) => ` -// ${e.name}.Init(som.GetPin(${e.pin.a}), som.GetPin(${e.pin.b}));` -// ).join("")} -// ${components.filter((e) => e.typename == "daisy::GateIn").map((e, i) => ` -// dsy_gpio_pin ${e.name}_pin = som.GetPin(${e.pin}); -// ${e.name}.Init(&${e.name}_pin);` -// ).join("")} -// ${components.filter((e) => e.typename == "daisy::Encoder").map((e, i) => ` -// ${e.name}.Init(som.GetPin(${e.pin.a}), som.GetPin(${e.pin.b}), som.GetPin(${e.pin.click}), som.AudioCallbackRate());` -// ).join("")} -// static const int ANALOG_COUNT = ${ -// components.filter((e) => e.typename == "daisy::AnalogControl").length}; -// daisy::AdcChannelConfig cfg[ANALOG_COUNT]; -// ${components.filter((e) => e.typename == "daisy::AnalogControl").map((e, i) => ` -// cfg[${i}].InitSingle(som.GetPin(${e.pin}));`).join("")} -// som.adc.Init(cfg, ANALOG_COUNT); -// ${components.filter((e) => e.typename == "daisy::AnalogControl").map((e, i) => ` -// ${e.name}.Init(som.adc.GetPtr(${i}), som.AudioCallbackRate(), ${e.flip}, ${e.invert});`).join("")} -// ${components.filter((e) => e.typename == "daisy::Led").map((e, i) => ` -// ${e.name}.Init(som.GetPin(${e.pin}), ${e.invert}); -// ${e.name}.Set(0.0f);`).join("")} -// ${components.filter((e) => e.typename == "daisy::RgbLed").map((e, i) => ` -// ${e.name}.Init(som.GetPin(${e.pin.r}), som.GetPin(${e.pin.g}), som.GetPin(${e.pin.b}), ${e.invert}); -// ${e.name}.Set(0.0f, 0.0f, 0.0f);`).join("")} -// ${components.filter((e) => e.typename == "daisy::dsy_gpio").map((e, i) => ` -// ${e.name}.pin = som.GetPin(${e.pin}); -// ${e.name}.mode = ${e.mode}; -// ${e.name}.pull = ${e.pull}; -// dsy_gpio_init(&${e.name});`).join("")} -// ${components.filter((e) => e.typename == "daisy::DacHandle::Config").map((e, i) => ` -// ${e.name}.bitdepth = ${e.bitdepth}; -// ${e.name}.buff_state = ${e.buff_state}; -// ${e.name}.mode = ${e.mode}; -// ${e.name}.chn = ${e.channel}; -// som.dac.Init(${e.name}); -// som.dac.WriteValue(${e.channel}, 0);`).join("")} -// ${target.display ? ` -// daisy::OledDisplay<${target.display.driver}>::Config display_config; -// display_config.driver_config.transport_config.Defaults(); ${(target.display.config || []).map(e=>` -// ${e}`).join("")} -// display.Init(display_config);`:`// no display`} -// } - -// void ProcessAllControls() { -// ${components.filter((e) => e.process).map((e) => ` -// ${template(e.process, e)}`).join("")} -// ${components.filter((e) => e.meta).map((e) => e.meta.map(m=>` -// ${template(m, e)}`).join("")).join("")} -// } - -// void PostProcess() { -// ${components.filter((e) => e.postprocess).map((e) => ` -// ${template(e.postprocess, e)}`).join("")} -// } - -// void Display() { -// ${components.filter((e) => e.display).map((e) => ` -// ${template(e.display, e)}`).join("")} -// } - -// void SetAudioSampleRate(daisy::SaiHandle::Config::SampleRate samplerate) { -// som.SetAudioSampleRate(samplerate); -// SetHidUpdateRates(); -// } - -// void SetAudioBlockSize(size_t size) { -// som.SetAudioBlockSize(size); -// SetHidUpdateRates(); -// } - -// void SetHidUpdateRates() { -// ${components.filter((e) => e.updaterate).map((e) => ` -// ${template(e.updaterate, e)}`).join("")} -// } - -// ${target.som == 'seed' ? 'daisy::DaisySeed' : 'daisy::patch_sm::DaisyPatchInit'} som; -// ${components.map((e) => ` -// ${e.typename} ${e.name};`).join("")} -// ${target.display ? `daisy::OledDisplay<${target.display.driver}> display;`:`// no display`} -// int menu_click = 0, menu_hold = 0, menu_rotate = 0; - -// };`; - return board_info; -} - let watchers = [] // the script can be invoked directly as a command-line program, @@ -472,14 +321,14 @@ function run() { case "upload": case "up": action="upload"; break; - case "field": - case "petal": - case "patch": case "versio": target = arg; break; case "bluemchen": target_path = path.join(__dirname, "seed.bluemchen.json"); break; case "nehcmeulb": target_path = path.join(__dirname, "seed.nehcmeulb.json"); break; case "pod": target_path = path.join(__dirname, "seed.pod.json"); break; case "patch_init": target_path = path.join(__dirname, "patch_sm.patch_init.json"); break; + case "field": target_path = path.join(__dirname, "seed.field.json"); break; + case "petal": target_path = path.join(__dirname, "seed.petal.json"); break; + case "patch": target_path = path.join(__dirname, "seed.patch.json"); break; case "watch": watch=true; break; @@ -558,7 +407,9 @@ function run() { target_path = path.join(__dirname, `daisy.${target}.json`); old_json = true; } else { - OOPSY_TARGET_SEED = 1 + // TODO -- should a seed target even really exist? Custom boards + // (and even prototypes / breadboards) should really be defined with a JSON file + // OOPSY_TARGET_SEED = 1 target = path.parse(target_path).name.replace(".", "_") som_match = path.parse(target_path).name.match(/([A-Za-z_0-9\-]+)\./) assert(som_match != null, `Daisy SOM undefined. Provide the SOM as in the following: "som.MyBoard.json"`); @@ -597,7 +448,6 @@ function run() { hardware.aliases = board_info.aliases; if (hardware.components) { - // hardware.struct = generate_target_struct(hardware); // generate IO for (let comp in hardware.components) { let component = hardware.components[comp]; @@ -1476,7 +1326,7 @@ function generate_app(app, hardware, target, config) { { let input = hardware.inputs[src]; - if ('range' in input) + if ('range' in input && typeof input.range !== 'undefined') { let input_min = input.range[0] || 0; let input_max = input.range[1] || 1; @@ -1520,7 +1370,7 @@ function generate_app(app, hardware, target, config) { } return varname; }) - // TODO -- need to figure out why gate outs are being omitted + gen.datas = app.patch.datas.map((param, i)=>{ const varname = "gen_data_"+param.name; let src, label; @@ -1574,8 +1424,8 @@ function generate_app(app, hardware, target, config) { } }) - // console.log(nodes); - let board_glue = daisy_glue.parse_parameters(nodes, hardware.components, hardware.aliases, 'hardware'); + // TODO -- This may or may not be implemented any time soon + // let board_glue = daisy_glue.parse_parameters(nodes, hardware.components, hardware.aliases, 'hardware'); // normal any audio outs from earlier (non cv/gate/midi) audio outs { @@ -1591,8 +1441,6 @@ function generate_app(app, hardware, target, config) { }); } - console.log(daisy.device_outs.map(name => nodes[name]).filter(node => node.src)); - let som_or_seed = hardware.defines.OOPSY_OLD_JSON ? 'seed' : 'som'; const struct = ` @@ -1728,7 +1576,7 @@ struct App_${name} : public oopsy::App { memcpy(${node.name}, ${node.src}, sizeof(float)*size);` : ` memset(${node.name}, 0, sizeof(float)*size);`).join("")} ${app.inserts.concat(hardware.inserts).filter(o => o.where == "post_audio").map(o => o.code).join("\n\t")} - ${hardware.defines.OOPSY_TARGET_SEED ? "hardware.PostProcess();" : ""} + ${hardware.som == 'seed' ? "hardware.PostProcess();" : ""} } void mainloopCallback(oopsy::GenDaisy& daisy, uint32_t t, uint32_t dt) { @@ -1801,7 +1649,7 @@ struct App_${name} : public oopsy::App { .filter(node => node.config.where == "display") .map(node=>` ${interpolate(node.config.code, node)}`).join("")} - ${hardware.defines.OOPSY_TARGET_SEED ? "hardware.Display();" : ""} + ${hardware.som == 'seed' ? "hardware.Display();" : ""} } ${defines.OOPSY_HAS_PARAM_VIEW ? ` From dfba59fc6a3b14c8263f9c0e7103efc057e5e981 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Wed, 8 Dec 2021 13:36:44 -0800 Subject: [PATCH 027/100] Added aliases and datahandler workaround --- source/seed.field.json | 57 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/source/seed.field.json b/source/seed.field.json index 9f0f560..bef34bb 100644 --- a/source/seed.field.json +++ b/source/seed.field.json @@ -2,6 +2,7 @@ "name": "field", "som": "seed", "defines": { + "OOPSY_TARGET_FIELD": 1, "OOPSY_TARGET_HAS_OLED": 1, "OOPSY_TARGET_HAS_MIDI_INPUT": 1, "OOPSY_TARGET_HAS_MIDI_OUTPUT": 1 @@ -109,10 +110,7 @@ "index": 7, "parent": "pot_mux" }, - "cvout1": { - "component": "CVOuts" - }, - "cvout2": { + "cvout": { "component": "CVOuts" }, "gatein": { @@ -336,6 +334,9 @@ }, "aliases": { "cvout": "cvout1", + "gate": "gatein", + "gate1": "gatein", + "gateout1": "gateout", "switch": "sw1", "button": "sw1", "switch1": "sw1", @@ -350,6 +351,52 @@ "ctrl": "knob1", "ctrl1": "knob1", "ctrl2": "knob2", - "led": "led1" + "led": "led1", + "keyA1": "pada1", + "keyA2": "pada2", + "keyA3": "pada3", + "keyA4": "pada4", + "keyA5": "pada5", + "keyA6": "pada6", + "keyA7": "pada7", + "keyA8": "pada8", + "keyB1": "padb1", + "keyB2": "padb2", + "keyB3": "padb3", + "keyB4": "padb4", + "keyB5": "padb5", + "keyB6": "padb6", + "keyB7": "padb7", + "keyB8": "padb8", + "key1": "pada1", + "key2": "pada2", + "key3": "pada3", + "key4": "pada4", + "key5": "pada5", + "key6": "pada6", + "key7": "pada7", + "key8": "pada8", + "key9": "padb1", + "key10": "padb2", + "key11": "padb3", + "key12": "padb4", + "key13": "padb5", + "key14": "padb6", + "key15": "padb7", + "key16": "padb8", + "leds": "dsy_leds" + }, + "datahandlers": { + "dsy_leds": { + "where": "display", + "code": "daisy.setFieldLedsFromData($);" + } + }, + "labels": { + "datas": { + "leds": "dsy_leds" + }, + "params": {}, + "outs": {} } } From e4e3ce7568c4c20e5fdb798c3cfcbf2b1c071597 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Tue, 11 Jan 2022 17:16:39 -0700 Subject: [PATCH 028/100] Added sensors to json generation --- source/component_defs.json | 881 +++++++++++++++++++++++++++++++++++++ source/json2daisy.js | 28 ++ 2 files changed, 909 insertions(+) diff --git a/source/component_defs.json b/source/component_defs.json index a6c845b..32fc000 100644 --- a/source/component_defs.json +++ b/source/component_defs.json @@ -394,5 +394,886 @@ "bool": false } ] + }, + "MotorShield": { + "map_init": "daisy::Pca9685::Config {name}_pca_config;\n {name}_pca_config.address = {address};\n {name}_pca_config.periph = {periph};\n {name}_pca_config.speed = {speed};\n {name}_pca_config.scl = som.GetPin({pin_scl});\n {name}_pca_config.sda = som.GetPin({pin_sda});\n daisy::Adafruit_MotorShield::Config {name}_config;\n {name}_config.pca9685_config = {name}_pca_config;\n {name}_config.frequency = {frequency};\n {name}.Init({name}_config);", + "typename": "daisy::Adafruit_MotorShield", + "direction": "out", + "pin": "scl,sda", + "address": "daisy::Pca9685::PCA9685_I2C_BASE_ADDRESS", + "periph": "daisy::I2CHandle::Config::Peripheral::I2C_1", + "speed": "daisy::I2CHandle::Config::Speed::I2C_400KHZ", + "frequency": "1600", + "mapping": [] + }, + "StepperMotor": { + "map_init": "{name} = {parent}.GetStepper({steps}, {index});\n {name}->SetSpeed({speed});", + "typename": "daisy::Adafruit_MotorShield::Adafruit_StepperMotor*", + "direction": "out", + "parent": "", + "steps": 48, + "index": 1, + "speed": 60, + "loopprocess": "{name}->Process();", + "mapping": [ + { + "name": "{name}", + "set": "if ({value} > 0)\n {class_name}.{name}->StepNonblocking({value}, daisy::Adafruit_MotorShield::FORWARD);\n else if ({value} < 0)\n {class_name}.{name}->StepNonblocking(-{value}, daisy::Adafruit_MotorShield::BACKWARD);", + "bool": true, + "where": "hook" + }, + { + "name": "{name}_release", + "set": "{class_name}.{name}->Release();", + "bool": true, + "where": "hook" + } + ] + }, + "DcMotor": { + "map_init": "{name} = {parent}.GetMotor({index});\n {name}->SetSpeedFine({speed} * 4095);", + "typename": "daisy::Adafruit_MotorShield::Adafruit_DCMotor*", + "direction": "out", + "parent": "", + "index": 1, + "speed": 0.25, + "mapping": [ + { + "name": "{name}", + "set": "if ({value} > 0)\n {class_name}.{name}->Run(daisy::Adafruit_MotorShield::FORWARD);\n else if ({value} < 0)\n {class_name}.{name}->Run(daisy::Adafruit_MotorShield::BACKWARD);\n else\n {class_name}.{name}->FullOff();", + "where": "main" + } + ] + }, + "Bme280": { + "map_init": "daisy::Bme280I2CTransport::Config {name}_config;\n {name}_config.periph = {periph};\n {name}_config.speed = {speed};\n {name}_config.scl = som.GetPin({pin_scl});\n {name}_config.sda = som.GetPin({pin_sda});\n {name}_config.address = {address};\n daisy::Bme280I2C::Config {name}_config_main;\n {name}_config_main.transport_config = {name}_config;\n {name}.Init({name}_config_main);", + "typename": "daisy::Bme280I2C", + "direction": "in", + "pin": "scl,sda", + "address": "daisy::Pca9685::PCA9685_I2C_BASE_ADDRESS", + "periph": "daisy::I2CHandle::Config::Peripheral::I2C_1", + "speed": "daisy::I2CHandle::Config::Speed::I2C_400KHZ", + "pressure": 1013, + "mapping": [ + { + "name": "{name}", + "get": "{class_name}.{name}.ReadTemperature()", + "where": "main" + }, + { + "name": "{name}_temp", + "get": "{class_name}.{name}.ReadTemperature()", + "where": "main" + }, + { + "name": "{name}_hum", + "get": "{class_name}.{name}.ReadHumidity()", + "where": "main" + }, + { + "name": "{name}_press", + "get": "{class_name}.{name}.ReadPressure()", + "where": "main" + }, + { + "name": "{name}_alt", + "get": "{class_name}.{name}.ReadAltitude({pressure})", + "where": "main" + } + ] + }, + "HallSensor": { + "map_init": "daisy::HallSensor::Config {name}_config;\n {name}_config.periph = {periph};\n {name}_config.pin = som.GetPin({pin});\n {name}.Init({name}_config);", + "typename": "daisy::HallSensor", + "direction": "in", + "pin": 14, + "periph": "daisy::HallSensor::Config::Peripheral::TIM_4", + "mapping": [ + { + "name": "{name}", + "get": "{class_name}.{name}.GetState()" + }, + { + "name": "{name}_count", + "get": "{class_name}.{name}.GetCount()" + } + ] + }, + "Tlv493d": { + "map_init": "daisy::Tlv493dI2CTransport::Config {name}_config;\n {name}_config.periph = {periph};\n {name}_config.speed = {speed};\n {name}_config.scl = som.GetPin({pin_scl});\n {name}_config.sda = som.GetPin({pin_sda});\n daisy::Tlv493dI2C::Config {name}_main_conf;\n {name}_main_conf.transport_config = {name}_config;\n {name}_main_conf.address = {address};\n {name}.Init({name}_main_conf);", + "typename": "daisy::Tlv493dI2C", + "direction": "in", + "pin": "scl,sda", + "address": "TLV493D_ADDRESS1", + "periph": "daisy::I2CHandle::Config::Peripheral::I2C_1", + "speed": "daisy::I2CHandle::Config::Speed::I2C_400KHZ", + "loopprocess": "{name}.UpdateData();", + "mapping": [ + { + "name": "{name}", + "get": "{class_name}.{name}.GetAmount()" + }, + { + "name": "{name}_x", + "get": "{class_name}.{name}.GetX()" + }, + { + "name": "{name}_y", + "get": "{class_name}.{name}.GetY()" + }, + { + "name": "{name}_z", + "get": "{class_name}.{name}.GetZ()" + }, + { + "name": "{name}_amount", + "get": "{class_name}.{name}.GetAmount()" + }, + { + "name": "{name}_azimuth", + "get": "{class_name}.{name}.GetAzimuth()" + }, + { + "name": "{name}_polar", + "get": "{class_name}.{name}.GetPolar()" + } + ] + }, + "Mpr121": { + "map_init": "daisy::Mpr121I2CTransport::Config {name}_config;\n {name}_config.periph = {periph};\n {name}_config.speed = {speed};\n {name}_config.scl = som.GetPin({pin_scl});\n {name}_config.sda = som.GetPin({pin_sda});\n {name}_config.dev_addr = {address};\n daisy::Mpr121I2C::Config {name}_main_conf;\n {name}_main_conf.transport_config = {name}_config;\n {name}_main_conf.touch_threshold = {touch_threshold};\n {name}_main_conf.release_threshold = {release_threshold};\n {name}.Init({name}_main_conf);", + "typename": "daisy::Mpr121I2C", + "direction": "in", + "pin": "scl,sda", + "address": "MPR121_I2CADDR_DEFAULT", + "periph": "daisy::I2CHandle::Config::Peripheral::I2C_1", + "speed": "daisy::I2CHandle::Config::Speed::I2C_400KHZ", + "touch_threshold": "MPR121_TOUCH_THRESHOLD_DEFAULT", + "release_threshold": "MPR121_RELEASE_THRESHOLD_DEFAULT", + "mapping": [ + { + "name": "{name}", + "get": "(({class_name}.{name}.Touched() & 0x001) ? 1.0f : 0.f)", + "where": "main" + }, + { + "name": "{name}_ch0", + "get": "(({class_name}.{name}.Touched() & 0x001) ? 1.0f : 0.f)", + "where": "main" + }, + { + "name": "{name}_ch1", + "get": "(({class_name}.{name}.Touched() & 0x002) ? 1.0f : 0.f)", + "where": "main" + }, + { + "name": "{name}_ch2", + "get": "(({class_name}.{name}.Touched() & 0x004) ? 1.0f : 0.f)", + "where": "main" + }, + { + "name": "{name}_ch3", + "get": "(({class_name}.{name}.Touched() & 0x008) ? 1.0f : 0.f)", + "where": "main" + }, + { + "name": "{name}_ch4", + "get": "(({class_name}.{name}.Touched() & 0x010) ? 1.0f : 0.f)", + "where": "main" + }, + { + "name": "{name}_ch5", + "get": "(({class_name}.{name}.Touched() & 0x020) ? 1.0f : 0.f)", + "where": "main" + }, + { + "name": "{name}_ch6", + "get": "(({class_name}.{name}.Touched() & 0x040) ? 1.0f : 0.f)", + "where": "main" + }, + { + "name": "{name}_ch7", + "get": "(({class_name}.{name}.Touched() & 0x080) ? 1.0f : 0.f)", + "where": "main" + }, + { + "name": "{name}_ch8", + "get": "(({class_name}.{name}.Touched() & 0x100) ? 1.0f : 0.f)", + "where": "main" + }, + { + "name": "{name}_ch9", + "get": "(({class_name}.{name}.Touched() & 0x200) ? 1.0f : 0.f)", + "where": "main" + }, + { + "name": "{name}_ch10", + "get": "(({class_name}.{name}.Touched() & 0x400) ? 1.0f : 0.f)", + "where": "main" + }, + { + "name": "{name}_ch11", + "get": "(({class_name}.{name}.Touched() & 0x800) ? 1.0f : 0.f)", + "where": "main" + }, + { + "name": "{name}_ch0_raw", + "get": "{class_name}.{name}.FilteredData(0)", + "where": "main", + "range": [ + 0, + 1023 + ] + }, + { + "name": "{name}_ch1_raw", + "get": "{class_name}.{name}.FilteredData(1)", + "where": "main", + "range": [ + 0, + 1023 + ] + }, + { + "name": "{name}_ch2_raw", + "get": "{class_name}.{name}.FilteredData(2)", + "where": "main", + "range": [ + 0, + 1023 + ] + }, + { + "name": "{name}_ch3_raw", + "get": "{class_name}.{name}.FilteredData(3)", + "where": "main", + "range": [ + 0, + 1023 + ] + }, + { + "name": "{name}_ch4_raw", + "get": "{class_name}.{name}.FilteredData(4)", + "where": "main", + "range": [ + 0, + 1023 + ] + }, + { + "name": "{name}_ch5_raw", + "get": "{class_name}.{name}.FilteredData(5)", + "where": "main", + "range": [ + 0, + 1023 + ] + }, + { + "name": "{name}_ch6_raw", + "get": "{class_name}.{name}.FilteredData(6)", + "where": "main", + "range": [ + 0, + 1023 + ] + }, + { + "name": "{name}_ch7_raw", + "get": "{class_name}.{name}.FilteredData(7)", + "where": "main", + "range": [ + 0, + 1023 + ] + }, + { + "name": "{name}_ch8_raw", + "get": "{class_name}.{name}.FilteredData(8)", + "where": "main", + "range": [ + 0, + 1023 + ] + }, + { + "name": "{name}_ch9_raw", + "get": "{class_name}.{name}.FilteredData(9)", + "where": "main", + "range": [ + 0, + 1023 + ] + }, + { + "name": "{name}_ch10_raw", + "get": "{class_name}.{name}.FilteredData(10)", + "where": "main", + "range": [ + 0, + 1023 + ] + }, + { + "name": "{name}_ch11_raw", + "get": "{class_name}.{name}.FilteredData(11)", + "where": "main", + "range": [ + 0, + 1023 + ] + } + ] + }, + "Apds9960": { + "map_init": "daisy::Apds9960I2CTransport::Config {name}_config;\n {name}_config.periph = {periph};\n {name}_config.speed = {speed};\n {name}_config.scl = som.GetPin({pin_scl});\n {name}_config.sda = som.GetPin({pin_sda});\n daisy::Apds9960I2C::Config {name}_main_conf;\n {name}_main_conf.transport_config = {name}_config;\n {name}.Init({name}_main_conf);", + "typename": "daisy::Apds9960I2C", + "direction": "in", + "pin": "scl,sda", + "periph": "daisy::I2CHandle::Config::Peripheral::I2C_1", + "speed": "daisy::I2CHandle::Config::Speed::I2C_400KHZ", + "mapping": [ + { + "name": "{name}", + "get": "{class_name}.{name}.ReadGesture()", + "where": "main" + }, + { + "name": "{name}_gest", + "get": "{class_name}.{name}.ReadGesture()", + "where": "main" + }, + { + "name": "{name}_prox", + "get": "{class_name}.{name}.ReadProximity()", + "where": "main" + }, + { + "name": "{name}_red", + "get": "{class_name}.{name}.GetColorDataRed()", + "where": "main" + }, + { + "name": "{name}_green", + "get": "{class_name}.{name}.GetColorDataGreen()", + "where": "main" + }, + { + "name": "{name}_blue", + "get": "{class_name}.{name}.GetColorDataBlue()", + "where": "main" + }, + { + "name": "{name}_clear", + "get": "{class_name}.{name}.GetColorDataClear()", + "where": "main" + } + ] + }, + "Bmp390": { + "map_init": "daisy::Bmp390I2CTransport::Config {name}_config;\n {name}_config.periph = {periph};\n {name}_config.speed = {speed};\n {name}_config.scl = som.GetPin({pin_scl});\n {name}_config.sda = som.GetPin({pin_sda});\n daisy::Bmp390I2C::Config {name}_config_main;\n {name}_config_main.transport_config = {name}_config;\n {name}.Init({name}_config_main);", + "typename": "daisy::Bmp390I2C", + "direction": "in", + "pin": "scl,sda", + "periph": "daisy::I2CHandle::Config::Peripheral::I2C_1", + "speed": "daisy::I2CHandle::Config::Speed::I2C_400KHZ", + "pressure": 1013, + "loopprocess": "{name}.Process();", + "mapping": [ + { + "name": "{name}", + "get": "{class_name}.{name}.ReadTemperature()" + }, + { + "name": "{name}_temp", + "get": "{class_name}.{name}.ReadTemperature()" + }, + { + "name": "{name}_press", + "get": "{class_name}.{name}.ReadPressure()" + }, + { + "name": "{name}_alt", + "get": "{class_name}.{name}.ReadAltitude({pressure})" + } + ] + }, + "Vl53l1x": { + "map_init": "daisy::Vl53l1xI2CTransport::Config {name}_config;\n {name}_config.periph = {periph};\n {name}_config.speed = {speed};\n {name}_config.scl = som.GetPin({pin_scl});\n {name}_config.sda = som.GetPin({pin_sda});\n {name}_config.dev_addr = {address};\n daisy::Vl53l1xI2C::Config {name}_main_conf;\n {name}_main_conf.transport_config = {name}_config;\n {name}_main_conf.xShut = som.GetPin({pin_xshut});\n {name}.Init({name}_main_conf);\n {name}.StartRanging();\n {name}.StartTemperatureUpdate();", + "typename": "daisy::Vl53l1xI2C", + "direction": "in", + "pin": "scl,sda,xshut", + "address": 82, + "periph": "daisy::I2CHandle::Config::Peripheral::I2C_1", + "speed": "daisy::I2CHandle::Config::Speed::I2C_400KHZ", + "loopprocess": "{name}.Process();", + "mapping": [ + { + "name": "{name}", + "get": "{class_name}.{name}.GetDistance()" + }, + { + "name": "{name}_dist", + "get": "{class_name}.{name}.GetDistance()" + }, + { + "name": "{name}_sig_per_spad", + "get": "{class_name}.{name}.GetSignalPerSpad()" + }, + { + "name": "{name}_amb_per_spad", + "get": "{class_name}.{name}.GetAmbientPerSpad()" + }, + { + "name": "{name}_sig_rate", + "get": "{class_name}.{name}.GetSignalRate()" + }, + { + "name": "{name}_amb_rate", + "get": "{class_name}.{name}.GetAmbientRate()" + }, + { + "name": "{name}_spad_nb", + "get": "{class_name}.{name}.GetSpadNb()" + } + ] + }, + "NeoTrellis": { + "map_init": "daisy::NeoTrellisI2CTransport::Config {name}_config;\n {name}_config.periph = {periph};\n {name}_config.speed = {speed};\n {name}_config.scl = som.GetPin({pin_scl});\n {name}_config.sda = som.GetPin({pin_sda});\n {name}_config.address = {address};\n daisy::NeoTrellisI2C::Config {name}_main_conf;\n {name}_main_conf.transport_config = {name}_config;\n {name}.Init({name}_main_conf);", + "typename": "daisy::NeoTrellisI2C", + "direction": "in", + "pin": "scl,sda", + "address": "NEO_TRELLIS_ADDR", + "periph": "daisy::I2CHandle::Config::Peripheral::I2C_1", + "speed": "daisy::I2CHandle::Config::Speed::I2C_400KHZ", + "loopprocess": "{name}.Process();", + "mapping": [ + { + "name": "{name}", + "get": "{class_name}.{name}.GetRising(0)", + "bool": true + }, + { + "name": "{name}_0", + "get": "{class_name}.{name}.GetRising(0)", + "bool": true + }, + { + "name": "{name}_1", + "get": "{class_name}.{name}.GetRising(1)", + "bool": true + }, + { + "name": "{name}_2", + "get": "{class_name}.{name}.GetRising(2)", + "bool": true + }, + { + "name": "{name}_3", + "get": "{class_name}.{name}.GetRising(3)", + "bool": true + }, + { + "name": "{name}_4", + "get": "{class_name}.{name}.GetRising(4)", + "bool": true + }, + { + "name": "{name}_5", + "get": "{class_name}.{name}.GetRising(5)", + "bool": true + }, + { + "name": "{name}_6", + "get": "{class_name}.{name}.GetRising(6)", + "bool": true + }, + { + "name": "{name}_7", + "get": "{class_name}.{name}.GetRising(7)", + "bool": true + }, + { + "name": "{name}_8", + "get": "{class_name}.{name}.GetRising(8)", + "bool": true + }, + { + "name": "{name}_9", + "get": "{class_name}.{name}.GetRising(9)", + "bool": true + }, + { + "name": "{name}_10", + "get": "{class_name}.{name}.GetRising(10)", + "bool": true + }, + { + "name": "{name}_11", + "get": "{class_name}.{name}.GetRising(11)", + "bool": true + }, + { + "name": "{name}_12", + "get": "{class_name}.{name}.GetRising(12)", + "bool": true + }, + { + "name": "{name}_13", + "get": "{class_name}.{name}.GetRising(13)", + "bool": true + }, + { + "name": "{name}_14", + "get": "{class_name}.{name}.GetRising(14)", + "bool": true + }, + { + "name": "{name}_15", + "get": "{class_name}.{name}.GetRising(15)", + "bool": true + }, + { + "name": "{name}_0_falling", + "get": "{class_name}.{name}.GetFalling(0)", + "bool": true + }, + { + "name": "{name}_1_falling", + "get": "{class_name}.{name}.GetFalling(1)", + "bool": true + }, + { + "name": "{name}_2_falling", + "get": "{class_name}.{name}.GetFalling(2)", + "bool": true + }, + { + "name": "{name}_3_falling", + "get": "{class_name}.{name}.GetFalling(3)", + "bool": true + }, + { + "name": "{name}_4_falling", + "get": "{class_name}.{name}.GetFalling(4)", + "bool": true + }, + { + "name": "{name}_5_falling", + "get": "{class_name}.{name}.GetFalling(5)", + "bool": true + }, + { + "name": "{name}_6_falling", + "get": "{class_name}.{name}.GetFalling(6)", + "bool": true + }, + { + "name": "{name}_7_falling", + "get": "{class_name}.{name}.GetFalling(7)", + "bool": true + }, + { + "name": "{name}_8_falling", + "get": "{class_name}.{name}.GetFalling(8)", + "bool": true + }, + { + "name": "{name}_9_falling", + "get": "{class_name}.{name}.GetFalling(9)", + "bool": true + }, + { + "name": "{name}_10_falling", + "get": "{class_name}.{name}.GetFalling(10)", + "bool": true + }, + { + "name": "{name}_11_falling", + "get": "{class_name}.{name}.GetFalling(11)", + "bool": true + }, + { + "name": "{name}_12_falling", + "get": "{class_name}.{name}.GetFalling(12)", + "bool": true + }, + { + "name": "{name}_13_falling", + "get": "{class_name}.{name}.GetFalling(13)", + "bool": true + }, + { + "name": "{name}_14_falling", + "get": "{class_name}.{name}.GetFalling(14)", + "bool": true + }, + { + "name": "{name}_15_falling", + "get": "{class_name}.{name}.GetFalling(15)", + "bool": true + }, + { + "name": "{name}_0_state", + "get": "({class_name}.{name}.GetState(0) ? 1.0f : 0.0f)" + }, + { + "name": "{name}_1_state", + "get": "({class_name}.{name}.GetState(1) ? 1.0f : 0.0f)" + }, + { + "name": "{name}_2_state", + "get": "({class_name}.{name}.GetState(2) ? 1.0f : 0.0f)" + }, + { + "name": "{name}_3_state", + "get": "({class_name}.{name}.GetState(3) ? 1.0f : 0.0f)" + }, + { + "name": "{name}_4_state", + "get": "({class_name}.{name}.GetState(4) ? 1.0f : 0.0f)" + }, + { + "name": "{name}_5_state", + "get": "({class_name}.{name}.GetState(5) ? 1.0f : 0.0f)" + }, + { + "name": "{name}_6_state", + "get": "({class_name}.{name}.GetState(6) ? 1.0f : 0.0f)" + }, + { + "name": "{name}_7_state", + "get": "({class_name}.{name}.GetState(7) ? 1.0f : 0.0f)" + }, + { + "name": "{name}_8_state", + "get": "({class_name}.{name}.GetState(8) ? 1.0f : 0.0f)" + }, + { + "name": "{name}_9_state", + "get": "({class_name}.{name}.GetState(9) ? 1.0f : 0.0f)" + }, + { + "name": "{name}_10_state", + "get": "({class_name}.{name}.GetState(10) ? 1.0f : 0.0f)" + }, + { + "name": "{name}_11_state", + "get": "({class_name}.{name}.GetState(11) ? 1.0f : 0.0f)" + }, + { + "name": "{name}_12_state", + "get": "({class_name}.{name}.GetState(12) ? 1.0f : 0.0f)" + }, + { + "name": "{name}_13_state", + "get": "({class_name}.{name}.GetState(13) ? 1.0f : 0.0f)" + }, + { + "name": "{name}_14_state", + "get": "({class_name}.{name}.GetState(14) ? 1.0f : 0.0f)" + }, + { + "name": "{name}_15_state", + "get": "({class_name}.{name}.GetState(15) ? 1.0f : 0.0f)" + } + ] + }, + "NeoTrellisLeds": { + "map_init": "", + "parent": "", + "direction": "out", + "loopprocess": "{parent}.Show();", + "mapping": [ + { + "name": "{name}", + "set": "{class_name}.{parent}.SetPixelColor(0, {class_name}.{parent}.pixels.Color({value}, {value}, {value}));", + "where": "main" + }, + { + "name": "{name}_0", + "set": "{class_name}.{parent}.SetPixelColor(0, {class_name}.{parent}.pixels.Color({value}, {value}, {value}));", + "where": "main" + }, + { + "name": "{name}_1", + "set": "{class_name}.{parent}.SetPixelColor(1, {class_name}.{parent}.pixels.Color({value}, {value}, {value}));", + "where": "main" + }, + { + "name": "{name}_2", + "set": "{class_name}.{parent}.SetPixelColor(2, {class_name}.{parent}.pixels.Color({value}, {value}, {value}));", + "where": "main" + }, + { + "name": "{name}_3", + "set": "{class_name}.{parent}.SetPixelColor(3, {class_name}.{parent}.pixels.Color({value}, {value}, {value}));", + "where": "main" + }, + { + "name": "{name}_4", + "set": "{class_name}.{parent}.SetPixelColor(4, {class_name}.{parent}.pixels.Color({value}, {value}, {value}));", + "where": "main" + }, + { + "name": "{name}_5", + "set": "{class_name}.{parent}.SetPixelColor(5, {class_name}.{parent}.pixels.Color({value}, {value}, {value}));", + "where": "main" + }, + { + "name": "{name}_6", + "set": "{class_name}.{parent}.SetPixelColor(6, {class_name}.{parent}.pixels.Color({value}, {value}, {value}));", + "where": "main" + }, + { + "name": "{name}_7", + "set": "{class_name}.{parent}.SetPixelColor(7, {class_name}.{parent}.pixels.Color({value}, {value}, {value}));", + "where": "main" + }, + { + "name": "{name}_8", + "set": "{class_name}.{parent}.SetPixelColor(8, {class_name}.{parent}.pixels.Color({value}, {value}, {value}));", + "where": "main" + }, + { + "name": "{name}_9", + "set": "{class_name}.{parent}.SetPixelColor(9, {class_name}.{parent}.pixels.Color({value}, {value}, {value}));", + "where": "main" + }, + { + "name": "{name}_10", + "set": "{class_name}.{parent}.SetPixelColor(10, {class_name}.{parent}.pixels.Color({value}, {value}, {value}));", + "where": "main" + }, + { + "name": "{name}_11", + "set": "{class_name}.{parent}.SetPixelColor(11, {class_name}.{parent}.pixels.Color({value}, {value}, {value}));", + "where": "main" + }, + { + "name": "{name}_12", + "set": "{class_name}.{parent}.SetPixelColor(12, {class_name}.{parent}.pixels.Color({value}, {value}, {value}));", + "where": "main" + }, + { + "name": "{name}_13", + "set": "{class_name}.{parent}.SetPixelColor(13, {class_name}.{parent}.pixels.Color({value}, {value}, {value}));", + "where": "main" + }, + { + "name": "{name}_14", + "set": "{class_name}.{parent}.SetPixelColor(14, {class_name}.{parent}.pixels.Color({value}, {value}, {value}));", + "where": "main" + }, + { + "name": "{name}_15", + "set": "{class_name}.{parent}.SetPixelColor(15, {class_name}.{parent}.pixels.Color({value}, {value}, {value}));", + "where": "main" + } + ] + }, + "Bno055": { + "map_init": "daisy::Bno055I2CTransport::Config {name}_config;\n {name}_config.periph = {periph};\n {name}_config.speed = {speed};\n {name}_config.scl = som.GetPin({pin_scl});\n {name}_config.sda = som.GetPin({pin_sda});\n {name}_config.address = {address};\n daisy::Bno055I2C::Config {name}_main_conf;\n {name}_main_conf.transport_config = {name}_config;\n {name}.Init({name}_main_conf);", + "typename": "daisy::Bno055I2C", + "direction": "in", + "pin": "scl,sda", + "address": "BNO055_ADDRESS_A", + "periph": "daisy::I2CHandle::Config::Peripheral::I2C_1", + "speed": "daisy::I2CHandle::Config::Speed::I2C_400KHZ", + "loopprocess": "{name}.Process();", + "mapping": [ + { + "name": "{name}", + "get": "{class_name}.{name}.GetVectorAccelerometer().x" + }, + { + "name": "{name}_accel_x", + "get": "{class_name}.{name}.GetVectorAccelerometer().x" + }, + { + "name": "{name}_accel_y", + "get": "{class_name}.{name}.GetVectorAccelerometer().y" + }, + { + "name": "{name}_accel_z", + "get": "{class_name}.{name}.GetVectorAccelerometer().z" + }, + { + "name": "{name}_magnet_x", + "get": "{class_name}.{name}.GetVectorMagnetometer().x" + }, + { + "name": "{name}_magnet_y", + "get": "{class_name}.{name}.GetVectorMagnetometer().y" + }, + { + "name": "{name}_magnet_z", + "get": "{class_name}.{name}.GetVectorMagnetometer().z" + }, + { + "name": "{name}_gyro_x", + "get": "{class_name}.{name}.GetVectorGyroscope().x" + }, + { + "name": "{name}_gyro_y", + "get": "{class_name}.{name}.GetVectorGyroscope().y" + }, + { + "name": "{name}_gyro_z", + "get": "{class_name}.{name}.GetVectorGyroscope().z" + }, + { + "name": "{name}_euler_x", + "get": "{class_name}.{name}.GetVectorEuler().x" + }, + { + "name": "{name}_euler_y", + "get": "{class_name}.{name}.GetVectorEuler().y" + }, + { + "name": "{name}_euler_z", + "get": "{class_name}.{name}.GetVectorEuler().z" + }, + { + "name": "{name}_linear_accel_x", + "get": "{class_name}.{name}.GetVectorLinearAccel().x" + }, + { + "name": "{name}_linear_accel_y", + "get": "{class_name}.{name}.GetVectorLinearAccel().y" + }, + { + "name": "{name}_linear_accel_z", + "get": "{class_name}.{name}.GetVectorLinearAccel().z" + }, + { + "name": "{name}_grav_x", + "get": "{class_name}.{name}.GetVectorGravity().x" + }, + { + "name": "{name}_grav_y", + "get": "{class_name}.{name}.GetVectorGravity().y" + }, + { + "name": "{name}_grav_z", + "get": "{class_name}.{name}.GetVectorGravity().z" + }, + { + "name": "{name}_quat_x", + "get": "{class_name}.{name}.GetQuat().x" + }, + { + "name": "{name}_quat_y", + "get": "{class_name}.{name}.GetQuat().y" + }, + { + "name": "{name}_quat_z", + "get": "{class_name}.{name}.GetQuat().z" + }, + { + "name": "{name}_quat_w", + "get": "{class_name}.{name}.GetQuat().w" + } + ] } } \ No newline at end of file diff --git a/source/json2daisy.js b/source/json2daisy.js index 4bbd4b4..10c210a 100644 --- a/source/json2daisy.js +++ b/source/json2daisy.js @@ -304,6 +304,20 @@ exports.generate_header = function generate_header(board_description_object) replacements.rgbled = filter_map_init(components, 'component', 'RgbLed', key_exclude='is_default', match_exclude=true); replacements.gateout = filter_map_init(components, 'component', 'GateOut', key_exclude='is_default', match_exclude=true); replacements.dachandle = filter_map_init(components, 'component', 'CVOuts', key_exclude='is_default', match_exclude=true); + + replacements.MotorShield = filter_map_init(components, 'component', 'MotorShield', key_exclude='is_default', match_exclude=true); + replacements.StepperMotor = filter_map_init(components, 'component', 'StepperMotor', key_exclude='is_default', match_exclude=true); + replacements.DcMotor = filter_map_init(components, 'component', 'DcMotor', key_exclude='is_default', match_exclude=true); + replacements.Bme280 = filter_map_init(components, 'component', 'Bme280', key_exclude='is_default', match_exclude=true); + replacements.HallSensor = filter_map_init(components, 'component', 'HallSensor', key_exclude='is_default', match_exclude=true); + replacements.Tlv493d = filter_map_init(components, 'component', 'Tlv493d', key_exclude='is_default', match_exclude=true); + replacements.Mpr121 = filter_map_init(components, 'component', 'Mpr121', key_exclude='is_default', match_exclude=true); + replacements.Apds9960 = filter_map_init(components, 'component', 'Apds9960', key_exclude='is_default', match_exclude=true); + replacements.Bmp390 = filter_map_init(components, 'component', 'Bmp390', key_exclude='is_default', match_exclude=true); + replacements.Vl53l1x = filter_map_init(components, 'component', 'Vl53l1x', key_exclude='is_default', match_exclude=true); + replacements.NeoTrellis = filter_map_init(components, 'component', 'NeoTrellis', key_exclude='is_default', match_exclude=true); + replacements.NeoTrellisLeds = filter_map_init(components, 'component', 'NeoTrellisLeds', key_exclude='is_default', match_exclude=true); + replacements.Bno055 = filter_map_init(components, 'component', 'Bno055', key_exclude='is_default', match_exclude=true); replacements.display = !(has_display) ? '' : ` daisy::OledDisplay<${target.display.driver}>::Config display_config; @@ -372,6 +386,20 @@ ${replacements.name != '' ? `struct Daisy${replacements.name[0].toUpperCase()}${ ${replacements.dachandle != '' ? '// DAC\n ' + replacements.dachandle : ''} ${replacements.display != '' ? '// Display\n ' + replacements.display : ''} + ${replacements.MotorShield != '' ? '// Motor Shield\n ' + replacements.MotorShield : ''} + ${replacements.StepperMotor != '' ? '// Stepper Motor\n ' + replacements.StepperMotor : ''} + ${replacements.DcMotor != '' ? '// DC Motor\n ' + replacements.DcMotor : ''} + ${replacements.Bme != '' ? '// BME sensor\n ' + replacements.Bme : ''} + ${replacements.HallSensor != '' ? '// Hall Effect Sensor\n ' + replacements.HallSensor : ''} + ${replacements.Tlv != '' ? '// TLV Sensor\n ' + replacements.Tlv : ''} + ${replacements.Mpr != '' ? '// MPR Sensor\n ' + replacements.Mpr : ''} + ${replacements.Apds != '' ? '// APDS Sensor\n ' + replacements.Apds : ''} + ${replacements.Bmp != '' ? '// BMP Sensor\n ' + replacements.Bmp : ''} + ${replacements.Vl53l1x != '' ? '// VL53L1X Sensor\n ' + replacements.Vl : ''} + ${replacements.NeoTrellis != '' ? '// Neo Trellis\n ' + replacements.NeoTrellis : ''} + ${replacements.NeoTrellisLeds != '' ? '// NeoTrellis LEDs\n ' + replacements.NeoTrellisLeds : ''} + ${replacements.Bno != '' ? '// BNO Sensor\n ' + replacements.Bno : ''} + ${replacements.external_codecs.length == 0 ? '' : generateCodecs(replacements.external_codecs)} ${replacements.som == 'seed' ? 'som.adc.Start();' : ''} From b7878271ad01edf2750d10761818edcc053f8adb Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Wed, 12 Jan 2022 14:50:31 -0700 Subject: [PATCH 029/100] Fixed small patch_sm / patch_init issues --- source/json2daisy.js | 3 +-- source/oopsy.js | 1 + source/patch_sm.patch_init.json | 10 ++++++++- templates/oopsy_patch_init.maxpat | 34 +++++++++++++++---------------- 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/source/json2daisy.js b/source/json2daisy.js index 4bbd4b4..9cba2d8 100644 --- a/source/json2daisy.js +++ b/source/json2daisy.js @@ -80,8 +80,7 @@ function generateCodecs(external_codecs) for (let i = 0; i < external_codecs.length; i++) { - if (i < external_codecs.length - 1) - codec_string += ",\n "; + codec_string += ",\n "; codec_string += `sai_handle[${i + 1}]`; } diff --git a/source/oopsy.js b/source/oopsy.js index 7e1f6df..93785ff 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -460,6 +460,7 @@ function run() { for (let mapping of component.mapping) { // let name = template(mapping.name, component); component.class_name = 'hardware'; + component.name_upper = component.name.toUpperCase(); let name = json2daisy.format_map(mapping.name, component); component.value = name.toLowerCase(); if (mapping.get) { diff --git a/source/patch_sm.patch_init.json b/source/patch_sm.patch_init.json index ffbb392..8026197 100644 --- a/source/patch_sm.patch_init.json +++ b/source/patch_sm.patch_init.json @@ -129,6 +129,14 @@ "ctrl5": "cv_5", "ctrl6": "cv_6", "ctrl7": "cv_7", - "ctrl8": "cv_8" + "ctrl8": "cv_8", + "cv1": "cv_1", + "cv2": "cv_2", + "cv3": "cv_3", + "cv4": "cv_4", + "cv5": "cv_5", + "cv6": "cv_6", + "cv7": "cv_7", + "cv8": "cv_8" } } \ No newline at end of file diff --git a/templates/oopsy_patch_init.maxpat b/templates/oopsy_patch_init.maxpat index 516533e..14cb0f6 100644 --- a/templates/oopsy_patch_init.maxpat +++ b/templates/oopsy_patch_init.maxpat @@ -593,7 +593,7 @@ "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 786.5, 312.0, 29.5, 22.0 ], + "patching_rect" : [ 803.5, 312.0, 29.5, 22.0 ], "text" : "+" } @@ -605,7 +605,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 862.211711704730988, 228.5, 26.0, 22.0 ], + "patching_rect" : [ 879.211711704730988, 228.5, 26.0, 22.0 ], "text" : "!- 1" } @@ -617,8 +617,8 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 797.0, 200.0, 49.0, 22.0 ], - "text" : "r switch" + "patching_rect" : [ 814.0, 200.0, 49.0, 22.0 ], + "text" : "r toggle" } } @@ -629,7 +629,7 @@ "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 851.711711704730988, 265.0, 29.5, 22.0 ], + "patching_rect" : [ 868.711711704730988, 265.0, 29.5, 22.0 ], "text" : "*" } @@ -641,7 +641,7 @@ "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 786.5, 269.0, 29.5, 22.0 ], + "patching_rect" : [ 803.5, 269.0, 29.5, 22.0 ], "text" : "*" } @@ -653,8 +653,8 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 870.0, 96.0, 79.0, 22.0 ], - "text" : "param switch" + "patching_rect" : [ 870.0, 96.0, 103.0, 22.0 ], + "text" : "param sw2_press" } } @@ -665,7 +665,7 @@ "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 870.0, 133.0, 51.0, 22.0 ], - "text" : "s switch" + "text" : "s toggle" } } @@ -676,8 +676,8 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 955.211711704730988, 96.0, 79.0, 22.0 ], - "text" : "param button" + "patching_rect" : [ 975.0, 96.0, 103.0, 22.0 ], + "text" : "param sw1_press" } } @@ -713,7 +713,7 @@ "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 409.0, 200.0, 49.0, 22.0 ], - "text" : "r switch" + "text" : "r toggle" } } @@ -843,8 +843,8 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 786.5, 351.5, 69.0, 22.0 ], - "text" : "out 6 gate2" + "patching_rect" : [ 803.5, 351.5, 99.0, 22.0 ], + "text" : "out 6 gate_out_2" } } @@ -855,7 +855,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 1075.5, 96.0, 107.0, 22.0 ], + "patching_rect" : [ 1081.5, 96.0, 107.0, 22.0 ], "text" : "oopsy.suggestions" } @@ -900,8 +900,8 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 703.5, 351.5, 69.0, 22.0 ], - "text" : "out 5 gate1" + "patching_rect" : [ 703.5, 351.5, 99.0, 22.0 ], + "text" : "out 5 gate_out_1" } } From 9418fbcb0124b66cedba320347c4a01a2b7d9d46 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Wed, 12 Jan 2022 15:08:39 -0700 Subject: [PATCH 030/100] Fixed small issues for field --- templates/oopsy_field.maxpat | 38 ++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/templates/oopsy_field.maxpat b/templates/oopsy_field.maxpat index ba8488f..578578c 100644 --- a/templates/oopsy_field.maxpat +++ b/templates/oopsy_field.maxpat @@ -4,13 +4,13 @@ "appversion" : { "major" : 8, "minor" : 1, - "revision" : 8, + "revision" : 11, "architecture" : "x64", "modernui" : 1 } , "classnamespace" : "box", - "rect" : [ 890.0, 138.0, 756.0, 523.0 ], + "rect" : [ 650.0, 138.0, 756.0, 523.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -269,13 +269,13 @@ "appversion" : { "major" : 8, "minor" : 1, - "revision" : 8, + "revision" : 11, "architecture" : "x64", "modernui" : 1 } , "classnamespace" : "dsp.gen", - "rect" : [ 84.0, 103.0, 1280.0, 913.0 ], + "rect" : [ 78.0, 102.0, 1280.0, 729.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -1524,7 +1524,7 @@ "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 570.5, 296.0, 36.5, 22.0 ], + "patching_rect" : [ 591.561904761904771, 296.0, 36.5, 22.0 ], "text" : "min" } @@ -1593,8 +1593,8 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 702.5, 323.0, 69.0, 22.0 ], - "text" : "out 5 gate1" + "patching_rect" : [ 702.5, 323.0, 85.0, 22.0 ], + "text" : "out 5 gateout1" } } @@ -1616,8 +1616,8 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 570.5, 323.0, 57.0, 22.0 ], - "text" : "out 4 cv2" + "patching_rect" : [ 591.561904761904771, 323.0, 74.0, 22.0 ], + "text" : "out 4 cvout2" } } @@ -1627,8 +1627,8 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 509.5, 323.0, 57.0, 22.0 ], - "text" : "out 3 cv1" + "patching_rect" : [ 509.5, 323.0, 74.0, 22.0 ], + "text" : "out 3 cvout1" } } @@ -1675,7 +1675,7 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 588.0, 144.0, 65.0, 22.0 ], + "patching_rect" : [ 609.061904761904771, 142.400900900363922, 65.0, 22.0 ], "text" : "param cv4" } @@ -1687,7 +1687,7 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 570.5, 118.5, 65.0, 22.0 ], + "patching_rect" : [ 591.561904761904771, 116.900900900363922, 65.0, 22.0 ], "text" : "param cv3" } @@ -2308,7 +2308,7 @@ , "patching_rect" : [ 24.0, 290.0, 194.0, 35.0 ], "saved_object_attributes" : { - "exportfolder" : "Macintosh HD:/Users/grrrwaaa/Documents/Max 8/Packages/oopsy/templates/", + "exportfolder" : "macOS:/Users/corvus/Documents/Max 8/Packages/oopsy/templates/", "exportname" : "oopsy_field" } , @@ -2524,7 +2524,8 @@ "obj-7::obj-21::obj-6" : [ "live.tab[3]", "live.tab[1]", 0 ], "obj-7::obj-35" : [ "[5]", "Level", 0 ], "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], - "obj-9::obj-4" : [ "live.menu[6]", "live.menu", 0 ], + "obj-9::obj-33" : [ "live.text[1]", "FILTER", 0 ], + "obj-9::obj-34" : [ "live.text[3]", "FILTER", 0 ], "parameterbanks" : { } @@ -2560,6 +2561,13 @@ "type" : "gDSP", "implicit" : 1 } +, { + "name" : "oopsy.gate.trig.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "patcherrelativepath" : "../code", + "type" : "gDSP", + "implicit" : 1 + } , { "name" : "oopsy.gate.min.gendsp", "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", From 793e3928f6267c1a9f70596632fef6156b389a12 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Wed, 12 Jan 2022 15:32:25 -0700 Subject: [PATCH 031/100] Updated pod and patch json / patchers --- source/seed.patch.json | 17 +++++++++-------- source/seed.pod.json | 4 ++-- templates/oopsy_patch.maxpat | 35 +++++++++++++++++++++-------------- templates/oopsy_pod.maxpat | 8 ++++---- 4 files changed, 36 insertions(+), 28 deletions(-) diff --git a/source/seed.patch.json b/source/seed.patch.json index acaa2e4..963718c 100644 --- a/source/seed.patch.json +++ b/source/seed.patch.json @@ -27,19 +27,23 @@ "components": { "knob1": { "component": "AnalogControl", - "pin": 15 + "pin": 15, + "flip": "true" }, "knob2": { "component": "AnalogControl", - "pin": 16 + "pin": 16, + "flip": "true" }, "knob3": { "component": "AnalogControl", - "pin": 21 + "pin": 21, + "flip": "true" }, "knob4": { "component": "AnalogControl", - "pin": 18 + "pin": 18, + "flip": "true" }, "encoder": { "component": "Encoder", @@ -54,10 +58,7 @@ "pin": 17, "display": "" }, - "cvout1": { - "component": "CVOuts" - }, - "cvout2": { + "cvout": { "component": "CVOuts" }, "gatein1": { diff --git a/source/seed.pod.json b/source/seed.pod.json index 08712c4..ac897e0 100644 --- a/source/seed.pod.json +++ b/source/seed.pod.json @@ -54,7 +54,7 @@ "pin": 10, "display": "" }, - "cvout1": { + "cvout": { "component": "CVOuts" }, "gatein": { @@ -70,7 +70,7 @@ } }, "aliases": { - "cvout": "cvout1", + "cvout1": "cvout", "switch": "sw1", "button": "sw1", "switch1": "sw1", diff --git a/templates/oopsy_patch.maxpat b/templates/oopsy_patch.maxpat index d97ad08..aecb29a 100644 --- a/templates/oopsy_patch.maxpat +++ b/templates/oopsy_patch.maxpat @@ -4,13 +4,13 @@ "appversion" : { "major" : 8, "minor" : 1, - "revision" : 8, + "revision" : 11, "architecture" : "x64", "modernui" : 1 } , "classnamespace" : "box", - "rect" : [ 431.0, 199.0, 800.0, 598.0 ], + "rect" : [ 478.0, 196.0, 800.0, 598.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -383,7 +383,7 @@ "appversion" : { "major" : 8, "minor" : 1, - "revision" : 8, + "revision" : 11, "architecture" : "x64", "modernui" : 1 } @@ -424,7 +424,7 @@ "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 369.5, 323.0, 36.5, 22.0 ], + "patching_rect" : [ 389.5, 324.0, 36.5, 22.0 ], "text" : "min" } @@ -516,8 +516,8 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 511.5, 350.0, 69.0, 22.0 ], - "text" : "out 7 gate1" + "patching_rect" : [ 511.5, 350.0, 85.0, 22.0 ], + "text" : "out 7 gateout1" } } @@ -539,8 +539,8 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 369.5, 350.0, 57.0, 22.0 ], - "text" : "out 6 cv2" + "patching_rect" : [ 389.5, 351.0, 74.0, 22.0 ], + "text" : "out 6 cvout2" } } @@ -550,8 +550,8 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 308.5, 350.0, 57.0, 22.0 ], - "text" : "out 5 cv1" + "patching_rect" : [ 308.5, 350.0, 74.0, 22.0 ], + "text" : "out 5 cvout1" } } @@ -646,7 +646,7 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 387.0, 171.0, 86.0, 49.0 ], + "patching_rect" : [ 407.0, 172.0, 86.0, 49.0 ], "text" : "param ctrl4 @min -10 @max 10" } @@ -658,7 +658,7 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 369.5, 145.5, 69.0, 22.0 ], + "patching_rect" : [ 389.5, 146.5, 69.0, 22.0 ], "text" : "param ctrl3" } @@ -682,7 +682,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 407.211711704730988, 225.0, 74.288288295269012, 47.0 ], + "patching_rect" : [ 427.211711704730988, 226.0, 74.288288295269012, 47.0 ], "text" : "cv1, knob1, cv1_foo, etc. all work" } @@ -917,7 +917,7 @@ , "patching_rect" : [ 47.0, 363.0, 195.0, 35.0 ], "saved_object_attributes" : { - "exportfolder" : "Macintosh HD:/Users/grrrwaaa/Documents/Max 8/Packages/oopsy/templates/", + "exportfolder" : "macOS:/Users/corvus/Documents/Max 8/Packages/oopsy/templates/", "exportname" : "oopsy_patch" } , @@ -1194,6 +1194,13 @@ "type" : "gDSP", "implicit" : 1 } +, { + "name" : "oopsy.gate.trig.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "patcherrelativepath" : "../code", + "type" : "gDSP", + "implicit" : 1 + } , { "name" : "oopsy.gate.min.gendsp", "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", diff --git a/templates/oopsy_pod.maxpat b/templates/oopsy_pod.maxpat index 6feb625..32331bf 100644 --- a/templates/oopsy_pod.maxpat +++ b/templates/oopsy_pod.maxpat @@ -4,13 +4,13 @@ "appversion" : { "major" : 8, "minor" : 1, - "revision" : 8, + "revision" : 11, "architecture" : "x64", "modernui" : 1 } , "classnamespace" : "box", - "rect" : [ 692.0, 240.0, 640.0, 480.0 ], + "rect" : [ 275.0, 205.0, 625.0, 480.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -50,7 +50,7 @@ "appversion" : { "major" : 8, "minor" : 1, - "revision" : 8, + "revision" : 11, "architecture" : "x64", "modernui" : 1 } @@ -573,7 +573,7 @@ , "patching_rect" : [ 18.0, 267.0, 137.0, 22.0 ], "saved_object_attributes" : { - "exportfolder" : "Macintosh HD:/Users/grrrwaaa/Documents/Max 8/Packages/oopsy/templates/", + "exportfolder" : "macOS:/Users/corvus/Documents/Max 8/Packages/oopsy/templates/", "exportname" : "oopsy_pod" } , From a5b64745422c7a7979cab39ed5d915157e188baf Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 17 Jan 2022 16:14:44 -0700 Subject: [PATCH 032/100] Added newest components --- source/component_defs.json | 98 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/source/component_defs.json b/source/component_defs.json index 32fc000..9312153 100644 --- a/source/component_defs.json +++ b/source/component_defs.json @@ -838,6 +838,23 @@ } ] }, + "Vl53l0x": { + "map_init": "daisy::Adafruit_VL53L0X::Config {name}_config;\n {name}_config.periph = {periph};\n {name}_config.speed = {speed};\n {name}_config.scl = som.GetPin({pin_scl});\n {name}_config.sda = som.GetPin({pin_sda});\n {name}_config.dev_addr = {address};\n {name}_config.vl_config = {vl_config};\n {name}.Init({name}_config);", + "typename": "daisy::Adafruit_VL53L0X", + "direction": "in", + "pin": "scl,sda", + "address": "VL53L0X_I2C_ADDR", + "periph": "daisy::I2CHandle::Config::Peripheral::I2C_1", + "speed": "daisy::I2CHandle::Config::Speed::I2C_400KHZ", + "vl_config": "daisy::Adafruit_VL53L0X::VL53L0X_Sense_config_t::VL53L0X_SENSE_DEFAULT", + "loopprocess": "{name}.Process();", + "mapping": [ + { + "name": "{name}", + "get": "{class_name}.{name}.GetRangeMilliMeter()" + } + ] + }, "NeoTrellis": { "map_init": "daisy::NeoTrellisI2CTransport::Config {name}_config;\n {name}_config.periph = {periph};\n {name}_config.speed = {speed};\n {name}_config.scl = som.GetPin({pin_scl});\n {name}_config.sda = som.GetPin({pin_sda});\n {name}_config.address = {address};\n daisy::NeoTrellisI2C::Config {name}_main_conf;\n {name}_main_conf.transport_config = {name}_config;\n {name}.Init({name}_main_conf);", "typename": "daisy::NeoTrellisI2C", @@ -1275,5 +1292,86 @@ "get": "{class_name}.{name}.GetQuat().w" } ] + }, + "Icm20948": { + "map_init": "daisy::Icm20948I2CTransport::Config {name}_config;\n {name}_config.periph = {periph};\n {name}_config.speed = {speed};\n {name}_config.scl = som.GetPin({pin_scl});\n {name}_config.sda = som.GetPin({pin_sda});\n {name}_config.address = {address};\n daisy::Icm20948I2C::Config {name}_main_conf;\n {name}_main_conf.transport_config = {name}_config;\n {name}.Init({name}_main_conf);", + "typename": "daisy::Icm20948I2C", + "direction": "in", + "pin": "scl,sda", + "address": "ICM20948_I2CADDR_DEFAULT", + "periph": "daisy::I2CHandle::Config::Peripheral::I2C_1", + "speed": "daisy::I2CHandle::Config::Speed::I2C_400KHZ", + "loopprocess": "{name}.Process();", + "mapping": [ + { + "name": "{name}", + "get": "{class_name}.{name}.GetAccelVect().x" + }, + { + "name": "{name}_accel_x", + "get": "{class_name}.{name}.GetAccelVect().x" + }, + { + "name": "{name}_accel_y", + "get": "{class_name}.{name}.GetAccelVect().y" + }, + { + "name": "{name}_accel_z", + "get": "{class_name}.{name}.GetAccelVect().z" + }, + { + "name": "{name}_magnet_x", + "get": "{class_name}.{name}.GetMagVect().x" + }, + { + "name": "{name}_magnet_y", + "get": "{class_name}.{name}.GetMagVect().y" + }, + { + "name": "{name}_magnet_z", + "get": "{class_name}.{name}.GetMagVect().z" + }, + { + "name": "{name}_gyro_x", + "get": "{class_name}.{name}.GetGyroVect().x" + }, + { + "name": "{name}_gyro_y", + "get": "{class_name}.{name}.GetGyroVect().y" + }, + { + "name": "{name}_gyro_z", + "get": "{class_name}.{name}.GetGyroVect().z" + } + ] + }, + "Dps310": { + "map_init": "daisy::Dps310I2CTransport::Config {name}_config;\n {name}_config.address = {address};\n {name}_config.periph = {periph};\n {name}_config.speed = {speed};\n {name}_config.scl = som.GetPin({pin_scl});\n {name}_config.sda = som.GetPin({pin_sda});\n daisy::Dps310I2C::Config {name}_config_main;\n {name}_config_main.transport_config = {name}_config;\n {name}.Init({name}_config_main);", + "typename": "daisy::Dps310I2C", + "direction": "in", + "pin": "scl,sda", + "periph": "daisy::I2CHandle::Config::Peripheral::I2C_1", + "speed": "daisy::I2CHandle::Config::Speed::I2C_400KHZ", + "address": "DPS310_I2CADDR_DEFAULT", + "pressure": 1013, + "loopprocess": "{name}.Process();", + "mapping": [ + { + "name": "{name}", + "get": "{class_name}.{name}.GetTemperature()" + }, + { + "name": "{name}_temp", + "get": "{class_name}.{name}.GetTemperature()" + }, + { + "name": "{name}_press", + "get": "{class_name}.{name}.GetPressure()" + }, + { + "name": "{name}_alt", + "get": "{class_name}.{name}.GetAltitude({pressure})" + } + ] } } \ No newline at end of file From 3eeeb68876a56e58398a11d077a4ec592986786e Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 17 Jan 2022 17:50:33 -0700 Subject: [PATCH 033/100] Added additional sensors --- source/json2daisy.js | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/source/json2daisy.js b/source/json2daisy.js index 10c210a..c055879 100644 --- a/source/json2daisy.js +++ b/source/json2daisy.js @@ -75,13 +75,11 @@ function generateCodecs(external_codecs) cfg.postgain = 0.5f; som.audio_handle.Init( cfg, - sai_handle[0] - `; + sai_handle[0]`; for (let i = 0; i < external_codecs.length; i++) { - if (i < external_codecs.length - 1) - codec_string += ",\n "; + codec_string += ",\n "; codec_string += `sai_handle[${i + 1}]`; } @@ -315,9 +313,15 @@ exports.generate_header = function generate_header(board_description_object) replacements.Apds9960 = filter_map_init(components, 'component', 'Apds9960', key_exclude='is_default', match_exclude=true); replacements.Bmp390 = filter_map_init(components, 'component', 'Bmp390', key_exclude='is_default', match_exclude=true); replacements.Vl53l1x = filter_map_init(components, 'component', 'Vl53l1x', key_exclude='is_default', match_exclude=true); + replacements.Vl53l0x = filter_map_init(components, 'component', 'Vl53l0x', key_exclude='is_default', match_exclude=true); replacements.NeoTrellis = filter_map_init(components, 'component', 'NeoTrellis', key_exclude='is_default', match_exclude=true); replacements.NeoTrellisLeds = filter_map_init(components, 'component', 'NeoTrellisLeds', key_exclude='is_default', match_exclude=true); replacements.Bno055 = filter_map_init(components, 'component', 'Bno055', key_exclude='is_default', match_exclude=true); + replacements.Icm20948 = filter_map_init(components, 'component', 'Icm20948', key_exclude='is_default', match_exclude=true); + replacements.Dps310 = filter_map_init(components, 'component', 'Dps310', key_exclude='is_default', match_exclude=true); + + for (item in replacements) + console.log(item, replacements[item]); replacements.display = !(has_display) ? '' : ` daisy::OledDisplay<${target.display.driver}>::Config display_config; @@ -389,16 +393,19 @@ ${replacements.name != '' ? `struct Daisy${replacements.name[0].toUpperCase()}${ ${replacements.MotorShield != '' ? '// Motor Shield\n ' + replacements.MotorShield : ''} ${replacements.StepperMotor != '' ? '// Stepper Motor\n ' + replacements.StepperMotor : ''} ${replacements.DcMotor != '' ? '// DC Motor\n ' + replacements.DcMotor : ''} - ${replacements.Bme != '' ? '// BME sensor\n ' + replacements.Bme : ''} + ${replacements.Bme280 != '' ? '// BME sensor\n ' + replacements.Bme280 : ''} ${replacements.HallSensor != '' ? '// Hall Effect Sensor\n ' + replacements.HallSensor : ''} - ${replacements.Tlv != '' ? '// TLV Sensor\n ' + replacements.Tlv : ''} - ${replacements.Mpr != '' ? '// MPR Sensor\n ' + replacements.Mpr : ''} - ${replacements.Apds != '' ? '// APDS Sensor\n ' + replacements.Apds : ''} - ${replacements.Bmp != '' ? '// BMP Sensor\n ' + replacements.Bmp : ''} - ${replacements.Vl53l1x != '' ? '// VL53L1X Sensor\n ' + replacements.Vl : ''} + ${replacements.Tlv493d != '' ? '// TLV Sensor\n ' + replacements.Tlv493d : ''} + ${replacements.Mpr121 != '' ? '// MPR Sensor\n ' + replacements.Mpr121 : ''} + ${replacements.Apds9960 != '' ? '// APDS Sensor\n ' + replacements.Apds9960 : ''} + ${replacements.Bmp390 != '' ? '// BMP Sensor\n ' + replacements.Bmp390 : ''} + ${replacements.Vl53l1x != '' ? '// VL53L1X Sensor\n ' + replacements.Vl53l1x : ''} + ${replacements.Vl53l0x != '' ? '// VL53L0X Sensor\n ' + replacements.Vl53l0x : ''} ${replacements.NeoTrellis != '' ? '// Neo Trellis\n ' + replacements.NeoTrellis : ''} ${replacements.NeoTrellisLeds != '' ? '// NeoTrellis LEDs\n ' + replacements.NeoTrellisLeds : ''} - ${replacements.Bno != '' ? '// BNO Sensor\n ' + replacements.Bno : ''} + ${replacements.Bno055 != '' ? '// BNO Sensor\n ' + replacements.Bno055 : ''} + ${replacements.Icm20948 != '' ? '// Icm20948 Sensor\n ' + replacements.Icm20948 : ''} + ${replacements.Dps310 != '' ? '// Dps310 Sensor\n ' + replacements.Dps310 : ''} ${replacements.external_codecs.length == 0 ? '' : generateCodecs(replacements.external_codecs)} From dcff94f3ffaedcb0211327fb801b2826cf68ff0a Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 17 Jan 2022 17:57:56 -0700 Subject: [PATCH 034/100] Updated libdaisy commit --- source/libdaisy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libdaisy b/source/libdaisy index ace9fb1..32e0aba 160000 --- a/source/libdaisy +++ b/source/libdaisy @@ -1 +1 @@ -Subproject commit ace9fb143ac389950937db3f251d2d59cbdc0625 +Subproject commit 32e0aba9ee0caf6f232ca6674057748f60ba579f From cdf843fccb9b83c45daa062bb793f2802f079809 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Tue, 18 Jan 2022 11:59:00 -0700 Subject: [PATCH 035/100] Added permit_scale field --- source/component_defs.json | 210 ++++++++++++++++++++++++------------- source/oopsy.js | 16 ++- 2 files changed, 153 insertions(+), 73 deletions(-) diff --git a/source/component_defs.json b/source/component_defs.json index 9312153..6752092 100644 --- a/source/component_defs.json +++ b/source/component_defs.json @@ -441,7 +441,8 @@ { "name": "{name}", "set": "if ({value} > 0)\n {class_name}.{name}->Run(daisy::Adafruit_MotorShield::FORWARD);\n else if ({value} < 0)\n {class_name}.{name}->Run(daisy::Adafruit_MotorShield::BACKWARD);\n else\n {class_name}.{name}->FullOff();", - "where": "main" + "where": "main", + "permit_scale": false } ] }, @@ -458,27 +459,32 @@ { "name": "{name}", "get": "{class_name}.{name}.ReadTemperature()", - "where": "main" + "where": "main", + "permit_scale": false }, { "name": "{name}_temp", "get": "{class_name}.{name}.ReadTemperature()", - "where": "main" + "where": "main", + "permit_scale": false }, { "name": "{name}_hum", "get": "{class_name}.{name}.ReadHumidity()", - "where": "main" + "where": "main", + "permit_scale": false }, { "name": "{name}_press", "get": "{class_name}.{name}.ReadPressure()", - "where": "main" + "where": "main", + "permit_scale": false }, { "name": "{name}_alt", "get": "{class_name}.{name}.ReadAltitude({pressure})", - "where": "main" + "where": "main", + "permit_scale": false } ] }, @@ -495,7 +501,8 @@ }, { "name": "{name}_count", - "get": "{class_name}.{name}.GetCount()" + "get": "{class_name}.{name}.GetCount()", + "permit_scale": false } ] }, @@ -511,31 +518,38 @@ "mapping": [ { "name": "{name}", - "get": "{class_name}.{name}.GetAmount()" + "get": "{class_name}.{name}.GetAmount()", + "permit_scale": false }, { "name": "{name}_x", - "get": "{class_name}.{name}.GetX()" + "get": "{class_name}.{name}.GetX()", + "permit_scale": false }, { "name": "{name}_y", - "get": "{class_name}.{name}.GetY()" + "get": "{class_name}.{name}.GetY()", + "permit_scale": false }, { "name": "{name}_z", - "get": "{class_name}.{name}.GetZ()" + "get": "{class_name}.{name}.GetZ()", + "permit_scale": false }, { "name": "{name}_amount", - "get": "{class_name}.{name}.GetAmount()" + "get": "{class_name}.{name}.GetAmount()", + "permit_scale": false }, { "name": "{name}_azimuth", - "get": "{class_name}.{name}.GetAzimuth()" + "get": "{class_name}.{name}.GetAzimuth()", + "permit_scale": false }, { "name": "{name}_polar", - "get": "{class_name}.{name}.GetPolar()" + "get": "{class_name}.{name}.GetPolar()", + "permit_scale": false } ] }, @@ -736,37 +750,44 @@ { "name": "{name}", "get": "{class_name}.{name}.ReadGesture()", - "where": "main" + "where": "main", + "permit_scale": false }, { "name": "{name}_gest", "get": "{class_name}.{name}.ReadGesture()", - "where": "main" + "where": "main", + "permit_scale": false }, { "name": "{name}_prox", "get": "{class_name}.{name}.ReadProximity()", - "where": "main" + "where": "main", + "permit_scale": false }, { "name": "{name}_red", "get": "{class_name}.{name}.GetColorDataRed()", - "where": "main" + "where": "main", + "permit_scale": false }, { "name": "{name}_green", "get": "{class_name}.{name}.GetColorDataGreen()", - "where": "main" + "where": "main", + "permit_scale": false }, { "name": "{name}_blue", "get": "{class_name}.{name}.GetColorDataBlue()", - "where": "main" + "where": "main", + "permit_scale": false }, { "name": "{name}_clear", "get": "{class_name}.{name}.GetColorDataClear()", - "where": "main" + "where": "main", + "permit_scale": false } ] }, @@ -782,19 +803,23 @@ "mapping": [ { "name": "{name}", - "get": "{class_name}.{name}.ReadTemperature()" + "get": "{class_name}.{name}.ReadTemperature()", + "permit_scale": false }, { "name": "{name}_temp", - "get": "{class_name}.{name}.ReadTemperature()" + "get": "{class_name}.{name}.ReadTemperature()", + "permit_scale": false }, { "name": "{name}_press", - "get": "{class_name}.{name}.ReadPressure()" + "get": "{class_name}.{name}.ReadPressure()", + "permit_scale": false }, { "name": "{name}_alt", - "get": "{class_name}.{name}.ReadAltitude({pressure})" + "get": "{class_name}.{name}.ReadAltitude({pressure})", + "permit_scale": false } ] }, @@ -810,31 +835,38 @@ "mapping": [ { "name": "{name}", - "get": "{class_name}.{name}.GetDistance()" + "get": "{class_name}.{name}.GetDistance()", + "permit_scale": false }, { "name": "{name}_dist", - "get": "{class_name}.{name}.GetDistance()" + "get": "{class_name}.{name}.GetDistance()", + "permit_scale": false }, { "name": "{name}_sig_per_spad", - "get": "{class_name}.{name}.GetSignalPerSpad()" + "get": "{class_name}.{name}.GetSignalPerSpad()", + "permit_scale": false }, { "name": "{name}_amb_per_spad", - "get": "{class_name}.{name}.GetAmbientPerSpad()" + "get": "{class_name}.{name}.GetAmbientPerSpad()", + "permit_scale": false }, { "name": "{name}_sig_rate", - "get": "{class_name}.{name}.GetSignalRate()" + "get": "{class_name}.{name}.GetSignalRate()", + "permit_scale": false }, { "name": "{name}_amb_rate", - "get": "{class_name}.{name}.GetAmbientRate()" + "get": "{class_name}.{name}.GetAmbientRate()", + "permit_scale": false }, { "name": "{name}_spad_nb", - "get": "{class_name}.{name}.GetSpadNb()" + "get": "{class_name}.{name}.GetSpadNb()", + "permit_scale": false } ] }, @@ -851,7 +883,8 @@ "mapping": [ { "name": "{name}", - "get": "{class_name}.{name}.GetRangeMilliMeter()" + "get": "{class_name}.{name}.GetRangeMilliMeter()", + "permit_scale": false } ] }, @@ -1201,95 +1234,118 @@ "mapping": [ { "name": "{name}", - "get": "{class_name}.{name}.GetVectorAccelerometer().x" + "get": "{class_name}.{name}.GetVectorAccelerometer().x", + "permit_scale": false }, { "name": "{name}_accel_x", - "get": "{class_name}.{name}.GetVectorAccelerometer().x" + "get": "{class_name}.{name}.GetVectorAccelerometer().x", + "permit_scale": false }, { "name": "{name}_accel_y", - "get": "{class_name}.{name}.GetVectorAccelerometer().y" + "get": "{class_name}.{name}.GetVectorAccelerometer().y", + "permit_scale": false }, { "name": "{name}_accel_z", - "get": "{class_name}.{name}.GetVectorAccelerometer().z" + "get": "{class_name}.{name}.GetVectorAccelerometer().z", + "permit_scale": false }, { "name": "{name}_magnet_x", - "get": "{class_name}.{name}.GetVectorMagnetometer().x" + "get": "{class_name}.{name}.GetVectorMagnetometer().x", + "permit_scale": false }, { "name": "{name}_magnet_y", - "get": "{class_name}.{name}.GetVectorMagnetometer().y" + "get": "{class_name}.{name}.GetVectorMagnetometer().y", + "permit_scale": false }, { "name": "{name}_magnet_z", - "get": "{class_name}.{name}.GetVectorMagnetometer().z" + "get": "{class_name}.{name}.GetVectorMagnetometer().z", + "permit_scale": false }, { "name": "{name}_gyro_x", - "get": "{class_name}.{name}.GetVectorGyroscope().x" + "get": "{class_name}.{name}.GetVectorGyroscope().x", + "permit_scale": false }, { "name": "{name}_gyro_y", - "get": "{class_name}.{name}.GetVectorGyroscope().y" + "get": "{class_name}.{name}.GetVectorGyroscope().y", + "permit_scale": false }, { "name": "{name}_gyro_z", - "get": "{class_name}.{name}.GetVectorGyroscope().z" + "get": "{class_name}.{name}.GetVectorGyroscope().z", + "permit_scale": false }, { "name": "{name}_euler_x", - "get": "{class_name}.{name}.GetVectorEuler().x" + "get": "{class_name}.{name}.GetVectorEuler().x", + "permit_scale": false }, { "name": "{name}_euler_y", - "get": "{class_name}.{name}.GetVectorEuler().y" + "get": "{class_name}.{name}.GetVectorEuler().y", + "permit_scale": false }, { "name": "{name}_euler_z", - "get": "{class_name}.{name}.GetVectorEuler().z" + "get": "{class_name}.{name}.GetVectorEuler().z", + "permit_scale": false }, { "name": "{name}_linear_accel_x", - "get": "{class_name}.{name}.GetVectorLinearAccel().x" + "get": "{class_name}.{name}.GetVectorLinearAccel().x", + "permit_scale": false }, { "name": "{name}_linear_accel_y", - "get": "{class_name}.{name}.GetVectorLinearAccel().y" + "get": "{class_name}.{name}.GetVectorLinearAccel().y", + "permit_scale": false }, { "name": "{name}_linear_accel_z", - "get": "{class_name}.{name}.GetVectorLinearAccel().z" + "get": "{class_name}.{name}.GetVectorLinearAccel().z", + "permit_scale": false }, { "name": "{name}_grav_x", - "get": "{class_name}.{name}.GetVectorGravity().x" + "get": "{class_name}.{name}.GetVectorGravity().x", + "permit_scale": false }, { "name": "{name}_grav_y", - "get": "{class_name}.{name}.GetVectorGravity().y" + "get": "{class_name}.{name}.GetVectorGravity().y", + "permit_scale": false }, { "name": "{name}_grav_z", - "get": "{class_name}.{name}.GetVectorGravity().z" + "get": "{class_name}.{name}.GetVectorGravity().z", + "permit_scale": false }, { "name": "{name}_quat_x", - "get": "{class_name}.{name}.GetQuat().x" + "get": "{class_name}.{name}.GetQuat().x", + "permit_scale": false }, { "name": "{name}_quat_y", - "get": "{class_name}.{name}.GetQuat().y" + "get": "{class_name}.{name}.GetQuat().y", + "permit_scale": false }, { "name": "{name}_quat_z", - "get": "{class_name}.{name}.GetQuat().z" + "get": "{class_name}.{name}.GetQuat().z", + "permit_scale": false }, { "name": "{name}_quat_w", - "get": "{class_name}.{name}.GetQuat().w" + "get": "{class_name}.{name}.GetQuat().w", + "permit_scale": false } ] }, @@ -1305,43 +1361,53 @@ "mapping": [ { "name": "{name}", - "get": "{class_name}.{name}.GetAccelVect().x" + "get": "{class_name}.{name}.GetAccelVect().x", + "permit_scale": false }, { "name": "{name}_accel_x", - "get": "{class_name}.{name}.GetAccelVect().x" + "get": "{class_name}.{name}.GetAccelVect().x", + "permit_scale": false }, { "name": "{name}_accel_y", - "get": "{class_name}.{name}.GetAccelVect().y" + "get": "{class_name}.{name}.GetAccelVect().y", + "permit_scale": false }, { "name": "{name}_accel_z", - "get": "{class_name}.{name}.GetAccelVect().z" + "get": "{class_name}.{name}.GetAccelVect().z", + "permit_scale": false }, { "name": "{name}_magnet_x", - "get": "{class_name}.{name}.GetMagVect().x" + "get": "{class_name}.{name}.GetMagVect().x", + "permit_scale": false }, { "name": "{name}_magnet_y", - "get": "{class_name}.{name}.GetMagVect().y" + "get": "{class_name}.{name}.GetMagVect().y", + "permit_scale": false }, { "name": "{name}_magnet_z", - "get": "{class_name}.{name}.GetMagVect().z" + "get": "{class_name}.{name}.GetMagVect().z", + "permit_scale": false }, { "name": "{name}_gyro_x", - "get": "{class_name}.{name}.GetGyroVect().x" + "get": "{class_name}.{name}.GetGyroVect().x", + "permit_scale": false }, { "name": "{name}_gyro_y", - "get": "{class_name}.{name}.GetGyroVect().y" + "get": "{class_name}.{name}.GetGyroVect().y", + "permit_scale": false }, { "name": "{name}_gyro_z", - "get": "{class_name}.{name}.GetGyroVect().z" + "get": "{class_name}.{name}.GetGyroVect().z", + "permit_scale": false } ] }, @@ -1358,19 +1424,23 @@ "mapping": [ { "name": "{name}", - "get": "{class_name}.{name}.GetTemperature()" + "get": "{class_name}.{name}.GetTemperature()", + "permit_scale": false }, { "name": "{name}_temp", - "get": "{class_name}.{name}.GetTemperature()" + "get": "{class_name}.{name}.GetTemperature()", + "permit_scale": false }, { "name": "{name}_press", - "get": "{class_name}.{name}.GetPressure()" + "get": "{class_name}.{name}.GetPressure()", + "permit_scale": false }, { "name": "{name}_alt", - "get": "{class_name}.{name}.GetAltitude({pressure})" + "get": "{class_name}.{name}.GetAltitude({pressure})", + "permit_scale": false } ] } diff --git a/source/oopsy.js b/source/oopsy.js index 93785ff..c9c215a 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -83,6 +83,15 @@ function asCppNumber(n, type="float") { } } +function node_scale(node) { + if (node.permit_scale == false) + return `${node.varname} = (${node.type})(${node.src}); + ` + else + return `${node.varname} = (${node.type})(${node.src}*${asCppNumber(node.range)} + ${asCppNumber(node.min + (node.type == "int" || node.type == "bool" ? 0.5 : 0))}); + ` +} + let build_tools_path; let has_dfu_util; function checkBuildEnvironment() { @@ -469,7 +478,8 @@ function run() { code: json2daisy.format_map(mapping.get, component), automap: component.automap && name == component.name, range: mapping.range, - where: mapping.where + where: mapping.where, + permit_scale: mapping.permit_scale != undefined ? mapping.permit_scale : true } hardware.labels.params[name] = name } @@ -1326,6 +1336,7 @@ function generate_app(app, hardware, target, config) { if (src in hardware.inputs) { let input = hardware.inputs[src]; + node.permit_scale = input.permit_scale; if ('range' in input && typeof input.range !== 'undefined') { @@ -1506,8 +1517,7 @@ struct App_${name} : public oopsy::App { .map(name=>nodes[name]) .filter(node => node.src) .filter(node => node.where == "audio" || node.where == undefined) - .map(node=>` - ${node.varname} = (${node.type})(${node.src}*${asCppNumber(node.range)} + ${asCppNumber(node.min + (node.type == "int" || node.type == "bool" ? 0.5 : 0))});`).join("")} + .map(node_scale).join("")} ${gen.params .map(name=>nodes[name]) .map(node=>` From 9533699fa8f78dd558c34455deddd6bfd5c49cb5 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Tue, 18 Jan 2022 15:09:47 -0700 Subject: [PATCH 036/100] Removed "hook" location from motor components --- source/component_defs.json | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/source/component_defs.json b/source/component_defs.json index 6752092..4086b77 100644 --- a/source/component_defs.json +++ b/source/component_defs.json @@ -418,15 +418,11 @@ "mapping": [ { "name": "{name}", - "set": "if ({value} > 0)\n {class_name}.{name}->StepNonblocking({value}, daisy::Adafruit_MotorShield::FORWARD);\n else if ({value} < 0)\n {class_name}.{name}->StepNonblocking(-{value}, daisy::Adafruit_MotorShield::BACKWARD);", - "bool": true, - "where": "hook" + "set": "if ({value} > 0)\n {class_name}.{name}->StepNonblocking({value}, daisy::Adafruit_MotorShield::FORWARD);\n else if ({value} < 0)\n {class_name}.{name}->StepNonblocking(-{value}, daisy::Adafruit_MotorShield::BACKWARD);" }, { "name": "{name}_release", - "set": "{class_name}.{name}->Release();", - "bool": true, - "where": "hook" + "set": "if ({value})\n {class_name}.{name}->Release();" } ] }, @@ -441,7 +437,6 @@ { "name": "{name}", "set": "if ({value} > 0)\n {class_name}.{name}->Run(daisy::Adafruit_MotorShield::FORWARD);\n else if ({value} < 0)\n {class_name}.{name}->Run(daisy::Adafruit_MotorShield::BACKWARD);\n else\n {class_name}.{name}->FullOff();", - "where": "main", "permit_scale": false } ] From bf7ad3688d939f01160c7a003949d9bc9c788e82 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 28 Mar 2022 11:31:50 -0600 Subject: [PATCH 037/100] Removed dependence on file name for som --- source/oopsy.js | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/source/oopsy.js b/source/oopsy.js index c9c215a..bd6e6e0 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -331,13 +331,13 @@ function run() { case "up": action="upload"; break; case "versio": target = arg; break; - case "bluemchen": target_path = path.join(__dirname, "seed.bluemchen.json"); break; - case "nehcmeulb": target_path = path.join(__dirname, "seed.nehcmeulb.json"); break; - case "pod": target_path = path.join(__dirname, "seed.pod.json"); break; - case "patch_init": target_path = path.join(__dirname, "patch_sm.patch_init.json"); break; - case "field": target_path = path.join(__dirname, "seed.field.json"); break; - case "petal": target_path = path.join(__dirname, "seed.petal.json"); break; - case "patch": target_path = path.join(__dirname, "seed.patch.json"); break; + case "bluemchen": target_path = path.join(__dirname, "bluemchen.json"); break; + case "nehcmeulb": target_path = path.join(__dirname, "nehcmeulb.json"); break; + case "pod": target_path = path.join(__dirname, "pod.json"); break; + case "patch_init": target_path = path.join(__dirname, "patch_init.json"); break; + case "field": target_path = path.join(__dirname, "field.json"); break; + case "petal": target_path = path.join(__dirname, "petal.json"); break; + case "patch": target_path = path.join(__dirname, "patch.json"); break; case "watch": watch=true; break; @@ -420,16 +420,20 @@ function run() { // (and even prototypes / breadboards) should really be defined with a JSON file // OOPSY_TARGET_SEED = 1 target = path.parse(target_path).name.replace(".", "_") - som_match = path.parse(target_path).name.match(/([A-Za-z_0-9\-]+)\./) - assert(som_match != null, `Daisy SOM undefined. Provide the SOM as in the following: "som.MyBoard.json"`); - assert(valid_soms.includes(som_match[1]), `unkown SOM ${som_match[1]}. Valid SOMs: ${valid_soms.join(', ')}`); - som = som_match[1]; + // som_match = path.parse(target_path).name.match(/([A-Za-z_0-9\-]+)\./) + // assert(som_match != null, `Daisy SOM undefined. Provide the SOM as in the following: "som.MyBoard.json"`); + // assert(valid_soms.includes(som_match[1]), `unkown SOM ${som_match[1]}. Valid SOMs: ${valid_soms.join(', ')}`); + // som = som_match[1]; } console.log(`Target ${target} configured in path ${target_path}`) assert(fs.existsSync(target_path), `couldn't find target configuration file ${target_path}`); const hardware = JSON.parse(fs.readFileSync(target_path, "utf8")); hardware.max_apps = hardware.max_apps || 1 - hardware.som = som; + // hardware.som = som; + + // Ensure som is valid + assert(valid_soms.includes(hardware.som), `unkown SOM ${hardware.som}. Valid SOMs: ${valid_soms.join(', ')}`); + // The following is compatibility code, so that the new JSON structure will generate the old JSON structure // At the point that the old one can be retired (because e.g. Patch, Petal etc can be defined in the new format) // this script should be revised to eliminate the old workflow From 65a108ed99de2f9399948e994e2e990837aad198 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 28 Mar 2022 11:32:06 -0600 Subject: [PATCH 038/100] Simplified template names --- source/{seed.bluemchen.json => bluemchen.json} | 1 + source/{seed.field.json => field.json} | 0 source/{seed.nehcmeulb.json => nehcmeulb.json} | 1 + source/{seed.patch.json => patch.json} | 0 source/{patch_sm.patch_init.json => patch_init.json} | 1 + source/{seed.petal.json => petal.json} | 0 source/{seed.pod.json => pod.json} | 0 source/{seed.versio.json => versio.json} | 1 + 8 files changed, 4 insertions(+) rename source/{seed.bluemchen.json => bluemchen.json} (97%) rename source/{seed.field.json => field.json} (100%) rename source/{seed.nehcmeulb.json => nehcmeulb.json} (97%) rename source/{seed.patch.json => patch.json} (100%) rename source/{patch_sm.patch_init.json => patch_init.json} (99%) rename source/{seed.petal.json => petal.json} (100%) rename source/{seed.pod.json => pod.json} (100%) rename source/{seed.versio.json => versio.json} (99%) diff --git a/source/seed.bluemchen.json b/source/bluemchen.json similarity index 97% rename from source/seed.bluemchen.json rename to source/bluemchen.json index 05546f5..3d9c7e2 100644 --- a/source/seed.bluemchen.json +++ b/source/bluemchen.json @@ -1,5 +1,6 @@ { "name":"bluemchen", + "som": "seed", "max_apps": 8, "defines": { "OOPSY_TARGET_HAS_MIDI_INPUT": 1 diff --git a/source/seed.field.json b/source/field.json similarity index 100% rename from source/seed.field.json rename to source/field.json diff --git a/source/seed.nehcmeulb.json b/source/nehcmeulb.json similarity index 97% rename from source/seed.nehcmeulb.json rename to source/nehcmeulb.json index e23524e..5cc86d0 100644 --- a/source/seed.nehcmeulb.json +++ b/source/nehcmeulb.json @@ -1,5 +1,6 @@ { "name":"nehcmeulb", + "som": "seed", "max_apps": 8, "defines": { "OOPSY_TARGET_HAS_MIDI_OUTPUT": 1 diff --git a/source/seed.patch.json b/source/patch.json similarity index 100% rename from source/seed.patch.json rename to source/patch.json diff --git a/source/patch_sm.patch_init.json b/source/patch_init.json similarity index 99% rename from source/patch_sm.patch_init.json rename to source/patch_init.json index 8026197..e8c11f1 100644 --- a/source/patch_sm.patch_init.json +++ b/source/patch_init.json @@ -1,5 +1,6 @@ { "name": "patch_init", + "som": "patch_sm", "defines": {}, "components": { "cv_1": { diff --git a/source/seed.petal.json b/source/petal.json similarity index 100% rename from source/seed.petal.json rename to source/petal.json diff --git a/source/seed.pod.json b/source/pod.json similarity index 100% rename from source/seed.pod.json rename to source/pod.json diff --git a/source/seed.versio.json b/source/versio.json similarity index 99% rename from source/seed.versio.json rename to source/versio.json index 34e9c81..02398b7 100644 --- a/source/seed.versio.json +++ b/source/versio.json @@ -1,5 +1,6 @@ { "name":"versio", + "som":"seed", "defines": {}, "components": { "knob1": { From 4126737a853729cf3b46b8f1c2b065f91d0455c2 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Thu, 31 Mar 2022 11:24:24 -0600 Subject: [PATCH 039/100] Removed old json files --- source/daisy.field.json | 228 ----------------------------------- source/daisy.patch.json | 99 --------------- source/daisy.patch_init.json | 177 --------------------------- source/daisy.petal.json | 130 -------------------- source/daisy.pod.json | 81 ------------- source/daisy.versio.json | 134 -------------------- 6 files changed, 849 deletions(-) delete mode 100644 source/daisy.field.json delete mode 100644 source/daisy.patch.json delete mode 100644 source/daisy.patch_init.json delete mode 100644 source/daisy.petal.json delete mode 100644 source/daisy.pod.json delete mode 100644 source/daisy.versio.json diff --git a/source/daisy.field.json b/source/daisy.field.json deleted file mode 100644 index 2682957..0000000 --- a/source/daisy.field.json +++ /dev/null @@ -1,228 +0,0 @@ -{ - "som": "seed", - "max_apps": 8, - "defines": { - "OOPSY_TARGET_FIELD": 1, - "OOPSY_TARGET_HAS_OLED": 1, - "OOPSY_TARGET_HAS_MIDI_INPUT": 1, - "OOPSY_TARGET_HAS_MIDI_OUTPUT": 1 - }, - "inserts": [ - { - "where": "header", - "code": "#include \"daisy_field.h\"" - }, - { - "where": "header", - "code": "typedef daisy::DaisyField Daisy;" - } - ], - "labels": { - "params": { - "knob1": "kn1", - "knob2": "kn2", - "knob3": "kn3", - "knob4": "kn4", - "knob5": "kn5", - "knob6": "kn6", - "knob7": "kn7", - "knob8": "kn8", - "keyA1": "kB1", - "keyA2": "kB2", - "keyA3": "kB3", - "keyA4": "kB4", - "keyA5": "kB5", - "keyA6": "kB6", - "keyA7": "kB7", - "keyA8": "kB8", - "keyB1": "kA1", - "keyB2": "kA2", - "keyB3": "kA3", - "keyB4": "kA4", - "keyB5": "kA5", - "keyB6": "kA6", - "keyB7": "kA7", - "keyB8": "kA8", - "sw1": "sw1", - "sw2": "sw2", - "cv1": "cv1", - "cv2": "cv2", - "cv3": "cv3", - "cv4": "cv4", - "gate1": "gt1", - "key1": "kA1", - "key2": "kA2", - "key3": "kA3", - "key4": "kA4", - "key5": "kA5", - "key6": "kA6", - "key7": "kA7", - "key8": "kA8", - "key9": "kB1", - "key10": "kB2", - "key11": "kB3", - "key12": "kB4", - "key13": "kB5", - "key14": "kB6", - "key15": "kB7", - "key16": "kB8", - "ctrl1": "kn1", - "ctrl2": "kn2", - "ctrl3": "kn3", - "ctrl4": "kn4", - "ctrl5": "kn5", - "ctrl6": "kn6", - "ctrl7": "kn7", - "ctrl8": "kn8", - "switch1": "sw1", - "switch2": "sw2", - "knob": "kn", - "key": "kA1", - "ctrl": "kn", - "cv": "cv1", - "gate": "gt1", - "switch": "sw1" - }, - "outs": { - "cv": "cvout1", - "cv1": "cvout1", - "cv2": "cvout2", - "gate": "gateout1", - "gate1": "gateout1" - }, - "datas": { - "leds": "dsy_leds" - } - }, - "inputs": { - "kn1": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_1);" - }, - "kn2": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_2);" - }, - "kn3": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_3);" - }, - "kn4": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_4);" - }, - "kn5": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_5);" - }, - "kn6": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_6);" - }, - "kn7": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_7);" - }, - "kn8": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_8);" - }, - "kA1": { - "code": "(hardware.KeyboardState(0)?1.f:0.f);" - }, - "kA2": { - "code": "(hardware.KeyboardState(1)?1.f:0.f);" - }, - "kA3": { - "code": "(hardware.KeyboardState(2)?1.f:0.f);" - }, - "kA4": { - "code": "(hardware.KeyboardState(3)?1.f:0.f);" - }, - "kA5": { - "code": "(hardware.KeyboardState(4)?1.f:0.f);" - }, - "kA6": { - "code": "(hardware.KeyboardState(5)?1.f:0.f);" - }, - "kA7": { - "code": "(hardware.KeyboardState(6)?1.f:0.f);" - }, - "kA8": { - "code": "(hardware.KeyboardState(7)?1.f:0.f);" - }, - "kB1": { - "code": "(hardware.KeyboardState(8)?1.f:0.f);" - }, - "kB2": { - "code": "(hardware.KeyboardState(9)?1.f:0.f);" - }, - "kB3": { - "code": "(hardware.KeyboardState(10)?1.f:0.f);" - }, - "kB4": { - "code": "(hardware.KeyboardState(11)?1.f:0.f);" - }, - "kB5": { - "code": "(hardware.KeyboardState(12)?1.f:0.f);" - }, - "kB6": { - "code": "(hardware.KeyboardState(13)?1.f:0.f);" - }, - "kB7": { - "code": "(hardware.KeyboardState(14)?1.f:0.f);" - }, - "kB8": { - "code": "(hardware.KeyboardState(15)?1.f:0.f);" - }, - "sw1": { - "code": "(hardware.GetSwitch(0)->Pressed()?1.f:0.f);" - }, - "sw2": { - "code": "(hardware.GetSwitch(1)->Pressed()?1.f:0.f);" - }, - "cv1": { - "input_min": -1, - "input_max": 1, - "code": "hardware.GetCvValue(0);" - }, - "cv2": { - "input_min": -1, - "input_max": 1, - "code": "hardware.GetCvValue(1);" - }, - "cv3": { - "input_min": -1, - "input_max": 1, - "code": "hardware.GetCvValue(2);" - }, - "cv4": { - "input_min": -1, - "input_max": 1, - "code": "hardware.GetCvValue(3);" - }, - "gt1": { - "code": "(hardware.gate_in.State()?1.f:0.f);" - } - }, - "outputs": { - "cvout1": { - "where": "main", - "code": "hardware.SetCvOut1($ * 4095);" - }, - "cvout2": { - "where": "main", - "code": "hardware.SetCvOut2($ * 4095);" - }, - "gateout1": { - "where": "audio", - "code": "dsy_gpio_write(&hardware.gate_out, $ > 0.f);" - } - }, - "datahandlers": { - "dsy_leds": { - "where": "display", - "code": "daisy.setFieldLedsFromData($);" - } - } -} \ No newline at end of file diff --git a/source/daisy.patch.json b/source/daisy.patch.json deleted file mode 100644 index b1589ec..0000000 --- a/source/daisy.patch.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "som": "seed", - "max_apps": 8, - "defines": { - "OOPSY_TARGET_PATCH": 1, - "OOPSY_TARGET_HAS_OLED": 1, - "OOPSY_IO_COUNT": 4, - "OOPSY_TARGET_HAS_MIDI_INPUT": 1, - "OOPSY_TARGET_HAS_MIDI_OUTPUT": 1, - "OOPSY_HAS_ENCODER": 1 - }, - "inserts": [ - { - "where": "header", - "code": "#include \"daisy_patch.h\"" - }, - { - "where": "header", - "code": "typedef daisy::DaisyPatch Daisy;" - } - ], - "labels": { - "params": { - "knob1": "kn1", - "knob2": "kn2", - "knob3": "kn3", - "knob4": "kn4", - "gate1": "gt1", - "gate2": "gt2", - "knob": "kn1", - "cv": "kn1", - "cv1": "kn1", - "cv2": "kn2", - "cv3": "kn3", - "cv4": "kn4", - "ctrl": "kn1", - "ctrl1": "kn1", - "ctrl2": "kn2", - "ctrl3": "kn3", - "ctrl4": "kn4", - "gate": "gt1" - }, - "outs": { - "cv1": "cvout1", - "cv2": "cvout2", - "gate1": "gateout1", - "cv": "cvout1", - "gate": "gateout1" - }, - "datas": { - "midi": "dsy_midi_out" - } - }, - "inputs": { - "kn1": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.CTRL_1);" - }, - "kn2": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.CTRL_2);" - }, - "kn3": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.CTRL_3);" - }, - "kn4": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.CTRL_4);" - }, - "gt1": { - "code": "(hardware.gate_input[hardware.GATE_IN_1].State()?1.f:0.f);" - }, - "gt2": { - "code": "(hardware.gate_input[hardware.GATE_IN_2].State()?1.f:0.f);" - } - }, - "outputs": { - "cvout1": { - "where": "main", - "code": "hardware.seed.dac.WriteValue(daisy::DacHandle::Channel::ONE, $ * 4095);" - }, - "cvout2": { - "where": "main", - "code": "hardware.seed.dac.WriteValue(daisy::DacHandle::Channel::TWO, $ * 4095);" - }, - "gateout1": { - "where": "audio", - "code": "dsy_gpio_write(&hardware.gate_output, $ > 0.f);" - } - }, - "datahandlers": { - "dsy_midi_out": { - "where": "main", - "init": "daisy.midi_nullData($)", - "code": "daisy.midi_fromData($);" - } - } -} \ No newline at end of file diff --git a/source/daisy.patch_init.json b/source/daisy.patch_init.json deleted file mode 100644 index 5e45f01..0000000 --- a/source/daisy.patch_init.json +++ /dev/null @@ -1,177 +0,0 @@ -{ - "som": "patch_sm", - "max_apps": 8, - "defines": { - "OOPSY_IO_COUNT": 2 - }, - "inserts": [ - { - "where": "header", - "code": "#include \"daisy_patch_sm.h\"" - }, - { - "where": "header", - "code": "typedef daisy::patch_sm::DaisyPatchSM Daisy;" - }, - { - "where": "header", - "code": "daisy::Switch sw_class;" - }, - { - "where": "init", - "code": "sw_class.Init(oopsy::daisy.hardware.B8, 1000);" - }, - { - "where": "audio", - "code": "sw_class.Debounce();" - }, - { - "where": "header", - "code": "daisy::Switch button_class;" - }, - { - "where": "init", - "code": "button_class.Init(oopsy::daisy.hardware.B7, 1000);" - }, - { - "where": "audio", - "code": "button_class.Debounce();" - } - ], - "labels": { - "params": { - "knob1": "kn1", - "knob2": "kn2", - "knob3": "kn3", - "knob4": "kn4", - "gate1": "gt1", - "gate2": "gt2", - "switch": "sw", - "toggle": "sw", - "sw": "sw", - "sw1": "sw", - "sw2": "button", - "button": "button", - "press": "button", - "knob": "kn1", - "cv": "kn1", - "cv1": "kn1", - "cv2": "kn2", - "cv3": "kn3", - "cv4": "kn4", - "cv5": "cv5", - "cv6": "cv6", - "cv7": "cv7", - "cv8": "cv8", - "ctrl": "kn1", - "ctrl1": "kn1", - "ctrl2": "kn2", - "ctrl3": "kn3", - "ctrl4": "kn4", - "gate": "gt1", - "CV_1": "kn1", - "CV_2": "kn2", - "CV_3": "kn3", - "CV_4": "kn4", - "CV_5": "cv5", - "CV_6": "cv6", - "CV_7": "cv7", - "CV_8": "cv8", - "B7": "button", - "B8": "sw", - "B10": "gt1", - "B9": "gt2", - "gate_in_1": "gt1", - "gate_in_2": "gt2" - }, - "outs": { - "cvout1": "cvout1", - "cvout2": "cvout2", - - "cv1": "cvout1", - "cv2": "cvout2", - "gate1": "gateout1", - "gate2": "gateout2", - "cv": "cvout1", - "led": "cvout2", - "gate": "gateout1", - "CV_OUT_1": "cvout1", - "C10": "cvout1", - "CV_OUT_2": "cvout2", - "B5": "gateout1", - "B6": "gateout2", - "gate_out_1": "gateout1", - "gate_out_2": "gateout2" - }, - "datas": {} - }, - "inputs": { - "kn1": { - "automap": true, - "code": "hardware.GetAdcValue(daisy::patch_sm::CV_1);" - }, - "kn2": { - "automap": true, - "code": "hardware.GetAdcValue(daisy::patch_sm::CV_2);" - }, - "kn3": { - "automap": true, - "code": "hardware.GetAdcValue(daisy::patch_sm::CV_3);" - }, - "kn4": { - "automap": true, - "code": "hardware.GetAdcValue(daisy::patch_sm::CV_4);" - }, - "cv5": { - "input_min": -1, - "input_max": 1, - "code": "hardware.GetAdcValue(daisy::patch_sm::CV_5);" - }, - "cv6": { - "input_min": -1, - "input_max": 1, - "code": "hardware.GetAdcValue(daisy::patch_sm::CV_6);" - }, - "cv7": { - "input_min": -1, - "input_max": 1, - "code": "hardware.GetAdcValue(daisy::patch_sm::CV_7);" - }, - "cv8": { - "input_min": -1, - "input_max": 1, - "code": "hardware.GetAdcValue(daisy::patch_sm::CV_8);" - }, - "gt1": { - "code": "(hardware.gate_in_1.State()?1.f:0.f);" - }, - "gt2": { - "code": "(hardware.gate_in_2.State()?1.f:0.f);" - }, - "button": { - "code": "(button_class.Pressed() ? 1.f : 0.f);" - }, - "sw": { - "code": "(sw_class.Pressed() ? 1.f : 0.f);" - } - }, - "outputs": { - "cvout1": { - "where": "main", - "code": "hardware.WriteCvOut(daisy::patch_sm::CV_OUT_1, $ * 5.f);" - }, - "cvout2": { - "where": "main", - "code": "hardware.WriteCvOut(daisy::patch_sm::CV_OUT_2, $ * 5.f);" - }, - "gateout1": { - "where": "audio", - "code": "dsy_gpio_write(&hardware.gate_out_1, $ > 0.f);" - }, - "gateout2": { - "where": "audio", - "code": "dsy_gpio_write(&hardware.gate_out_2, $ > 0.f);" - } - }, - "datahandlers": {} -} \ No newline at end of file diff --git a/source/daisy.petal.json b/source/daisy.petal.json deleted file mode 100644 index f5234de..0000000 --- a/source/daisy.petal.json +++ /dev/null @@ -1,130 +0,0 @@ -{ - "som": "seed", - "max_apps": 8, - "defines": { - "OOPSY_TARGET_PETAL": 1, - "OOPSY_HAS_ENCODER": 1 - }, - "inserts": [ - { - "where": "header", - "code": "#include \"daisy_petal.h\"" - }, - { - "where": "header", - "code": "typedef daisy::DaisyPetal Daisy;" - } - ], - "labels": { - "params": { - "knob1": "kn1", - "knob2": "kn2", - "knob3": "kn3", - "knob4": "kn4", - "knob5": "kn5", - "knob6": "kn6", - "sw1": "sw1", - "sw2": "sw2", - "sw3": "sw3", - "sw4": "sw4", - "sw5": "sw5", - "sw6": "sw6", - "sw7": "sw7", - "exp1": "exp", - "ctrl1": "kn1", - "ctrl2": "kn2", - "ctrl3": "kn3", - "ctrl4": "kn4", - "ctrl5": "kn5", - "ctrl6": "kn6", - "switch1": "sw1", - "switch2": "sw2", - "switch3": "sw3", - "switch4": "sw4", - "switch5": "sw5", - "switch6": "sw6", - "switch7": "sw7", - "knob": "kn1", - "ctrl": "kn1", - "switch": "sw1", - "exp": "exp", - "expression": "exp" - }, - "outs": { - "led1": "led1", - "led2": "led2", - "led3": "led3", - "led4": "led4" - }, - "datas": {} - }, - "inputs": { - "kn1": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_1);" - }, - "kn2": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_2);" - }, - "kn3": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_3);" - }, - "kn4": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_4);" - }, - "kn5": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_5);" - }, - "kn6": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_6);" - }, - "sw1": { - "code": "(hardware.switches[0].Pressed()?1.f:0.f);" - }, - "sw2": { - "code": "(hardware.switches[1].Pressed()?1.f:0.f);" - }, - "sw3": { - "code": "(hardware.switches[2].Pressed()?1.f:0.f);" - }, - "sw4": { - "code": "(hardware.switches[3].Pressed()?1.f:0.f);" - }, - "sw5": { - "code": "(hardware.switches[4].Pressed()?1.f:0.f);" - }, - "sw6": { - "code": "(hardware.switches[5].Pressed()?1.f:0.f);" - }, - "sw7": { - "code": "(hardware.switches[6].Pressed()?1.f:0.f);" - }, - "exp": { - "code": "(hardware.GetExpression());" - } - }, - "outputs": { - "led1": { - "where": "display", - "code": "hardware.SetFootswitchLed(daisy::DaisyPetal::FOOTSWITCH_LED_1, $);" - }, - "led2": { - "where": "display", - "code": "hardware.SetFootswitchLed(daisy::DaisyPetal::FOOTSWITCH_LED_2, $);" - }, - "led3": { - "where": "display", - "code": "hardware.SetFootswitchLed(daisy::DaisyPetal::FOOTSWITCH_LED_3, $);" - }, - "led4": { - "where": "display", - "code": "hardware.SetFootswitchLed(daisy::DaisyPetal::FOOTSWITCH_LED_4, $);" - } - }, - "datahandlers": {} -} \ No newline at end of file diff --git a/source/daisy.pod.json b/source/daisy.pod.json deleted file mode 100644 index 42c5329..0000000 --- a/source/daisy.pod.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "som": "seed", - "max_apps": 1, - "defines": { - "OOPSY_TARGET_POD": 1, - "OOPSY_TARGET_HAS_MIDI_INPUT": 1, - "OOPSY_HAS_ENCODER": 1 - }, - "inserts": [ - { - "where": "header", - "code": "#include \"daisy_pod.h\"" - }, - { - "where": "header", - "code": "typedef daisy::DaisyPod Daisy;" - }, - { - "where": "post_audio", - "code": "hardware.UpdateLeds();" - } - ], - "labels": { - "params": { - "knob1": "kn1", - "knob2": "kn2", - "sw1": "sw1", - "sw2": "sw2", - "sw3": "enp", - "encoder": "enc", - "ctrl1": "kn1", - "ctrl2": "kn2", - "switch1": "sw1", - "switch2": "sw2", - "switch3": "enp", - "knob": "kn1", - "ctrl": "kn1", - "switch": "sw1", - "press": "enp" - }, - "outs": { - "led1": "led1", - "led2": "led2", - "led": "led1" - }, - "datas": {} - }, - "inputs": { - "kn1": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_1);" - }, - "kn2": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_2);" - }, - "sw1": { - "code": "(hardware.button1.Pressed()?1.f:0.f);" - }, - "sw2": { - "code": "(hardware.button2.Pressed()?1.f:0.f);" - }, - "enc": { - "code": "(hardware.encoder.Increment()*0.5f+0.5f);" - }, - "enp": { - "code": "(hardware.encoder.Pressed());" - } - }, - "outputs": { - "led1": { - "where": "audio", - "code": "hardware.led1.Set(clamp(-$, 0.f, 1.f), clamp($, 0.f, 1.f), 0.f);" - }, - "led2": { - "where": "audio", - "code": "hardware.led2.Set(clamp(-$, 0.f, 1.f), clamp($, 0.f, 1.f), 0.f);" - } - }, - "datahandlers": {} -} \ No newline at end of file diff --git a/source/daisy.versio.json b/source/daisy.versio.json deleted file mode 100644 index 8fec263..0000000 --- a/source/daisy.versio.json +++ /dev/null @@ -1,134 +0,0 @@ -{ - "som": "seed", - "max_apps": 1, - "defines": { - "OOPSY_TARGET_VERSIO": 1 - }, - "inserts": [ - { - "where": "header", - "code": "#include \"daisy_versio.h\"" - }, - { - "where": "header", - "code": "typedef daisy::DaisyVersio Daisy;" - }, - { - "where": "post_audio", - "code": "hardware.UpdateLeds();" - } - ], - "labels": { - "params": { - "knob1": "kn1", - "knob2": "kn2", - "knob3": "kn3", - "knob4": "kn4", - "knob5": "kn5", - "knob6": "kn6", - "knob7": "kn7", - "button1": "bt1", - "sw1": "sw1", - "sw2": "sw2", - "gate1": "gt1", - "cv1": "kn1", - "cv2": "kn2", - "cv3": "kn3", - "cv4": "kn4", - "cv5": "kn5", - "cv6": "kn6", - "cv7": "kn7", - "ctrl1": "kn1", - "ctrl2": "kn2", - "ctrl3": "kn3", - "ctrl4": "kn4", - "ctrl5": "kn5", - "ctrl6": "kn6", - "ctrl7": "kn7", - "switch1": "sw1", - "switch2": "sw2", - "knob": "kn1", - "button": "bt1", - "ctrl": "kn1", - "cv": "kn1", - "switch": "sw1", - "gate": "gt1", - "tap": "bt1", - "fsu": "bt1", - "abc": "sw1", - "xyz": "sw2" - }, - "outs": { - "led1": "led1", - "led2": "led2", - "led3": "led3", - "led4": "led4" - }, - "datas": {} - }, - "inputs": { - "kn1": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_0);" - }, - "kn2": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_1);" - }, - "kn3": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_2);" - }, - "kn4": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_3);" - }, - "kn5": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_4);" - }, - "kn6": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_5);" - }, - "kn7": { - "automap": true, - "code": "hardware.GetKnobValue(hardware.KNOB_6);" - }, - "sw1": { - "code": "(hardware.sw[0].Read()/2.f);" - }, - "sw2": { - "code": "(hardware.sw[1].Read()/2.f);" - }, - "bt1": { - "code": "(hardware.tap.Pressed()?1.f:0.f);", - "update": { - "where": "audio", - "code": "hardware.tap.Debounce();" - } - }, - "gt1": { - "code": "(hardware.Gate()?1.f:0.f);" - } - }, - "outputs": { - "led1": { - "where": "audio", - "code": "hardware.leds[0].Set(clamp(-$, 0.f, 1.f), clamp($, 0.f, 1.f), 0.f);" - }, - "led2": { - "where": "audio", - "code": "hardware.leds[1].Set(clamp(-$, 0.f, 1.f), clamp($, 0.f, 1.f), 0.f);" - }, - "led3": { - "where": "audio", - "code": "hardware.leds[2].Set(clamp(-$, 0.f, 1.f), clamp($, 0.f, 1.f), 0.f);" - }, - "led4": { - "where": "audio", - "code": "hardware.leds[3].Set(clamp(-$, 0.f, 1.f), clamp($, 0.f, 1.f), 0.f);" - } - }, - "datahandlers": {} -} \ No newline at end of file From 95dc866fcb65a6898aff218b504743655e654bfb Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 4 Apr 2022 11:03:02 -0600 Subject: [PATCH 040/100] Updated pod example to thoroughly test hardware --- templates/oopsy_pod.maxpat | 627 +++++++++++++++++++++++++++++++------ 1 file changed, 537 insertions(+), 90 deletions(-) diff --git a/templates/oopsy_pod.maxpat b/templates/oopsy_pod.maxpat index 32331bf..566987e 100644 --- a/templates/oopsy_pod.maxpat +++ b/templates/oopsy_pod.maxpat @@ -10,7 +10,7 @@ } , "classnamespace" : "box", - "rect" : [ 275.0, 205.0, 625.0, 480.0 ], + "rect" : [ 759.0, 192.0, 625.0, 480.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -56,12 +56,12 @@ } , "classnamespace" : "dsp.gen", - "rect" : [ 84.0, 103.0, 964.0, 458.0 ], + "rect" : [ 84.0, 103.0, 1240.0, 680.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, "default_fontface" : 0, - "default_fontname" : "Arial", + "default_fontname" : "Tahoma", "gridonopen" : 1, "gridsize" : [ 15.0, 15.0 ], "gridsnaponopen" : 1, @@ -86,111 +86,382 @@ "assistshowspatchername" : 0, "boxes" : [ { "box" : { - "id" : "obj-26", + "id" : "obj-101", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 225.5, 61.0, 67.0, 21.0 ], + "text" : "Buttons" + } + + } +, { + "box" : { + "id" : "obj-98", + "linecount" : 4, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 767.0, 325.0, 150.0, 64.0 ], + "text" : "Rotating the encoder will change the wave shape of the Saw / Triangle oscillator" + } + + } +, { + "box" : { + "id" : "obj-96", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 767.0, 61.0, 72.0, 21.0 ], + "text" : "Encoder" + } + + } +, { + "box" : { + "id" : "obj-93", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 140.0, 240.0, 43.0, 22.0 ], - "text" : "* 1000" + "patching_rect" : [ 767.0, 253.5, 36.0, 23.0 ], + "text" : "* 0.1" } } , { "box" : { - "id" : "obj-25", + "id" : "obj-92", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 90.0, 240.0, 43.0, 22.0 ], - "text" : "* 1000" + "patching_rect" : [ 839.5, 253.5, 36.0, 23.0 ], + "text" : "* 0.1" } } , { "box" : { - "id" : "obj-24", + "id" : "obj-91", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 767.0, 289.5, 141.0, 23.0 ], + "text" : "accum @max 1 @init 0.5" + } + + } +, { + "box" : { + "id" : "obj-90", "maxclass" : "newobj", "numinlets" : 1, - "numoutlets" : 2, - "outlettype" : [ "", "" ], - "patching_rect" : [ 128.0, 276.400900900363922, 36.0, 22.0 ], - "text" : "cycle" + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 767.0, 219.0, 60.0, 23.0 ], + "text" : "clamp 0 1" + } + + } +, { + "box" : { + "id" : "obj-89", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 839.5, 219.0, 65.0, 23.0 ], + "text" : "clamp -1 0" + } + + } +, { + "box" : { + "id" : "obj-88", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 767.0, 177.0, 47.0, 23.0 ], + "text" : "change" + } + + } +, { + "box" : { + "id" : "obj-87", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 839.5, 177.0, 47.0, 23.0 ], + "text" : "change" + } + + } +, { + "box" : { + "id" : "obj-86", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 839.5, 136.0, 65.0, 23.0 ], + "text" : "clamp -1 0" } } , { "box" : { - "id" : "obj-23", + "id" : "obj-85", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 767.0, 136.0, 60.0, 23.0 ], + "text" : "clamp 0 1" + } + + } +, { + "box" : { + "id" : "obj-84", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 656.5, 365.0, 90.0, 21.0 ], + "text" : "Saw / Triangle" + } + + } +, { + "box" : { + "id" : "obj-81", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 411.5, 215.0, 41.0, 21.0 ], + "text" : "Sine" + } + + } +, { + "box" : { + "id" : "obj-78", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 458.0, 215.0, 37.0, 21.0 ], + "text" : "Rect" + } + + } +, { + "box" : { + "id" : "obj-66", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 656.5, 325.0, 90.0, 23.0 ], + "text" : "expr in1 * 2 - 1" + } + + } +, { + "box" : { + "id" : "obj-65", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "" ], - "patching_rect" : [ 84.0, 276.400900900363922, 36.0, 22.0 ], + "patching_rect" : [ 246.5, 460.0, 35.0, 23.0 ], "text" : "cycle" } } , { "box" : { - "id" : "obj-22", + "id" : "obj-63", "maxclass" : "newobj", - "numinlets" : 0, + "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 37.5, 243.900900900363922, 37.0, 22.0 ], - "text" : "noise" + "patching_rect" : [ 225.5, 205.0, 33.0, 23.0 ], + "text" : "* -1." } } , { "box" : { - "id" : "obj-18", + "id" : "obj-62", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 37.5, 276.400900900363922, 33.0, 22.0 ], - "text" : "* 0.1" + "patching_rect" : [ 225.5, 165.0, 60.0, 23.0 ], + "text" : "clamp 0 1" + } + + } +, { + "box" : { + "id" : "obj-61", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 225.5, 128.400900900363922, 47.0, 23.0 ], + "text" : "change" } } , { "box" : { - "id" : "obj-21", + "id" : "obj-60", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 307.0, 165.0, 60.0, 23.0 ], + "text" : "clamp 0 1" + } + + } +, { + "box" : { + "id" : "obj-59", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 307.0, 128.400900900363922, 47.0, 23.0 ], + "text" : "change" + } + + } +, { + "box" : { + "id" : "obj-57", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 656.5, 219.0, 100.0, 23.0 ], + "text" : "expr in1 / 48000." + } + + } +, { + "box" : { + "id" : "obj-56", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 284.5, 315.0, 29.5, 22.0 ], + "patching_rect" : [ 656.5, 252.0, 90.0, 23.0 ], + "text" : "accum @max 1" + } + + } +, { + "box" : { + "id" : "obj-43", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 225.5, 252.0, 176.0, 23.0 ], + "text" : "accum @min 1 @max 4 @init 1" + } + + } +, { + "box" : { + "id" : "obj-34", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 225.5, 352.0, 29.5, 23.0 ], "text" : "*" } } , { "box" : { - "id" : "obj-20", - "linecount" : 3, - "maxclass" : "comment", + "id" : "obj-33", + "maxclass" : "newobj", "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 225.5, 378.0, 192.0, 47.0 ], - "text" : "LED outputs range -1 to 1; where output will be green when positive and red when negative" + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 454.0, 252.0, 194.0, 23.0 ], + "text" : "expr round(in1 * 0.5 + 0.5) * 2 - 1" } } , { "box" : { - "id" : "obj-16", + "id" : "obj-26", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "" ], - "patching_rect" : [ 225.5, 284.0, 36.0, 22.0 ], + "patching_rect" : [ 409.5, 252.0, 35.0, 23.0 ], "text" : "cycle" } + } +, { + "box" : { + "id" : "obj-24", + "maxclass" : "newobj", + "numinlets" : 4, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 225.5, 303.5, 60.0, 23.0 ], + "text" : "selector 3" + } + + } +, { + "box" : { + "id" : "obj-22", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 656.5, 289.5, 48.0, 23.0 ], + "text" : "triangle" + } + + } +, { + "box" : { + "id" : "obj-25", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 483.5, 139.5, 50.0, 23.0 ], + "text" : "* 1000" + } + + } +, { + "box" : { + "id" : "obj-20", + "linecount" : 3, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 245.5, 529.0, 192.0, 47.0 ], + "text" : "LED outputs range -1 to 1; where output will be blue when positive and red when negative" + } + } , { "box" : { @@ -198,7 +469,7 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 289.0, 350.0, 61.0, 22.0 ], + "patching_rect" : [ 315.0, 501.0, 63.5, 23.0 ], "text" : "out 4 led2" } @@ -209,7 +480,7 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 225.5, 350.0, 61.0, 22.0 ], + "patching_rect" : [ 245.5, 501.0, 64.0, 23.0 ], "text" : "out 3 led1" } @@ -221,7 +492,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 493.5, 150.0, 108.0, 60.0 ], + "patching_rect" : [ 929.5, 136.0, 108.0, 60.0 ], "text" : "Pod encoder will be +1, -1 or 0;\nencoder press will be 0 or 1" } @@ -233,7 +504,7 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 473.5, 120.0, 75.0, 22.0 ], + "patching_rect" : [ 970.5, 96.0, 75.0, 22.0 ], "text" : "param press" } @@ -245,7 +516,7 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 453.5, 96.0, 186.0, 22.0 ], + "patching_rect" : [ 767.0, 96.0, 186.0, 22.0 ], "text" : "param encoder @min -1 @max 1" } @@ -257,8 +528,8 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 284.5, 172.0, 164.0, 22.0 ], - "text" : "param sw2 @min -1 @max 1" + "patching_rect" : [ 307.0, 96.0, 66.0, 23.0 ], + "text" : "param sw2" } } @@ -269,7 +540,7 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 265.5, 148.0, 67.0, 22.0 ], + "patching_rect" : [ 225.5, 96.0, 67.0, 22.0 ], "text" : "param sw1" } @@ -281,7 +552,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 794.5, 96.0, 107.0, 22.0 ], + "patching_rect" : [ 1163.5, 529.0, 107.0, 22.0 ], "text" : "oopsy.suggestions" } @@ -314,7 +585,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 651.0, 62.5, 139.0, 20.0 ], + "patching_rect" : [ 1008.0, 529.0, 139.0, 20.0 ], "text" : "MIDI:" } @@ -322,11 +593,12 @@ , { "box" : { "id" : "obj-19", + "linecount" : 2, "maxclass" : "newobj", "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 651.0, 96.0, 53.0, 22.0 ], + "patching_rect" : [ 1008.0, 564.0, 53.0, 22.0 ], "text" : "in 3 midi" } @@ -334,11 +606,11 @@ , { "box" : { "id" : "obj-30", - "linecount" : 7, + "linecount" : 6, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 651.0, 150.0, 139.0, 100.0 ], + "patching_rect" : [ 1033.0, 594.0, 160.0, 93.0 ], "text" : "\"midi\" input/output is converted to/from normalized byte streams. See the MIDI examples more info on how to read and write these. " } @@ -346,11 +618,11 @@ , { "box" : { "id" : "obj-17", - "linecount" : 6, + "linecount" : 5, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 313.5, 211.400900900363922, 122.0, 87.0 ], + "patching_rect" : [ 576.0, 125.0, 135.0, 79.0 ], "text" : "Knob and switch inputs will be mapped to the @min..@max range. @min @max are 0 and 1 by default." } @@ -362,7 +634,7 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 244.5, 120.0, 79.0, 22.0 ], + "patching_rect" : [ 576.0, 96.0, 79.0, 22.0 ], "text" : "param knob2" } @@ -374,8 +646,8 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 225.5, 96.0, 127.0, 22.0 ], - "text" : "param knob1 @max 1" + "patching_rect" : [ 483.5, 96.0, 78.0, 23.0 ], + "text" : "param knob1" } } @@ -385,7 +657,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 225.5, 61.0, 57.0, 20.0 ], + "patching_rect" : [ 483.5, 61.0, 57.0, 20.0 ], "text" : "Knobs" } @@ -416,10 +688,11 @@ , { "box" : { "id" : "obj-5", + "linecount" : 2, "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 158.5, 350.0, 35.0, 22.0 ], + "patching_rect" : [ 158.5, 501.0, 35.0, 22.0 ], "text" : "out 2" } @@ -439,10 +712,11 @@ , { "box" : { "id" : "obj-4", + "linecount" : 2, "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 117.5, 350.0, 35.0, 22.0 ], + "patching_rect" : [ 117.5, 501.0, 35.0, 22.0 ], "text" : "out 1" } @@ -457,33 +731,91 @@ } , { "patchline" : { - "destination" : [ "obj-21", 1 ], - "order" : 0, + "destination" : [ "obj-34", 1 ], + "midpoints" : [ 585.5, 127.0, 568.0, 127.0, 568.0, 237.0, 653.0, 237.0, 653.0, 339.0, 245.5, 339.0 ], "source" : [ "obj-14", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-25", 0 ], + "order" : 0, + "source" : [ "obj-2", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-65", 0 ], + "midpoints" : [ 493.0, 133.0, 468.0, 133.0, 468.0, 191.0, 406.0, 191.0, 406.0, 447.0, 256.0, 447.0 ], + "order" : 1, + "source" : [ "obj-2", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-66", 0 ], + "source" : [ "obj-22", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-34", 0 ], + "source" : [ "obj-24", 0 ] + } + } , { "patchline" : { "destination" : [ "obj-26", 0 ], + "midpoints" : [ 493.0, 206.75, 419.0, 206.75 ], "order" : 1, - "source" : [ "obj-14", 0 ] + "source" : [ "obj-25", 0 ] } } , { "patchline" : { - "destination" : [ "obj-13", 0 ], + "destination" : [ "obj-57", 0 ], + "midpoints" : [ 493.0, 208.25, 666.0, 208.25 ], + "order" : 0, + "source" : [ "obj-25", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-24", 1 ], + "midpoints" : [ 419.0, 282.75, 248.666666666666657, 282.75 ], "order" : 1, - "source" : [ "obj-16", 0 ] + "source" : [ "obj-26", 0 ] } } , { "patchline" : { - "destination" : [ "obj-21", 0 ], + "destination" : [ "obj-33", 0 ], + "midpoints" : [ 419.0, 282.0, 449.25, 282.0, 449.25, 241.0, 463.5, 241.0 ], "order" : 0, - "source" : [ "obj-16", 0 ] + "source" : [ "obj-26", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-5", 0 ], + "source" : [ "obj-3", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-24", 2 ], + "midpoints" : [ 463.5, 288.75, 262.333333333333314, 288.75 ], + "source" : [ "obj-33", 0 ] } } @@ -491,7 +823,7 @@ "patchline" : { "destination" : [ "obj-4", 0 ], "order" : 1, - "source" : [ "obj-18", 0 ] + "source" : [ "obj-34", 0 ] } } @@ -499,72 +831,187 @@ "patchline" : { "destination" : [ "obj-5", 0 ], "order" : 0, - "source" : [ "obj-18", 0 ] + "source" : [ "obj-34", 0 ] } } , { "patchline" : { - "destination" : [ "obj-16", 0 ], - "order" : 0, - "source" : [ "obj-2", 0 ] + "destination" : [ "obj-24", 0 ], + "source" : [ "obj-43", 0 ] } } , { "patchline" : { - "destination" : [ "obj-25", 0 ], + "destination" : [ "obj-22", 0 ], + "source" : [ "obj-56", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-56", 0 ], + "source" : [ "obj-57", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-60", 0 ], + "source" : [ "obj-59", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-59", 0 ], + "source" : [ "obj-6", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-43", 0 ], + "source" : [ "obj-60", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-62", 0 ], + "source" : [ "obj-61", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-63", 0 ], + "source" : [ "obj-62", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-43", 0 ], + "source" : [ "obj-63", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-13", 0 ], "order" : 1, - "source" : [ "obj-2", 0 ] + "source" : [ "obj-65", 0 ] } } , { "patchline" : { "destination" : [ "obj-15", 0 ], - "source" : [ "obj-21", 0 ] + "order" : 0, + "source" : [ "obj-65", 0 ] } } , { "patchline" : { - "destination" : [ "obj-18", 0 ], - "source" : [ "obj-22", 0 ] + "destination" : [ "obj-24", 3 ], + "midpoints" : [ 666.0, 358.0, 631.0, 358.0, 631.0, 294.5, 276.0, 294.5 ], + "source" : [ "obj-66", 0 ] } } , { "patchline" : { - "destination" : [ "obj-4", 0 ], - "source" : [ "obj-23", 0 ] + "destination" : [ "obj-61", 0 ], + "source" : [ "obj-7", 0 ] } } , { "patchline" : { - "destination" : [ "obj-5", 0 ], - "source" : [ "obj-24", 0 ] + "destination" : [ "obj-91", 1 ], + "source" : [ "obj-8", 0 ] } } , { "patchline" : { - "destination" : [ "obj-23", 0 ], - "source" : [ "obj-25", 0 ] + "destination" : [ "obj-88", 0 ], + "source" : [ "obj-85", 0 ] } } , { "patchline" : { - "destination" : [ "obj-24", 0 ], - "source" : [ "obj-26", 0 ] + "destination" : [ "obj-87", 0 ], + "source" : [ "obj-86", 0 ] } } , { "patchline" : { - "destination" : [ "obj-5", 0 ], - "source" : [ "obj-3", 0 ] + "destination" : [ "obj-89", 0 ], + "source" : [ "obj-87", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-90", 0 ], + "source" : [ "obj-88", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-92", 0 ], + "source" : [ "obj-89", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-85", 0 ], + "order" : 1, + "source" : [ "obj-9", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-86", 0 ], + "order" : 0, + "source" : [ "obj-9", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-93", 0 ], + "source" : [ "obj-90", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-22", 1 ], + "source" : [ "obj-91", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-91", 0 ], + "source" : [ "obj-92", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-91", 0 ], + "source" : [ "obj-93", 0 ] } } @@ -573,7 +1020,7 @@ , "patching_rect" : [ 18.0, 267.0, 137.0, 22.0 ], "saved_object_attributes" : { - "exportfolder" : "macOS:/Users/corvus/Documents/Max 8/Packages/oopsy/templates/", + "exportfolder" : "macOS:/Users/corvus/Documents/Max 8/Packages/Oopsy/templates/", "exportname" : "oopsy_pod" } , @@ -843,21 +1290,21 @@ , "dependency_cache" : [ { "name" : "oopsy.maxpat", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/patchers", "patcherrelativepath" : "../patchers", "type" : "JSON", "implicit" : 1 } , { "name" : "oopsy.snoop.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/javascript", "patcherrelativepath" : "../javascript", "type" : "TEXT", "implicit" : 1 } , { "name" : "oopsy.node4max.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/javascript", "patcherrelativepath" : "../javascript", "type" : "TEXT", "implicit" : 1 @@ -900,35 +1347,35 @@ } , { "name" : "oopsy.suggestions.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { "name" : "oopsy.gate.trig.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { "name" : "oopsy.gate.min.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { "name" : "oopsy.ctrl.smooth3.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { "name" : "oopsy.ctrl.smooth2.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 From 0bd44301a5159a43a38c3c6d8f6301c1620a8fca Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 4 Apr 2022 11:03:23 -0600 Subject: [PATCH 041/100] Removed extraneous pod description --- source/pod.json | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/source/pod.json b/source/pod.json index ac897e0..0e50316 100644 --- a/source/pod.json +++ b/source/pod.json @@ -48,38 +48,15 @@ "g": 24, "b": 23 } - }, - "led3": { - "component": "Led", - "pin": 10, - "display": "" - }, - "cvout": { - "component": "CVOuts" - }, - "gatein": { - "component": "GateIn", - "pin": 12 - }, - "sw3": { - "component": "Switch3", - "pin": { - "a": 1, - "b": 2 - } } }, "aliases": { - "cvout1": "cvout", "switch": "sw1", "button": "sw1", "switch1": "sw1", "button1": "sw1", "switch2": "sw2", "button2": "sw2", - "switch3": "sw3", - "gate": "gatein", - "gate1": "gatein", "encswitch": "encoder_rise", "enp": "encoder_press", "press": "encoder_press", From aed230155d374427cbdfcb399785c3da18880004 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 4 Apr 2022 11:05:00 -0600 Subject: [PATCH 042/100] Updated switch definition This changes the default switch behavior from bang-like to stately. Since audio block sizes are variable and user-selectable, a bang-like component simply won't work. --- source/component_defs.json | 14 ++------------ source/component_defs_patchsm.json | 18 ++++-------------- 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/source/component_defs.json b/source/component_defs.json index 4086b77..9d3018c 100644 --- a/source/component_defs.json +++ b/source/component_defs.json @@ -12,12 +12,12 @@ "mapping": [ { "name": "{name}", - "get": "({class_name}.{name}.RisingEdge()?1.f:0.f)", + "get": "({class_name}.{name}.Pressed()?1.f:0.f)", "range": [ 0, 1 ], - "bool": true + "bool": false }, { "name": "{name}_press", @@ -28,19 +28,9 @@ ], "bool": false }, - { - "name": "{name}_fall", - "get": "({class_name}.{name}.FallingEdge()?1.f:0.f)", - "range": [ - 0, - 1 - ], - "bool": true - }, { "name": "{name}_seconds", "get": "({class_name}.{name}.TimeHeldMs()*0.001f)", - "range": null, "bool": false } ] diff --git a/source/component_defs_patchsm.json b/source/component_defs_patchsm.json index cee95e6..5e2a97e 100644 --- a/source/component_defs_patchsm.json +++ b/source/component_defs_patchsm.json @@ -11,7 +11,7 @@ "updaterate": "{name}.SetUpdateRate(som.AudioCallbackRate());", "mapping": [ { - "name": "{name}_press", + "name": "{name}", "get": "({class_name}.{name}.Pressed()?1.f:0.f)", "range": [ 0, @@ -20,27 +20,17 @@ "bool": false }, { - "name": "{name}", - "get": "({class_name}.{name}.RisingEdge()?1.f:0.f)", - "range": [ - 0, - 1 - ], - "bool": true - }, - { - "name": "{name}_fall", - "get": "({class_name}.{name}.FallingEdge()?1.f:0.f)", + "name": "{name}_press", + "get": "({class_name}.{name}.Pressed()?1.f:0.f)", "range": [ 0, 1 ], - "bool": true + "bool": false }, { "name": "{name}_seconds", "get": "({class_name}.{name}.TimeHeldMs()*0.001f)", - "range": null, "bool": false } ] From 44577175d7803028388c762ac8275d34e8ed1b68 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 4 Apr 2022 11:05:26 -0600 Subject: [PATCH 043/100] Added todo we should permit no scaling to occur on certain inputs --- source/oopsy.js | 1 + 1 file changed, 1 insertion(+) diff --git a/source/oopsy.js b/source/oopsy.js index bd6e6e0..a833d31 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -1342,6 +1342,7 @@ function generate_app(app, hardware, target, config) { let input = hardware.inputs[src]; node.permit_scale = input.permit_scale; + // TODO -- we should allow no scaling to occur on certain inputs if ('range' in input && typeof input.range !== 'undefined') { let input_min = input.range[0] || 0; From d53d8793a5a6ffeb688093d1be97bc1eee2006b8 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 4 Apr 2022 11:08:38 -0600 Subject: [PATCH 044/100] Updated field json --- source/field.json | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/source/field.json b/source/field.json index bef34bb..cb6bee1 100644 --- a/source/field.json +++ b/source/field.json @@ -320,16 +320,6 @@ "component": "PCA9685Led", "index": 23, "parent": "led_driver" - }, - "led_sw_1": { - "component": "PCA9685Led", - "index": 24, - "parent": "led_driver" - }, - "led_sw_2": { - "component": "PCA9685Led", - "index": 25, - "parent": "led_driver" } }, "aliases": { @@ -351,6 +341,12 @@ "ctrl": "knob1", "ctrl1": "knob1", "ctrl2": "knob2", + "ctrl3": "knob3", + "ctrl4": "knob4", + "ctrl5": "knob5", + "ctrl6": "knob6", + "ctrl7": "knob7", + "ctrl8": "knob8", "led": "led1", "keyA1": "pada1", "keyA2": "pada2", From 513d13d1efa5aab9004bd1ba80bf11b902d29da3 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 4 Apr 2022 14:38:08 -0600 Subject: [PATCH 045/100] Fixed audio channel bug --- source/oopsy.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/oopsy.js b/source/oopsy.js index a833d31..15de5da 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -517,7 +517,10 @@ function run() { // consolidate hardware definition: hardware.samplerate = samplerate - if (hardware.defines.OOPSY_IO_COUNT == undefined) hardware.defines.OOPSY_IO_COUNT = 2 + if (hardware.audio) + hardware.defines.OOPSY_IO_COUNT = hardware.audio.channels || 2; + else if (!hardware.defines.OOPSY_IO_COUNT) + hardware.defines.OOPSY_IO_COUNT = 2; if (!hardware.max_apps) hardware.max_apps = 1; hardware.defines.OOPSY_SAMPLERATE = samplerate * 1000 From e0291b699e973308f58f2ba65c2adc9a7e2e7816 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 4 Apr 2022 14:38:33 -0600 Subject: [PATCH 046/100] Updated multi-codec initialization routine --- source/json2daisy.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/source/json2daisy.js b/source/json2daisy.js index c055879..cd662dc 100644 --- a/source/json2daisy.js +++ b/source/json2daisy.js @@ -21,18 +21,28 @@ function generateCodecs(external_codecs) daisy::SaiHandle::Config sai_config[${1 + external_codecs.length}]; // Internal Codec + if(som.CheckBoardVersion() == daisy::DaisySeed::BoardVersion::DAISY_SEED_1_1) + { + sai_config[0].pin_config.sa = {DSY_GPIOE, 6}; + sai_config[0].pin_config.sb = {DSY_GPIOE, 3}; + sai_config[0].a_dir = daisy::SaiHandle::Config::Direction::RECEIVE; + sai_config[0].b_dir = daisy::SaiHandle::Config::Direction::TRANSMIT; + } + else + { + sai_config[0].pin_config.sa = {DSY_GPIOE, 6}; + sai_config[0].pin_config.sb = {DSY_GPIOE, 3}; + sai_config[0].a_dir = daisy::SaiHandle::Config::Direction::TRANSMIT; + sai_config[0].b_dir = daisy::SaiHandle::Config::Direction::RECEIVE; + } sai_config[0].periph = daisy::SaiHandle::Config::Peripheral::SAI_1; sai_config[0].sr = daisy::SaiHandle::Config::SampleRate::SAI_48KHZ; sai_config[0].bit_depth = daisy::SaiHandle::Config::BitDepth::SAI_24BIT; sai_config[0].a_sync = daisy::SaiHandle::Config::Sync::MASTER; sai_config[0].b_sync = daisy::SaiHandle::Config::Sync::SLAVE; - sai_config[0].a_dir = daisy::SaiHandle::Config::Direction::TRANSMIT; - sai_config[0].b_dir = daisy::SaiHandle::Config::Direction::RECEIVE; sai_config[0].pin_config.fs = {DSY_GPIOE, 4}; sai_config[0].pin_config.mclk = {DSY_GPIOE, 2}; sai_config[0].pin_config.sck = {DSY_GPIOE, 5}; - sai_config[0].pin_config.sa = {DSY_GPIOE, 6}; - sai_config[0].pin_config.sb = {DSY_GPIOE, 3}; ` for (let i = 0; i < external_codecs.length; i++) From e613884b8c14bfac64388510d90016f55a16507f Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 4 Apr 2022 14:57:50 -0600 Subject: [PATCH 047/100] Added LED alias --- source/patch_init.json | 1 + 1 file changed, 1 insertion(+) diff --git a/source/patch_init.json b/source/patch_init.json index e8c11f1..db795db 100644 --- a/source/patch_init.json +++ b/source/patch_init.json @@ -113,6 +113,7 @@ "cvout": "cvout1", "cv_out_1": "cvout1", "cv_out_2": "cvout2", + "led": "cvout2", "knob": "cv_1", "knob1": "cv_1", "knob2": "cv_2", From 1db7a800eba59500917882da772a3c1820965832 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 4 Apr 2022 14:58:11 -0600 Subject: [PATCH 048/100] Improved patch init template --- templates/oopsy_patch_init.maxpat | 151 ++++++++++-------------------- 1 file changed, 52 insertions(+), 99 deletions(-) diff --git a/templates/oopsy_patch_init.maxpat b/templates/oopsy_patch_init.maxpat index 14cb0f6..472ce00 100644 --- a/templates/oopsy_patch_init.maxpat +++ b/templates/oopsy_patch_init.maxpat @@ -10,7 +10,7 @@ } , "classnamespace" : "box", - "rect" : [ 226.0, 177.0, 1003.0, 630.0 ], + "rect" : [ 58.0, 85.0, 1003.0, 630.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -575,6 +575,30 @@ "subpatcher_template" : "", "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "id" : "obj-47", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 398.5, 243.5, 26.0, 22.0 ], + "text" : "+ 1" + } + + } +, { + "box" : { + "id" : "obj-6", + "maxclass" : "newobj", + "numinlets" : 3, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 398.5, 276.0, 61.0, 22.0 ], + "text" : "selector 2" + } + + } +, { "box" : { "id" : "obj-48", "linecount" : 5, @@ -680,30 +704,6 @@ "text" : "param sw1_press" } - } -, { - "box" : { - "id" : "obj-35", - "maxclass" : "newobj", - "numinlets" : 2, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 398.5, 312.0, 29.5, 22.0 ], - "text" : "+" - } - - } -, { - "box" : { - "id" : "obj-32", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 409.0, 232.5, 26.0, 22.0 ], - "text" : "!- 1" - } - } , { "box" : { @@ -712,34 +712,10 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 409.0, 200.0, 49.0, 22.0 ], + "patching_rect" : [ 398.5, 211.0, 49.0, 22.0 ], "text" : "r toggle" } - } -, { - "box" : { - "id" : "obj-21", - "maxclass" : "newobj", - "numinlets" : 2, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 451.5, 269.0, 29.5, 22.0 ], - "text" : "*" - } - - } -, { - "box" : { - "id" : "obj-20", - "maxclass" : "newobj", - "numinlets" : 2, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 398.5, 269.0, 29.5, 22.0 ], - "text" : "*" - } - } , { "box" : { @@ -1125,7 +1101,7 @@ } , { "patchline" : { - "destination" : [ "obj-21", 0 ], + "destination" : [ "obj-6", 2 ], "source" : [ "obj-10", 0 ] } @@ -1139,7 +1115,7 @@ } , { "patchline" : { - "destination" : [ "obj-20", 0 ], + "destination" : [ "obj-6", 1 ], "source" : [ "obj-15", 0 ] } @@ -1150,20 +1126,6 @@ "source" : [ "obj-2", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-35", 0 ], - "source" : [ "obj-20", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-35", 1 ], - "source" : [ "obj-21", 0 ] - } - } , { "patchline" : { @@ -1195,33 +1157,10 @@ } , { "patchline" : { - "destination" : [ "obj-21", 1 ], - "order" : 0, - "source" : [ "obj-30", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-32", 0 ], - "order" : 1, + "destination" : [ "obj-47", 0 ], "source" : [ "obj-30", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-20", 1 ], - "source" : [ "obj-32", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-29", 0 ], - "source" : [ "obj-35", 0 ] - } - } , { "patchline" : { @@ -1280,13 +1219,27 @@ "source" : [ "obj-46", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-6", 0 ], + "source" : [ "obj-47", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-29", 0 ], + "source" : [ "obj-6", 0 ] + } + } ] } , "patching_rect" : [ 47.0, 363.0, 195.0, 35.0 ], "saved_object_attributes" : { - "exportfolder" : "macOS:/Users/corvus/Documents/Max 8/Packages/oopsy/templates/", + "exportfolder" : "macOS:/Users/corvus/Documents/Max 8/Packages/Oopsy/templates/", "exportname" : "oopsy_patch_init" } , @@ -1564,35 +1517,35 @@ , "dependency_cache" : [ { "name" : "oopsy.suggestions.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { "name" : "oopsy.gate.trig.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { "name" : "oopsy.gate.min.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { "name" : "oopsy.ctrl.smooth3.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { "name" : "oopsy.ctrl.smooth2.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 @@ -1635,21 +1588,21 @@ } , { "name" : "oopsy.maxpat", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/patchers", "patcherrelativepath" : "../patchers", "type" : "JSON", "implicit" : 1 } , { "name" : "oopsy.snoop.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/javascript", "patcherrelativepath" : "../javascript", "type" : "TEXT", "implicit" : 1 } , { "name" : "oopsy.node4max.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/javascript", "patcherrelativepath" : "../javascript", "type" : "TEXT", "implicit" : 1 From 7ffc45e5bcdd0d7d541c220f917b6c25c660e8b1 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 4 Apr 2022 15:00:10 -0600 Subject: [PATCH 049/100] Added adc aliases --- source/patch_init.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/patch_init.json b/source/patch_init.json index db795db..9d2cf12 100644 --- a/source/patch_init.json +++ b/source/patch_init.json @@ -139,6 +139,10 @@ "cv5": "cv_5", "cv6": "cv_6", "cv7": "cv_7", - "cv8": "cv_8" + "cv8": "cv_8", + "adc9": "adc_9", + "adc10": "adc_10", + "adc11": "adc_11", + "adc12": "adc_12" } } \ No newline at end of file From 79f02b140b3caa672672798050569c7c17aa9fff Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 4 Apr 2022 15:11:01 -0600 Subject: [PATCH 050/100] Corrected i2c address on petal --- source/petal.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/petal.json b/source/petal.json index 8afa70a..d07b602 100644 --- a/source/petal.json +++ b/source/petal.json @@ -11,7 +11,7 @@ }, "led_driver": { "component": "PCA9685", - "address": "{0x00, 0x02}", + "address": "{0x00, 0x01}", "parent": "i2c", "driver_count": 2 } From 888490216682d80fb837aef425a8f87020fae13a Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 4 Apr 2022 15:40:28 -0600 Subject: [PATCH 051/100] Fixed index bug --- source/json2daisy.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/source/json2daisy.js b/source/json2daisy.js index cd662dc..0b3da4e 100644 --- a/source/json2daisy.js +++ b/source/json2daisy.js @@ -223,11 +223,11 @@ function flatten_index_dicts(comp) { flattened = {}; Object.assign(flattened, comp); // maybe not actually necessary to copy - if ('index' in comp && typeof comp.pin === 'object') + if ('index' in comp && typeof comp.index === 'object') { - for (property in comp.pin) + for (property in comp.index) { - flattened[`index_${property}`] = comp.pin[property]; + flattened[`index_${property}`] = comp.index[property]; } } return flattened; @@ -329,9 +329,6 @@ exports.generate_header = function generate_header(board_description_object) replacements.Bno055 = filter_map_init(components, 'component', 'Bno055', key_exclude='is_default', match_exclude=true); replacements.Icm20948 = filter_map_init(components, 'component', 'Icm20948', key_exclude='is_default', match_exclude=true); replacements.Dps310 = filter_map_init(components, 'component', 'Dps310', key_exclude='is_default', match_exclude=true); - - for (item in replacements) - console.log(item, replacements[item]); replacements.display = !(has_display) ? '' : ` daisy::OledDisplay<${target.display.driver}>::Config display_config; From 37feefc6eea36549750e2de765f80f90719fbac8 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 4 Apr 2022 15:40:39 -0600 Subject: [PATCH 052/100] Added additional petal LED aliases --- source/petal.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/petal.json b/source/petal.json index d07b602..6a32dbc 100644 --- a/source/petal.json +++ b/source/petal.json @@ -178,6 +178,10 @@ } }, "aliases": { + "led1": "led_fs_1", + "led2": "led_fs_2", + "led3": "led_fs_3", + "led4": "led_fs_4", "switch": "sw1", "switch1": "sw1", "switch2": "sw2", From 339f852cd0c50a195fafeacb262c4eae5acc9219 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Tue, 5 Apr 2022 11:05:23 -0600 Subject: [PATCH 053/100] Moved pod items around --- templates/oopsy_pod.maxpat | 43 ++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/templates/oopsy_pod.maxpat b/templates/oopsy_pod.maxpat index 566987e..48315c2 100644 --- a/templates/oopsy_pod.maxpat +++ b/templates/oopsy_pod.maxpat @@ -10,7 +10,7 @@ } , "classnamespace" : "box", - "rect" : [ 759.0, 192.0, 625.0, 480.0 ], + "rect" : [ 226.0, 180.0, 625.0, 480.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -102,7 +102,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 767.0, 325.0, 150.0, 64.0 ], + "patching_rect" : [ 767.0, 325.0, 151.0, 64.0 ], "text" : "Rotating the encoder will change the wave shape of the Saw / Triangle oscillator" } @@ -458,7 +458,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 245.5, 529.0, 192.0, 47.0 ], + "patching_rect" : [ 245.5, 529.0, 192.0, 50.0 ], "text" : "LED outputs range -1 to 1; where output will be blue when positive and red when negative" } @@ -492,7 +492,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 929.5, 136.0, 108.0, 60.0 ], + "patching_rect" : [ 929.5, 136.0, 108.0, 64.0 ], "text" : "Pod encoder will be +1, -1 or 0;\nencoder press will be 0 or 1" } @@ -504,7 +504,7 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 970.5, 96.0, 75.0, 22.0 ], + "patching_rect" : [ 970.5, 96.0, 75.0, 23.0 ], "text" : "param press" } @@ -516,7 +516,7 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 767.0, 96.0, 186.0, 22.0 ], + "patching_rect" : [ 767.0, 96.0, 186.0, 23.0 ], "text" : "param encoder @min -1 @max 1" } @@ -540,7 +540,7 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 225.5, 96.0, 67.0, 22.0 ], + "patching_rect" : [ 225.5, 96.0, 67.0, 23.0 ], "text" : "param sw1" } @@ -552,7 +552,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 1163.5, 529.0, 107.0, 22.0 ], + "patching_rect" : [ 1138.5, 280.0, 107.0, 23.0 ], "text" : "oopsy.suggestions" } @@ -563,7 +563,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 9.5, 350.0, 69.0, 20.0 ], + "patching_rect" : [ 9.5, 350.0, 69.0, 21.0 ], "text" : "OUTPUTS" } @@ -574,7 +574,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 9.5, 96.0, 69.0, 20.0 ], + "patching_rect" : [ 9.5, 96.0, 69.0, 21.0 ], "text" : "INPUTS" } @@ -585,7 +585,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 1008.0, 529.0, 139.0, 20.0 ], + "patching_rect" : [ 991.0, 280.0, 139.0, 21.0 ], "text" : "MIDI:" } @@ -593,12 +593,11 @@ , { "box" : { "id" : "obj-19", - "linecount" : 2, "maxclass" : "newobj", "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 1008.0, 564.0, 53.0, 22.0 ], + "patching_rect" : [ 991.0, 312.0, 59.0, 23.0 ], "text" : "in 3 midi" } @@ -610,7 +609,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 1033.0, 594.0, 160.0, 93.0 ], + "patching_rect" : [ 1061.0, 317.0, 160.0, 93.0 ], "text" : "\"midi\" input/output is converted to/from normalized byte streams. See the MIDI examples more info on how to read and write these. " } @@ -634,7 +633,7 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 576.0, 96.0, 79.0, 22.0 ], + "patching_rect" : [ 576.0, 96.0, 79.0, 23.0 ], "text" : "param knob2" } @@ -657,7 +656,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 483.5, 61.0, 57.0, 20.0 ], + "patching_rect" : [ 483.5, 61.0, 57.0, 21.0 ], "text" : "Knobs" } @@ -668,7 +667,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 117.5, 61.0, 69.0, 20.0 ], + "patching_rect" : [ 117.5, 61.0, 69.0, 21.0 ], "text" : "Audio IOs" } @@ -680,7 +679,7 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 158.5, 96.0, 28.0, 22.0 ], + "patching_rect" : [ 158.5, 96.0, 28.0, 23.0 ], "text" : "in 2" } @@ -688,11 +687,10 @@ , { "box" : { "id" : "obj-5", - "linecount" : 2, "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 158.5, 501.0, 35.0, 22.0 ], + "patching_rect" : [ 158.5, 501.0, 36.0, 23.0 ], "text" : "out 2" } @@ -704,7 +702,7 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 117.5, 96.0, 28.0, 22.0 ], + "patching_rect" : [ 117.5, 96.0, 28.0, 23.0 ], "text" : "in 1" } @@ -712,11 +710,10 @@ , { "box" : { "id" : "obj-4", - "linecount" : 2, "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 117.5, 501.0, 35.0, 22.0 ], + "patching_rect" : [ 117.5, 501.0, 36.0, 23.0 ], "text" : "out 1" } From e9fc74c956df6f7195e9e577b041666632b1e69e Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Wed, 6 Apr 2022 17:33:14 -0600 Subject: [PATCH 054/100] Added petal sm defs --- source/component_defs_petalsm.json | 111 +++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 source/component_defs_petalsm.json diff --git a/source/component_defs_petalsm.json b/source/component_defs_petalsm.json new file mode 100644 index 0000000..9a4c6c7 --- /dev/null +++ b/source/component_defs_petalsm.json @@ -0,0 +1,111 @@ +{ + "Switch": { + "map_init": "", + "typename": "", + "direction": "in", + "index": 1, + "updaterate": "", + "mapping": [ + { + "name": "{name}", + "get": "({class_name}.som.footswitch{index}.Pressed()?1.f:0.f)", + "range": [ + 0, + 1 + ], + "bool": false + }, + { + "name": "{name}_press", + "get": "({class_name}.som.footswitch{index}.Pressed()?1.f:0.f)", + "range": [ + 0, + 1 + ], + "bool": false + }, + { + "name": "{name}_seconds", + "get": "({class_name}.som.footswitch{index}.TimeHeldMs()*0.001f)", + "bool": false + } + ] + }, + "Switch3": { + "map_init": "", + "typename": "", + "direction": "in", + "index": 0, + "mapping": [ + { + "name": "{name}", + "get": "({class_name}.som.toggle[{index}].Read()*0.5f+0.5f)", + "range": [ + 0, + 2 + ], + "bool": false + } + ] + }, + "AnalogControl": { + "init_single": "", + "map_init": "", + "typename": "", + "direction": "in", + "index": 0, + "updaterate": "", + "mapping": [ + { + "name": "{name}", + "get": "({class_name}.som.knob[{index}].Value()?1.f:0.f)", + "range": [ + 0, + 1 + ], + "bool": false + } + ] + }, + "Led": { + "map_init": "", + "typename": "", + "direction": "out", + "index": 2, + "postprocess": "", + "mapping": [ + { + "name": "{name}", + "set": "{class_name}.som.led[{index}].Set({value});" + } + ] + }, + "RgbLed": { + "map_init": "", + "typename": "", + "direction": "out", + "index": "r,g,b", + "mapping": [ + { + "name": "{name}_red", + "set": "{class_name}.som.led[{index_r}].Set({value});" + }, + { + "name": "{name}_green", + "set": "{class_name}.som.led[{index_g}].Set({value});" + }, + { + "name": "{name}_blue", + "set": "{class_name}.som.led[{index_b}].Set({value});" + }, + { + "name": "{name}", + "set": "{class_name}.som.led[{index_r}].Set(clamp(-{value}, 0.f, 1.f)); \n{class_name}.som.led[{index_g}].Set(0); \n{class_name}.som.led[{index_b}].Set(clamp({value}, 0.f, 1.f));" + }, + { + "name": "{name}_white", + "set": "{class_name}.som.led[{index_r}].Set({value}); \n{class_name}.som.led[{index_g}].Set({value}); \n{class_name}.som.led[{index_b}].Set({value});" + } + ] + } +} \ No newline at end of file From eb709bd397cdeeedab44504179478728e582f07b Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Wed, 6 Apr 2022 17:33:35 -0600 Subject: [PATCH 055/100] Updated json2daisy to include petal sm --- source/json2daisy.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/source/json2daisy.js b/source/json2daisy.js index 0b3da4e..fac5ba6 100644 --- a/source/json2daisy.js +++ b/source/json2daisy.js @@ -6,6 +6,7 @@ const assert = require("assert"); const path = require("path"); const seed_defs = require(path.join(__dirname, "component_defs.json")); const patchsm_defs = require(path.join(__dirname, "component_defs_patchsm.json")); +const petalsm_defs = require(path.join(__dirname, "component_defs_petalsm.json")); var global_definitions; @@ -251,6 +252,7 @@ exports.generate_header = function generate_header(board_description_object) let temp_defs = { seed: seed_defs, patch_sm: patchsm_defs, + petal_125b_sm: petalsm_defs, }; assert(som in temp_defs, `Unkown som "${som}"`); @@ -289,7 +291,14 @@ exports.generate_header = function generate_header(board_description_object) replacements.name = target.name; replacements.som = som; replacements.external_codecs = target.external_codecs || []; - replacements.som_class = som == 'seed' ? 'daisy::DaisySeed' : 'daisy::patch_sm::DaisyPatchSM'; + + const classes = { + seed: 'daisy::DaisySeed', + patch_sm: 'daisy::patch_sm::DaisyPatchSM', + petal_125b_sm: 'daisy::Petal125BSM' + }; + + replacements.som_class = classes[som]; replacements.target_name = target.name; // TODO -- redundant? replacements.init = filter_map_template(components, 'init', 'is_default', true); From cc82c5f9327839e97cb337113a6b997db64f3d29 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Wed, 6 Apr 2022 17:33:53 -0600 Subject: [PATCH 056/100] Added petal sm json --- source/petal_125b_sm.json | 45 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 source/petal_125b_sm.json diff --git a/source/petal_125b_sm.json b/source/petal_125b_sm.json new file mode 100644 index 0000000..8da2fce --- /dev/null +++ b/source/petal_125b_sm.json @@ -0,0 +1,45 @@ +{ + "name": "petal_125b_sm", + "som": "petal_125b_sm", + "audio": { + "channels": 2 + }, + "components": { + "knob_1": { + "component": "AnalogControl", + "index": 0 + }, + "knob_2": { + "component": "AnalogControl", + "index": 1 + }, + "knob_3": { + "component": "AnalogControl", + "index": 2 + }, + "knob_4": { + "component": "AnalogControl", + "index": 3 + }, + "knob_5": { + "component": "AnalogControl", + "index": 4 + }, + "knob_6": { + "component": "AnalogControl", + "index": 5 + }, + "toggle_1": { + "component": "Switch3", + "index": 0 + }, + "toggle_2": { + "component": "Switch3", + "index": 1 + }, + "toggle_3": { + "component": "Switch3", + "index": 2 + } + } +} \ No newline at end of file From ab550a9a7df5b13511210ca6466296cc3e8d3e83 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Wed, 6 Apr 2022 17:34:16 -0600 Subject: [PATCH 057/100] Added temporary petal sm BSP files --- source/petal_sm/daisy_petal_125b_sm.cpp | 326 ++++++++++++++++++++++++ source/petal_sm/daisy_petal_125b_sm.h | 288 +++++++++++++++++++++ 2 files changed, 614 insertions(+) create mode 100644 source/petal_sm/daisy_petal_125b_sm.cpp create mode 100644 source/petal_sm/daisy_petal_125b_sm.h diff --git a/source/petal_sm/daisy_petal_125b_sm.cpp b/source/petal_sm/daisy_petal_125b_sm.cpp new file mode 100644 index 0000000..1db80c2 --- /dev/null +++ b/source/petal_sm/daisy_petal_125b_sm.cpp @@ -0,0 +1,326 @@ +#include "daisy_petal_125b_sm.h" +#include + +namespace daisy +{ + void Petal125BSM::Init() + { + /** Pot Pins */ + constexpr Pin knobpins[KNOB_LAST] = { + Pin(PORTC, 4), /**< VR1 - sch: ADC_POT_6 */ + Pin(PORTA, 7), /**< VR2 - sch: ADC_POT_5 */ + Pin(PORTB, 1), /**< VR3 - sch: ADC_POT_3 */ + Pin(PORTA, 6), /**< VR4 - sch: ADC_POT_2 */ + Pin(PORTA, 2), /**< VR5 - sch: ADC_POT_4 */ + Pin(PORTA, 3), /**< VR6 - sch: ADC_POT_1 */ + }; + + /** 3-way Toggle Switch Pins + * These are routed to the opposite sides + * of what the Switch3 class expects. + * + * So below, we initialize them in what + * may appear to be the opposite direction. + */ + constexpr Pin togglepins[TOGGLE_LAST][2] = { + {Pin(PORTB, 4), Pin(PORTC, 12)}, /**< sch: GPIO_TSW (1A, 1B) */ + {Pin(PORTA, 8), Pin(PORTC, 7)}, /**< sch: GPIO_TSW (3A, 3B) */ + {Pin(PORTB, 15), Pin(PORTB, 14)}, /**< sch: GPIO_TSW (2A, 2B) */ + }; + + /** Momentary Footswitch Pins */ + constexpr Pin footswpins[FOOTSWITCH_LAST] = { + Pin(PORTD, 13), /**< sch: GPIO_MSW_2 */ + Pin(PORTC, 6), /**< sch: GPIO_MSW_1 */ + }; + + /** LED Pins */ + constexpr Pin ledpins[LED_LAST] = { + Pin(PORTA, 5), /**< LED1R - sch: GPIO_LED_1_R, */ + Pin(PORTB, 6), /**< LED1G - sch: GPIO_LED_1_G, */ + Pin(PORTD, 7), /**< LED1B - sch: GPIO_LED_1_B, */ + Pin(PORTG, 14), /**< LED2 - sch: GPIO_LED_2, */ + Pin(PORTG, 10), /**< LED3R - sch: GPIO_LED_3_R, */ + Pin(PORTC, 10), /**< LED3G - sch: GPIO_LED_3_G, */ + Pin(PORTC, 11), /**< LED3B - sch: GPIO_LED_3_B, */ + Pin(PORTB, 5), /**< LED4 - sch: GPIO_LED_4, */ + Pin(PORTB, 7), /**< LED5 - sch: GPIO_LED_5, */ + }; + + /** Expression Pin */ + constexpr Pin exprpin = Pin(PORTC, 0); + + /** Relay Control Pin */ + constexpr Pin relay_pin = Pin(PORTG, 13); + + /** System Init (sys, ram, flash, etc.) */ + System::Config syscfg; + syscfg.Defaults(); + sys.Init(syscfg); + + /** SDRAM */ + sdram.Init(); + + /** EXT. FLASH */ + auto qspi_config = qspi.GetConfig(); + qspi_config.device = QSPIHandle::Config::Device::IS25LP064A; + qspi_config.mode = QSPIHandle::Config::Mode::MEMORY_MAPPED; + qspi_config.pin_config.io0 = dsy_pin(DSY_GPIOF, 8); + qspi_config.pin_config.io1 = dsy_pin(DSY_GPIOF, 9); + qspi_config.pin_config.io2 = dsy_pin(DSY_GPIOF, 7); + qspi_config.pin_config.io3 = dsy_pin(DSY_GPIOF, 6); + qspi_config.pin_config.clk = dsy_pin(DSY_GPIOF, 10); + qspi_config.pin_config.ncs = dsy_pin(DSY_GPIOG, 6); + qspi.Init(qspi_config); + + // Audio Init + SaiHandle::Config sai_config; + sai_config.periph = SaiHandle::Config::Peripheral::SAI_1; + sai_config.sr = SaiHandle::Config::SampleRate::SAI_48KHZ; + sai_config.bit_depth = SaiHandle::Config::BitDepth::SAI_24BIT; + sai_config.a_sync = SaiHandle::Config::Sync::MASTER; + sai_config.b_sync = SaiHandle::Config::Sync::SLAVE; + sai_config.a_dir = SaiHandle::Config::Direction::RECEIVE; + sai_config.b_dir = SaiHandle::Config::Direction::TRANSMIT; + sai_config.pin_config.fs = {DSY_GPIOE, 4}; + sai_config.pin_config.mclk = {DSY_GPIOE, 2}; + sai_config.pin_config.sck = {DSY_GPIOE, 5}; + sai_config.pin_config.sa = {DSY_GPIOE, 6}; + sai_config.pin_config.sb = {DSY_GPIOE, 3}; + SaiHandle sai_1_handle; + sai_1_handle.Init(sai_config); + + // TODO: Add Codec Init + I2CHandle::Config i2c_cfg; + i2c_cfg.periph = I2CHandle::Config::Peripheral::I2C_1; + i2c_cfg.speed = I2CHandle::Config::Speed::I2C_400KHZ; + i2c_cfg.mode = I2CHandle::Config::Mode::I2C_MASTER; + i2c_cfg.pin_config.scl = {DSY_GPIOB, 8}; + i2c_cfg.pin_config.sda = {DSY_GPIOB, 9}; + + I2CHandle i2c1; + i2c1.Init(i2c_cfg); + codec.Init(i2c1); + + AudioHandle::Config audio_config; + audio_config.blocksize = 4; + audio_config.samplerate = SaiHandle::Config::SampleRate::SAI_48KHZ; + audio_config.postgain = 1.f; + audio.Init(audio_config, sai_1_handle); + callback_rate_ = AudioSampleRate() / AudioBlockSize(); + + // Adc Init + AdcChannelConfig adc_config[KNOB_LAST + 1]; + for (size_t i = 0; i < KNOB_LAST; i++) + { + adc_config[i].InitSingle(knobpins[i]); + } + // last ADC channel will be expression input. + adc_config[KNOB_LAST].InitSingle(exprpin); + adc.Init(adc_config, KNOB_LAST + 1); + + for (size_t i = 0; i < KNOB_LAST; i++) + { + knob[i].Init(adc.GetPtr(i), AudioCallbackRate()); + } + expression.Init(adc.GetPtr(KNOB_LAST), AudioCallbackRate()); + // Other Inits (switches, analogcontrols, etc.) + for (size_t i = 0; i < TOGGLE_LAST; i++) + { + toggle[i].Init(togglepins[i][1], togglepins[i][0]); + } + footswitch1.Init(footswpins[0], AudioCallbackRate()); + footswitch2.Init(footswpins[1], AudioCallbackRate()); + for (size_t i = 0; i < LED_LAST; i++) + { + // Invert RGB LEDs because they're common anode + bool inv = (i == LED_1_R) || (i == LED_1_G) || (i == LED_1_B) || + (i == LED_3_R) | (i == LED_3_G) | (i == LED_3_B) + ? true + : false; + led[i].Init(ledpins[i], inv, AudioCallbackRate()); + } + + relay_control.Init(relay_pin, GPIO::Mode::OUTPUT); + bypass_state_ = false; + SetBypassState(bypass_state_); + adc.Start(); + SetLed1(0.f, 0.f, 0.f); + SetLed2(0.f); + SetLed3(0.f, 0.f, 0.f); + SetLed4(0.f); + SetLed5(0.f); + UpdateLeds(); + } + + void Petal125BSM::StartAudio(AudioHandle::InterleavingAudioCallback cb) + { + audio.Start(cb); + } + + void Petal125BSM::StartAudio(AudioHandle::AudioCallback cb) + { + audio.Start(cb); + } + + void Petal125BSM::ChangeAudioCallback(AudioHandle::InterleavingAudioCallback cb) + { + audio.ChangeCallback(cb); + } + + void Petal125BSM::ChangeAudioCallback(AudioHandle::AudioCallback cb) + { + audio.ChangeCallback(cb); + } + + void Petal125BSM::StopAudio() + { + audio.Stop(); + } + + void Petal125BSM::SetAudioSampleRate(SaiHandle::Config::SampleRate samplerate) + { + audio.SetSampleRate(samplerate); + callback_rate_ = AudioSampleRate() / AudioBlockSize(); + } + + float Petal125BSM::AudioSampleRate() + { + return audio.GetSampleRate(); + } + + void Petal125BSM::SetAudioBlockSize(size_t blocksize) + { + audio.SetBlockSize(blocksize); + callback_rate_ = AudioSampleRate() / AudioBlockSize(); + } + + size_t Petal125BSM::AudioBlockSize() + { + return audio.GetConfig().blocksize; + } + + float Petal125BSM::AudioCallbackRate() + { + return callback_rate_; + } + + void Petal125BSM::ProcessAnalogControls() + { + for (size_t i = 0; i < KNOB_LAST; i++) + { + knob[i].Process(); + } + expression.Process(); + } + + void Petal125BSM::ProcessDigitalControls() + { + footswitch1.Debounce(); + footswitch2.Debounce(); + } + + void Petal125BSM::SetBypassState(bool state) + { + bypass_state_ = state; + relay_control.Write(!bypass_state_); + } + + void Petal125BSM::ToggleBypassState() + { + bypass_state_ = !bypass_state_; + relay_control.Write(!bypass_state_); + } + + void Petal125BSM::UpdateLeds() + { + for (size_t i = 0; i < LED_LAST; i++) + { + led[i].Update(); + } + } + + void Petal125BSM::SetLed1(float r, float g, float b) + { + led[LED_1_R].Set(r); + led[LED_1_G].Set(g); + led[LED_1_B].Set(b); + } + + void Petal125BSM::SetLed3(float r, float g, float b) + { + led[LED_3_R].Set(r); + led[LED_3_G].Set(g); + led[LED_3_B].Set(b); + } + + bool Petal125BSM::ValidateSDRAM() + { + uint32_t *sdramptr = (uint32_t *)0xc0000000; + uint32_t size_in_words = 16777216; + uint32_t testval = 0xdeadbeef; + uint32_t num_failed = 0; + /** Write test val */ + for (uint32_t i = 0; i < size_in_words; i++) + { + uint32_t *word = sdramptr + i; + *word = testval; + } + /** Compare written */ + for (uint32_t i = 0; i < size_in_words; i++) + { + uint32_t *word = sdramptr + i; + if (*word != testval) + num_failed++; + } + /** Write Zeroes */ + for (uint32_t i = 0; i < size_in_words; i++) + { + uint32_t *word = sdramptr + i; + *word = 0x00000000; + } + /** Compare Cleared */ + for (uint32_t i = 0; i < size_in_words; i++) + { + uint32_t *word = sdramptr + i; + if (*word != 0) + num_failed++; + } + return num_failed == 0; + } + + bool Petal125BSM::ValidateQSPI(bool quick) + { + uint32_t start; + uint32_t size; + if (quick) + { + start = 0x400000; + size = 0x4000; + } + else + { + start = 0; + size = 0x800000; + } + // Erase the section to be tested + qspi.Erase(start, start + size); + // Create some test data + std::vector test; + test.resize(size); + uint8_t *testmem = test.data(); + for (size_t i = 0; i < size; i++) + testmem[i] = (uint8_t)(i & 0xff); + // Write the test data to the device + qspi.Write(start, size, testmem); + // Read it all back and count any/all errors + // I supppose any byte where ((data & 0xff) == data) + // would be able to false-pass.. + size_t fail_cnt = 0; + for (size_t i = 0; i < size; i++) + if (testmem[i] != (uint8_t)(i & 0xff)) + fail_cnt++; + return fail_cnt == 0; + } + +}; // namespace daisy diff --git a/source/petal_sm/daisy_petal_125b_sm.h b/source/petal_sm/daisy_petal_125b_sm.h new file mode 100644 index 0000000..afba187 --- /dev/null +++ b/source/petal_sm/daisy_petal_125b_sm.h @@ -0,0 +1,288 @@ +#pragma once +#ifndef DSY_BUD_H +#define DSY_BUD_H + +#include "daisy.h" + +namespace daisy +{ + /** + * @brief Configurable Guitar Pedal SOM based on Daisy. + * @ingroup boards + */ + class Petal125BSM + { + public: + enum + { + KNOB_1, /**< Top Left */ + KNOB_2, /**< Top Midddle */ + KNOB_3, /**< Top Right */ + KNOB_4, /**< Bottom Left */ + KNOB_5, /**< Bottom Middle */ + KNOB_6, /**< Bottom Right */ + KNOB_LAST, + }; + + enum + { + LED_1_R, + LED_1_G, + LED_1_B, + LED_2, + LED_3_R, + LED_3_G, + LED_3_B, + LED_4, + LED_5, + LED_LAST, + }; + + enum + { + TOGGLE_1, /**< Left */ + TOGGLE_2, /**< Middle */ + TOGGLE_3, /**< Right */ + TOGGLE_LAST + }; + + enum + { + FOOTSWITCH_1, /** Top */ + FOOTSWITCH_2, /** Bottom */ + FOOTSWITCH_LAST + }; + + Petal125BSM() {} + ~Petal125BSM() {} + + /** @brief Initializes the submodule hardware + * This includes SDRAM, External Flash, + * Knobs, toggles, etc. etc. + */ + void Init(); + + /** @brief Begins the audio. + * the specified Interleaving callback will get called whenever + * new data is ready to be prepared. + */ + void StartAudio(AudioHandle::InterleavingAudioCallback cb); + + /** @brief Begins the audio. + * the specified Non-Interleaving callback will get called whenever + * new data is ready to be prepared. + */ + void StartAudio(AudioHandle::AudioCallback cb); + + /** @brief Changes to a new interleaved callback */ + void ChangeAudioCallback(AudioHandle::InterleavingAudioCallback cb); + + /** @brief Changes to a new non-interleaving callback */ + void ChangeAudioCallback(AudioHandle::AudioCallback cb); + + /** @brief Stops audio stream if its running, disabling the SAI DMA */ + void StopAudio(); + + /** @brief Updates the Audio Sample Rate, and reinitializes. + * @note Audio must be stopped for this to work. + */ + void SetAudioSampleRate(SaiHandle::Config::SampleRate samplerate); + + /** @brief Returns the audio sample rate in Hz as a floating point number. */ + float AudioSampleRate(); + + /** @brief Sets the number of samples processed per channel by the audio callback. */ + void SetAudioBlockSize(size_t blocksize); + + /** @brief Returns the number of samples per channel in a block of audio. */ + size_t AudioBlockSize(); + + /** @brief Returns the rate in Hz that the Audio callback is called */ + float AudioCallbackRate(); + + /** @brief Processes Analog Controls (all 6 knobs, and expression) */ + void ProcessAnalogControls(); + + /** @brief Processes Digital buttons, debouncing as necessary. */ + void ProcessDigitalControls(); + + /** @brief Processes all controls */ + inline void ProcessAllControls() + { + ProcessAnalogControls(); + ProcessDigitalControls(); + } + + /** @brief Returns the value of a specific knob. + * @param index number representing which knob to use 0-5 + * @return 0-1 value corresponding to knob position + */ + inline float GetKnobValue(int index) const + { + return knob[index < KNOB_LAST ? index : 0].Value(); + } + + /** @brief Returns the value of Knob 1 + * @return 0-1 value corresponding to the knob position. + */ + inline float GetKnob1() const { return knob[0].Value(); } + + /** @brief Returns the value of Knob 2 + * @return 0-1 value corresponding to the knob position. + */ + inline float GetKnob2() const { return knob[1].Value(); } + + /** @brief Returns the value of Knob 3 + * @return 0-1 value corresponding to the knob position. + */ + inline float GetKnob3() const { return knob[2].Value(); } + + /** @brief Returns the value of Knob 4 + * @return 0-1 value corresponding to the knob position. + */ + inline float GetKnob4() const { return knob[3].Value(); } + + /** @brief Returns the value of Knob 5 + * @return 0-1 value corresponding to the knob position. + */ + inline float GetKnob5() const { return knob[4].Value(); } + + /** @brief Returns the value of Knob 6 + * @return 0-1 value corresponding to the knob position. + */ + inline float GetKnob6() const { return knob[5].Value(); } + + /** @brief Returns the current expression value + * @return 0-1 value corresponding to the expression input + */ + inline float GetExpressionValue() const { return expression.Value(); } + + /** @brief Enables/Disables True Bypass */ + void SetBypassState(bool state); + + /** @brief Toggles the state of the True Bypass feature */ + void ToggleBypassState(); + + /** @brief Returns whether True Bypass is enabled or not. */ + inline bool BypassState() const { return bypass_state_; } + + /** @brief Updates the PWM value for any direct GPIO LEDs + * + * @note This should be called at AudioCallbackRate + * + * For setting individual LED brightnesses you can access the + * leds[] array, and use the `Set` function. + * + * For example: + * hw.leds[LED_2].Set(0.5); + * + * The RGB LEDs each have convenience functions below. + */ + void UpdateLeds(); + + /** @brief Convenience function for setting the RGB values for LED 1 + * @param r 0-1 value for red LED + * @param g 0-1 value for green LED + * @param b 0-1 value for blue LED + */ + void SetLed1(float r, float g, float b); + + /** @brief Convenience function for Setting LED2 + * @param val 0-1 value for brightness of LED. + */ + inline void SetLed2(float val) { led[LED_2].Set(val); } + + /** @brief Convenience function for setting the RGB values for LED 3 + * @param r 0-1 value for red LED + * @param g 0-1 value for green LED + * @param b 0-1 value for blue LED + */ + void SetLed3(float r, float g, float b); + + /** @brief Convenience function for Setting LED2 + * @param val 0-1 value for brightness of LED. + */ + inline void SetLed4(float val) { led[LED_4].Set(val); } + + /** @brief Convenience function for Setting LED2 + * @param val 0-1 value for brightness of LED. + */ + inline void SetLed5(float val) { led[LED_5].Set(val); } + + /** @brief Print formatted debug log message */ + template + static void Print(const char *format, VA... va) + { + Log::Print(format, va...); + } + + /** @brief Print formatted debug log message with automatic line termination */ + template + static void PrintLine(const char *format, VA... va) + { + Log::PrintLine(format, va...); + } + + /** @brief Start the logging session. + * @param wait_for_pc Optionally wait for terminal connection before proceeding. + * defaults to not waiting + */ + static void StartLog(bool wait_for_pc = false) + { + Log::StartLog(wait_for_pc); + } + + /** @brief Tests entirety of SDRAM for validity + * This will wipe contents of SDRAM when testing. + * + * @note If using the SDRAM for the default bss, or heap, + * and using constructors as initializers do not + * call this function. Otherwise, it could + * overwrite changes performed by constructors. + * + * \retval returns true if SDRAM is okay, otherwise false + */ + bool ValidateSDRAM(); + + /** @brief Tests the QSPI for validity + * This will wipe contents of QSPI when testing. + * + * @note If called with quick = false, this will erase all memory + * the "quick" test starts 0x400000 bytes into the memory and + * test 16kB of data + * + * \param quick if this is true the test will only test a small piece of the QSPI + * checking the entire 8MB can take roughly over a minute. + * + * \retval returns true if SDRAM is okay, otherwise false + */ + bool ValidateQSPI(bool quick = true); + + AnalogControl knob[KNOB_LAST]; /**< Knob Objects */ + AnalogControl expression; /**< Expresion Object */ + Switch3 toggle[TOGGLE_LAST]; /**< Toggle Objects */ + Switch footswitch1, footswitch2; /**< Footswitch Objects */ + + /** LED Objects -- RGBs are handled as separate LEDs + * @see SetLed1 + * @see SetLed3 + */ + Led led[LED_LAST]; + + QSPIHandle qspi; /**< External Flash Access */ + AudioHandle audio; /**< Audio Engine Access */ + AdcHandle adc; /**< Analog to Digital Converter Access */ + Pcm3060 codec; /**< PCM3060 codec control */ + + private: + using Log = Logger; + float callback_rate_; + GPIO relay_control; + bool bypass_state_; + System sys; + SdramHandle sdram; + }; + +} // namespace daisy + +#endif From 9a466446743329eb76c9737cf482952bd9669127 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Wed, 6 Apr 2022 17:34:56 -0600 Subject: [PATCH 058/100] Updated libdaisy commit --- source/libdaisy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libdaisy b/source/libdaisy index 32e0aba..c8a34a7 160000 --- a/source/libdaisy +++ b/source/libdaisy @@ -1 +1 @@ -Subproject commit 32e0aba9ee0caf6f232ca6674057748f60ba579f +Subproject commit c8a34a7c47dc1bb2c4ea704fd5c09d3008dcd472 From dbd618d00a634b82cf90a66b3a212c1e43b9e970 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Thu, 7 Apr 2022 13:21:57 -0600 Subject: [PATCH 059/100] Corrected field LED and button errors --- source/field.json | 64 +++++++++++++++++++++---------------------- source/genlib_daisy.h | 10 ++----- 2 files changed, 35 insertions(+), 39 deletions(-) diff --git a/source/field.json b/source/field.json index cb6bee1..4653650 100644 --- a/source/field.json +++ b/source/field.json @@ -124,161 +124,161 @@ "pada1": { "component": "CD4021Switch", "parent": "pad_shift", - "index": 0 + "index": 15 }, "pada2": { "component": "CD4021Switch", "parent": "pad_shift", - "index": 1 + "index": 14 }, "pada3": { "component": "CD4021Switch", "parent": "pad_shift", - "index": 2 + "index": 13 }, "pada4": { "component": "CD4021Switch", "parent": "pad_shift", - "index": 3 + "index": 12 }, "pada5": { "component": "CD4021Switch", "parent": "pad_shift", - "index": 4 + "index": 11 }, "pada6": { "component": "CD4021Switch", "parent": "pad_shift", - "index": 5 + "index": 10 }, "pada7": { "component": "CD4021Switch", "parent": "pad_shift", - "index": 6 + "index": 9 }, "pada8": { "component": "CD4021Switch", "parent": "pad_shift", - "index": 7 + "index": 8 }, "padb1": { "component": "CD4021Switch", "parent": "pad_shift", - "index": 15 + "index": 7 }, "padb2": { "component": "CD4021Switch", "parent": "pad_shift", - "index": 14 + "index": 6 }, "padb3": { "component": "CD4021Switch", "parent": "pad_shift", - "index": 13 + "index": 5 }, "padb4": { "component": "CD4021Switch", "parent": "pad_shift", - "index": 12 + "index": 4 }, "padb5": { "component": "CD4021Switch", "parent": "pad_shift", - "index": 11 + "index": 3 }, "padb6": { "component": "CD4021Switch", "parent": "pad_shift", - "index": 10 + "index": 2 }, "padb7": { "component": "CD4021Switch", "parent": "pad_shift", - "index": 9 + "index": 1 }, "padb8": { "component": "CD4021Switch", "parent": "pad_shift", - "index": 8 + "index": 0 }, "led_key_b1": { "component": "PCA9685Led", - "index": 0, + "index": 15, "parent": "led_driver" }, "led_key_b2": { "component": "PCA9685Led", - "index": 1, + "index": 14, "parent": "led_driver" }, "led_key_b3": { "component": "PCA9685Led", - "index": 2, + "index": 13, "parent": "led_driver" }, "led_key_b4": { "component": "PCA9685Led", - "index": 3, + "index": 12, "parent": "led_driver" }, "led_key_b5": { "component": "PCA9685Led", - "index": 4, + "index": 11, "parent": "led_driver" }, "led_key_b6": { "component": "PCA9685Led", - "index": 5, + "index": 10, "parent": "led_driver" }, "led_key_b7": { "component": "PCA9685Led", - "index": 6, + "index": 9, "parent": "led_driver" }, "led_key_b8": { "component": "PCA9685Led", - "index": 7, + "index": 8, "parent": "led_driver" }, "led_key_a1": { "component": "PCA9685Led", - "index": 15, + "index": 0, "parent": "led_driver" }, "led_key_a2": { "component": "PCA9685Led", - "index": 14, + "index": 1, "parent": "led_driver" }, "led_key_a3": { "component": "PCA9685Led", - "index": 13, + "index": 2, "parent": "led_driver" }, "led_key_a4": { "component": "PCA9685Led", - "index": 12, + "index": 3, "parent": "led_driver" }, "led_key_a5": { "component": "PCA9685Led", - "index": 11, + "index": 4, "parent": "led_driver" }, "led_key_a6": { "component": "PCA9685Led", - "index": 10, + "index": 5, "parent": "led_driver" }, "led_key_a7": { "component": "PCA9685Led", - "index": 9, + "index": 6, "parent": "led_driver" }, "led_key_a8": { "component": "PCA9685Led", - "index": 8, + "index": 7, "parent": "led_driver" }, "led_knob_1": { diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index c81897b..3a2127c 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -1046,13 +1046,9 @@ namespace oopsy { for(long i = 0; i < daisy::DaisyField::LED_LAST && i < data.dim; i++) { // LED indices run A1..8, B8..1, Knob1..8 // switch here to re-order the B8-1 to B1-8 - // long idx=i; - // if (idx > 7 && idx < 16) idx = 23-i; - long idx = i; - if (idx < 8) - idx += 8; - else if (idx < 16) - idx -= 8; + long idx=i; + if (idx > 7 && idx < 16) + idx = 23 - i; hardware.led_driver.SetLed(idx, data.read(i, 0)); } // hardware.led_driver.SwapBuffersAndTransmit(); // now handled by hardware class From 160b335f9e8f7ebd7ccfa5aad28fdc24084587e8 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Thu, 7 Apr 2022 13:22:23 -0600 Subject: [PATCH 060/100] Updated libdaisy commit --- source/libdaisy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libdaisy b/source/libdaisy index 32e0aba..c8a34a7 160000 --- a/source/libdaisy +++ b/source/libdaisy @@ -1 +1 @@ -Subproject commit 32e0aba9ee0caf6f232ca6674057748f60ba579f +Subproject commit c8a34a7c47dc1bb2c4ea704fd5c09d3008dcd472 From 407c8df3daeeb59f6cb649cb025b6bf1cf88e0bb Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 18 Apr 2022 13:50:56 -0600 Subject: [PATCH 061/100] Added petal sm options to oopsy object --- init/oopsy-objectmappings.txt | 2 ++ patchers/oopsy.maxpat | 53 +++++++++++++++++------------------ 2 files changed, 27 insertions(+), 28 deletions(-) diff --git a/init/oopsy-objectmappings.txt b/init/oopsy-objectmappings.txt index 41aad83..48f8240 100644 --- a/init/oopsy-objectmappings.txt +++ b/init/oopsy-objectmappings.txt @@ -4,6 +4,8 @@ max definesubstitution oopsy.field bpatcher @name oopsy.maxpat @args field; max objectfile oopsy.field oopsy.field; max definesubstitution oopsy.petal bpatcher @name oopsy.maxpat @args petal; max objectfile oopsy.petal oopsy.petal; +max definesubstitution oopsy.petal bpatcher @name oopsy.maxpat @args petal_125b_sm; +max objectfile oopsy.petal_125b_sm oopsy.petal_125b_sm; max definesubstitution oopsy.pod bpatcher @name oopsy.maxpat @args pod; max objectfile oopsy.pod oopsy.pod; max definesubstitution oopsy.patch_init bpatcher @name oopsy.maxpat @args patch_init; diff --git a/patchers/oopsy.maxpat b/patchers/oopsy.maxpat index 3a3ccc9..9ad1656 100644 --- a/patchers/oopsy.maxpat +++ b/patchers/oopsy.maxpat @@ -383,7 +383,7 @@ } , "classnamespace" : "box", - "rect" : [ 488.0, 269.0, 918.0, 472.0 ], + "rect" : [ 421.0, 260.0, 918.0, 472.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -411,7 +411,6 @@ "style" : "", "subpatcher_template" : "", "assistshowspatchername" : 0, - "visible" : 1, "boxes" : [ { "box" : { "id" : "obj-31", @@ -419,7 +418,7 @@ "numinlets" : 1, "numoutlets" : 3, "outlettype" : [ "", "", "bang" ], - "patching_rect" : [ 523.0, 253.0, 40.0, 22.0 ], + "patching_rect" : [ 511.0, 251.0, 40.0, 22.0 ], "text" : "t l l b" } @@ -428,11 +427,11 @@ "box" : { "id" : "obj-29", "maxclass" : "newobj", - "numinlets" : 9, - "numoutlets" : 9, - "outlettype" : [ "", "", "", "", "", "", "", "", "" ], - "patching_rect" : [ 17.0, 97.0, 386.0, 22.0 ], - "text" : "routepass patch patch_init field petal pod versio bluemchen nehcmeulb" + "numinlets" : 10, + "numoutlets" : 10, + "outlettype" : [ "", "", "", "", "", "", "", "", "", "" ], + "patching_rect" : [ 17.0, 97.0, 471.0, 22.0 ], + "text" : "routepass patch patch_init field petal petal_125b_sm pod versio bluemchen nehcmeulb" } } @@ -442,7 +441,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 465.0, 59.0, 62.0, 20.0 ], + "patching_rect" : [ 548.0, 55.0, 62.0, 20.0 ], "text" : "browse" } @@ -456,7 +455,7 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 431.0, 58.0, 30.0, 30.0 ] + "patching_rect" : [ 514.0, 54.0, 30.0, 30.0 ] } } @@ -467,7 +466,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "malconformed_path" ], - "patching_rect" : [ 641.0, 251.0, 121.0, 22.0 ], + "patching_rect" : [ 629.0, 251.0, 121.0, 22.0 ], "text" : "t malconformed_path" } @@ -479,7 +478,7 @@ "numinlets" : 2, "numoutlets" : 2, "outlettype" : [ "bang", "" ], - "patching_rect" : [ 641.0, 224.0, 34.0, 22.0 ], + "patching_rect" : [ 629.0, 224.0, 34.0, 22.0 ], "text" : "sel 0" } @@ -491,7 +490,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 431.0, 214.0, 81.0, 22.0 ], + "patching_rect" : [ 419.0, 214.0, 81.0, 22.0 ], "text" : "prepend error" } @@ -502,7 +501,7 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 431.0, 238.0, 32.0, 22.0 ], + "patching_rect" : [ 419.0, 238.0, 32.0, 22.0 ], "text" : "print" } @@ -514,7 +513,7 @@ "numinlets" : 2, "numoutlets" : 2, "outlettype" : [ "", "" ], - "patching_rect" : [ 431.0, 166.0, 111.0, 22.0 ], + "patching_rect" : [ 419.0, 166.0, 111.0, 22.0 ], "text" : "routepass notfound" } @@ -526,7 +525,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 431.0, 136.0, 77.0, 22.0 ], + "patching_rect" : [ 419.0, 136.0, 77.0, 22.0 ], "text" : "absolutepath", "varname" : "example[4]" } @@ -539,7 +538,7 @@ "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "int" ], - "patching_rect" : [ 523.0, 194.0, 137.0, 22.0 ], + "patching_rect" : [ 511.0, 193.0, 137.0, 22.0 ], "text" : "conformpath native boot" } @@ -551,7 +550,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 533.5, 287.0, 96.0, 22.0 ], + "patching_rect" : [ 521.5, 287.0, 96.0, 22.0 ], "text" : "prepend append" } @@ -563,7 +562,7 @@ "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "bang" ], - "patching_rect" : [ 431.0, 97.0, 103.0, 22.0 ], + "patching_rect" : [ 514.0, 97.0, 103.0, 22.0 ], "text" : "opendialog JSON" } @@ -576,8 +575,8 @@ "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 544.0, 329.0, 369.0, 49.0 ], - "text" : "clear, append patch, append patch_init, append field, append petal, append pod, append versio, append bluemchen, append nehcmeulb" + "patching_rect" : [ 532.0, 323.0, 369.0, 49.0 ], + "text" : "clear, append patch, append patch_init, append field, append petal, append petal_125b_sm, append pod, append versio, append bluemchen, append nehcmeulb" } } @@ -643,7 +642,7 @@ , { "patchline" : { "destination" : [ "obj-74", 0 ], - "midpoints" : [ 553.5, 380.0, 26.5, 380.0 ], + "midpoints" : [ 541.5, 380.0, 26.5, 380.0 ], "source" : [ "obj-2", 0 ] } @@ -756,7 +755,7 @@ , { "patchline" : { "destination" : [ "obj-37", 0 ], - "midpoints" : [ 532.5, 280.5, 26.5, 280.5 ], + "midpoints" : [ 520.5, 280.5, 26.5, 280.5 ], "source" : [ "obj-31", 0 ] } @@ -779,7 +778,7 @@ , { "patchline" : { "destination" : [ "obj-74", 0 ], - "midpoints" : [ 543.0, 327.5, 26.5, 327.5 ], + "midpoints" : [ 531.0, 327.5, 26.5, 327.5 ], "source" : [ "obj-53", 0 ] } @@ -1340,8 +1339,6 @@ "saved_object_attributes" : { "autostart" : 0, "defer" : 0, - "node_bin_path" : "", - "npm_bin_path" : "", "watch" : 0 } , @@ -1988,14 +1985,14 @@ , "dependency_cache" : [ { "name" : "oopsy.snoop.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/javascript", "patcherrelativepath" : "../javascript", "type" : "TEXT", "implicit" : 1 } , { "name" : "oopsy.node4max.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/javascript", "patcherrelativepath" : "../javascript", "type" : "TEXT", "implicit" : 1 From edfa641f3a0b98965f48eb252c59a07d34903663 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 18 Apr 2022 13:51:09 -0600 Subject: [PATCH 062/100] Added footswitch components --- source/petal_125b_sm.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/petal_125b_sm.json b/source/petal_125b_sm.json index 8da2fce..613e970 100644 --- a/source/petal_125b_sm.json +++ b/source/petal_125b_sm.json @@ -40,6 +40,14 @@ "toggle_3": { "component": "Switch3", "index": 2 + }, + "footswitch_1": { + "component": "Switch", + "index": 1 + }, + "footswitch_2": { + "component": "Switch", + "index": 2 } } } \ No newline at end of file From 4e307c26bae493072139a388633064dc010799e2 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 18 Apr 2022 13:51:34 -0600 Subject: [PATCH 063/100] Added petal sm max patcher --- templates/oopsy_petal_125b_sm.maxpat | 1009 ++++++++++++++++++++++++++ 1 file changed, 1009 insertions(+) create mode 100644 templates/oopsy_petal_125b_sm.maxpat diff --git a/templates/oopsy_petal_125b_sm.maxpat b/templates/oopsy_petal_125b_sm.maxpat new file mode 100644 index 0000000..a12a785 --- /dev/null +++ b/templates/oopsy_petal_125b_sm.maxpat @@ -0,0 +1,1009 @@ +{ + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 11, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "box", + "rect" : [ 487.0, 95.0, 871.0, 640.0 ], + "bglocked" : 0, + "openinpresentation" : 0, + "default_fontsize" : 12.0, + "default_fontface" : 0, + "default_fontname" : "Arial", + "gridonopen" : 1, + "gridsize" : [ 15.0, 15.0 ], + "gridsnaponopen" : 1, + "objectsnaponopen" : 1, + "statusbarvisible" : 2, + "toolbarvisible" : 1, + "lefttoolbarpinned" : 0, + "toptoolbarpinned" : 0, + "righttoolbarpinned" : 0, + "bottomtoolbarpinned" : 0, + "toolbars_unpinned_last_save" : 0, + "tallnewobj" : 0, + "boxanimatetime" : 200, + "enablehscroll" : 1, + "enablevscroll" : 1, + "devicewidth" : 0.0, + "description" : "", + "digest" : "", + "tags" : "", + "style" : "", + "subpatcher_template" : "", + "assistshowspatchername" : 0, + "boxes" : [ { + "box" : { + "id" : "obj-17", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 262.333333333333371, 110.942857142857122, 150.0, 20.0 ], + "text" : "etc." + } + + } +, { + "box" : { + "fontface" : 0, + "fontname" : "Arial", + "fontsize" : 12.0, + "id" : "obj-12", + "maxclass" : "number~", + "mode" : 2, + "numinlets" : 2, + "numoutlets" : 2, + "outlettype" : [ "signal", "float" ], + "patching_rect" : [ 140.0, 314.0, 56.0, 22.0 ], + "sig" : 0.0 + } + + } +, { + "box" : { + "fontface" : 0, + "fontname" : "Arial", + "fontsize" : 12.0, + "id" : "obj-14", + "maxclass" : "number~", + "mode" : 2, + "numinlets" : 2, + "numoutlets" : 2, + "outlettype" : [ "signal", "float" ], + "patching_rect" : [ 140.0, 285.0, 56.0, 22.0 ], + "sig" : 0.0 + } + + } +, { + "box" : { + "fontface" : 0, + "fontname" : "Arial", + "fontsize" : 12.0, + "id" : "obj-3", + "maxclass" : "number~", + "mode" : 2, + "numinlets" : 2, + "numoutlets" : 2, + "outlettype" : [ "signal", "float" ], + "patching_rect" : [ 75.0, 314.0, 56.0, 22.0 ], + "sig" : 0.0 + } + + } +, { + "box" : { + "fontface" : 0, + "fontname" : "Arial", + "fontsize" : 12.0, + "id" : "obj-1", + "maxclass" : "number~", + "mode" : 2, + "numinlets" : 2, + "numoutlets" : 2, + "outlettype" : [ "signal", "float" ], + "patching_rect" : [ 75.0, 285.0, 56.0, 22.0 ], + "sig" : 0.0 + } + + } +, { + "box" : { + "fontname" : "Arial Italic", + "fontsize" : 18.0, + "id" : "obj-24", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 19.333333333333343, 22.0, 221.0, 27.0 ], + "text" : "Template for DaisyPetal" + } + + } +, { + "box" : { + "id" : "obj-13", + "maxclass" : "ezdac~", + "numinlets" : 2, + "numoutlets" : 0, + "patching_rect" : [ 17.333333333333343, 393.0, 45.0, 45.0 ] + } + + } +, { + "box" : { + "id" : "obj-11", + "lastchannelcount" : 0, + "maxclass" : "live.gain~", + "numinlets" : 2, + "numoutlets" : 5, + "outlettype" : [ "signal", "signal", "", "float", "list" ], + "parameter_enable" : 1, + "patching_rect" : [ 17.333333333333343, 287.0, 44.0, 90.0 ], + "saved_attribute_attributes" : { + "valueof" : { + "parameter_initial" : [ -70.0 ], + "parameter_initial_enable" : 1, + "parameter_longname" : "live.gain~", + "parameter_mmax" : 6.0, + "parameter_mmin" : -70.0, + "parameter_shortname" : "live.gain~", + "parameter_type" : 0, + "parameter_unitstyle" : 4 + } + + } +, + "varname" : "live.gain~" + } + + } +, { + "box" : { + "args" : [ "@loop", 1, "@file", "jongly.aif" ], + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-7", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "demosound.maxpat", + "numinlets" : 0, + "numoutlets" : 1, + "offset" : [ 0.0, 0.0 ], + "outlettype" : [ "signal" ], + "patching_rect" : [ 17.333333333333343, 65.0, 225.0, 105.0 ], + "viewvisibility" : 1 + } + + } +, { + "box" : { + "attr" : "sw1", + "id" : "obj-2", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 262.333333333333371, 65.0, 150.0, 22.0 ] + } + + } +, { + "box" : { + "attr" : "sw2", + "id" : "obj-4", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 262.333333333333371, 87.942857142857122, 150.0, 22.0 ] + } + + } +, { + "box" : { + "attr" : "knob5", + "id" : "obj-5", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 262.333333333333371, 128.885714285714272, 150.0, 22.0 ] + } + + } +, { + "box" : { + "attr" : "knob6", + "id" : "obj-6", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 262.333333333333371, 151.828571428571394, 150.0, 22.0 ] + } + + } +, { + "box" : { + "attr" : "exp", + "displaymode" : 1, + "id" : "obj-8", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 262.333333333333371, 174.771428571428544, 150.0, 22.0 ] + } + + } +, { + "box" : { + "args" : [ "@target", "petal" ], + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-9", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "oopsy.maxpat", + "numinlets" : 1, + "numoutlets" : 0, + "offset" : [ 0.0, 0.0 ], + "patching_rect" : [ 267.5, 327.0, 128.0, 128.0 ], + "viewvisibility" : 1 + } + + } +, { + "box" : { + "color" : [ 0.254901960784314, 0.533333333333333, 0.258823529411765, 1.0 ], + "fontsize" : 24.0, + "id" : "obj-16", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 7, + "outlettype" : [ "signal", "signal", "signal", "signal", "signal", "signal", "signal" ], + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 11, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "dsp.gen", + "rect" : [ 67.0, 198.0, 1141.0, 427.0 ], + "bglocked" : 0, + "openinpresentation" : 0, + "default_fontsize" : 12.0, + "default_fontface" : 0, + "default_fontname" : "Arial", + "gridonopen" : 1, + "gridsize" : [ 15.0, 15.0 ], + "gridsnaponopen" : 1, + "objectsnaponopen" : 1, + "statusbarvisible" : 2, + "toolbarvisible" : 1, + "lefttoolbarpinned" : 0, + "toptoolbarpinned" : 0, + "righttoolbarpinned" : 0, + "bottomtoolbarpinned" : 0, + "toolbars_unpinned_last_save" : 0, + "tallnewobj" : 0, + "boxanimatetime" : 200, + "enablehscroll" : 1, + "enablevscroll" : 1, + "devicewidth" : 0.0, + "description" : "", + "digest" : "", + "tags" : "", + "style" : "", + "subpatcher_template" : "", + "assistshowspatchername" : 0, + "boxes" : [ { + "box" : { + "id" : "obj-29", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 587.0, 372.0, 95.0, 22.0 ], + "text" : "out 7 led_ring_1" + } + + } +, { + "box" : { + "id" : "obj-28", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 2, + "outlettype" : [ "", "" ], + "patching_rect" : [ 628.0, 314.0, 46.0, 22.0 ], + "text" : "cycle 1" + } + + } +, { + "box" : { + "id" : "obj-13", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 77.0, 221.0, 29.5, 22.0 ], + "text" : "*" + } + + } +, { + "box" : { + "id" : "obj-12", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 77.0, 178.0, 37.0, 22.0 ], + "text" : "noise" + } + + } +, { + "box" : { + "id" : "obj-10", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 77.0, 264.0, 29.5, 22.0 ], + "text" : "*" + } + + } +, { + "box" : { + "id" : "obj-26", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 458.140522875816941, 341.0, 61.0, 22.0 ], + "text" : "out 6 led4" + } + + } +, { + "box" : { + "id" : "obj-27", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 381.5, 341.0, 61.0, 22.0 ], + "text" : "out 5 led3" + } + + } +, { + "box" : { + "id" : "obj-25", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 301.140522875816941, 341.0, 61.0, 22.0 ], + "text" : "out 4 led2" + } + + } +, { + "box" : { + "id" : "obj-24", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 235.5, 341.0, 61.0, 22.0 ], + "text" : "out 3 led1" + } + + } +, { + "box" : { + "id" : "obj-23", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 535.5, 88.0, 65.0, 22.0 ], + "text" : "param exp" + } + + } +, { + "box" : { + "id" : "obj-20", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 320.547120418848181, 230.30375586854467, 67.0, 22.0 ], + "text" : "param sw7" + } + + } +, { + "box" : { + "id" : "obj-21", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 307.515706806282765, 206.586463223787234, 67.0, 22.0 ], + "text" : "param sw6" + } + + } +, { + "box" : { + "id" : "obj-22", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 291.74083769633512, 182.86917057902977, 67.0, 22.0 ], + "text" : "param sw5" + } + + } +, { + "box" : { + "id" : "obj-18", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 277.33769633507859, 159.151877934272306, 67.0, 22.0 ], + "text" : "param sw4" + } + + } +, { + "box" : { + "id" : "obj-19", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 264.30628272251306, 135.434585289514871, 67.0, 22.0 ], + "text" : "param sw3" + } + + } +, { + "box" : { + "id" : "obj-15", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 458.140522875816941, 210.0, 176.0, 22.0 ], + "text" : "param knob6 @min -1 @max 1" + } + + } +, { + "box" : { + "id" : "obj-16", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 441.166666666666742, 185.600000000000023, 79.0, 22.0 ], + "text" : "param knob5" + } + + } +, { + "box" : { + "id" : "obj-8", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 427.807189542483684, 161.200000000000017, 79.0, 22.0 ], + "text" : "param knob4" + } + + } +, { + "box" : { + "id" : "obj-9", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 412.833333333333258, 136.800000000000011, 79.0, 22.0 ], + "text" : "param knob3" + } + + } +, { + "box" : { + "id" : "obj-6", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 248.531413612565416, 111.717292644757435, 67.0, 22.0 ], + "text" : "param sw2" + } + + } +, { + "box" : { + "id" : "obj-7", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 235.5, 88.0, 67.0, 22.0 ], + "text" : "param sw1" + } + + } +, { + "box" : { + "id" : "obj-39", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 1000.5, 88.0, 107.0, 22.0 ], + "text" : "oopsy.suggestions" + } + + } +, { + "box" : { + "id" : "obj-38", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 18.5, 342.0, 69.0, 20.0 ], + "text" : "OUTPUTS" + } + + } +, { + "box" : { + "id" : "obj-37", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 18.5, 88.0, 69.0, 20.0 ], + "text" : "INPUTS" + } + + } +, { + "box" : { + "id" : "obj-17", + "linecount" : 2, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 235.5, 40.0, 319.0, 33.0 ], + "text" : "Knob and switch inputs will be mapped to the @min..@max range. @min @max are 0 and 1 by default." + } + + } +, { + "box" : { + "id" : "obj-14", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 396.473856209150313, 112.400000000000006, 79.0, 22.0 ], + "text" : "param knob2" + } + + } +, { + "box" : { + "id" : "obj-2", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 381.5, 88.0, 79.0, 22.0 ], + "text" : "param knob1" + } + + } +, { + "box" : { + "id" : "obj-11", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 126.5, 53.0, 69.0, 20.0 ], + "text" : "Audio IOs" + } + + } +, { + "box" : { + "id" : "obj-3", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 167.5, 88.0, 28.0, 22.0 ], + "text" : "in 2" + } + + } +, { + "box" : { + "id" : "obj-5", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 167.5, 342.0, 35.0, 22.0 ], + "text" : "out 2" + } + + } +, { + "box" : { + "id" : "obj-1", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 126.5, 88.0, 28.0, 22.0 ], + "text" : "in 1" + } + + } +, { + "box" : { + "id" : "obj-4", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 126.5, 342.0, 35.0, 22.0 ], + "text" : "out 1" + } + + } + ], + "lines" : [ { + "patchline" : { + "destination" : [ "obj-4", 0 ], + "source" : [ "obj-1", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-4", 0 ], + "order" : 1, + "source" : [ "obj-10", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-5", 0 ], + "order" : 0, + "source" : [ "obj-10", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-13", 0 ], + "source" : [ "obj-12", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-10", 0 ], + "source" : [ "obj-13", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-26", 0 ], + "source" : [ "obj-15", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-27", 0 ], + "source" : [ "obj-16", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-10", 1 ], + "source" : [ "obj-2", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-13", 1 ], + "source" : [ "obj-22", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-25", 0 ], + "source" : [ "obj-28", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-5", 0 ], + "source" : [ "obj-3", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-25", 0 ], + "source" : [ "obj-6", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-24", 0 ], + "source" : [ "obj-7", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-29", 0 ], + "source" : [ "obj-8", 0 ] + } + + } + ] + } +, + "patching_rect" : [ 17.333333333333343, 222.0, 71.5, 35.0 ], + "saved_object_attributes" : { + "exportfolder" : "macOS:/Users/corvus/Documents/Max 8/Packages/Oopsy/templates/", + "exportname" : "oopsy_petal_125b_sm" + } +, + "text" : "gen~", + "varname" : "oopsy_petal_125b_sm" + } + + } + ], + "lines" : [ { + "patchline" : { + "destination" : [ "obj-13", 1 ], + "source" : [ "obj-11", 1 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-13", 0 ], + "source" : [ "obj-11", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-1", 0 ], + "source" : [ "obj-16", 2 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-11", 0 ], + "source" : [ "obj-16", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-12", 0 ], + "source" : [ "obj-16", 5 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-14", 0 ], + "source" : [ "obj-16", 4 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-3", 0 ], + "source" : [ "obj-16", 3 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-16", 0 ], + "source" : [ "obj-2", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-16", 0 ], + "source" : [ "obj-4", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-16", 0 ], + "source" : [ "obj-5", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-16", 0 ], + "source" : [ "obj-6", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-16", 0 ], + "source" : [ "obj-7", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-16", 0 ], + "source" : [ "obj-8", 0 ] + } + + } + ], + "parameters" : { + "obj-11" : [ "live.gain~", "live.gain~", 0 ], + "obj-7::obj-21::obj-6" : [ "live.tab[3]", "live.tab[1]", 0 ], + "obj-7::obj-35" : [ "[5]", "Level", 0 ], + "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], + "obj-9::obj-33" : [ "live.text[1]", "FILTER", 0 ], + "obj-9::obj-34" : [ "live.text[3]", "FILTER", 0 ], + "parameterbanks" : { + + } +, + "inherited_shortname" : 1 + } +, + "dependency_cache" : [ { + "name" : "oopsy.suggestions.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", + "patcherrelativepath" : "../code", + "type" : "gDSP", + "implicit" : 1 + } +, { + "name" : "oopsy.gate.trig.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", + "patcherrelativepath" : "../code", + "type" : "gDSP", + "implicit" : 1 + } +, { + "name" : "oopsy.gate.min.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", + "patcherrelativepath" : "../code", + "type" : "gDSP", + "implicit" : 1 + } +, { + "name" : "oopsy.ctrl.smooth3.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", + "patcherrelativepath" : "../code", + "type" : "gDSP", + "implicit" : 1 + } +, { + "name" : "oopsy.ctrl.smooth2.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", + "patcherrelativepath" : "../code", + "type" : "gDSP", + "implicit" : 1 + } +, { + "name" : "oopsy.maxpat", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/patchers", + "patcherrelativepath" : "../patchers", + "type" : "JSON", + "implicit" : 1 + } +, { + "name" : "oopsy.snoop.js", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "oopsy.node4max.js", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "demosound.maxpat", + "bootpath" : "C74:/help/msp", + "type" : "JSON", + "implicit" : 1 + } +, { + "name" : "sine.svg", + "bootpath" : "C74:/media/max/picts/m4l-picts", + "type" : "svg", + "implicit" : 1 + } +, { + "name" : "saw.svg", + "bootpath" : "C74:/media/max/picts/m4l-picts", + "type" : "svg", + "implicit" : 1 + } +, { + "name" : "square.svg", + "bootpath" : "C74:/media/max/picts/m4l-picts", + "type" : "svg", + "implicit" : 1 + } +, { + "name" : "random.svg", + "bootpath" : "C74:/media/max/picts/m4l-picts", + "type" : "svg", + "implicit" : 1 + } +, { + "name" : "interfacecolor.js", + "bootpath" : "C74:/interfaces", + "type" : "TEXT", + "implicit" : 1 + } + ], + "autosave" : 0 + } + +} From 46f4ef7faa57caeb018fb5f423910495a4bdedac Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 18 Apr 2022 14:34:01 -0600 Subject: [PATCH 064/100] Fixed bipolar issue with patch init --- source/component_defs_patchsm.json | 23 +++++++++++ source/patch_init.json | 8 ++-- templates/oopsy_patch_init.maxpat | 62 +++++++++++++++++++++--------- 3 files changed, 70 insertions(+), 23 deletions(-) diff --git a/source/component_defs_patchsm.json b/source/component_defs_patchsm.json index 5e2a97e..b49e88c 100644 --- a/source/component_defs_patchsm.json +++ b/source/component_defs_patchsm.json @@ -154,6 +154,29 @@ } ] }, + "AnalogControlBipolar": { + "init_single": "cfg[{i}].InitSingle(daisy::patch_sm::DaisyPatchSM::{pin});", + "map_init": "{name}.Init(som.adc.GetPtr({i}), som.AudioCallbackRate(), {flip}, {invert});", + "typename": "daisy::AnalogControl", + "direction": "in", + "pin": "a", + "flip": "false", + "invert": "false", + "slew": "1.0/som.AudioCallbackRate()", + "process": "{name}.Process();", + "updaterate": "{name}.SetSampleRate(som.AudioCallbackRate());", + "mapping": [ + { + "name": "{name}", + "get": "({class_name}.som.GetAdcValue((int)daisy::patch_sm::{name_upper}))", + "range": [ + -1, + 1 + ], + "bool": false + } + ] + }, "Led": { "map_init": "{name}.Init(daisy::patch_sm::DaisyPatchSM::{pin}), {invert});\n\t\t{name}.Set(0.0f);", "typename": "daisy::Led", diff --git a/source/patch_init.json b/source/patch_init.json index 9d2cf12..1d07a8e 100644 --- a/source/patch_init.json +++ b/source/patch_init.json @@ -24,22 +24,22 @@ "is_default": true }, "cv_5": { - "component": "AnalogControl", + "component": "AnalogControlBipolar", "pin": "C6", "is_default": true }, "cv_6": { - "component": "AnalogControl", + "component": "AnalogControlBipolar", "pin": "C7", "is_default": true }, "cv_7": { - "component": "AnalogControl", + "component": "AnalogControlBipolar", "pin": "C8", "is_default": true }, "cv_8": { - "component": "AnalogControl", + "component": "AnalogControlBipolar", "pin": "C9", "is_default": true }, diff --git a/templates/oopsy_patch_init.maxpat b/templates/oopsy_patch_init.maxpat index 472ce00..6ea73c9 100644 --- a/templates/oopsy_patch_init.maxpat +++ b/templates/oopsy_patch_init.maxpat @@ -575,6 +575,30 @@ "subpatcher_template" : "", "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "id" : "obj-21", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 565.0, 358.0, 23.0, 22.0 ], + "text" : "* 1" + } + + } +, { + "box" : { + "id" : "obj-20", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 506.0, 255.0, 26.0, 22.0 ], + "text" : "< 0" + } + + } +, { "box" : { "id" : "obj-47", "maxclass" : "newobj", @@ -744,12 +768,12 @@ , { "box" : { "id" : "obj-8", - "linecount" : 6, + "linecount" : 8, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 589.0, 211.0, 83.0, 87.0 ], - "text" : "cv5, cv5_foo, etc. all work for these 4 (but not knob5 or related)" + "patching_rect" : [ 565.0, 211.0, 143.0, 114.0 ], + "text" : "cv5, cv5_foo, etc. all work for these 4 (but not knob5 or related).\nSince these inputs are all bipolar, we need to set the @min attribute to -1 (@max can be left at the default value of 1)" } } @@ -760,8 +784,8 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 589.0, 178.0, 65.0, 22.0 ], - "text" : "param cv8" + "patching_rect" : [ 594.0, 180.0, 113.0, 22.0 ], + "text" : "param cv8 @min -1" } } @@ -772,8 +796,8 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 568.0, 151.0, 65.0, 22.0 ], - "text" : "param cv7" + "patching_rect" : [ 565.0, 151.0, 113.0, 22.0 ], + "text" : "param cv7 @min -1" } } @@ -784,8 +808,8 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 544.0, 123.0, 65.0, 22.0 ], - "text" : "param cv6" + "patching_rect" : [ 532.0, 123.0, 113.0, 22.0 ], + "text" : "param cv6 @min -1" } } @@ -796,8 +820,8 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 520.0, 96.0, 65.0, 22.0 ], - "text" : "param cv5" + "patching_rect" : [ 506.0, 96.0, 113.0, 22.0 ], + "text" : "param cv5 @min -1" } } @@ -1101,7 +1125,7 @@ } , { "patchline" : { - "destination" : [ "obj-6", 2 ], + "destination" : [ "obj-20", 0 ], "source" : [ "obj-10", 0 ] } @@ -1126,6 +1150,13 @@ "source" : [ "obj-2", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-29", 0 ], + "source" : [ "obj-20", 0 ] + } + } , { "patchline" : { @@ -1226,13 +1257,6 @@ "source" : [ "obj-47", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-29", 0 ], - "source" : [ "obj-6", 0 ] - } - } ] } From ae21491517dcb539a3461f499dd509bced84b2e4 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 18 Apr 2022 14:35:51 -0600 Subject: [PATCH 065/100] Restored previous logic flow --- templates/oopsy_patch_init.maxpat | 42 +++++++------------------------ 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/templates/oopsy_patch_init.maxpat b/templates/oopsy_patch_init.maxpat index 6ea73c9..1f46f20 100644 --- a/templates/oopsy_patch_init.maxpat +++ b/templates/oopsy_patch_init.maxpat @@ -575,30 +575,6 @@ "subpatcher_template" : "", "assistshowspatchername" : 0, "boxes" : [ { - "box" : { - "id" : "obj-21", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 565.0, 358.0, 23.0, 22.0 ], - "text" : "* 1" - } - - } -, { - "box" : { - "id" : "obj-20", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 506.0, 255.0, 26.0, 22.0 ], - "text" : "< 0" - } - - } -, { "box" : { "id" : "obj-47", "maxclass" : "newobj", @@ -772,7 +748,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 565.0, 211.0, 143.0, 114.0 ], + "patching_rect" : [ 565.0, 211.0, 146.0, 114.0 ], "text" : "cv5, cv5_foo, etc. all work for these 4 (but not knob5 or related).\nSince these inputs are all bipolar, we need to set the @min attribute to -1 (@max can be left at the default value of 1)" } @@ -1125,7 +1101,7 @@ } , { "patchline" : { - "destination" : [ "obj-20", 0 ], + "destination" : [ "obj-6", 2 ], "source" : [ "obj-10", 0 ] } @@ -1150,13 +1126,6 @@ "source" : [ "obj-2", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-29", 0 ], - "source" : [ "obj-20", 0 ] - } - } , { "patchline" : { @@ -1257,6 +1226,13 @@ "source" : [ "obj-47", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-29", 0 ], + "source" : [ "obj-6", 0 ] + } + } ] } From cda02016f836d4271ce76ac06d927d85a3328230 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Thu, 21 Apr 2022 14:33:55 -0600 Subject: [PATCH 066/100] Completed petal JSON --- source/component_defs_petalsm.json | 22 +++++++++- source/petal_125b_sm.json | 69 ++++++++++++++++++++++++------ 2 files changed, 78 insertions(+), 13 deletions(-) diff --git a/source/component_defs_petalsm.json b/source/component_defs_petalsm.json index 9a4c6c7..e3f072e 100644 --- a/source/component_defs_petalsm.json +++ b/source/component_defs_petalsm.json @@ -58,7 +58,7 @@ "mapping": [ { "name": "{name}", - "get": "({class_name}.som.knob[{index}].Value()?1.f:0.f)", + "get": "({class_name}.som.knob[{index}].Value())", "range": [ 0, 1 @@ -67,6 +67,15 @@ } ] }, + "Expression": { + "direction": "in", + "mapping": [ + { + "name": "{name}", + "get": "({class_name}.som.GetExpressionValue())" + } + ] + }, "Led": { "map_init": "", "typename": "", @@ -107,5 +116,16 @@ "set": "{class_name}.som.led[{index_r}].Set({value}); \n{class_name}.som.led[{index_g}].Set({value}); \n{class_name}.som.led[{index_b}].Set({value});" } ] + }, + "Relay": { + "map_init": "", + "typename": "", + "direction": "out", + "mapping": [ + { + "name": "{name}", + "set": "{class_name}.som.SetBypassState({value});" + } + ] } } \ No newline at end of file diff --git a/source/petal_125b_sm.json b/source/petal_125b_sm.json index 613e970..6d99b44 100644 --- a/source/petal_125b_sm.json +++ b/source/petal_125b_sm.json @@ -2,52 +2,97 @@ "name": "petal_125b_sm", "som": "petal_125b_sm", "audio": { - "channels": 2 + "channels": 1 }, "components": { "knob_1": { "component": "AnalogControl", - "index": 0 + "index": 0, + "is_default": true }, "knob_2": { "component": "AnalogControl", - "index": 1 + "index": 1, + "is_default": true }, "knob_3": { "component": "AnalogControl", - "index": 2 + "index": 2, + "is_default": true }, "knob_4": { "component": "AnalogControl", - "index": 3 + "index": 3, + "is_default": true }, "knob_5": { "component": "AnalogControl", - "index": 4 + "index": 4, + "is_default": true }, "knob_6": { "component": "AnalogControl", - "index": 5 + "index": 5, + "is_default": true + }, + "expression": { + "component": "Expression", + "is_default": true }, "toggle_1": { "component": "Switch3", - "index": 0 + "index": 0, + "is_default": true }, "toggle_2": { "component": "Switch3", - "index": 1 + "index": 1, + "is_default": true }, "toggle_3": { "component": "Switch3", - "index": 2 + "index": 2, + "is_default": true }, "footswitch_1": { "component": "Switch", - "index": 1 + "index": 1, + "is_default": true }, "footswitch_2": { "component": "Switch", - "index": 2 + "index": 2, + "is_default": true + }, + "led1": { + "component": "RgbLed", + "index": {"r": 0, "g": 1, "b": 2}, + "is_default": true + }, + "led2": { + "component": "Led", + "index": 3, + "is_default": true + }, + "led3": { + "component": "RgbLed", + "index": {"r": 4, "g": 5, "b": 6}, + "is_default": true + }, + "relay": { + "component": "Relay", + "is_default": true } + }, + "aliases": { + "knob1": "knob_1", + "knob2": "knob_2", + "knob3": "knob_3", + "knob4": "knob_4", + "knob5": "knob_5", + "knob6": "knob_6", + "sw1": "toggle_1", + "sw2": "toggle_2", + "sw3": "toggle_3" } } \ No newline at end of file From ef07de8ca638d0f659dc8892176888a6846e30ea Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Thu, 21 Apr 2022 14:34:23 -0600 Subject: [PATCH 067/100] Updated generation code for petal sm --- source/genlib_daisy.h | 16 +++++++++++----- source/json2daisy.js | 5 +++-- source/oopsy.js | 14 ++++++++++---- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index c81897b..700533a 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -154,13 +154,17 @@ namespace oopsy { struct GenDaisy { Daisy hardware; - #ifdef OOPSY_SOM_PATCH_SM - daisy::patch_sm::DaisyPatchSM *som = &hardware.som; + #ifdef OOPSY_SOM_PETAL_SM + daisy::Petal125BSM *som = &hardware.som; #else - #ifdef OOPSY_OLD_JSON - daisy::DaisySeed *som = &hardware.seed; + #ifdef OOPSY_SOM_PATCH_SM + daisy::patch_sm::DaisyPatchSM *som = &hardware.som; #else - daisy::DaisySeed *som = &hardware.som; + #ifdef OOPSY_OLD_JSON + daisy::DaisySeed *som = &hardware.seed; + #else + daisy::DaisySeed *som = &hardware.som; + #endif #endif #endif AppDef * appdefs = nullptr; @@ -532,7 +536,9 @@ namespace oopsy { t = t1; // pulse seed LED for status according to CPU usage: + #ifndef OOPSY_SOM_PETAL_SM som->SetLed((t % 1000)/10 <= uint32_t(audioCpuUsage)); + #endif if (app_load_scheduled) { app_load_scheduled = 0; diff --git a/source/json2daisy.js b/source/json2daisy.js index fac5ba6..08eead4 100644 --- a/source/json2daisy.js +++ b/source/json2daisy.js @@ -434,7 +434,7 @@ ${replacements.name != '' ? `struct Daisy${replacements.name[0].toUpperCase()}${ void ProcessAllControls() { ${replacements.process} - ${replacements.som == 'patch_sm' ? 'som.ProcessAllControls();' : ''} + ${replacements.som == 'patch_sm' || replacements.som == 'petal_125b_sm' ? 'som.ProcessAllControls();' : ''} } /** Handles all the maintenance processing. This should be run last within the audio callback. @@ -443,6 +443,7 @@ ${replacements.name != '' ? `struct Daisy${replacements.name[0].toUpperCase()}${ void PostProcess() { ${replacements.postprocess} + ${replacements.som == 'petal_125b_sm' ? 'som.UpdateLeds();' : ''} } /** Handles processing that shouldn't occur in the audio block, such as blocking transfers @@ -488,7 +489,7 @@ ${replacements.name != '' ? `struct Daisy${replacements.name[0].toUpperCase()}${ */ void SetAudioSampleRate(daisy::SaiHandle::Config::SampleRate sample_rate) { - ${som == 'seed' ? 'som.SetAudioSampleRate(sample_rate);' : + ${som == 'seed' || som == 'petal_125b_sm' ? 'som.SetAudioSampleRate(sample_rate);' : `size_t hz_rate; switch (sample_rate) { diff --git a/source/oopsy.js b/source/oopsy.js index 15de5da..419e670 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -337,6 +337,7 @@ function run() { case "patch_init": target_path = path.join(__dirname, "patch_init.json"); break; case "field": target_path = path.join(__dirname, "field.json"); break; case "petal": target_path = path.join(__dirname, "petal.json"); break; + case "petal_125b_sm": target_path = path.join(__dirname, "petal_125b_sm.json"); break; case "patch": target_path = path.join(__dirname, "patch.json"); break; case "watch": watch=true; break; @@ -405,7 +406,7 @@ function run() { let OOPSY_TARGET_SEED = 0 - let valid_soms = ['seed', 'patch_sm']; + let valid_soms = ['seed', 'patch_sm', 'petal_125b_sm']; let som = 'seed'; let old_json = false; @@ -589,6 +590,9 @@ function run() { if (hardware.som == 'patch_sm') { hardware.defines.OOPSY_SOM_PATCH_SM = 1; } + else if (hardware.som == 'petal_125b_sm') { + hardware.defines.OOPSY_SOM_PETAL_SM = 1; + } const makefile_path = path.join(build_path, `Makefile`) const bin_path = path.join(build_path, "build", build_name+".bin"); @@ -597,7 +601,8 @@ function run() { # Project Name TARGET = ${build_name} # Sources -- note, won't work with paths with spaces -CPP_SOURCES = ${posixify_path(path.relative(build_path, maincpp_path).replace(" ", "\\ "))} +CPP_SOURCES = ${posixify_path(path.relative(build_path, maincpp_path).replace(" ", "\\ "))} \\ +${posixify_path(path.relative(build_path, path.join(__dirname, "petal_sm", "daisy_petal_125b_sm.cpp")))} # Library Locations LIBDAISY_DIR = ${(posixify_path(path.relative(build_path, path.join(__dirname, "libdaisy"))).replace(" ", "\\ "))} ${hardware.defines.OOPSY_TARGET_USES_SDMMC ? `USE_FATFS = 1`:``} @@ -607,7 +612,8 @@ OPT = -O3 SYSTEM_FILES_DIR = $(LIBDAISY_DIR)/core include $(SYSTEM_FILES_DIR)/Makefile # Include the gen_dsp files -CFLAGS+=-I"${posixify_path(path.relative(build_path, path.join(__dirname, "gen_dsp")))}" +CFLAGS+=-I"${posixify_path(path.relative(build_path, path.join(__dirname, "gen_dsp")))}" \\ +-I${posixify_path(path.relative(build_path, path.join(__dirname, "petal_sm")))} # Silence irritating warnings: CFLAGS+=-O3 -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable CPPFLAGS+=-O3 -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable @@ -1595,7 +1601,7 @@ struct App_${name} : public oopsy::App { memcpy(${node.name}, ${node.src}, sizeof(float)*size);` : ` memset(${node.name}, 0, sizeof(float)*size);`).join("")} ${app.inserts.concat(hardware.inserts).filter(o => o.where == "post_audio").map(o => o.code).join("\n\t")} - ${hardware.som == 'seed' ? "hardware.PostProcess();" : ""} + ${hardware.som == 'seed' || hardware.som == 'petal_125b_sm' ? "hardware.PostProcess();" : ""} } void mainloopCallback(oopsy::GenDaisy& daisy, uint32_t t, uint32_t dt) { From aadd2de5f2d2b1ccd5f4bc38c8ad645b4bbd581b Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Thu, 21 Apr 2022 14:34:41 -0600 Subject: [PATCH 068/100] Added callback rate updates for petal components --- source/petal_sm/daisy_petal_125b_sm.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/petal_sm/daisy_petal_125b_sm.cpp b/source/petal_sm/daisy_petal_125b_sm.cpp index 1db80c2..2c522b7 100644 --- a/source/petal_sm/daisy_petal_125b_sm.cpp +++ b/source/petal_sm/daisy_petal_125b_sm.cpp @@ -182,6 +182,10 @@ namespace daisy { audio.SetSampleRate(samplerate); callback_rate_ = AudioSampleRate() / AudioBlockSize(); + for (size_t i = 0; i < LED_LAST; i++) + led[i].SetSampleRate(callback_rate_); + for (size_t i = 0; i < KNOB_LAST; i++) + knob[i].SetSampleRate(callback_rate_); } float Petal125BSM::AudioSampleRate() @@ -193,6 +197,10 @@ namespace daisy { audio.SetBlockSize(blocksize); callback_rate_ = AudioSampleRate() / AudioBlockSize(); + for (size_t i = 0; i < LED_LAST; i++) + led[i].SetSampleRate(callback_rate_); + for (size_t i = 0; i < KNOB_LAST; i++) + knob[i].SetSampleRate(callback_rate_); } size_t Petal125BSM::AudioBlockSize() From ccc82da01f922bc9b3ff19ca34a0e2903edb2a5b Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Thu, 21 Apr 2022 14:34:53 -0600 Subject: [PATCH 069/100] Added petal option to oopsy object --- patchers/oopsy.maxpat | 4 +- templates/oopsy_petal_125b_sm.maxpat | 341 +++++++++++++++++---------- 2 files changed, 225 insertions(+), 120 deletions(-) diff --git a/patchers/oopsy.maxpat b/patchers/oopsy.maxpat index 9ad1656..b9d217f 100644 --- a/patchers/oopsy.maxpat +++ b/patchers/oopsy.maxpat @@ -353,7 +353,7 @@ "box" : { "fontsize" : 9.0, "id" : "obj-76", - "items" : [ "patch", ",", "patch_init", ",", "field", ",", "petal", ",", "pod", ",", "versio", ",", "bluemchen", ",", "nehcmeulb" ], + "items" : [ "patch", ",", "patch_init", ",", "field", ",", "petal", ",", "petal_125b_sm", ",", "pod", ",", "versio", ",", "bluemchen", ",", "nehcmeulb" ], "maxclass" : "umenu", "numinlets" : 1, "numoutlets" : 3, @@ -1339,6 +1339,8 @@ "saved_object_attributes" : { "autostart" : 0, "defer" : 0, + "node_bin_path" : "", + "npm_bin_path" : "", "watch" : 0 } , diff --git a/templates/oopsy_petal_125b_sm.maxpat b/templates/oopsy_petal_125b_sm.maxpat index a12a785..7798219 100644 --- a/templates/oopsy_petal_125b_sm.maxpat +++ b/templates/oopsy_petal_125b_sm.maxpat @@ -10,7 +10,7 @@ } , "classnamespace" : "box", - "rect" : [ 487.0, 95.0, 871.0, 640.0 ], + "rect" : [ 388.0, 94.0, 439.0, 640.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -272,7 +272,7 @@ "fontsize" : 24.0, "id" : "obj-16", "maxclass" : "newobj", - "numinlets" : 2, + "numinlets" : 1, "numoutlets" : 7, "outlettype" : [ "signal", "signal", "signal", "signal", "signal", "signal", "signal" ], "patcher" : { @@ -286,7 +286,7 @@ } , "classnamespace" : "dsp.gen", - "rect" : [ 67.0, 198.0, 1141.0, 427.0 ], + "rect" : [ 64.0, 203.0, 1141.0, 427.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -316,71 +316,118 @@ "assistshowspatchername" : 0, "boxes" : [ { "box" : { - "id" : "obj-29", + "id" : "obj-47", + "linecount" : 2, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 489.0, 238.0, 150.0, 33.0 ], + "text" : "Cycle through RGB spectrum" + } + + } +, { + "box" : { + "id" : "obj-44", + "linecount" : 3, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 818.0, 306.0, 150.0, 47.0 ], + "text" : "The LED will go dark when the petal is set to bypass" + } + + } +, { + "box" : { + "id" : "obj-42", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 621.5, 305.0, 69.0, 22.0 ], + "text" : "expr 1 - in1" + } + + } +, { + "box" : { + "id" : "obj-41", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 341.0, 209.600000000000023, 72.0, 22.0 ], + "text" : "expr in1 * pi" + } + + } +, { + "box" : { + "id" : "obj-40", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 587.0, 372.0, 95.0, 22.0 ], - "text" : "out 7 led_ring_1" + "patching_rect" : [ 381.5, 340.0, 91.0, 22.0 ], + "text" : "out 5 led3_blue" } } , { "box" : { - "id" : "obj-28", + "id" : "obj-36", "maxclass" : "newobj", - "numinlets" : 0, - "numoutlets" : 2, - "outlettype" : [ "", "" ], - "patching_rect" : [ 628.0, 314.0, 46.0, 22.0 ], - "text" : "cycle 1" + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 359.5, 366.0, 99.0, 22.0 ], + "text" : "out 4 led3_green" } } , { "box" : { - "id" : "obj-13", + "id" : "obj-35", "maxclass" : "newobj", - "numinlets" : 2, + "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 77.0, 221.0, 29.5, 22.0 ], - "text" : "*" + "patching_rect" : [ 381.5, 309.0, 184.0, 22.0 ], + "text" : "expr sin(in1 + pi * 1.2) * 0.5 + 0.5" } } , { "box" : { - "id" : "obj-12", + "id" : "obj-34", "maxclass" : "newobj", - "numinlets" : 0, + "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 77.0, 178.0, 37.0, 22.0 ], - "text" : "noise" + "patching_rect" : [ 359.5, 278.0, 184.0, 22.0 ], + "text" : "expr sin(in1 + pi * 0.6) * 0.5 + 0.5" } } , { "box" : { - "id" : "obj-10", + "id" : "obj-33", "maxclass" : "newobj", - "numinlets" : 2, + "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 77.0, 264.0, 29.5, 22.0 ], - "text" : "*" + "patching_rect" : [ 341.0, 249.0, 133.0, 22.0 ], + "text" : "expr sin(in1) * 0.5 + 0.5" } } , { "box" : { - "id" : "obj-26", + "id" : "obj-32", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 458.140522875816941, 341.0, 61.0, 22.0 ], - "text" : "out 6 led4" + "patching_rect" : [ 341.0, 392.0, 85.0, 22.0 ], + "text" : "out 3 led3_red" } } @@ -388,92 +435,140 @@ "box" : { "id" : "obj-27", "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 743.5, 112.400000000000006, 113.0, 22.0 ], + "text" : "param footswitch_2" + } + + } +, { + "box" : { + "id" : "obj-21", + "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 381.5, 341.0, 61.0, 22.0 ], - "text" : "out 5 led3" + "patching_rect" : [ 730.0, 340.0, 65.0, 22.0 ], + "text" : "out 7 relay" } } , { "box" : { - "id" : "obj-25", + "id" : "obj-20", "maxclass" : "newobj", "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 301.140522875816941, 341.0, 61.0, 22.0 ], - "text" : "out 4 led2" + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 730.0, 185.600000000000023, 61.0, 22.0 ], + "text" : "clamp 0 1" } } , { "box" : { - "id" : "obj-24", + "id" : "obj-18", "maxclass" : "newobj", "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 235.5, 341.0, 61.0, 22.0 ], - "text" : "out 3 led1" + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 730.0, 157.0, 48.0, 22.0 ], + "text" : "change" } } , { "box" : { - "id" : "obj-23", + "id" : "obj-5", "maxclass" : "newobj", "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 535.5, 88.0, 65.0, 22.0 ], - "text" : "param exp" + "patching_rect" : [ 730.0, 88.0, 113.0, 22.0 ], + "text" : "param footswitch_1" } } , { "box" : { - "id" : "obj-20", + "id" : "obj-3", "maxclass" : "newobj", - "numinlets" : 0, + "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 320.547120418848181, 230.30375586854467, 67.0, 22.0 ], - "text" : "param sw7" + "patching_rect" : [ 730.0, 216.0, 92.0, 22.0 ], + "text" : "accum @max 2" } } , { "box" : { - "id" : "obj-21", + "id" : "obj-13", "maxclass" : "newobj", - "numinlets" : 0, + "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 307.515706806282765, 206.586463223787234, 67.0, 22.0 ], - "text" : "param sw6" + "patching_rect" : [ 77.0, 221.0, 29.5, 22.0 ], + "text" : "*" } } , { "box" : { - "id" : "obj-22", + "id" : "obj-12", "maxclass" : "newobj", "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 291.74083769633512, 182.86917057902977, 67.0, 22.0 ], - "text" : "param sw5" + "patching_rect" : [ 77.0, 178.0, 37.0, 22.0 ], + "text" : "noise" } } , { "box" : { - "id" : "obj-18", + "id" : "obj-10", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 77.0, 264.0, 29.5, 22.0 ], + "text" : "*" + } + + } +, { + "box" : { + "id" : "obj-25", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 248.531413612565416, 342.0, 61.0, 22.0 ], + "text" : "out 2 led2" + } + + } +, { + "box" : { + "id" : "obj-24", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 621.5, 340.0, 96.0, 22.0 ], + "text" : "out 6 led1_white" + } + + } +, { + "box" : { + "id" : "obj-23", "maxclass" : "newobj", "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 277.33769633507859, 159.151877934272306, 67.0, 22.0 ], - "text" : "param sw4" + "patching_rect" : [ 575.5, 88.0, 104.0, 22.0 ], + "text" : "param expression" } } @@ -496,8 +591,8 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 458.140522875816941, 210.0, 176.0, 22.0 ], - "text" : "param knob6 @min -1 @max 1" + "patching_rect" : [ 458.140522875816941, 210.0, 79.0, 22.0 ], + "text" : "param knob6" } } @@ -532,8 +627,8 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 412.833333333333258, 136.800000000000011, 79.0, 22.0 ], - "text" : "param knob3" + "patching_rect" : [ 412.833333333333258, 136.800000000000011, 176.0, 22.0 ], + "text" : "param knob3 @min -1 @max 1" } } @@ -568,7 +663,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 1000.5, 88.0, 107.0, 22.0 ], + "patching_rect" : [ 898.5, 88.0, 107.0, 22.0 ], "text" : "oopsy.suggestions" } @@ -641,29 +736,6 @@ "text" : "Audio IOs" } - } -, { - "box" : { - "id" : "obj-3", - "maxclass" : "newobj", - "numinlets" : 0, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 167.5, 88.0, 28.0, 22.0 ], - "text" : "in 2" - } - - } -, { - "box" : { - "id" : "obj-5", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 167.5, 342.0, 35.0, 22.0 ], - "text" : "out 2" - } - } , { "box" : { @@ -699,15 +771,6 @@ , { "patchline" : { "destination" : [ "obj-4", 0 ], - "order" : 1, - "source" : [ "obj-10", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-5", 0 ], - "order" : 0, "source" : [ "obj-10", 0 ] } @@ -728,15 +791,15 @@ } , { "patchline" : { - "destination" : [ "obj-26", 0 ], - "source" : [ "obj-15", 0 ] + "destination" : [ "obj-20", 0 ], + "source" : [ "obj-18", 0 ] } } , { "patchline" : { - "destination" : [ "obj-27", 0 ], - "source" : [ "obj-16", 0 ] + "destination" : [ "obj-13", 1 ], + "source" : [ "obj-19", 0 ] } } @@ -749,43 +812,97 @@ } , { "patchline" : { - "destination" : [ "obj-13", 1 ], - "source" : [ "obj-22", 0 ] + "destination" : [ "obj-3", 0 ], + "source" : [ "obj-20", 0 ] } } , { "patchline" : { - "destination" : [ "obj-25", 0 ], - "source" : [ "obj-28", 0 ] + "destination" : [ "obj-21", 0 ], + "order" : 0, + "source" : [ "obj-3", 0 ] } } , { "patchline" : { - "destination" : [ "obj-5", 0 ], + "destination" : [ "obj-42", 0 ], + "order" : 1, "source" : [ "obj-3", 0 ] } } , { "patchline" : { - "destination" : [ "obj-25", 0 ], - "source" : [ "obj-6", 0 ] + "destination" : [ "obj-32", 0 ], + "source" : [ "obj-33", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-36", 0 ], + "source" : [ "obj-34", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-40", 0 ], + "source" : [ "obj-35", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-33", 0 ], + "order" : 2, + "source" : [ "obj-41", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-34", 0 ], + "order" : 1, + "source" : [ "obj-41", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-35", 0 ], + "order" : 0, + "source" : [ "obj-41", 0 ] } } , { "patchline" : { "destination" : [ "obj-24", 0 ], - "source" : [ "obj-7", 0 ] + "source" : [ "obj-42", 0 ] } } , { "patchline" : { - "destination" : [ "obj-29", 0 ], - "source" : [ "obj-8", 0 ] + "destination" : [ "obj-18", 0 ], + "source" : [ "obj-5", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-25", 0 ], + "source" : [ "obj-6", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-41", 0 ], + "source" : [ "obj-9", 0 ] } } @@ -831,20 +948,6 @@ "source" : [ "obj-16", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-12", 0 ], - "source" : [ "obj-16", 5 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-14", 0 ], - "source" : [ "obj-16", 4 ] - } - } , { "patchline" : { From cb497ba78f6aa556c00453a5e02bc8def8fb9231 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 2 May 2022 16:52:09 -0600 Subject: [PATCH 070/100] Updated libdaisy commit This brings the gate polarity option. --- source/libdaisy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libdaisy b/source/libdaisy index c8a34a7..04dd336 160000 --- a/source/libdaisy +++ b/source/libdaisy @@ -1 +1 @@ -Subproject commit c8a34a7c47dc1bb2c4ea704fd5c09d3008dcd472 +Subproject commit 04dd33614ab67fde6deae3ec0bc60a0ad128e3c3 From f03f402ad12af74112a2bddf62fcdc3bcbadea8c Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 2 May 2022 16:52:33 -0600 Subject: [PATCH 071/100] Added gate polarity to JSON --- source/component_defs.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/component_defs.json b/source/component_defs.json index 9d3018c..935ff5f 100644 --- a/source/component_defs.json +++ b/source/component_defs.json @@ -104,10 +104,11 @@ ] }, "GateIn": { - "map_init": "dsy_gpio_pin {name}_pin = som.GetPin({pin});\n {name}.Init(&{name}_pin);", + "map_init": "dsy_gpio_pin {name}_pin = som.GetPin({pin});\n {name}.Init(&{name}_pin, {invert});", "typename": "daisy::GateIn", "direction": "in", "pin": "a", + "invert": "true", "mapping": [ { "name": "{name}", From b9eac29d75ba28c1a5674b4222a02f4bab080000 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 2 May 2022 16:52:50 -0600 Subject: [PATCH 072/100] Fixed seed bipolar bug --- source/component_defs.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/component_defs.json b/source/component_defs.json index 935ff5f..7982a56 100644 --- a/source/component_defs.json +++ b/source/component_defs.json @@ -379,7 +379,7 @@ "name": "{name}", "get": "({class_name}.{name}.Value())", "range": [ - 0, + -1, 1 ], "bool": false From 82cf61f9595f575529c4fcf89f16415bba539843 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Wed, 4 May 2022 14:56:08 -0600 Subject: [PATCH 073/100] Added build_path output for Build button --- patchers/oopsy.maxpat | 175 +++++++++++++++++++++++++++++++++++------- source/oopsy.js | 1 + 2 files changed, 150 insertions(+), 26 deletions(-) diff --git a/patchers/oopsy.maxpat b/patchers/oopsy.maxpat index 3a3ccc9..4c80d3f 100644 --- a/patchers/oopsy.maxpat +++ b/patchers/oopsy.maxpat @@ -10,7 +10,7 @@ } , "classnamespace" : "box", - "rect" : [ 140.0, 79.0, 1182.0, 558.0 ], + "rect" : [ 178.0, 104.0, 721.0, 654.0 ], "bglocked" : 0, "openinpresentation" : 1, "default_fontsize" : 12.0, @@ -39,6 +39,96 @@ "subpatcher_template" : "", "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "id" : "obj-68", + "linecount" : 4, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 15.5, 577.0, 150.0, 60.0 ], + "text" : "these objects grab the build path and allow users to open a file browser right to it" + } + + } +, { + "box" : { + "id" : "obj-65", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 2, + "outlettype" : [ "", "int" ], + "patching_rect" : [ 170.0, 608.0, 159.0, 22.0 ], + "text" : "conformpath native absolute" + } + + } +, { + "box" : { + "fontsize" : 10.0, + "id" : "obj-61", + "maxclass" : "textbutton", + "numinlets" : 1, + "numoutlets" : 3, + "outlettype" : [ "", "", "int" ], + "parameter_enable" : 0, + "patching_rect" : [ 70.0, 647.0, 41.0, 19.0 ], + "presentation" : 1, + "presentation_rect" : [ 120.0, 19.0, 50.0, 19.0 ], + "text" : "Build" + } + + } +, { + "box" : { + "id" : "obj-60", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 2, + "outlettype" : [ "", "" ], + "patching_rect" : [ 295.0, 562.0, 95.0, 22.0 ], + "text" : "route build_path" + } + + } +, { + "box" : { + "id" : "obj-58", + "linecount" : 3, + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 170.0, 647.0, 83.0, 49.0 ], + "text" : "sprintf \"; max launchbrowser \\\"file://%s\\\"\"" + } + + } +, { + "box" : { + "id" : "obj-52", + "maxclass" : "message", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 763.0, 394.0, 57.0, 22.0 ], + "text" : "/usr/local" + } + + } +, { + "box" : { + "id" : "obj-23", + "linecount" : 2, + "maxclass" : "message", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 70.0, 713.0, 141.0, 35.0 ], + "text" : ";\rmax launchbrowser file://" + } + + } +, { "box" : { "id" : "obj-20", "maxclass" : "button", @@ -134,7 +224,7 @@ "parameter_enable" : 1, "patching_rect" : [ 735.0, 298.0, 52.5, 20.0 ], "presentation" : 1, - "presentation_rect" : [ 75.0, 37.0, 54.0, 15.0 ], + "presentation_rect" : [ 102.0, 37.0, 69.0, 15.0 ], "saved_attribute_attributes" : { "valueof" : { "parameter_enum" : [ "Off", "On" ], @@ -166,7 +256,7 @@ "parameter_enable" : 1, "patching_rect" : [ 554.0, 298.0, 43.5, 20.0 ], "presentation" : 1, - "presentation_rect" : [ 37.0, 37.0, 40.0, 15.0 ], + "presentation_rect" : [ 47.0, 37.0, 60.0, 15.0 ], "saved_attribute_attributes" : { "valueof" : { "parameter_enum" : [ "Off", "On" ], @@ -198,7 +288,7 @@ "parameter_enable" : 0, "patching_rect" : [ 179.0, 315.0, 85.0, 19.0 ], "presentation" : 1, - "presentation_rect" : [ 86.0, 19.0, 42.0, 19.0 ] + "presentation_rect" : [ 86.0, 19.0, 35.0, 19.0 ] } } @@ -301,7 +391,7 @@ "parameter_enable" : 1, "patching_rect" : [ 742.0, 516.0, 62.0, 16.0 ], "presentation" : 1, - "presentation_rect" : [ -1.0, 37.0, 39.999999642372131, 15.0 ], + "presentation_rect" : [ -1.0, 37.0, 52.999999642372131, 15.0 ], "saved_attribute_attributes" : { "valueof" : { "parameter_enum" : [ "Off", "On" ], @@ -344,7 +434,7 @@ "parameter_enable" : 0, "patching_rect" : [ 377.5, 263.0, 41.0, 19.0 ], "presentation" : 1, - "presentation_rect" : [ 86.0, 0.0, 42.0, 19.0 ], + "presentation_rect" : [ 120.0, 0.0, 50.0, 19.0 ], "text" : "Browse" } @@ -361,7 +451,7 @@ "parameter_enable" : 0, "patching_rect" : [ 330.5, 315.0, 100.0, 19.0 ], "presentation" : 1, - "presentation_rect" : [ 38.0, 0.0, 50.0, 19.0 ] + "presentation_rect" : [ 38.0, 0.0, 83.0, 19.0 ] } } @@ -1192,7 +1282,7 @@ "parameter_enable" : 0, "patching_rect" : [ 371.0, 690.0, 114.0, 58.0 ], "presentation" : 1, - "presentation_rect" : [ 0.0, 48.0, 129.0, 80.0 ], + "presentation_rect" : [ 0.0, 48.0, 170.0, 124.0 ], "readonly" : 1, "rounded" : 0.0, "separator" : "newline", @@ -1308,7 +1398,7 @@ "numinlets" : 2, "numoutlets" : 2, "outlettype" : [ "", "" ], - "patching_rect" : [ 580.0, 522.0, 102.0, 22.0 ], + "patching_rect" : [ 580.0, 525.0, 102.0, 22.0 ], "text" : "route terminated" } @@ -1340,8 +1430,6 @@ "saved_object_attributes" : { "autostart" : 0, "defer" : 0, - "node_bin_path" : "", - "npm_bin_path" : "", "watch" : 0 } , @@ -1613,27 +1701,17 @@ } , { "patchline" : { - "destination" : [ "obj-13", 1 ], - "midpoints" : [ 380.5, 551.5, 672.5, 551.5 ], - "order" : 0, - "source" : [ "obj-2", 0 ] + "destination" : [ "obj-42", 0 ], + "source" : [ "obj-2", 1 ] } } , { "patchline" : { - "destination" : [ "obj-35", 0 ], - "order" : 1, + "destination" : [ "obj-60", 0 ], "source" : [ "obj-2", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-42", 0 ], - "source" : [ "obj-2", 1 ] - } - } , { "patchline" : { @@ -1924,6 +2002,13 @@ "source" : [ "obj-57", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-23", 1 ], + "source" : [ "obj-58", 0 ] + } + } , { "patchline" : { @@ -1931,6 +2016,37 @@ "source" : [ "obj-6", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-13", 1 ], + "midpoints" : [ 380.5, 646.0, 549.5, 646.0, 549.5, 572.0, 672.5, 572.0 ], + "order" : 0, + "source" : [ "obj-60", 1 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-35", 0 ], + "order" : 1, + "source" : [ "obj-60", 1 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-65", 0 ], + "source" : [ "obj-60", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-23", 0 ], + "source" : [ "obj-61", 0 ] + } + } , { "patchline" : { @@ -1938,6 +2054,13 @@ "source" : [ "obj-62", 1 ] } + } +, { + "patchline" : { + "destination" : [ "obj-58", 0 ], + "source" : [ "obj-65", 0 ] + } + } , { "patchline" : { @@ -1988,14 +2111,14 @@ , "dependency_cache" : [ { "name" : "oopsy.snoop.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/javascript", "patcherrelativepath" : "../javascript", "type" : "TEXT", "implicit" : 1 } , { "name" : "oopsy.node4max.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/javascript", "patcherrelativepath" : "../javascript", "type" : "TEXT", "implicit" : 1 diff --git a/source/oopsy.js b/source/oopsy.js index 15de5da..c187a67 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -547,6 +547,7 @@ function run() { // configure build path: const build_path = path.join(__dirname, `build_${build_name}_${target}`) + console.log(`build_path ${path.join(build_path, 'build')}`) console.log(`Building to ${build_path}`) // ensure build path exists: fs.mkdirSync(build_path, {recursive: true}); From cb6714b4462cd4e557aaab6c6a03573593d57e03 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Wed, 4 May 2022 14:56:24 -0600 Subject: [PATCH 074/100] Added build path catcher --- javascript/oopsy.node4max.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/javascript/oopsy.node4max.js b/javascript/oopsy.node4max.js index 52b4fdb..64df913 100644 --- a/javascript/oopsy.node4max.js +++ b/javascript/oopsy.node4max.js @@ -17,7 +17,10 @@ process.stdout.write = (function() { if (match = str.match(/^oopsy (.*)/i)) { //maxAPI.outlet(match[1]) // Node was timing out here, so we set up an interval reader instead msgs.push(match[1]) - } + } + if (match = str.match(/^build_path (.*)/i)) { + msgs.push(['build_path', match[1]]) + } } })(); From db12fe5d24159ac507c0907f7ba650839c750b72 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Wed, 4 May 2022 14:56:51 -0600 Subject: [PATCH 075/100] Updated templates for larger oopsy object --- init/oopsy-objectmappings.txt | 14 +-- templates/oopsy_bluemchen.maxpat | 73 ++++++----- templates/oopsy_field.maxpat | 115 +++++++++-------- templates/oopsy_nehcmeulb.maxpat | 64 +++++----- templates/oopsy_patch.maxpat | 115 +++++++++-------- templates/oopsy_patch_init.maxpat | 2 +- templates/oopsy_petal.maxpat | 98 +++++++-------- templates/oopsy_pod.maxpat | 88 ++++++------- templates/oopsy_versio.maxpat | 201 ++++++++++++++++-------------- 9 files changed, 415 insertions(+), 355 deletions(-) diff --git a/init/oopsy-objectmappings.txt b/init/oopsy-objectmappings.txt index 41aad83..2e82ac3 100644 --- a/init/oopsy-objectmappings.txt +++ b/init/oopsy-objectmappings.txt @@ -1,14 +1,14 @@ -max definesubstitution oopsy.patch bpatcher @name oopsy.maxpat @args patch; +max definesubstitution oopsy.patch bpatcher @name oopsy.maxpat @args patch @patching_rect 256 256 171 171; max objectfile oopsy.patch oopsy.patch; -max definesubstitution oopsy.field bpatcher @name oopsy.maxpat @args field; +max definesubstitution oopsy.field bpatcher @name oopsy.maxpat @args field @patching_rect 256 256 171 171; max objectfile oopsy.field oopsy.field; -max definesubstitution oopsy.petal bpatcher @name oopsy.maxpat @args petal; +max definesubstitution oopsy.petal bpatcher @name oopsy.maxpat @args petal @patching_rect 256 256 171 171; max objectfile oopsy.petal oopsy.petal; -max definesubstitution oopsy.pod bpatcher @name oopsy.maxpat @args pod; +max definesubstitution oopsy.pod bpatcher @name oopsy.maxpat @args pod @patching_rect 256 256 171 171; max objectfile oopsy.pod oopsy.pod; -max definesubstitution oopsy.patch_init bpatcher @name oopsy.maxpat @args patch_init; +max definesubstitution oopsy.patch_init bpatcher @name oopsy.maxpat @args patch_init @patching_rect 256 256 171 171; max objectfile oopsy.patch_init oopsy.patch_init; -max definesubstitution oopsy.bluemchen bpatcher @name oopsy.maxpat @args bluemchen; +max definesubstitution oopsy.bluemchen bpatcher @name oopsy.maxpat @args bluemchen @patching_rect 256 256 171 171; max objectfile oopsy.bluemchen oopsy.bluemchen; -max definesubstitution oopsy.nehcmeulb bpatcher @name oopsy.maxpat @args nehcmeulb; +max definesubstitution oopsy.nehcmeulb bpatcher @name oopsy.maxpat @args nehcmeulb @patching_rect 256 256 171 171; max objectfile oopsy.nehcmeulb oopsy.nehcmeulb; diff --git a/templates/oopsy_bluemchen.maxpat b/templates/oopsy_bluemchen.maxpat index 6fb3119..79e14e2 100644 --- a/templates/oopsy_bluemchen.maxpat +++ b/templates/oopsy_bluemchen.maxpat @@ -4,7 +4,7 @@ "appversion" : { "major" : 8, "minor" : 1, - "revision" : 8, + "revision" : 11, "architecture" : "x64", "modernui" : 1 } @@ -39,6 +39,26 @@ "subpatcher_template" : "oopsy_bluemchen", "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "args" : [ "bluemchen" ], + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-1", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "oopsy.maxpat", + "numinlets" : 1, + "numoutlets" : 0, + "offset" : [ 0.0, 0.0 ], + "patching_rect" : [ 215.0, 230.0, 171.0, 171.0 ], + "viewvisibility" : 1 + } + + } +, { "box" : { "id" : "obj-2", "maxclass" : "comment", @@ -97,26 +117,6 @@ "varname" : "live.gain~" } - } -, { - "box" : { - "args" : [ "@target", "bluemchen" ], - "bgmode" : 0, - "border" : 0, - "clickthrough" : 0, - "enablehscroll" : 0, - "enablevscroll" : 0, - "id" : "obj-9", - "lockeddragscroll" : 0, - "maxclass" : "bpatcher", - "name" : "oopsy.maxpat", - "numinlets" : 1, - "numoutlets" : 0, - "offset" : [ 0.0, 0.0 ], - "patching_rect" : [ 240.0, 230.0, 128.0, 128.0 ], - "viewvisibility" : 1 - } - } , { "box" : { @@ -131,7 +131,7 @@ "appversion" : { "major" : 8, "minor" : 1, - "revision" : 8, + "revision" : 11, "architecture" : "x64", "modernui" : 1 } @@ -454,7 +454,7 @@ , "patching_rect" : [ 40.0, 230.0, 144.0, 35.0 ], "saved_object_attributes" : { - "exportfolder" : "Macintosh HD:/Users/grrrwaaa/Documents/Max 8/Packages/oopsy/templates/", + "exportfolder" : "macOS:/Users/corvus/Documents/Max 8/Packages/Oopsy/templates/", "exportname" : "oopsy_bluemchen" } , @@ -571,11 +571,26 @@ ], "parameters" : { "obj-11" : [ "live.gain~", "live.gain~", 0 ], - "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], - "obj-9::obj-33" : [ "live.text[1]", "FILTER", 0 ], - "obj-9::obj-34" : [ "live.text[3]", "FILTER", 0 ], + "obj-1::obj-32" : [ "live.text[6]", "FILTER", 0 ], + "obj-1::obj-33" : [ "live.text[4]", "FILTER", 0 ], + "obj-1::obj-34" : [ "live.text[5]", "FILTER", 0 ], "parameterbanks" : { + } +, + "parameter_overrides" : { + "obj-1::obj-32" : { + "parameter_longname" : "live.text[6]" + } +, + "obj-1::obj-33" : { + "parameter_longname" : "live.text[4]" + } +, + "obj-1::obj-34" : { + "parameter_longname" : "live.text[5]" + } + } , "inherited_shortname" : 1 @@ -583,21 +598,21 @@ , "dependency_cache" : [ { "name" : "oopsy.maxpat", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/patchers", "patcherrelativepath" : "../patchers", "type" : "JSON", "implicit" : 1 } , { "name" : "oopsy.snoop.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/javascript", "patcherrelativepath" : "../javascript", "type" : "TEXT", "implicit" : 1 } , { "name" : "oopsy.node4max.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/javascript", "patcherrelativepath" : "../javascript", "type" : "TEXT", "implicit" : 1 diff --git a/templates/oopsy_field.maxpat b/templates/oopsy_field.maxpat index 578578c..8190cc2 100644 --- a/templates/oopsy_field.maxpat +++ b/templates/oopsy_field.maxpat @@ -39,6 +39,26 @@ "subpatcher_template" : "oopsy_field", "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "args" : [ "field" ], + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-15", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "oopsy.maxpat", + "numinlets" : 1, + "numoutlets" : 0, + "offset" : [ 0.0, 0.0 ], + "patching_rect" : [ 484.0, 57.0, 171.0, 171.0 ], + "viewvisibility" : 1 + } + + } +, { "box" : { "id" : "obj-23", "maxclass" : "comment", @@ -2308,7 +2328,7 @@ , "patching_rect" : [ 24.0, 290.0, 194.0, 35.0 ], "saved_object_attributes" : { - "exportfolder" : "macOS:/Users/corvus/Documents/Max 8/Packages/oopsy/templates/", + "exportfolder" : "macOS:/Users/corvus/Documents/Max 8/Packages/Oopsy/templates/", "exportname" : "oopsy_field" } , @@ -2377,26 +2397,6 @@ "patching_rect" : [ 269.0, 174.771428571428544, 150.0, 22.0 ] } - } -, { - "box" : { - "args" : [ "@target", "field" ], - "bgmode" : 0, - "border" : 0, - "clickthrough" : 0, - "enablehscroll" : 0, - "enablevscroll" : 0, - "id" : "obj-9", - "lockeddragscroll" : 0, - "maxclass" : "bpatcher", - "name" : "oopsy.maxpat", - "numinlets" : 1, - "numoutlets" : 0, - "offset" : [ 0.0, 0.0 ], - "patching_rect" : [ 567.5, 57.0, 128.0, 128.0 ], - "viewvisibility" : 1 - } - } ], "lines" : [ { @@ -2521,70 +2521,64 @@ ], "parameters" : { "obj-11" : [ "live.gain~", "live.gain~", 0 ], + "obj-15::obj-32" : [ "live.text[6]", "FILTER", 0 ], + "obj-15::obj-33" : [ "live.text[4]", "FILTER", 0 ], + "obj-15::obj-34" : [ "live.text[5]", "FILTER", 0 ], "obj-7::obj-21::obj-6" : [ "live.tab[3]", "live.tab[1]", 0 ], "obj-7::obj-35" : [ "[5]", "Level", 0 ], - "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], - "obj-9::obj-33" : [ "live.text[1]", "FILTER", 0 ], - "obj-9::obj-34" : [ "live.text[3]", "FILTER", 0 ], "parameterbanks" : { + } +, + "parameter_overrides" : { + "obj-15::obj-32" : { + "parameter_longname" : "live.text[6]" + } +, + "obj-15::obj-33" : { + "parameter_longname" : "live.text[4]" + } +, + "obj-15::obj-34" : { + "parameter_longname" : "live.text[5]" + } + } , "inherited_shortname" : 1 } , "dependency_cache" : [ { - "name" : "oopsy.maxpat", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", - "patcherrelativepath" : "../patchers", - "type" : "JSON", - "implicit" : 1 - } -, { - "name" : "oopsy.snoop.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", - "patcherrelativepath" : "../javascript", - "type" : "TEXT", - "implicit" : 1 - } -, { - "name" : "oopsy.node4max.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", - "patcherrelativepath" : "../javascript", - "type" : "TEXT", - "implicit" : 1 - } -, { "name" : "oopsy.suggestions.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { "name" : "oopsy.gate.trig.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { "name" : "oopsy.gate.min.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { "name" : "oopsy.ctrl.smooth3.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { "name" : "oopsy.ctrl.smooth2.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 @@ -2625,6 +2619,27 @@ "type" : "TEXT", "implicit" : 1 } +, { + "name" : "oopsy.maxpat", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/patchers", + "patcherrelativepath" : "../patchers", + "type" : "JSON", + "implicit" : 1 + } +, { + "name" : "oopsy.snoop.js", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "oopsy.node4max.js", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } ], "autosave" : 0 } diff --git a/templates/oopsy_nehcmeulb.maxpat b/templates/oopsy_nehcmeulb.maxpat index e32abd3..56daf02 100644 --- a/templates/oopsy_nehcmeulb.maxpat +++ b/templates/oopsy_nehcmeulb.maxpat @@ -4,13 +4,13 @@ "appversion" : { "major" : 8, "minor" : 1, - "revision" : 8, + "revision" : 11, "architecture" : "x64", "modernui" : 1 } , "classnamespace" : "box", - "rect" : [ 300.0, 426.0, 546.0, 483.0 ], + "rect" : [ 303.0, 203.0, 546.0, 483.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -39,6 +39,26 @@ "subpatcher_template" : "oopsy_bluemchen", "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "args" : [ "nehcmeulb" ], + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-7", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "oopsy.maxpat", + "numinlets" : 1, + "numoutlets" : 0, + "offset" : [ 0.0, 0.0 ], + "patching_rect" : [ 212.0, 230.0, 171.0, 171.0 ], + "viewvisibility" : 1 + } + + } +, { "box" : { "attr" : "cv1", "id" : "obj-6", @@ -109,26 +129,6 @@ "varname" : "live.gain~" } - } -, { - "box" : { - "args" : [ "@target", "nehcmeulb" ], - "bgmode" : 0, - "border" : 0, - "clickthrough" : 0, - "enablehscroll" : 0, - "enablevscroll" : 0, - "id" : "obj-9", - "lockeddragscroll" : 0, - "maxclass" : "bpatcher", - "name" : "oopsy.maxpat", - "numinlets" : 1, - "numoutlets" : 0, - "offset" : [ 0.0, 0.0 ], - "patching_rect" : [ 240.0, 230.0, 128.0, 128.0 ], - "viewvisibility" : 1 - } - } , { "box" : { @@ -136,14 +136,14 @@ "id" : "obj-3", "maxclass" : "newobj", "numinlets" : 2, - "numoutlets" : 3, - "outlettype" : [ "signal", "signal", "signal" ], + "numoutlets" : 4, + "outlettype" : [ "signal", "signal", "signal", "signal" ], "patcher" : { "fileversion" : 1, "appversion" : { "major" : 8, "minor" : 1, - "revision" : 8, + "revision" : 11, "architecture" : "x64", "modernui" : 1 } @@ -523,7 +523,7 @@ , "patching_rect" : [ 40.0, 230.0, 144.0, 35.0 ], "saved_object_attributes" : { - "exportfolder" : "Macintosh HD:/Users/grrrwaaa/Documents/Max 8/Packages/oopsy/templates/", + "exportfolder" : "macOS:/Users/corvus/Documents/Max 8/Packages/Oopsy/templates/", "exportname" : "oopsy_nehcmeulb" } , @@ -628,9 +628,9 @@ ], "parameters" : { "obj-11" : [ "live.gain~", "live.gain~", 0 ], - "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], - "obj-9::obj-33" : [ "live.text[1]", "FILTER", 0 ], - "obj-9::obj-34" : [ "live.text[3]", "FILTER", 0 ], + "obj-7::obj-32" : [ "live.text[2]", "FILTER", 0 ], + "obj-7::obj-33" : [ "live.text[1]", "FILTER", 0 ], + "obj-7::obj-34" : [ "live.text[3]", "FILTER", 0 ], "parameterbanks" : { } @@ -640,21 +640,21 @@ , "dependency_cache" : [ { "name" : "oopsy.maxpat", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/patchers", "patcherrelativepath" : "../patchers", "type" : "JSON", "implicit" : 1 } , { "name" : "oopsy.snoop.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/javascript", "patcherrelativepath" : "../javascript", "type" : "TEXT", "implicit" : 1 } , { "name" : "oopsy.node4max.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/javascript", "patcherrelativepath" : "../javascript", "type" : "TEXT", "implicit" : 1 diff --git a/templates/oopsy_patch.maxpat b/templates/oopsy_patch.maxpat index aecb29a..07f9d14 100644 --- a/templates/oopsy_patch.maxpat +++ b/templates/oopsy_patch.maxpat @@ -39,6 +39,26 @@ "subpatcher_template" : "", "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "args" : [ "patch" ], + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-15", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "oopsy.maxpat", + "numinlets" : 1, + "numoutlets" : 0, + "offset" : [ 0.0, 0.0 ], + "patching_rect" : [ 556.0, 108.0, 171.0, 171.0 ], + "viewvisibility" : 1 + } + + } +, { "box" : { "id" : "obj-25", "maxclass" : "live.dial", @@ -349,26 +369,6 @@ "viewvisibility" : 1 } - } -, { - "box" : { - "args" : [ "field", "@target", "patch" ], - "bgmode" : 0, - "border" : 0, - "clickthrough" : 0, - "enablehscroll" : 0, - "enablevscroll" : 0, - "id" : "obj-9", - "lockeddragscroll" : 0, - "maxclass" : "bpatcher", - "name" : "oopsy.maxpat", - "numinlets" : 1, - "numoutlets" : 0, - "offset" : [ 0.0, 0.0 ], - "patching_rect" : [ 614.5, 22.0, 128.0, 128.0 ], - "viewvisibility" : 1 - } - } , { "box" : { @@ -917,7 +917,7 @@ , "patching_rect" : [ 47.0, 363.0, 195.0, 35.0 ], "saved_object_attributes" : { - "exportfolder" : "macOS:/Users/corvus/Documents/Max 8/Packages/oopsy/templates/", + "exportfolder" : "macOS:/Users/corvus/Documents/Max 8/Packages/Oopsy/templates/", "exportname" : "oopsy_patch" } , @@ -1171,17 +1171,32 @@ "parameters" : { "obj-11" : [ "live.gain~", "live.gain~", 0 ], "obj-12" : [ "live.gain~[1]", "live.gain~", 0 ], + "obj-15::obj-32" : [ "live.text[6]", "FILTER", 0 ], + "obj-15::obj-33" : [ "live.text[4]", "FILTER", 0 ], + "obj-15::obj-34" : [ "live.text[5]", "FILTER", 0 ], "obj-25" : [ "knob4", "knob4", 0 ], "obj-27" : [ "knob3", "knob3", 0 ], "obj-28" : [ "knob2", "knob2", 0 ], "obj-29" : [ "knob1", "knob1", 0 ], "obj-7::obj-21::obj-6" : [ "live.tab[3]", "live.tab[1]", 0 ], "obj-7::obj-35" : [ "[5]", "Level", 0 ], - "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], - "obj-9::obj-33" : [ "live.text[1]", "FILTER", 0 ], - "obj-9::obj-34" : [ "live.text[3]", "FILTER", 0 ], "parameterbanks" : { + } +, + "parameter_overrides" : { + "obj-15::obj-32" : { + "parameter_longname" : "live.text[6]" + } +, + "obj-15::obj-33" : { + "parameter_longname" : "live.text[4]" + } +, + "obj-15::obj-34" : { + "parameter_longname" : "live.text[5]" + } + } , "inherited_shortname" : 1 @@ -1189,60 +1204,39 @@ , "dependency_cache" : [ { "name" : "oopsy.suggestions.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { "name" : "oopsy.gate.trig.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { "name" : "oopsy.gate.min.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { "name" : "oopsy.ctrl.smooth3.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { "name" : "oopsy.ctrl.smooth2.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } -, { - "name" : "oopsy.maxpat", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", - "patcherrelativepath" : "../patchers", - "type" : "JSON", - "implicit" : 1 - } -, { - "name" : "oopsy.snoop.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", - "patcherrelativepath" : "../javascript", - "type" : "TEXT", - "implicit" : 1 - } -, { - "name" : "oopsy.node4max.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", - "patcherrelativepath" : "../javascript", - "type" : "TEXT", - "implicit" : 1 - } , { "name" : "demosound.maxpat", "bootpath" : "C74:/help/msp", @@ -1279,6 +1273,27 @@ "type" : "TEXT", "implicit" : 1 } +, { + "name" : "oopsy.maxpat", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/patchers", + "patcherrelativepath" : "../patchers", + "type" : "JSON", + "implicit" : 1 + } +, { + "name" : "oopsy.snoop.js", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "oopsy.node4max.js", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } ], "autosave" : 0 } diff --git a/templates/oopsy_patch_init.maxpat b/templates/oopsy_patch_init.maxpat index 1f46f20..dfc078f 100644 --- a/templates/oopsy_patch_init.maxpat +++ b/templates/oopsy_patch_init.maxpat @@ -53,7 +53,7 @@ "numinlets" : 1, "numoutlets" : 0, "offset" : [ 0.0, 0.0 ], - "patching_rect" : [ 752.0, 63.0, 128.0, 128.0 ], + "patching_rect" : [ 527.833333333333258, 243.5, 171.0, 171.0 ], "viewvisibility" : 1 } diff --git a/templates/oopsy_petal.maxpat b/templates/oopsy_petal.maxpat index 8a397d6..3abf115 100644 --- a/templates/oopsy_petal.maxpat +++ b/templates/oopsy_petal.maxpat @@ -4,7 +4,7 @@ "appversion" : { "major" : 8, "minor" : 1, - "revision" : 8, + "revision" : 11, "architecture" : "x64", "modernui" : 1 } @@ -39,6 +39,26 @@ "subpatcher_template" : "", "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "args" : [ "petal" ], + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-9", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "oopsy.maxpat", + "numinlets" : 1, + "numoutlets" : 0, + "offset" : [ 0.0, 0.0 ], + "patching_rect" : [ 241.333333333333371, 239.5, 171.0, 171.0 ], + "viewvisibility" : 1 + } + + } +, { "box" : { "id" : "obj-17", "maxclass" : "comment", @@ -245,26 +265,6 @@ "patching_rect" : [ 262.333333333333371, 174.771428571428544, 150.0, 22.0 ] } - } -, { - "box" : { - "args" : [ "@target", "petal" ], - "bgmode" : 0, - "border" : 0, - "clickthrough" : 0, - "enablehscroll" : 0, - "enablevscroll" : 0, - "id" : "obj-9", - "lockeddragscroll" : 0, - "maxclass" : "bpatcher", - "name" : "oopsy.maxpat", - "numinlets" : 1, - "numoutlets" : 0, - "offset" : [ 0.0, 0.0 ], - "patching_rect" : [ 267.5, 327.0, 128.0, 128.0 ], - "viewvisibility" : 1 - } - } , { "box" : { @@ -280,7 +280,7 @@ "appversion" : { "major" : 8, "minor" : 1, - "revision" : 8, + "revision" : 11, "architecture" : "x64", "modernui" : 1 } @@ -776,7 +776,7 @@ , "patching_rect" : [ 17.333333333333343, 222.0, 71.5, 35.0 ], "saved_object_attributes" : { - "exportfolder" : "Macintosh HD:/Users/grrrwaaa/Documents/Max 8/Packages/oopsy/templates/", + "exportfolder" : "macOS:/Users/corvus/Documents/Max 8/Packages/Oopsy/templates/", "exportname" : "oopsy_petal" } , @@ -894,60 +894,39 @@ , "dependency_cache" : [ { "name" : "oopsy.suggestions.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { "name" : "oopsy.gate.trig.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { "name" : "oopsy.gate.min.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { "name" : "oopsy.ctrl.smooth3.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { "name" : "oopsy.ctrl.smooth2.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } -, { - "name" : "oopsy.maxpat", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", - "patcherrelativepath" : "../patchers", - "type" : "JSON", - "implicit" : 1 - } -, { - "name" : "oopsy.snoop.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", - "patcherrelativepath" : "../javascript", - "type" : "TEXT", - "implicit" : 1 - } -, { - "name" : "oopsy.node4max.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", - "patcherrelativepath" : "../javascript", - "type" : "TEXT", - "implicit" : 1 - } , { "name" : "demosound.maxpat", "bootpath" : "C74:/help/msp", @@ -984,6 +963,27 @@ "type" : "TEXT", "implicit" : 1 } +, { + "name" : "oopsy.maxpat", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/patchers", + "patcherrelativepath" : "../patchers", + "type" : "JSON", + "implicit" : 1 + } +, { + "name" : "oopsy.snoop.js", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "oopsy.node4max.js", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } ], "autosave" : 0 } diff --git a/templates/oopsy_pod.maxpat b/templates/oopsy_pod.maxpat index 48315c2..b428efe 100644 --- a/templates/oopsy_pod.maxpat +++ b/templates/oopsy_pod.maxpat @@ -39,6 +39,26 @@ "subpatcher_template" : "", "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "args" : [ "pod" ], + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-3", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "oopsy.maxpat", + "numinlets" : 1, + "numoutlets" : 0, + "offset" : [ 0.0, 0.0 ], + "patching_rect" : [ 438.0, 101.0, 171.0, 171.0 ], + "viewvisibility" : 1 + } + + } +, { "box" : { "id" : "obj-1", "maxclass" : "newobj", @@ -1171,26 +1191,6 @@ "text" : "Template for DaisyPod" } - } -, { - "box" : { - "args" : [ "@target", "pod" ], - "bgmode" : 0, - "border" : 0, - "clickthrough" : 0, - "enablehscroll" : 0, - "enablevscroll" : 0, - "id" : "obj-9", - "lockeddragscroll" : 0, - "maxclass" : "bpatcher", - "name" : "oopsy.maxpat", - "numinlets" : 1, - "numoutlets" : 0, - "offset" : [ 0.0, 0.0 ], - "patching_rect" : [ 457.5, 101.0, 128.0, 128.0 ], - "viewvisibility" : 1 - } - } ], "lines" : [ { @@ -1273,11 +1273,11 @@ ], "parameters" : { "obj-11" : [ "live.gain~", "live.gain~", 0 ], + "obj-3::obj-32" : [ "live.text[2]", "FILTER", 0 ], + "obj-3::obj-33" : [ "live.text[1]", "FILTER", 0 ], + "obj-3::obj-34" : [ "live.text[3]", "FILTER", 0 ], "obj-7::obj-21::obj-6" : [ "live.tab[3]", "live.tab[1]", 0 ], "obj-7::obj-35" : [ "[5]", "Level", 0 ], - "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], - "obj-9::obj-33" : [ "live.text[1]", "FILTER", 0 ], - "obj-9::obj-34" : [ "live.text[3]", "FILTER", 0 ], "parameterbanks" : { } @@ -1286,27 +1286,6 @@ } , "dependency_cache" : [ { - "name" : "oopsy.maxpat", - "bootpath" : "~/Documents/Max 8/Packages/Oopsy/patchers", - "patcherrelativepath" : "../patchers", - "type" : "JSON", - "implicit" : 1 - } -, { - "name" : "oopsy.snoop.js", - "bootpath" : "~/Documents/Max 8/Packages/Oopsy/javascript", - "patcherrelativepath" : "../javascript", - "type" : "TEXT", - "implicit" : 1 - } -, { - "name" : "oopsy.node4max.js", - "bootpath" : "~/Documents/Max 8/Packages/Oopsy/javascript", - "patcherrelativepath" : "../javascript", - "type" : "TEXT", - "implicit" : 1 - } -, { "name" : "demosound.maxpat", "bootpath" : "C74:/help/msp", "type" : "JSON", @@ -1377,6 +1356,27 @@ "type" : "gDSP", "implicit" : 1 } +, { + "name" : "oopsy.maxpat", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/patchers", + "patcherrelativepath" : "../patchers", + "type" : "JSON", + "implicit" : 1 + } +, { + "name" : "oopsy.snoop.js", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "oopsy.node4max.js", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } ], "autosave" : 0 } diff --git a/templates/oopsy_versio.maxpat b/templates/oopsy_versio.maxpat index 8396f7b..b096f4c 100644 --- a/templates/oopsy_versio.maxpat +++ b/templates/oopsy_versio.maxpat @@ -4,13 +4,13 @@ "appversion" : { "major" : 8, "minor" : 1, - "revision" : 8, + "revision" : 11, "architecture" : "x64", "modernui" : 1 } , "classnamespace" : "box", - "rect" : [ 288.0, 78.0, 679.0, 709.0 ], + "rect" : [ 288.0, 79.0, 835.0, 709.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -39,6 +39,26 @@ "subpatcher_template" : "", "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "args" : [ "nehcmeulb" ], + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-5", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "oopsy.maxpat", + "numinlets" : 1, + "numoutlets" : 0, + "offset" : [ 0.0, 0.0 ], + "patching_rect" : [ 251.0, 179.0, 171.0, 171.0 ], + "viewvisibility" : 1 + } + + } +, { "box" : { "activebgcolor" : [ -0.0, 0.0, 0.0, 1.0 ], "bgcolor" : [ 1.0, 0.0, 0.0, 1.0 ], @@ -50,7 +70,7 @@ "outlettype" : [ "" ], "parameter_enable" : 1, "parameter_mappable" : 0, - "patching_rect" : [ 547.833333333333258, 111.5, 16.0, 16.0 ], + "patching_rect" : [ 588.833333333333258, 111.5, 16.0, 16.0 ], "saved_attribute_attributes" : { "valueof" : { "parameter_enum" : [ "off", "on" ], @@ -78,7 +98,7 @@ "numoutlets" : 1, "outlettype" : [ "" ], "parameter_enable" : 1, - "patching_rect" : [ 528.5, 111.5, 16.0, 16.0 ], + "patching_rect" : [ 569.5, 111.5, 16.0, 16.0 ], "saved_attribute_attributes" : { "valueof" : { "parameter_enum" : [ "off", "on" ], @@ -107,7 +127,7 @@ "outlettype" : [ "" ], "parameter_enable" : 1, "parameter_mappable" : 0, - "patching_rect" : [ 502.333333333333314, 111.5, 16.0, 16.0 ], + "patching_rect" : [ 543.333333333333258, 111.5, 16.0, 16.0 ], "saved_attribute_attributes" : { "valueof" : { "parameter_enum" : [ "off", "on" ], @@ -135,7 +155,7 @@ "numoutlets" : 1, "outlettype" : [ "" ], "parameter_enable" : 1, - "patching_rect" : [ 483.0, 111.5, 16.0, 16.0 ], + "patching_rect" : [ 524.0, 111.5, 16.0, 16.0 ], "saved_attribute_attributes" : { "valueof" : { "parameter_enum" : [ "off", "on" ], @@ -160,7 +180,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 521.0, 462.355421686746922, 113.0, 22.0 ], + "patching_rect" : [ 562.0, 462.355421686746922, 113.0, 22.0 ], "text_width" : 60.0 } @@ -173,7 +193,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 521.0, 440.379518072289102, 113.0, 22.0 ], + "patching_rect" : [ 562.0, 440.379518072289102, 113.0, 22.0 ], "text_width" : 60.0 } @@ -186,7 +206,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 521.0, 418.403614457831281, 113.0, 22.0 ], + "patching_rect" : [ 562.0, 418.403614457831281, 113.0, 22.0 ], "text_width" : 60.0 } @@ -199,7 +219,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 521.0, 396.427710843373461, 113.0, 22.0 ], + "patching_rect" : [ 562.0, 396.427710843373461, 113.0, 22.0 ], "text_width" : 60.0 } @@ -212,7 +232,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 521.0, 374.451807228915641, 113.0, 22.0 ], + "patching_rect" : [ 562.0, 374.451807228915641, 113.0, 22.0 ], "text_width" : 60.0 } @@ -225,7 +245,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 521.0, 352.47590361445782, 113.0, 22.0 ], + "patching_rect" : [ 562.0, 352.47590361445782, 113.0, 22.0 ], "text_width" : 60.0 } @@ -238,7 +258,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 408.5, 437.855421686746922, 99.0, 22.0 ], + "patching_rect" : [ 449.5, 437.855421686746922, 99.0, 22.0 ], "text_width" : 63.0 } @@ -252,7 +272,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 408.5, 462.355421686746922, 99.0, 22.0 ], + "patching_rect" : [ 449.5, 462.355421686746922, 99.0, 22.0 ], "text_width" : 63.0 } @@ -265,7 +285,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 521.0, 330.5, 113.0, 22.0 ], + "patching_rect" : [ 562.0, 330.5, 113.0, 22.0 ], "text_width" : 60.0 } @@ -278,7 +298,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 408.5, 413.855421686746922, 99.0, 22.0 ], + "patching_rect" : [ 449.5, 413.855421686746922, 99.0, 22.0 ], "text_width" : 63.0 } @@ -292,7 +312,7 @@ "mode" : 0, "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 401.75, 328.284172661870343, 242.25, 161.0 ], + "patching_rect" : [ 442.75, 328.284172661870343, 242.25, 161.0 ], "proportion" : 0.5, "rounded" : 0 } @@ -310,7 +330,7 @@ "appversion" : { "major" : 8, "minor" : 1, - "revision" : 8, + "revision" : 11, "architecture" : "x64", "modernui" : 1 } @@ -592,7 +612,7 @@ ] } , - "patching_rect" : [ 404.5, 330.5, 58.0, 22.0 ], + "patching_rect" : [ 445.5, 330.5, 58.0, 22.0 ], "saved_object_attributes" : { "description" : "", "digest" : "", @@ -614,7 +634,7 @@ "numoutlets" : 3, "outlettype" : [ "", "", "float" ], "parameter_enable" : 1, - "patching_rect" : [ 443.5, 253.5, 29.0, 17.0 ], + "patching_rect" : [ 484.5, 253.5, 29.0, 17.0 ], "saved_attribute_attributes" : { "valueof" : { "parameter_enum" : [ "A", "B", "C" ], @@ -643,7 +663,7 @@ "numoutlets" : 4, "outlettype" : [ "bang", "bang", "", "int" ], "parameter_enable" : 0, - "patching_rect" : [ 513.0, 294.0, 24.0, 24.0 ], + "patching_rect" : [ 554.0, 294.0, 24.0, 24.0 ], "rounded" : 20.0 } @@ -656,7 +676,7 @@ "numoutlets" : 2, "outlettype" : [ "", "" ], "parameter_enable" : 1, - "patching_rect" : [ 513.0, 294.0, 24.0, 24.0 ], + "patching_rect" : [ 554.0, 294.0, 24.0, 24.0 ], "rounded" : 22.0, "saved_attribute_attributes" : { "valueof" : { @@ -685,7 +705,7 @@ "numoutlets" : 3, "outlettype" : [ "", "", "float" ], "parameter_enable" : 1, - "patching_rect" : [ 443.5, 290.0, 29.0, 17.0 ], + "patching_rect" : [ 484.5, 290.0, 29.0, 17.0 ], "saved_attribute_attributes" : { "valueof" : { "parameter_enum" : [ "X", "Y", "Z" ], @@ -715,7 +735,7 @@ "outlettype" : [ "", "float" ], "panelcolor" : [ 1.0, 1.0, 1.0, 1.0 ], "parameter_enable" : 1, - "patching_rect" : [ 564.0, 252.0, 50.0, 43.0 ], + "patching_rect" : [ 605.0, 252.0, 50.0, 43.0 ], "saved_attribute_attributes" : { "valueof" : { "parameter_longname" : "knob7", @@ -744,7 +764,7 @@ "outlettype" : [ "", "float" ], "panelcolor" : [ 1.0, 1.0, 1.0, 1.0 ], "parameter_enable" : 1, - "patching_rect" : [ 564.0, 174.0, 50.0, 43.0 ], + "patching_rect" : [ 605.0, 174.0, 50.0, 43.0 ], "saved_attribute_attributes" : { "valueof" : { "parameter_longname" : "knob6", @@ -773,7 +793,7 @@ "outlettype" : [ "", "float" ], "panelcolor" : [ 1.0, 1.0, 1.0, 1.0 ], "parameter_enable" : 1, - "patching_rect" : [ 564.0, 96.0, 50.0, 43.0 ], + "patching_rect" : [ 605.0, 96.0, 50.0, 43.0 ], "saved_attribute_attributes" : { "valueof" : { "parameter_longname" : "knob5", @@ -802,7 +822,7 @@ "outlettype" : [ "", "float" ], "panelcolor" : [ 1.0, 1.0, 1.0, 1.0 ], "parameter_enable" : 1, - "patching_rect" : [ 496.0, 210.0, 50.0, 43.0 ], + "patching_rect" : [ 537.0, 210.0, 50.0, 43.0 ], "saved_attribute_attributes" : { "valueof" : { "parameter_longname" : "knob4", @@ -831,7 +851,7 @@ "outlettype" : [ "", "float" ], "panelcolor" : [ 1.0, 1.0, 1.0, 1.0 ], "parameter_enable" : 1, - "patching_rect" : [ 496.0, 134.0, 50.0, 43.0 ], + "patching_rect" : [ 537.0, 134.0, 50.0, 43.0 ], "saved_attribute_attributes" : { "valueof" : { "parameter_longname" : "knob3", @@ -860,7 +880,7 @@ "outlettype" : [ "", "float" ], "panelcolor" : [ 1.0, 1.0, 1.0, 1.0 ], "parameter_enable" : 1, - "patching_rect" : [ 431.0, 174.0, 50.0, 43.0 ], + "patching_rect" : [ 472.0, 174.0, 50.0, 43.0 ], "saved_attribute_attributes" : { "valueof" : { "parameter_longname" : "knob2", @@ -889,7 +909,7 @@ "outlettype" : [ "", "float" ], "panelcolor" : [ 1.0, 1.0, 1.0, 1.0 ], "parameter_enable" : 1, - "patching_rect" : [ 431.0, 96.0, 50.0, 43.0 ], + "patching_rect" : [ 472.0, 96.0, 50.0, 43.0 ], "saved_attribute_attributes" : { "valueof" : { "parameter_longname" : "knob1", @@ -977,26 +997,6 @@ "viewvisibility" : 1 } - } -, { - "box" : { - "args" : [ "@target", "versio" ], - "bgmode" : 0, - "border" : 0, - "clickthrough" : 0, - "enablehscroll" : 0, - "enablevscroll" : 0, - "id" : "obj-9", - "lockeddragscroll" : 0, - "maxclass" : "bpatcher", - "name" : "oopsy.maxpat", - "numinlets" : 1, - "numoutlets" : 0, - "offset" : [ 0.0, 0.0 ], - "patching_rect" : [ 252.0, 179.0, 128.0, 128.0 ], - "viewvisibility" : 1 - } - } , { "box" : { @@ -1011,7 +1011,7 @@ "appversion" : { "major" : 8, "minor" : 1, - "revision" : 8, + "revision" : 11, "architecture" : "x64", "modernui" : 1 } @@ -1452,7 +1452,7 @@ , "patching_rect" : [ 18.0, 483.0, 144.0, 35.0 ], "saved_object_attributes" : { - "exportfolder" : "Macintosh HD:/Users/grrrwaaa/Documents/Max 8/Packages/oopsy/templates/", + "exportfolder" : "macOS:/Users/corvus/Documents/Max 8/Packages/Oopsy/templates/", "exportname" : "oopsy_versio" } , @@ -1470,7 +1470,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "jit_matrix" ], - "patching_rect" : [ 391.0, 18.715827338129543, 263.0, 533.568345323740914 ], + "patching_rect" : [ 432.0, 18.715827338129543, 263.0, 533.568345323740914 ], "pic" : "oopsy_noise_engineering_versio.png" } @@ -1487,7 +1487,7 @@ "appversion" : { "major" : 8, "minor" : 1, - "revision" : 8, + "revision" : 11, "architecture" : "x64", "modernui" : 1 } @@ -2297,7 +2297,7 @@ ] } , - "patching_rect" : [ 449.0, 523.0, 147.0, 22.0 ], + "patching_rect" : [ 490.0, 523.0, 147.0, 22.0 ], "saved_object_attributes" : { "description" : "", "digest" : "", @@ -2426,7 +2426,7 @@ "patchline" : { "destination" : [ "obj-70", 3 ], "hidden" : 1, - "midpoints" : [ 152.5, 520.0, 586.5, 520.0 ], + "midpoints" : [ 152.5, 520.0, 627.5, 520.0 ], "source" : [ "obj-3", 5 ] } @@ -2435,7 +2435,7 @@ "patchline" : { "destination" : [ "obj-70", 2 ], "hidden" : 1, - "midpoints" : [ 127.5, 520.0, 543.833333333333371, 520.0 ], + "midpoints" : [ 127.5, 520.0, 584.833333333333371, 520.0 ], "source" : [ "obj-3", 4 ] } @@ -2444,7 +2444,7 @@ "patchline" : { "destination" : [ "obj-70", 1 ], "hidden" : 1, - "midpoints" : [ 102.5, 520.0, 501.166666666666686, 520.0 ], + "midpoints" : [ 102.5, 520.0, 542.166666666666629, 520.0 ], "source" : [ "obj-3", 3 ] } @@ -2453,7 +2453,7 @@ "patchline" : { "destination" : [ "obj-70", 0 ], "hidden" : 1, - "midpoints" : [ 77.5, 520.0, 458.5, 520.0 ], + "midpoints" : [ 77.5, 520.0, 499.5, 520.0 ], "source" : [ "obj-3", 2 ] } @@ -2613,17 +2613,32 @@ "obj-26" : [ "live.tab[2]", "live.tab[3]", 0 ], "obj-29" : [ "live.tab[4]", "live.tab[3]", 0 ], "obj-30" : [ "live.text", "live.text", 0 ], + "obj-5::obj-32" : [ "live.text[6]", "FILTER", 0 ], + "obj-5::obj-33" : [ "live.text[4]", "FILTER", 0 ], + "obj-5::obj-34" : [ "live.text[5]", "FILTER", 0 ], "obj-73" : [ "live.button", "live.button", 0 ], "obj-7::obj-21::obj-6" : [ "live.tab[3]", "live.tab[1]", 0 ], "obj-7::obj-35" : [ "[5]", "Level", 0 ], "obj-83" : [ "live.button[3]", "live.button", 0 ], "obj-85" : [ "live.button[5]", "live.button", 0 ], "obj-86" : [ "live.button[6]", "live.button", 0 ], - "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], - "obj-9::obj-33" : [ "live.text[1]", "FILTER", 0 ], - "obj-9::obj-34" : [ "live.text[3]", "FILTER", 0 ], "parameterbanks" : { + } +, + "parameter_overrides" : { + "obj-5::obj-32" : { + "parameter_longname" : "live.text[6]" + } +, + "obj-5::obj-33" : { + "parameter_longname" : "live.text[4]" + } +, + "obj-5::obj-34" : { + "parameter_longname" : "live.text[5]" + } + } , "inherited_shortname" : 1 @@ -2631,67 +2646,46 @@ , "dependency_cache" : [ { "name" : "oopsy_noise_engineering_versio.png", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/media", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/media", "patcherrelativepath" : "../media", "type" : "PNG", "implicit" : 1 } , { "name" : "oopsy.suggestions.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { - "name" : "oopsy.gate.min.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "name" : "oopsy.gate.trig.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { - "name" : "oopsy.ctrl.smooth3.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "name" : "oopsy.gate.min.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { - "name" : "oopsy.ctrl.smooth2.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "name" : "oopsy.ctrl.smooth3.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { - "name" : "oopsy.gate.trig.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "name" : "oopsy.ctrl.smooth2.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } -, { - "name" : "oopsy.maxpat", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", - "patcherrelativepath" : "../patchers", - "type" : "JSON", - "implicit" : 1 - } -, { - "name" : "oopsy.snoop.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", - "patcherrelativepath" : "../javascript", - "type" : "TEXT", - "implicit" : 1 - } -, { - "name" : "oopsy.node4max.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", - "patcherrelativepath" : "../javascript", - "type" : "TEXT", - "implicit" : 1 - } , { "name" : "demosound.maxpat", "bootpath" : "C74:/help/msp", @@ -2728,6 +2722,27 @@ "type" : "TEXT", "implicit" : 1 } +, { + "name" : "oopsy.maxpat", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/patchers", + "patcherrelativepath" : "../patchers", + "type" : "JSON", + "implicit" : 1 + } +, { + "name" : "oopsy.snoop.js", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "oopsy.node4max.js", + "bootpath" : "~/Documents/Max 8/Packages/Oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } ], "autosave" : 0, "boxgroups" : [ { From 50cb6f544bd2c71491e83dc6f8b60ea9da94938e Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Wed, 4 May 2022 15:22:54 -0600 Subject: [PATCH 076/100] Added app type option --- source/oopsy.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/oopsy.js b/source/oopsy.js index c187a67..9c399df 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -406,6 +406,7 @@ function run() { let OOPSY_TARGET_SEED = 0 let valid_soms = ['seed', 'patch_sm']; + let valid_app_type = ['BOOT_NONE', 'BOOT_SRAM', 'BOOT_QPSI']; let som = 'seed'; let old_json = false; @@ -434,6 +435,10 @@ function run() { // Ensure som is valid assert(valid_soms.includes(hardware.som), `unkown SOM ${hardware.som}. Valid SOMs: ${valid_soms.join(', ')}`); + // ensure app type is valid + hardware.app_type = hardware.app_type || "BOOT_NONE"; + assert(valid_app_type.includes(hardware.app_type), `unkown app type ${hardware.app_type}. Valid types: ${valid_app_type.join(', ')}`); + // The following is compatibility code, so that the new JSON structure will generate the old JSON structure // At the point that the old one can be retired (because e.g. Patch, Petal etc can be defined in the new format) // this script should be revised to eliminate the old workflow @@ -597,6 +602,8 @@ function run() { fs.writeFileSync(makefile_path, ` # Project Name TARGET = ${build_name} +# App type +APP_TYPE = ${hardware.app_type} # Sources -- note, won't work with paths with spaces CPP_SOURCES = ${posixify_path(path.relative(build_path, maincpp_path).replace(" ", "\\ "))} # Library Locations From 7edd3bb6c9d4ae65b52b875f81956c6bb755ad74 Mon Sep 17 00:00:00 2001 From: Corvus Date: Wed, 6 Jul 2022 11:57:08 -0600 Subject: [PATCH 077/100] Corrected syntax error in Patch SM defs --- source/component_defs_patchsm.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/component_defs_patchsm.json b/source/component_defs_patchsm.json index b49e88c..c9968e0 100644 --- a/source/component_defs_patchsm.json +++ b/source/component_defs_patchsm.json @@ -178,7 +178,7 @@ ] }, "Led": { - "map_init": "{name}.Init(daisy::patch_sm::DaisyPatchSM::{pin}), {invert});\n\t\t{name}.Set(0.0f);", + "map_init": "{name}.Init(daisy::patch_sm::DaisyPatchSM::{pin}, {invert});\n\t\t{name}.Set(0.0f);", "typename": "daisy::Led", "direction": "out", "pin": "a", @@ -258,4 +258,4 @@ } ] } -} \ No newline at end of file +} From ea522b4466746cf9ef2523f0138d84bc21ca8e1b Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 15 Aug 2022 13:50:59 -0600 Subject: [PATCH 078/100] Created basic insert framework --- source/component_defs.json | 33 ++++++++ source/json2daisy.js | 43 ++++++---- source/oopsy.js | 158 ++++++++++++++++++------------------- 3 files changed, 138 insertions(+), 96 deletions(-) diff --git a/source/component_defs.json b/source/component_defs.json index 9d3018c..2d38389 100644 --- a/source/component_defs.json +++ b/source/component_defs.json @@ -1428,5 +1428,38 @@ "permit_scale": false } ] + }, + "CodeClass": { + "map_init": "{name}.Init(&som);", + "typename": "", + "process": "", + "loopprocess": "", + "header_path": "" + }, + "CodeInput": { + "direction": "out", + "typename": "", + "parent": "", + "setter": "", + "mapping": [ + { + "name": "{name}", + "set": "{parent}.{setter}(value);", + "permit_scale": false + } + ] + }, + "CodeOutput": { + "direction": "in", + "typename": "", + "parent": "", + "getter": "", + "mapping": [ + { + "name": "{name}", + "set": "{parent}.{getter}();", + "permit_scale": false + } + ] } } \ No newline at end of file diff --git a/source/json2daisy.js b/source/json2daisy.js index 0b3da4e..cf95e5d 100644 --- a/source/json2daisy.js +++ b/source/json2daisy.js @@ -10,7 +10,7 @@ const patchsm_defs = require(path.join(__dirname, "component_defs_patchsm.json") var global_definitions; // .filter for objects that returns array -Object.filter = (obj, predicate) => +Object.filter = (obj, predicate) => Object.keys(obj).filter(key => predicate(obj[key])) .map(key => obj[key]); @@ -84,7 +84,7 @@ function generateCodecs(external_codecs) cfg.samplerate = daisy::SaiHandle::Config::SampleRate::SAI_48KHZ; cfg.postgain = 0.5f; som.audio_handle.Init( - cfg, + cfg, sai_handle[0]`; for (let i = 0; i < external_codecs.length; i++) @@ -126,7 +126,7 @@ function map_load(key, item) item.name = key; assert(item.component in global_definitions, `Undefined component kind "${item.component}"`); component = global_definitions[item.component]; - + for (property in component) { if (!(property in item)) @@ -233,7 +233,7 @@ function flatten_index_dicts(comp) return flattened; } -exports.generate_header = function generate_header(board_description_object) +exports.generate_header = function generate_header(board_description_object, target_path) { let target = board_description_object; @@ -329,7 +329,9 @@ exports.generate_header = function generate_header(board_description_object) replacements.Bno055 = filter_map_init(components, 'component', 'Bno055', key_exclude='is_default', match_exclude=true); replacements.Icm20948 = filter_map_init(components, 'component', 'Icm20948', key_exclude='is_default', match_exclude=true); replacements.Dps310 = filter_map_init(components, 'component', 'Dps310', key_exclude='is_default', match_exclude=true); - + + replacements.CodeClass = filter_map_init(components, 'component', 'CodeClass', key_exclude='is_default', match_exclude=true); + replacements.display = !(has_display) ? '' : ` daisy::OledDisplay<${target.display.driver}>::Config display_config; display_config.driver_config.transport_config.Defaults(); @@ -353,6 +355,10 @@ exports.generate_header = function generate_header(board_description_object) non_class_decls = component_decls.filter(item => 'non_class_decl' in item); replacements.non_class_declarations = non_class_decls.map(item => stringFormatMap(item.non_class_decl, item)).join("\n"); + headers = Object.filter(components, item => 'header' in item); + abs_headers = headers.map(item => path.isAbsolute(item.header) ? item.header : path.normalize(path.join(path.basename(target_path), item))); + replacements.headers = abs_headers.map(item => `#include "${item}"`).join("\n"); + replacements.dispdec = 'display' in target ? `daisy::OledDisplay<${target.display.driver}> display;` : ""; let header = ` @@ -362,6 +368,7 @@ exports.generate_header = function generate_header(board_description_object) #include "daisy_${replacements.som}.h" ${replacements.som == 'seed' ? '#include "dev/codec_ak4556.h"' : ''} ${has_display ? '#include "dev/oled_ssd130x.h"' : ''} +${replacements.headers} #define ANALOG_COUNT ${replacements.analogcount} @@ -375,7 +382,7 @@ ${replacements.name != '' ? `struct Daisy${replacements.name[0].toUpperCase()}${ /** Initializes the board according to the JSON board description * \\param boost boosts the clock speed from 400 to 480 MHz */ - void Init(bool boost=true) + void Init(bool boost=true) { ${replacements.som == 'seed' ? `som.Configure(); som.Init(boost);` : `som.Init();`} @@ -414,22 +421,24 @@ ${replacements.name != '' ? `struct Daisy${replacements.name[0].toUpperCase()}${ ${replacements.Icm20948 != '' ? '// Icm20948 Sensor\n ' + replacements.Icm20948 : ''} ${replacements.Dps310 != '' ? '// Dps310 Sensor\n ' + replacements.Dps310 : ''} + ${replacements.CodeClass != '' ? '// Custom classes\n ' + replacements.CodeClass : ''} + ${replacements.external_codecs.length == 0 ? '' : generateCodecs(replacements.external_codecs)} ${replacements.som == 'seed' ? 'som.adc.Start();' : ''} } /** Handles all the controls processing that needs to occur at the block rate - * + * */ - void ProcessAllControls() + void ProcessAllControls() { ${replacements.process} ${replacements.som == 'patch_sm' ? 'som.ProcessAllControls();' : ''} } /** Handles all the maintenance processing. This should be run last within the audio callback. - * + * */ void PostProcess() { @@ -437,7 +446,7 @@ ${replacements.name != '' ? `struct Daisy${replacements.name[0].toUpperCase()}${ } /** Handles processing that shouldn't occur in the audio block, such as blocking transfers - * + * */ void LoopProcess() { @@ -445,7 +454,7 @@ ${replacements.name != '' ? `struct Daisy${replacements.name[0].toUpperCase()}${ } /** Handles display-related processing - * + * */ void Display() { @@ -455,9 +464,9 @@ ${replacements.name != '' ? `struct Daisy${replacements.name[0].toUpperCase()}${ /** Sets the audio sample rate * \\param sample_rate the new sample rate in Hz */ - void SetAudioSampleRate(size_t sample_rate) + void SetAudioSampleRate(size_t sample_rate) { - ${som == 'patch_sm' ? 'som.SetAudioSampleRate(sample_rate);' : + ${som == 'patch_sm' ? 'som.SetAudioSampleRate(sample_rate);' : `daisy::SaiHandle::Config::SampleRate enum_rate; if (sample_rate >= 96000) enum_rate = daisy::SaiHandle::Config::SampleRate::SAI_96KHZ; @@ -477,9 +486,9 @@ ${replacements.name != '' ? `struct Daisy${replacements.name[0].toUpperCase()}${ /** Sets the audio sample rate * \\param sample_rate the new sample rate as an enum */ - void SetAudioSampleRate(daisy::SaiHandle::Config::SampleRate sample_rate) + void SetAudioSampleRate(daisy::SaiHandle::Config::SampleRate sample_rate) { - ${som == 'seed' ? 'som.SetAudioSampleRate(sample_rate);' : + ${som == 'seed' ? 'som.SetAudioSampleRate(sample_rate);' : `size_t hz_rate; switch (sample_rate) { @@ -508,13 +517,13 @@ ${replacements.name != '' ? `struct Daisy${replacements.name[0].toUpperCase()}${ /** Sets the audio block size * \\param block_size the new block size in words */ - inline void SetAudioBlockSize(size_t block_size) + inline void SetAudioBlockSize(size_t block_size) { som.SetAudioBlockSize(block_size); } /** Starts up the audio callback process with the given callback - * + * */ inline void StartAudio(daisy::AudioHandle::AudioCallback cb) { diff --git a/source/oopsy.js b/source/oopsy.js index 15de5da..422ec61 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -27,7 +27,7 @@ - configure a "gen" object representing features in the .cpp patch The general idea here is that there is a list of named "nodes" making a graph - most nodes are sources, + most nodes are sources, they may have a list of `to` destinations they may have a `src` field naming another node they map from some nodes are sinks, and have a list of 'from' sources @@ -107,7 +107,7 @@ function checkBuildEnvironment() { console.warn(`oopsy can't find the ARM GCC build tools, will not be able to upload binary to the Daisy. Please check https://github.com/electro-smith/DaisyWiki/wiki/1e.-Getting-Started-With-Oopsy-(Gen~-Integration) for installation instructions.`) process.exit(-1); } - + } else { // OSX: let locations = ["/opt/homebrew/bin", "/usr/local/bin"] @@ -123,7 +123,7 @@ function checkBuildEnvironment() { process.exit(-1); } if (fs.existsSync(`${build_tools_path}/dfu-util`)) { - has_dfu_util = true; + has_dfu_util = true; } else { console.warn(`oopsy can't find the dfu-util binary in ${build_tools_path}, will not be able to upload binary to the Daisy. Please check https://github.com/electro-smith/DaisyWiki/wiki/1e.-Getting-Started-With-Oopsy-(Gen~-Integration) for installation instructions.`) } @@ -136,8 +136,8 @@ const help = ` cmds: up/upload = (default) generate & upload gen/generate = generate only -target: path to a JSON for the hardware config, - or simply "patch", "patch_sm", "field", "petal", "pod" etc. +target: path to a JSON for the hardware config, + or simply "patch", "patch_sm", "field", "petal", "pod" etc. Defaults to "daisy.patch.json" 32kHz, 48kHz, "96kHz" will set the sampling rate of the binary @@ -152,7 +152,7 @@ nooled will disable code generration for OLED (it will be blank) cpps: paths to the gen~ exported cpp files first item will be the default app - + watch: script will not terminate actions will be re-run each time any of the cpp files are modified ` @@ -316,7 +316,7 @@ function run() { let options = {} checkBuildEnvironment(); - + if (args.length == 0) { console.log(help) return; @@ -341,9 +341,9 @@ function run() { case "watch": watch=true; break; - case "96kHz": - case "48kHz": - case "32kHz": samplerate = +(arg.match(/(\d+)kHz/)[1]); break; + case "96kHz": + case "48kHz": + case "32kHz": samplerate = +(arg.match(/(\d+)kHz/)[1]); break; case "block1": case "block2": @@ -354,15 +354,15 @@ function run() { case "block16": case "block24": case "block32": - case "block48": - case "block64": - case "block96": + case "block48": + case "block64": + case "block96": case "block128": case "block256": blocksize = +(arg.match(/block(\d+)/)[1]); break; case "writejson": - case "nooled": - case "boost": + case "nooled": + case "boost": case "fastmath": options[arg] = true; break; default: { @@ -374,10 +374,10 @@ function run() { if (fs.lstatSync(arg).isDirectory()) { // add a whole folder full of cpps: cpps = cpps.concat(fs.readdirSync(arg) - .filter(s => path.parse(s).ext == ".cpp") + .filter(s => path.parse(s).ext == ".cpp") .map(s => path.join(arg, s)) ) - } else { + } else { let p = path.parse(arg); switch(p.ext) { case ".json": {target_path = arg; target = ""}; break; @@ -453,7 +453,7 @@ function run() { let tempname = hardware.name; hardware.name = ''; - let board_info = json2daisy.generate_header(hardware); + let board_info = json2daisy.generate_header(hardware, target_path); hardware.name = tempname; hardware.struct = board_info.header; @@ -466,7 +466,7 @@ function run() { let component = hardware.components[comp]; // meta-elements are handled separately if (component.meta) { - + } else { // else it is available for gen mapping: @@ -618,7 +618,7 @@ CPPFLAGS+=-O3 -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-var console.log(`\t${maincpp_path}`) console.log(`\t${makefile_path}`) console.log(`\t${bin_path}`) - + // add watcher if (watch && watchers.length < 1) { watchers = cpps.map(cpp_path => fs.watch(cpp_path, (event, filepath)=>{ @@ -635,7 +635,7 @@ CPPFLAGS+=-O3 -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-var //if (options.writejson) fs.writeFileSync(path.join(build_path, `${build_name}_${target}.json`), JSON.stringify(config,null," "),"utf8"); const cppcode = ` -/* +/* This code was generated by Oopsy (https://github.com/electro-smith/oopsy) on ${new Date().toString()} @@ -673,7 +673,7 @@ oopsy::AppDef appdefs[] = { }; int main(void) { - oopsy::daisy.hardware.Init(${hardware.som == 'seed' ? options.boost|false : ''}); + oopsy::daisy.hardware.Init(${hardware.som == 'seed' ? options.boost|false : ''}); oopsy::daisy.hardware.SetAudioSampleRate(daisy::SaiHandle::Config::SampleRate::SAI_${hardware.samplerate}KHZ); oopsy::daisy.hardware.SetAudioBlockSize(${hardware.defines.OOPSY_BLOCK_SIZE}); ${hardware.inserts.filter(o => o.where == "init").map(o => o.code).join("\n\t")} @@ -681,7 +681,7 @@ int main(void) { return oopsy::daisy.run(appdefs, ${apps.length}); } ` - fs.writeFileSync(maincpp_path, cppcode, "utf-8"); + fs.writeFileSync(maincpp_path, cppcode, "utf-8"); console.log("oopsy generated code") @@ -703,7 +703,7 @@ int main(void) { // if successful, try to upload to hardware: if (has_dfu_util && action=="upload") { console.log("oopsy flashing...") - + exec(`make program-dfu`, { cwd: build_path }, (err, stdout, stderr)=>{ console.log("stdout", stdout) console.log("stderr", stderr) @@ -793,7 +793,7 @@ function analyze_cpp(cpp, hardware, cpp_path) { // search for history outs: // i.e. any history with "_out" on its name histories: (cpp.match(/t_sample\s+(m_([\w]+)_out_\d+);/gm) || []).map(s=>{ - + const match = /t_sample\s+(m_([\w]+)_out_\d+);/gm.exec(s); let cname = match[1] let name = match[2]; @@ -808,19 +808,19 @@ function analyze_cpp(cpp, hardware, cpp_path) { result.midi_type = "note"; result.midi_num = midimatch[1] !== "" && midimatch[1] !== undefined ? +midimatch[1] : 1; result.midi_notetype = midimatch[3] || "pitch" - } else + } else if (midimatch = /midi_(program|cc|vel|drum)(\d*)(_ch(\d+))?/g.exec(name)) { result.midi_type = midimatch[1]; result.midi_num = midimatch[2] !== "" && midimatch[2] !== undefined ? +midimatch[2] : 1; result.midi_chan = +midimatch[4] || 1; - } else + } else if (midimatch = /midi_(bend|press)(_ch(\d+))?/g.exec(name)) { result.midi_type = midimatch[1]; result.midi_chan = +midimatch[3] || 1; - } else + } else if (midimatch = /midi_(clock|stop|start|continue|sense|reset)?/g.exec(name)) { result.midi_type = midimatch[1]; - } + } // find the initializer: result.default = constexpr( new RegExp(`\\s${cname}\\s+=\\s+([^;]+);`, "gm").exec(cpp)[1] ); @@ -838,7 +838,7 @@ function analyze_cpp(cpp, hardware, cpp_path) { cname: null, } if (type == "GENLIB_PARAMTYPE_FLOAT") { - param.cname = /pi->defaultvalue\s+=\s+self->([^;]+)/gm.exec(s)[1]; + param.cname = /pi->defaultvalue\s+=\s+self->([^;]+)/gm.exec(s)[1]; param.min = +(/pi->outputmin\s+=\s+([^;]+)/gm.exec(s)[1]) param.max = +(/pi->outputmax\s+=\s+([^;]+)/gm.exec(s)[1]) //param.default = +new RegExp(`\\s${param.cname}\\s+=\\s+\\(\\(\\w+\\)([^\\)]+)`, "gm").exec(cpp)[1] @@ -899,7 +899,7 @@ function analyze_cpp(cpp, hardware, cpp_path) { console.log(`[data ${param.name}] has possible source: ${path.resolve( wavpath )}`) wavname = param.name+".wav"; //wavpath = path.resolve( wavpath ) - } + } } if (wavname) { param.wavname = wavname @@ -967,7 +967,7 @@ function generate_daisy(hardware, nodes) { } daisy.audio_outs.push(name); } - + if (hardware.defines.OOPSY_TARGET_HAS_MIDI_INPUT) { let name = `dsy_midi_in` nodes[name] = { @@ -1055,7 +1055,7 @@ function generate_app(app, hardware, target, config) { } app.audio_outs.push(src); } - + let node = { name: name, // label: label, @@ -1080,7 +1080,7 @@ function generate_app(app, hardware, target, config) { if (map) { label = maplabel } else { - // else it is audio data + // else it is audio data nodes[src].src = src; } nodes[name].label = label @@ -1098,7 +1098,7 @@ function generate_app(app, hardware, target, config) { let node = Object.assign({ varname: varname, }, history); - + if (node.midi_type) { if (node.midi_type == "note") { let id = node.midi_num-1 @@ -1120,13 +1120,13 @@ function generate_app(app, hardware, target, config) { // } } else { - + app.midi_outs.push(node) node.setter_src = "gen."+node.cname if (node.midi_type == "cc") { app.has_midi_out = true; let statusbyte = 176+((node.midi_chan)-1)%16; - node.setter = `daisy.midi_message3(${statusbyte}, ${(node.midi_num)%128}, ((uint8_t)(${node.varname}*127.f)) & 0x7F);`; + node.setter = `daisy.midi_message3(${statusbyte}, ${(node.midi_num)%128}, ((uint8_t)(${node.varname}*127.f)) & 0x7F);`; node.type = "float"; node.midi_throttle = true; node.midi_only_when_changed = true; @@ -1134,7 +1134,7 @@ function generate_app(app, hardware, target, config) { } else if (node.midi_type == "press") { app.has_midi_out = true; let statusbyte = 208+((node.midi_chan)-1)%16; - node.setter = `daisy.midi_message2(${statusbyte}, ((uint8_t)(${node.varname}*127.f)) & 0x7F);`; + node.setter = `daisy.midi_message2(${statusbyte}, ((uint8_t)(${node.varname}*127.f)) & 0x7F);`; node.type = "float"; node.midi_throttle = true; node.midi_only_when_changed = true; @@ -1145,7 +1145,7 @@ function generate_app(app, hardware, target, config) { let float = `((${node.varname}+1.f)*64.f)`; let lsb = `((uint8_t)(${float}*128.f)) & 0x7F`; let msb = `((uint8_t)${float}) & 0x7F`; - node.setter = `daisy.midi_message3(${statusbyte}, ${lsb}, ${msb});`; + node.setter = `daisy.midi_message3(${statusbyte}, ${lsb}, ${msb});`; node.type = "float"; node.midi_throttle = true; node.midi_only_when_changed = true; @@ -1153,20 +1153,20 @@ function generate_app(app, hardware, target, config) { } else if (node.midi_type == "program") { app.has_midi_out = true; let statusbyte = 192+((node.midi_chan)-1)%16; - node.setter = `daisy.midi_message2(${statusbyte}, ${node.varname} & 0x7F);`; + node.setter = `daisy.midi_message2(${statusbyte}, ${node.varname} & 0x7F);`; node.type = "uint8_t"; nodes[name] = node; } else if (node.midi_type == "drum") { app.has_midi_out = true; node.setter = `daisy.midi_message3(153, ${(node.midi_num)%128}, ((uint8_t)(${node.varname}*127.f)) & 0x7F);`; node.type = "float"; - nodes[name] = node + nodes[name] = node } else if (node.midi_type == "vel") { app.has_midi_out = true; let statusbyte = 144+((node.midi_chan)-1)%16; node.setter = `daisy.midi_message3(${statusbyte}, ${(node.midi_num)%128}, ((uint8_t)(${node.varname}*127.f)) & 0x7F);`; node.type = "float"; - nodes[name] = node + nodes[name] = node } else if (node.midi_type == "clock" || node.midi_type == "stop" || node.midi_type == "start" @@ -1186,10 +1186,10 @@ function generate_app(app, hardware, target, config) { node.setter = `daisy.midi_message1(254);`; } else if (node.midi_type == "reset") { node.setter = `daisy.midi_message1(255);`; - } + } node.type = "uint8_t"; - nodes[name] = node - } + nodes[name] = node + } } } else { @@ -1206,12 +1206,12 @@ function generate_app(app, hardware, target, config) { // was this history mapped to something? if (map) { - nodes[name] = node + nodes[name] = node node.type = "t_sample"; nodes[map].src = "gen."+node.cname; //from.push(src); // nodes[src].to.push(map) } - + } return name; }) @@ -1242,30 +1242,30 @@ function generate_app(app, hardware, target, config) { node.where = "midi_msg" // need to set "src" to something to prevent this being automapped src = node.where - node.code = `if (daisy.midi.lastbyte == 1 && ${ch != null ? `daisy.midi.status == ${176+ch}` : `daisy.midi.status/16 == 11`} && daisy.midi.byte[0] == ${cc}) { + node.code = `if (daisy.midi.lastbyte == 1 && ${ch != null ? `daisy.midi.status == ${176+ch}` : `daisy.midi.status/16 == 11`} && daisy.midi.byte[0] == ${cc}) { ${node.varname} = (daisy.midi.byte[1]/127.f)*${asCppNumber(node.range)} + ${asCppNumber(node.min)}; }`; - } else + } else if (match = (/^midi_press(_(ch)?(\d+))?/g).exec(param.name)) { let ch = match[3] ? ((+match[3])+15)%16 : null; app.has_midi_in = true; node.where = "midi_msg" // need to set "src" to something to prevent this being automapped src = node.where - node.code = `if (daisy.midi.lastbyte == 1 && ${ch != null ? `daisy.midi.status == ${208+ch}` : `daisy.midi.status/16 == 13`}) { + node.code = `if (daisy.midi.lastbyte == 1 && ${ch != null ? `daisy.midi.status == ${208+ch}` : `daisy.midi.status/16 == 13`}) { ${node.varname} = (daisy.midi.byte[0]/127.f)*${asCppNumber(node.range)} + ${asCppNumber(node.min)}; }`; - } else + } else if (match = (/^midi_program(_(ch)?(\d+))?/g).exec(param.name)) { let ch = match[3] ? ((+match[3])+15)%16 : null; app.has_midi_in = true; node.where = "midi_msg" // need to set "src" to something to prevent this being automapped src = node.where - node.code = `if (daisy.midi.lastbyte == 1 && ${ch != null ? `daisy.midi.status == ${192+ch}` : `daisy.midi.status/16 == 12`}) { + node.code = `if (daisy.midi.lastbyte == 1 && ${ch != null ? `daisy.midi.status == ${192+ch}` : `daisy.midi.status/16 == 12`}) { ${node.varname} = (daisy.midi.byte[0]/127.f)*${asCppNumber(node.range)} + ${asCppNumber(node.min)}; }`; - } else + } else if (match = (/^midi_(vel|drum)(\d+)(_(ch)?(\d+))?/g).exec(param.name)) { let ch = match[5] ? ((+match[5])+15)%16 : (match[1] == "drum" ? 9 : null); let note = (+match[2])%128; @@ -1273,26 +1273,26 @@ function generate_app(app, hardware, target, config) { node.where = "midi_msg" // need to set "src" to something to prevent this being automapped src = node.where - node.code = `if (daisy.midi.lastbyte == 1 && ${ch != null ? `(daisy.midi.status == ${128+ch} || daisy.midi.status == ${144+ch})` : `(daisy.midi.status/16 == 8 || daisy.midi.status/16 == 9)`} && daisy.midi.byte[0] == ${note}) { + node.code = `if (daisy.midi.lastbyte == 1 && ${ch != null ? `(daisy.midi.status == ${128+ch} || daisy.midi.status == ${144+ch})` : `(daisy.midi.status/16 == 8 || daisy.midi.status/16 == 9)`} && daisy.midi.byte[0] == ${note}) { ${node.varname} = (daisy.midi.byte[1]/127.f)*${asCppNumber(node.range)} + ${asCppNumber(node.min)}; }`; - } else + } else if (match = (/^midi_bend(_(ch)?(\d+))?/g).exec(param.name)) { let ch = match[3] ? ((+match[3])+15)%16 : null; app.has_midi_in = true; node.where = "midi_msg" // need to set "src" to something to prevent this being automapped src = node.where - node.code = `if (daisy.midi.lastbyte == 1 && ${ch != null ? `daisy.midi.status == ${224+ch}` : `daisy.midi.status/16 == 14`}) { + node.code = `if (daisy.midi.lastbyte == 1 && ${ch != null ? `daisy.midi.status == ${224+ch}` : `daisy.midi.status/16 == 14`}) { ${node.varname} = ((daisy.midi.byte[0] + daisy.midi.byte[1]/128.f)/128.f)*${asCppNumber(node.range)} + ${asCppNumber(node.min)}; }`; - } else + } else if (param.name == "midi_clock") { app.has_midi_in = true; node.where = "midi_status" // need to set "src" to something to prevent this being automapped src = node.where - node.code = `if (byte == 248) { + node.code = `if (byte == 248) { ${node.varname} = 1.f; }`; // reset: @@ -1305,9 +1305,9 @@ function generate_app(app, hardware, target, config) { node.where = "midi_status" // need to set "src" to something to prevent this being automapped src = node.where - node.code = `if (byte == 250 || byte == 251) { + node.code = `if (byte == 250 || byte == 251) { ${node.varname} = 1.f; - } else if (byte == 252) { + } else if (byte == 252) { ${node.varname} = 0.f; }`; // reset: @@ -1328,7 +1328,7 @@ function generate_app(app, hardware, target, config) { //type = match[3]; type = match[1] // trim type from label: - //label = (match[2] || "") + (match[5] || "") + //label = (match[2] || "") + (match[5] || "") label = match[3] || label } } @@ -1377,13 +1377,13 @@ function generate_app(app, hardware, target, config) { let power = Math.round(Math.log2(node.range / ideal_steps)) node.stepsize = Math.pow(2, power) } - } + } } if (!node.stepsize) { // general case: node.stepsize = node.range / ideal_steps } - + nodes[varname] = node; if (src && nodes[src]) { nodes[src].to.push(varname) @@ -1481,11 +1481,11 @@ struct App_${name} : public oopsy::App { float ${node.name};`).join("")} ${app.audio_outs.map(name=>` float ${name}[OOPSY_BLOCK_SIZE];`).join("")} - + void init(oopsy::GenDaisy& daisy) { daisy.gen = ${name}::create(daisy.hardware.${som_or_seed}.AudioSampleRate(), daisy.hardware.${som_or_seed}.AudioBlockSize()); ${name}::State& gen = *(${name}::State *)daisy.gen; - + daisy.param_count = ${gen.params.length}; ${(defines.OOPSY_HAS_PARAM_VIEW) ? `daisy.param_selected = ${Math.max(0, gen.params.map(name=>nodes[name].src).indexOf(undefined))};`:``} ${gen.params.map(name=>nodes[name]) @@ -1537,7 +1537,7 @@ struct App_${name} : public oopsy::App { ${app.has_midi_in ? daisy.midi_ins.map(name=>` float * ${name} = daisy.midi_in_data;`).join("") : ''} // ${gen.audio_ins.map(name=>nodes[name].label).join(", ")}: - float * inputs[] = { ${gen.audio_ins.map(name=>nodes[name].src).join(", ")} }; + float * inputs[] = { ${gen.audio_ins.map(name=>nodes[name].src).join(", ")} }; // ${gen.audio_outs.map(name=>nodes[name].label).join(", ")}: float * outputs[] = { ${gen.audio_outs.map(name=>nodes[name].src).join(", ")} }; gen.perform(inputs, outputs, size); @@ -1562,13 +1562,13 @@ struct App_${name} : public oopsy::App { if (${node.varname} != (${node.type})${node.setter_src}) { ${node.varname} = ${node.setter_src}; ${node.setter} - }`).join("")} + }`).join("")} ${app.midi_noteouts .filter(note=>note.vel && note.pitch) .map(note=>` - ${note.cname}.update(daisy, - ((uint8_t)(gen.${note.vel.cname}*127.f)) & 0x7F, - ((uint8_t)gen.${note.pitch.cname}) & 0x7F, + ${note.cname}.update(daisy, + ((uint8_t)(gen.${note.vel.cname}*127.f)) & 0x7F, + ((uint8_t)gen.${note.pitch.cname}) & 0x7F, ${note.chan ? `((uint8_t)(gen.${note.chan.cname})-1) % 16` : "0"});`).join("")} // msgs: ${(app.midi_outs.filter(node=>node.midi_throttle).length + app.midi_noteouts.filter(note=>note.press).length)} // rate: ${hardware.defines.OOPSY_BLOCK_RATE/500} @@ -1596,7 +1596,7 @@ struct App_${name} : public oopsy::App { memset(${node.name}, 0, sizeof(float)*size);`).join("")} ${app.inserts.concat(hardware.inserts).filter(o => o.where == "post_audio").map(o => o.code).join("\n\t")} ${hardware.som == 'seed' ? "hardware.PostProcess();" : ""} - } + } void mainloopCallback(oopsy::GenDaisy& daisy, uint32_t t, uint32_t dt) { Daisy& hardware = daisy.hardware; @@ -1623,14 +1623,14 @@ struct App_${name} : public oopsy::App { .concat(`if (byte == 0xFF) { // reset event -> go to bootloader daisy.log("reboot"); daisy::System::ResetToBootloader(); - } + } if (byte <= 240 || byte == 247) { - daisy.midi.status = byte; + daisy.midi.status = byte; daisy.midi.lastbyte = 255; // means 'no bytes received' }`) .join(" else ")} } else { - daisy.midi.lastbyte = !daisy.midi.lastbyte; + daisy.midi.lastbyte = !daisy.midi.lastbyte; daisy.midi.byte[daisy.midi.lastbyte] = byte; ${gen.params .map(name=>nodes[name]) @@ -1679,7 +1679,7 @@ struct App_${name} : public oopsy::App { .map((node, i)=>` case ${i}: return ${node.varname} = (${node.type})(val > ${asCppNumber(node.max, node.type)}) ? ${asCppNumber(node.max, node.type)} : (val < ${asCppNumber(node.min, node.type)}) ? ${asCppNumber(node.min, node.type)} : val;`).join("")} } - return 0.f; + return 0.f; } ${defines.OOPSY_TARGET_HAS_OLED && defines.OOPSY_HAS_PARAM_VIEW ? ` @@ -1687,13 +1687,13 @@ struct App_${name} : public oopsy::App { switch(idx) { ${gen.params.map(name=>nodes[name]).map((node, i)=>` case ${i}: ${defines.OOPSY_CAN_PARAM_TWEAK ? ` if (tweak) setparam(${i}, ${node.varname} + daisy.menu_button_incr ${node.type == "float" ? '* ' + asCppNumber(node.stepsize, node.type) : ""});` : ""} - ${defines.OOPSY_OLED_DISPLAY_WIDTH < 128 ? `snprintf(label, len, "${node.label.substring(0,5).padEnd(5," ")}" FLT_FMT3 "", FLT_VAR3(${node.varname}) );` : `snprintf(label, len, "${node.src ? - `${node.src.substring(0,3).padEnd(3," ")} ${node.label.substring(0,11).padEnd(11," ")}" FLT_FMT3 ""` - : + ${defines.OOPSY_OLED_DISPLAY_WIDTH < 128 ? `snprintf(label, len, "${node.label.substring(0,5).padEnd(5," ")}" FLT_FMT3 "", FLT_VAR3(${node.varname}) );` : `snprintf(label, len, "${node.src ? + `${node.src.substring(0,3).padEnd(3," ")} ${node.label.substring(0,11).padEnd(11," ")}" FLT_FMT3 ""` + : `%s ${node.label.substring(0,11).padEnd(11," ")}" FLT_FMT3 "", (daisy.param_is_tweaking && ${i} == daisy.param_selected) ? "enc" : " "` }, FLT_VAR3(${node.varname}) );`} break;`).join("")} - } + } } ` : ""} ` : ""} From 170c900a83faa89422001fd5e7b579d7aba0fbc9 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 15 Aug 2022 14:15:07 -0600 Subject: [PATCH 079/100] Added check to prevent adc initialization with zero channels --- source/json2daisy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/json2daisy.js b/source/json2daisy.js index cf95e5d..f8cfc72 100644 --- a/source/json2daisy.js +++ b/source/json2daisy.js @@ -395,7 +395,7 @@ ${replacements.name != '' ? `struct Daisy${replacements.name[0].toUpperCase()}${ ${replacements.gatein != '' ? '// Gate ins\n ' + replacements.gatein : ''} ${replacements.encoder != '' ? '// Rotary encoders\n ' + replacements.encoder : ''} ${replacements.init_single != '' ? '// Single channel ADC initialization\n ' + replacements.init_single : ''} - ${replacements.som == 'seed' ? 'som.adc.Init(cfg, ANALOG_COUNT);' : ''} + ${replacements.som == 'seed' && analogcount ? 'som.adc.Init(cfg, ANALOG_COUNT);' : ''} ${replacements.ctrl_init != '' ? '// AnalogControl objects\n ' + replacements.ctrl_init : ''} ${replacements.ctrl_mux_init != '' ? '// Multiplexed AnlogControl objects\n ' + replacements.ctrl_mux_init : ''} ${replacements.led != '' ? '// LEDs\n ' + replacements.led : ''} From 0bedb9dd70e693cd7cb659fc2a51056e9becdded Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 15 Aug 2022 15:54:28 -0600 Subject: [PATCH 080/100] Fixed compile bugs --- source/component_defs.json | 7 ++++--- source/json2daisy.js | 5 +++-- source/oopsy.js | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/source/component_defs.json b/source/component_defs.json index 2d38389..c166c4f 100644 --- a/source/component_defs.json +++ b/source/component_defs.json @@ -1434,7 +1434,8 @@ "typename": "", "process": "", "loopprocess": "", - "header_path": "" + "header_path": "", + "mapping": [] }, "CodeInput": { "direction": "out", @@ -1444,7 +1445,7 @@ "mapping": [ { "name": "{name}", - "set": "{parent}.{setter}(value);", + "set": "{class_name}.{parent}.{setter}({value});", "permit_scale": false } ] @@ -1457,7 +1458,7 @@ "mapping": [ { "name": "{name}", - "set": "{parent}.{getter}();", + "set": "{class_name}.{parent}.{getter}();", "permit_scale": false } ] diff --git a/source/json2daisy.js b/source/json2daisy.js index f8cfc72..ce6e2c8 100644 --- a/source/json2daisy.js +++ b/source/json2daisy.js @@ -356,7 +356,8 @@ exports.generate_header = function generate_header(board_description_object, tar replacements.non_class_declarations = non_class_decls.map(item => stringFormatMap(item.non_class_decl, item)).join("\n"); headers = Object.filter(components, item => 'header' in item); - abs_headers = headers.map(item => path.isAbsolute(item.header) ? item.header : path.normalize(path.join(path.basename(target_path), item))); + abs_headers = headers.map(item => path.isAbsolute(item.header) ? item.header : + path.normalize(path.join(path.dirname(target_path), item.header))); replacements.headers = abs_headers.map(item => `#include "${item}"`).join("\n"); replacements.dispdec = 'display' in target ? `daisy::OledDisplay<${target.display.driver}> display;` : ""; @@ -395,7 +396,7 @@ ${replacements.name != '' ? `struct Daisy${replacements.name[0].toUpperCase()}${ ${replacements.gatein != '' ? '// Gate ins\n ' + replacements.gatein : ''} ${replacements.encoder != '' ? '// Rotary encoders\n ' + replacements.encoder : ''} ${replacements.init_single != '' ? '// Single channel ADC initialization\n ' + replacements.init_single : ''} - ${replacements.som == 'seed' && analogcount ? 'som.adc.Init(cfg, ANALOG_COUNT);' : ''} + ${replacements.som == 'seed' && replacements.analogcount ? 'som.adc.Init(cfg, ANALOG_COUNT);' : ''} ${replacements.ctrl_init != '' ? '// AnalogControl objects\n ' + replacements.ctrl_init : ''} ${replacements.ctrl_mux_init != '' ? '// Multiplexed AnlogControl objects\n ' + replacements.ctrl_mux_init : ''} ${replacements.led != '' ? '// LEDs\n ' + replacements.led : ''} diff --git a/source/oopsy.js b/source/oopsy.js index 422ec61..4869af1 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -475,7 +475,7 @@ function run() { component.class_name = 'hardware'; component.name_upper = component.name.toUpperCase(); let name = json2daisy.format_map(mapping.name, component); - component.value = name.toLowerCase(); + component.value = name; if (mapping.get) { // an input hardware.inputs[name] = { From fe6ec9635d72e990521f24efe98856cf81ffc21e Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 15 Aug 2022 16:59:41 -0600 Subject: [PATCH 081/100] Added nicer syntax for CodeClass process calls --- source/component_defs.json | 2 +- source/json2daisy.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/source/component_defs.json b/source/component_defs.json index c166c4f..a2e2bd1 100644 --- a/source/component_defs.json +++ b/source/component_defs.json @@ -1458,7 +1458,7 @@ "mapping": [ { "name": "{name}", - "set": "{class_name}.{parent}.{getter}();", + "get": "{class_name}.{parent}.{getter}()", "permit_scale": false } ] diff --git a/source/json2daisy.js b/source/json2daisy.js index ce6e2c8..74dee4c 100644 --- a/source/json2daisy.js +++ b/source/json2daisy.js @@ -340,6 +340,21 @@ exports.generate_header = function generate_header(board_description_object, tar display.Update(); `; + // mangle CodeClass process calls into the correct syntax + let process_fields = ['process', 'loopprocess', 'postprocess', 'display']; + for (let component in components) + { + let comp_obj = components[component]; + if (comp_obj.component == 'CodeClass') + { + for (let field of process_fields) + { + if (field in comp_obj && comp_obj[field]) + comp_obj[field] = `{name}.${comp_obj[field]}();`; + } + } + } + replacements.process = filter_map_template(components, 'process', key_exclude='is_default', match_exclude=true); // There's also this after {process}. I don't see any meta in the defaults json at this time. Is this needed? // ${components.filter((e) => e.meta).map((e) => e.meta.map(m=>`${template(m, e)}`).join("")).join("")} From 693d1d19f2c098871beabf70ec9e3c9282ebb60f Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 15 Aug 2022 16:59:55 -0600 Subject: [PATCH 082/100] Fixed potential ProcessAllControls bug --- source/oopsy.js | 1 + 1 file changed, 1 insertion(+) diff --git a/source/oopsy.js b/source/oopsy.js index 4869af1..b99e4d3 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -1511,6 +1511,7 @@ struct App_${name} : public oopsy::App { void audioCallback(oopsy::GenDaisy& daisy, daisy::AudioHandle::InputBuffer hardware_ins, daisy::AudioHandle::OutputBuffer hardware_outs, size_t size) { Daisy& hardware = daisy.hardware; ${name}::State& gen = *(${name}::State *)daisy.gen; + ${hardware.som == 'seed' ? "hardware.ProcessAllControls();" : ""} ${app.inserts.concat(hardware.inserts).filter(o => o.where == "audio").map(o => o.code).join("\n\t")} ${daisy.device_inputs.map(name => nodes[name]) .filter(node => node.to.length) From b47f0bd161d3859afb6dde5a9e4011dca3ffc678 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Tue, 16 Aug 2022 14:08:50 -0600 Subject: [PATCH 083/100] Improved header file usability --- source/json2daisy.js | 8 +++++--- source/oopsy.js | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/source/json2daisy.js b/source/json2daisy.js index 74dee4c..0a40cb7 100644 --- a/source/json2daisy.js +++ b/source/json2daisy.js @@ -373,8 +373,9 @@ exports.generate_header = function generate_header(board_description_object, tar headers = Object.filter(components, item => 'header' in item); abs_headers = headers.map(item => path.isAbsolute(item.header) ? item.header : path.normalize(path.join(path.dirname(target_path), item.header))); - replacements.headers = abs_headers.map(item => `#include "${item}"`).join("\n"); - + include_paths = abs_headers.map(item => path.dirname(item)); + replacements.headers = abs_headers.map(item => `#include "${path.basename(item)}"`).join("\n"); + replacements.dispdec = 'display' in target ? `daisy::OledDisplay<${target.display.driver}> display;` : ""; let header = ` @@ -572,7 +573,8 @@ ${replacements.name != '' ? `struct Daisy${replacements.name[0].toUpperCase()}${ name: target.name, components: components, aliases: target.aliases, - channels: audio_channels + channels: audio_channels, + includes: include_paths, }; return board_info; diff --git a/source/oopsy.js b/source/oopsy.js index b99e4d3..a0b8099 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -459,6 +459,7 @@ function run() { hardware.struct = board_info.header; hardware.components = board_info.components; hardware.aliases = board_info.aliases; + hardware.includes = board_info.includes; if (hardware.components) { // generate IO @@ -593,11 +594,15 @@ function run() { const makefile_path = path.join(build_path, `Makefile`) const bin_path = path.join(build_path, "build", build_name+".bin"); const maincpp_path = path.join(build_path, `${build_name}_${target}.cpp`); + const includes = hardware.includes.map( + item => `-I"${posixify_path(path.relative(build_path, item))}"`); + fs.writeFileSync(makefile_path, ` # Project Name TARGET = ${build_name} # Sources -- note, won't work with paths with spaces CPP_SOURCES = ${posixify_path(path.relative(build_path, maincpp_path).replace(" ", "\\ "))} +${includes.length > 0 ? `C_INCLUDES = ${includes.join('\\\n')}` : ``} # Library Locations LIBDAISY_DIR = ${(posixify_path(path.relative(build_path, path.join(__dirname, "libdaisy"))).replace(" ", "\\ "))} ${hardware.defines.OOPSY_TARGET_USES_SDMMC ? `USE_FATFS = 1`:``} From f4e637d40f016e299564fc87f3e39e32c09485c6 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 22 Aug 2022 15:27:55 -0600 Subject: [PATCH 084/100] Provided default getters and setters --- source/json2daisy.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/source/json2daisy.js b/source/json2daisy.js index 0a40cb7..2cfbf9e 100644 --- a/source/json2daisy.js +++ b/source/json2daisy.js @@ -355,6 +355,22 @@ exports.generate_header = function generate_header(board_description_object, tar } } + // Provide default getters and setters for CodeInput and CodeOutput components + for (let component in components) + { + let comp_obj = components[component]; + if (comp_obj.component == 'CodeInput') + { + if (!comp_obj.setter) + comp_obj.setter = component; + } + else if (comp_obj.component == 'CodeOutput') + { + if (!comp_obj.getter) + comp_obj.getter = component; + } + } + replacements.process = filter_map_template(components, 'process', key_exclude='is_default', match_exclude=true); // There's also this after {process}. I don't see any meta in the defaults json at this time. Is this needed? // ${components.filter((e) => e.meta).map((e) => e.meta.map(m=>`${template(m, e)}`).join("")).join("")} @@ -375,7 +391,7 @@ exports.generate_header = function generate_header(board_description_object, tar path.normalize(path.join(path.dirname(target_path), item.header))); include_paths = abs_headers.map(item => path.dirname(item)); replacements.headers = abs_headers.map(item => `#include "${path.basename(item)}"`).join("\n"); - + replacements.dispdec = 'display' in target ? `daisy::OledDisplay<${target.display.driver}> display;` : ""; let header = ` From 2503de8b8db3346ae237c441a7511b0750c1ddb9 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Fri, 7 Oct 2022 18:37:28 -0600 Subject: [PATCH 085/100] Corrected bootloader app allocation --- source/genlib_daisy.h | 6 +++++- source/libdaisy | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 3a2127c..6c686b8 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -51,7 +51,11 @@ static bool update = false; #define OOPSY_SUPER_LONG_PRESS_MS (20000) #define OOPSY_DISPLAY_PERIOD_MS 10 #define OOPSY_SCOPE_MAX_ZOOM (8) -static const uint32_t OOPSY_SRAM_SIZE = 512 * 1024; +#ifndef BOOT_APP +static const uint32_t OOPSY_SRAM_SIZE = 511 * 1024; +#else +static const uint32_t OOPSY_SRAM_SIZE = 255 * 1024; +#endif static const uint32_t OOPSY_SDRAM_SIZE = 64 * 1024 * 1024; // Added dedicated global SDFile to replace old global from libDaisy diff --git a/source/libdaisy b/source/libdaisy index 04dd336..d56be69 160000 --- a/source/libdaisy +++ b/source/libdaisy @@ -1 +1 @@ -Subproject commit 04dd33614ab67fde6deae3ec0bc60a0ad128e3c3 +Subproject commit d56be6916ecbb82ab129e1d1939582a2a2bfedcd From f46a9fa750a410d426b22247f6af9469a2c71118 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Wed, 26 Oct 2022 13:07:47 -0600 Subject: [PATCH 086/100] Updated libDaisy commit This fixes Seed 2 DFM extra pin issues. --- source/libdaisy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libdaisy b/source/libdaisy index c8a34a7..c65cbfe 160000 --- a/source/libdaisy +++ b/source/libdaisy @@ -1 +1 @@ -Subproject commit c8a34a7c47dc1bb2c4ea704fd5c09d3008dcd472 +Subproject commit c65cbfe88295282d95734299065a58d9e87af172 From f1842e94b423c96a4ab7ab44ef97e8ec01b31f67 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 6 Feb 2023 10:44:03 -0700 Subject: [PATCH 087/100] Reintroduced oopsy defines --- source/field.json | 1 + source/patch.json | 8 +++++++- source/petal.json | 5 +++++ source/pod.json | 11 +++++++---- source/versio.json | 5 ++++- 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/source/field.json b/source/field.json index 4653650..72f93cb 100644 --- a/source/field.json +++ b/source/field.json @@ -7,6 +7,7 @@ "OOPSY_TARGET_HAS_MIDI_INPUT": 1, "OOPSY_TARGET_HAS_MIDI_OUTPUT": 1 }, + "max_apps": 8, "display": {}, "audio": { "channels": 2 diff --git a/source/patch.json b/source/patch.json index 963718c..b8ba9a1 100644 --- a/source/patch.json +++ b/source/patch.json @@ -2,8 +2,14 @@ "name": "patch", "som": "seed", "defines": { - "OOPSY_TARGET_HAS_MIDI_INPUT": 1 + "OOPSY_TARGET_PATCH": 1, + "OOPSY_TARGET_HAS_MIDI_INPUT": 1, + "OOPSY_TARGET_HAS_MIDI_OUTPUT": 1, + "OOPSY_IO_COUNT": 4, + "OOPSY_HAS_ENCODER": 1, + "OOPSY_TARGET_HAS_OLED": 1 }, + "max_apps": 8, "display": {}, "audio": { "channels": 4 diff --git a/source/petal.json b/source/petal.json index 6a32dbc..c8ce815 100644 --- a/source/petal.json +++ b/source/petal.json @@ -1,6 +1,11 @@ { "name": "petal", "som": "seed", + "defines": { + "OOPSY_TARGET_PETAL": 1, + "OOPSY_HAS_ENCODER": 1 + }, + "max_apps": 8, "parents": { "i2c": { "component": "i2c", diff --git a/source/pod.json b/source/pod.json index 0e50316..861dfc6 100644 --- a/source/pod.json +++ b/source/pod.json @@ -2,12 +2,15 @@ "name": "pod", "som": "seed", "defines": { - "OOPSY_TARGET_HAS_MIDI_INPUT": 1 + "OOPSY_TARGET_POD": 1, + "OOPSY_TARGET_HAS_MIDI_INPUT": 1, + "OOPSY_HAS_ENCODER": 1 }, + "max_apps": 8, "display": {}, "audio": { - "channels": 2 - }, + "channels": 2 + }, "components": { "sw1": { "component": "Switch", @@ -66,4 +69,4 @@ "ctrl2": "knob2", "led": "led1" } -} +} \ No newline at end of file diff --git a/source/versio.json b/source/versio.json index 02398b7..73a7153 100644 --- a/source/versio.json +++ b/source/versio.json @@ -1,7 +1,10 @@ { "name":"versio", "som":"seed", - "defines": {}, + "defines": { + "OOPSY_TARGET_VERSIO": 1 + }, + "max_apps": 1, "components": { "knob1": { "component": "AnalogControl", From 8b5df2e7be9ea3b92cf00d3c918dc3ee4c8f356e Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 27 Feb 2023 12:07:43 -0700 Subject: [PATCH 088/100] Create release.yaml --- .github/workflows/release.yaml | 37 ++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..e1a8c7d --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,37 @@ +name: Release + +on: + push: + tags: + - "v*" + workflow_dispatch: + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + path: 'oopsy' + ref: 'main' + - name: Install ARM Toolchain + uses: carlosperate/arm-none-eabi-gcc-action@v1 + with: + release: '10-2020-q4' + - name: Build libDaisy + run: | + make -C oopsy/source/libdaisy -j$(nproc) + - name: Zip it up + run: | + rm -rf oopsy/.git + rm -rf oopsy/.github + zip -r oopsy.zip oopsy + - name: Make Release + uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: ${{ github.token }} + draft: true + prerelease: false + files: | + oopsy.zip + LICENSE From 25b6d2f1207340b2e7e40a7435c3b9ae5fc1da79 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 27 Feb 2023 12:17:36 -0700 Subject: [PATCH 089/100] Added specific branch to push trigger --- .github/workflows/release.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e1a8c7d..97a0f27 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -2,6 +2,8 @@ name: Release on: push: + branches: + - main tags: - "v*" workflow_dispatch: From 3a16f332ebb3487ed104a354689772eb97ec1f20 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 27 Feb 2023 12:31:00 -0700 Subject: [PATCH 090/100] Added submodule checkout --- .github/workflows/release.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 97a0f27..a48286f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -20,6 +20,10 @@ jobs: uses: carlosperate/arm-none-eabi-gcc-action@v1 with: release: '10-2020-q4' + - name: update submodules + working-directory: oopsy + run: | + git submodule update --init - name: Build libDaisy run: | make -C oopsy/source/libdaisy -j$(nproc) From d457eec1480602f008c873d01499626581a42655 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Tue, 7 Mar 2023 14:04:57 -0700 Subject: [PATCH 091/100] Corrected SRAM allocation size --- source/genlib_daisy.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index a626445..798a4c7 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -51,13 +51,12 @@ static bool update = false; #define OOPSY_SUPER_LONG_PRESS_MS (20000) #define OOPSY_DISPLAY_PERIOD_MS 10 #define OOPSY_SCOPE_MAX_ZOOM (8) -#ifndef BOOT_APP -static const uint32_t OOPSY_SRAM_SIZE = 511 * 1024; -#else -static const uint32_t OOPSY_SRAM_SIZE = 255 * 1024; -#endif +static const uint32_t OOPSY_SRAM_SIZE = 512 * 1024; static const uint32_t OOPSY_SDRAM_SIZE = 64 * 1024 * 1024; +// Pointer to the beginning of the SRAM heap +extern void *__heap_start__; + // Added dedicated global SDFile to replace old global from libDaisy FIL SDFile; @@ -70,7 +69,10 @@ namespace oopsy { void init() { if (!sram_pool) sram_pool = (char *)malloc(OOPSY_SRAM_SIZE); - sram_usable = OOPSY_SRAM_SIZE; + // There's no guarantee the allocation will actually be + // of size "OOPSY_SRAM_SIZE," so this just clamps the + // usable space to what it really is. + sram_usable = (0x24080000 - 1024) - ((size_t) sram_pool); sram_used = 0; sdram_usable = OOPSY_SDRAM_SIZE; sdram_used = 0; From ffcca0754c5e3d2a7e02b7b3d4a9629c3dd27b17 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Tue, 7 Mar 2023 14:16:15 -0700 Subject: [PATCH 092/100] Removed spurious linker variable --- source/genlib_daisy.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 798a4c7..cd93996 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -54,9 +54,6 @@ static bool update = false; static const uint32_t OOPSY_SRAM_SIZE = 512 * 1024; static const uint32_t OOPSY_SDRAM_SIZE = 64 * 1024 * 1024; -// Pointer to the beginning of the SRAM heap -extern void *__heap_start__; - // Added dedicated global SDFile to replace old global from libDaisy FIL SDFile; From d8a1ce25fd23e9c02aa50d637d3360759d9c80b1 Mon Sep 17 00:00:00 2001 From: Corvus Date: Mon, 3 Apr 2023 12:51:37 -0600 Subject: [PATCH 093/100] Updated libdaisy to latest master --- source/libdaisy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libdaisy b/source/libdaisy index d56be69..8d38c67 160000 --- a/source/libdaisy +++ b/source/libdaisy @@ -1 +1 @@ -Subproject commit d56be6916ecbb82ab129e1d1939582a2a2bfedcd +Subproject commit 8d38c67f941c2c9f01327517248df0a27596b9a0 From 212d9d8d643dce191709c6f45b893b275b4a9e4c Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Thu, 6 Apr 2023 10:55:12 -0600 Subject: [PATCH 094/100] Updated libDaisy to existing commit --- source/libdaisy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libdaisy b/source/libdaisy index 8d38c67..5f1d862 160000 --- a/source/libdaisy +++ b/source/libdaisy @@ -1 +1 @@ -Subproject commit 8d38c67f941c2c9f01327517248df0a27596b9a0 +Subproject commit 5f1d862c60c6966dda3fb8a71fceeb6aeec00e02 From 1d3e65962f43c187a3a1aa2bb1c05a3dd0d77cea Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Mon, 5 Jun 2023 14:12:46 -0600 Subject: [PATCH 095/100] Added temporary Petal LED fix --- source/genlib_daisy.h | 11 ++++-- source/petal_led_hardcode.h | 74 +++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 source/petal_led_hardcode.h diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index cd93996..4ab9458 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -44,6 +44,10 @@ static bool update = false; #include "daisy_field.h" #endif +#ifdef OOPSY_TARGET_PETAL +#include "petal_led_hardcode.h" +#endif + ////////////////////////// DAISY EXPORT INTERFACING ////////////////////////// #define OOPSY_MIDI_BUFFER_SIZE (1024) @@ -584,7 +588,7 @@ namespace oopsy { hardware.display.Fill(false); #endif #ifdef OOPSY_TARGET_PETAL - hardware.ClearLeds(); + hardware.led_driver.SetAllTo((uint8_t) 0); #endif if (menu_button_held_ms > OOPSY_LONG_PRESS_MS) { @@ -599,7 +603,8 @@ namespace oopsy { #endif for(int i = 0; i < 8; i++) { float white = (i == app_selecting || menu_button_released); - hardware.SetRingLed((daisy::DaisyPetal::RingLed)i, + + SetRingLed(&hardware.led_driver, (daisy::DaisyPetal::RingLed)i, (i == app_selected || white) * 1.f, white * 1.f, (i < app_count) * 0.3f + white * 1.f @@ -856,7 +861,7 @@ namespace oopsy { #endif //OOPSY_TARGET_HAS_OLED #if (OOPSY_TARGET_PETAL) - hardware.UpdateLeds(); + hardware.led_driver.SwapBuffersAndTransmit(); #endif //(OOPSY_TARGET_PETAL) } // uitimer.ready diff --git a/source/petal_led_hardcode.h b/source/petal_led_hardcode.h new file mode 100644 index 0000000..bc4ac23 --- /dev/null +++ b/source/petal_led_hardcode.h @@ -0,0 +1,74 @@ +#include +#include "daisy.h" +#include "daisy_petal.h" + +enum LedOrder +{ + LED_RING_1_R, + LED_RING_1_G, + LED_RING_1_B, + LED_RING_5_R, + LED_RING_5_G, + LED_RING_5_B, + LED_RING_2_R, + LED_RING_2_G, + LED_RING_2_B, + LED_RING_6_R, + LED_RING_6_G, + LED_RING_6_B, + LED_RING_3_R, + LED_RING_3_G, + LED_RING_3_B, + LED_FS_1, + LED_RING_4_R, + LED_RING_4_G, + LED_RING_4_B, + LED_RING_7_R, + LED_RING_7_G, + LED_RING_7_B, + LED_RING_8_R, + LED_RING_8_G, + LED_RING_8_B, + LED_FS_2, + LED_FS_3, + LED_FS_4, + LED_FAKE1, + LED_FAKE2, + LED_FAKE3, + LED_FAKE4, + LED_LAST, +}; + +template +void SetRingLed(daisy::LedDriverPca9685* led_driver, daisy::DaisyPetal::RingLed idx, float r, float g, float b) +{ + uint8_t r_addr[daisy::DaisyPetal::RingLed::RING_LED_LAST] = {LED_RING_1_R, + LED_RING_2_R, + LED_RING_3_R, + LED_RING_4_R, + LED_RING_5_R, + LED_RING_6_R, + LED_RING_7_R, + LED_RING_8_R}; + uint8_t g_addr[daisy::DaisyPetal::RingLed::RING_LED_LAST] = {LED_RING_1_G, + LED_RING_2_G, + LED_RING_3_G, + LED_RING_4_G, + LED_RING_5_G, + LED_RING_6_G, + LED_RING_7_G, + LED_RING_8_G}; + uint8_t b_addr[daisy::DaisyPetal::RingLed::RING_LED_LAST] = {LED_RING_1_B, + LED_RING_2_B, + LED_RING_3_B, + LED_RING_4_B, + LED_RING_5_B, + LED_RING_6_B, + LED_RING_7_B, + LED_RING_8_B}; + + + led_driver->SetLed(r_addr[idx], r); + led_driver->SetLed(g_addr[idx], g); + led_driver->SetLed(b_addr[idx], b); +} \ No newline at end of file From 40c6d12cdfc697b3634d20791ec836a9062272dc Mon Sep 17 00:00:00 2001 From: Corvus Date: Wed, 7 Jun 2023 10:50:26 -0600 Subject: [PATCH 096/100] Update libdaisy --- source/libdaisy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libdaisy b/source/libdaisy index 5f1d862..76e0071 160000 --- a/source/libdaisy +++ b/source/libdaisy @@ -1 +1 @@ -Subproject commit 5f1d862c60c6966dda3fb8a71fceeb6aeec00e02 +Subproject commit 76e0071020aaf78c859f6b73d376a7e256df3d9e From da557cb07a68334e77c53e5e81367188289489f9 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Fri, 9 Jun 2023 11:37:05 -0600 Subject: [PATCH 097/100] Revert "Update libdaisy" This reverts commit 40c6d12cdfc697b3634d20791ec836a9062272dc. --- source/libdaisy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libdaisy b/source/libdaisy index 76e0071..5f1d862 160000 --- a/source/libdaisy +++ b/source/libdaisy @@ -1 +1 @@ -Subproject commit 76e0071020aaf78c859f6b73d376a7e256df3d9e +Subproject commit 5f1d862c60c6966dda3fb8a71fceeb6aeec00e02 From e40f70a396e760ad2157dec7fba5d62e4fa28c28 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Fri, 9 Jun 2023 11:40:28 -0600 Subject: [PATCH 098/100] Updated to valid libDaisy commit --- source/libdaisy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libdaisy b/source/libdaisy index 5f1d862..b65a1ba 160000 --- a/source/libdaisy +++ b/source/libdaisy @@ -1 +1 @@ -Subproject commit 5f1d862c60c6966dda3fb8a71fceeb6aeec00e02 +Subproject commit b65a1bad880f5d6ca5194d7162652757c6f4fcc5 From 7af02e74c9378a702e8f2c755a4087146ec56583 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Fri, 9 Jun 2023 12:46:45 -0600 Subject: [PATCH 099/100] Resolved Versio issues --- source/genlib_daisy.h | 32 +++--- source/oopsy.js | 2 +- source/test.sh | 4 +- source/versio.json | 3 +- templates/oopsy_versio.maxpat | 182 ++++++++++++++++++++++++---------- 5 files changed, 148 insertions(+), 75 deletions(-) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 4ab9458..7be7646 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -612,22 +612,22 @@ namespace oopsy { } #endif //OOPSY_TARGET_PETAL - #ifdef OOPSY_TARGET_VERSIO - // has no mode selection - is_mode_selecting = 0; - #if defined(OOPSY_MULTI_APP) - // multi-app is always in menu mode: - mode = MODE_MENU; - #endif - for(int i = 0; i < 4; i++) { - float white = (i == app_selecting || menu_button_released); - hardware.SetLed(i, - (i == app_selected || white) * 1.f, - white * 1.f, - (i < app_count) * 0.3f + white * 1.f - ); - } - #endif //OOPSY_TARGET_VERSIO + // #ifdef OOPSY_TARGET_VERSIO + // // has no mode selection + // is_mode_selecting = 0; + // #if defined(OOPSY_MULTI_APP) + // // multi-app is always in menu mode: + // mode = MODE_MENU; + // #endif + // for(int i = 0; i < 4; i++) { + // float white = (i == app_selecting || menu_button_released); + // hardware.SetLed(i, + // (i == app_selected || white) * 1.f, + // white * 1.f, + // (i < app_count) * 0.3f + white * 1.f + // ); + // } + // #endif //OOPSY_TARGET_VERSIO // Handle encoder increment actions: if (is_mode_selecting) { diff --git a/source/oopsy.js b/source/oopsy.js index 20bd60d..bcc4722 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -330,7 +330,7 @@ function run() { case "upload": case "up": action="upload"; break; - case "versio": target = arg; break; + case "versio": target_path = path.join(__dirname, "versio.json"); break; case "bluemchen": target_path = path.join(__dirname, "bluemchen.json"); break; case "nehcmeulb": target_path = path.join(__dirname, "nehcmeulb.json"); break; case "pod": target_path = path.join(__dirname, "pod.json"); break; diff --git a/source/test.sh b/source/test.sh index eac9afa..c57098a 100755 --- a/source/test.sh +++ b/source/test.sh @@ -4,8 +4,8 @@ node oopsy.js ../templates/oopsy_field.cpp field && \ node oopsy.js ../templates/oopsy_petal.cpp petal && \ node oopsy.js ../templates/oopsy_pod.cpp pod && \ node oopsy.js ../templates/oopsy_versio.cpp versio && \ -node oopsy.js ../templates/oopsy_pod.cpp seed.pod.json && \ -node oopsy.js ../templates/oopsy_versio.cpp seed.versio.json && \ +node oopsy.js ../templates/oopsy_pod.cpp pod.json && \ +node oopsy.js ../templates/oopsy_versio.cpp versio.json && \ node oopsy.js ../templates/oopsy_bluemchen.cpp bluemchen && \ node oopsy.js ../templates/oopsy_nehcmeulb.cpp nehcmeulb && \ node oopsy.js ../examples/dattoro.cpp ../examples/gigaverb.cpp ../examples/crossover.cpp ../examples/midside.cpp && \ diff --git a/source/versio.json b/source/versio.json index 73a7153..d530f20 100644 --- a/source/versio.json +++ b/source/versio.json @@ -41,7 +41,8 @@ }, "gate1": { "component": "GateIn", - "pin": 24 + "pin": 24, + "invert": false }, "sw1": { "component": "Switch3", diff --git a/templates/oopsy_versio.maxpat b/templates/oopsy_versio.maxpat index b096f4c..9a80d22 100644 --- a/templates/oopsy_versio.maxpat +++ b/templates/oopsy_versio.maxpat @@ -3,14 +3,14 @@ "fileversion" : 1, "appversion" : { "major" : 8, - "minor" : 1, - "revision" : 11, + "minor" : 5, + "revision" : 4, "architecture" : "x64", "modernui" : 1 } , "classnamespace" : "box", - "rect" : [ 288.0, 79.0, 835.0, 709.0 ], + "rect" : [ 61.0, 79.0, 535.0, 709.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -48,6 +48,7 @@ "enablevscroll" : 0, "id" : "obj-5", "lockeddragscroll" : 0, + "lockedsize" : 0, "maxclass" : "bpatcher", "name" : "oopsy.maxpat", "numinlets" : 1, @@ -72,6 +73,14 @@ "parameter_mappable" : 0, "patching_rect" : [ 588.833333333333258, 111.5, 16.0, 16.0 ], "saved_attribute_attributes" : { + "activebgcolor" : { + "expression" : "" + } +, + "bgcolor" : { + "expression" : "" + } +, "valueof" : { "parameter_enum" : [ "off", "on" ], "parameter_initial" : [ 0.0 ], @@ -100,6 +109,14 @@ "parameter_enable" : 1, "patching_rect" : [ 569.5, 111.5, 16.0, 16.0 ], "saved_attribute_attributes" : { + "activebgcolor" : { + "expression" : "" + } +, + "bgcolor" : { + "expression" : "" + } +, "valueof" : { "parameter_enum" : [ "off", "on" ], "parameter_initial" : [ 0.0 ], @@ -129,6 +146,14 @@ "parameter_mappable" : 0, "patching_rect" : [ 543.333333333333258, 111.5, 16.0, 16.0 ], "saved_attribute_attributes" : { + "activebgcolor" : { + "expression" : "" + } +, + "bgcolor" : { + "expression" : "" + } +, "valueof" : { "parameter_enum" : [ "off", "on" ], "parameter_initial" : [ 0.0 ], @@ -157,6 +182,14 @@ "parameter_enable" : 1, "patching_rect" : [ 524.0, 111.5, 16.0, 16.0 ], "saved_attribute_attributes" : { + "activebgcolor" : { + "expression" : "" + } +, + "bgcolor" : { + "expression" : "" + } +, "valueof" : { "parameter_enum" : [ "off", "on" ], "parameter_initial" : [ 0.0 ], @@ -180,6 +213,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], + "parameter_enable" : 0, "patching_rect" : [ 562.0, 462.355421686746922, 113.0, 22.0 ], "text_width" : 60.0 } @@ -193,6 +227,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], + "parameter_enable" : 0, "patching_rect" : [ 562.0, 440.379518072289102, 113.0, 22.0 ], "text_width" : 60.0 } @@ -206,6 +241,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], + "parameter_enable" : 0, "patching_rect" : [ 562.0, 418.403614457831281, 113.0, 22.0 ], "text_width" : 60.0 } @@ -219,6 +255,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], + "parameter_enable" : 0, "patching_rect" : [ 562.0, 396.427710843373461, 113.0, 22.0 ], "text_width" : 60.0 } @@ -232,6 +269,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], + "parameter_enable" : 0, "patching_rect" : [ 562.0, 374.451807228915641, 113.0, 22.0 ], "text_width" : 60.0 } @@ -245,6 +283,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], + "parameter_enable" : 0, "patching_rect" : [ 562.0, 352.47590361445782, 113.0, 22.0 ], "text_width" : 60.0 } @@ -258,6 +297,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], + "parameter_enable" : 0, "patching_rect" : [ 449.5, 437.855421686746922, 99.0, 22.0 ], "text_width" : 63.0 } @@ -272,6 +312,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], + "parameter_enable" : 0, "patching_rect" : [ 449.5, 462.355421686746922, 99.0, 22.0 ], "text_width" : 63.0 } @@ -285,6 +326,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], + "parameter_enable" : 0, "patching_rect" : [ 562.0, 330.5, 113.0, 22.0 ], "text_width" : 60.0 } @@ -298,6 +340,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], + "parameter_enable" : 0, "patching_rect" : [ 449.5, 413.855421686746922, 99.0, 22.0 ], "text_width" : 63.0 } @@ -329,8 +372,8 @@ "fileversion" : 1, "appversion" : { "major" : 8, - "minor" : 1, - "revision" : 11, + "minor" : 5, + "revision" : 4, "architecture" : "x64", "modernui" : 1 } @@ -737,6 +780,10 @@ "parameter_enable" : 1, "patching_rect" : [ 605.0, 252.0, 50.0, 43.0 ], "saved_attribute_attributes" : { + "panelcolor" : { + "expression" : "" + } +, "valueof" : { "parameter_longname" : "knob7", "parameter_mmax" : 1.0, @@ -766,6 +813,10 @@ "parameter_enable" : 1, "patching_rect" : [ 605.0, 174.0, 50.0, 43.0 ], "saved_attribute_attributes" : { + "panelcolor" : { + "expression" : "" + } +, "valueof" : { "parameter_longname" : "knob6", "parameter_mmax" : 1.0, @@ -795,6 +846,10 @@ "parameter_enable" : 1, "patching_rect" : [ 605.0, 96.0, 50.0, 43.0 ], "saved_attribute_attributes" : { + "panelcolor" : { + "expression" : "" + } +, "valueof" : { "parameter_longname" : "knob5", "parameter_mmax" : 1.0, @@ -824,6 +879,10 @@ "parameter_enable" : 1, "patching_rect" : [ 537.0, 210.0, 50.0, 43.0 ], "saved_attribute_attributes" : { + "panelcolor" : { + "expression" : "" + } +, "valueof" : { "parameter_longname" : "knob4", "parameter_mmax" : 1.0, @@ -853,6 +912,10 @@ "parameter_enable" : 1, "patching_rect" : [ 537.0, 134.0, 50.0, 43.0 ], "saved_attribute_attributes" : { + "panelcolor" : { + "expression" : "" + } +, "valueof" : { "parameter_longname" : "knob3", "parameter_mmax" : 1.0, @@ -882,6 +945,10 @@ "parameter_enable" : 1, "patching_rect" : [ 472.0, 174.0, 50.0, 43.0 ], "saved_attribute_attributes" : { + "panelcolor" : { + "expression" : "" + } +, "valueof" : { "parameter_longname" : "knob2", "parameter_mmax" : 1.0, @@ -911,6 +978,10 @@ "parameter_enable" : 1, "patching_rect" : [ 472.0, 96.0, 50.0, 43.0 ], "saved_attribute_attributes" : { + "panelcolor" : { + "expression" : "" + } +, "valueof" : { "parameter_longname" : "knob1", "parameter_mmax" : 1.0, @@ -987,6 +1058,7 @@ "enablevscroll" : 0, "id" : "obj-7", "lockeddragscroll" : 0, + "lockedsize" : 0, "maxclass" : "bpatcher", "name" : "demosound.maxpat", "numinlets" : 0, @@ -1010,8 +1082,8 @@ "fileversion" : 1, "appversion" : { "major" : 8, - "minor" : 1, - "revision" : 11, + "minor" : 5, + "revision" : 4, "architecture" : "x64", "modernui" : 1 } @@ -1452,7 +1524,7 @@ , "patching_rect" : [ 18.0, 483.0, 144.0, 35.0 ], "saved_object_attributes" : { - "exportfolder" : "macOS:/Users/corvus/Documents/Max 8/Packages/Oopsy/templates/", + "exportfolder" : "macOS:/Users/corvus/Documents/Max 8/Packages/oopsy/templates/", "exportname" : "oopsy_versio" } , @@ -1486,8 +1558,8 @@ "fileversion" : 1, "appversion" : { "major" : 8, - "minor" : 1, - "revision" : 11, + "minor" : 5, + "revision" : 4, "architecture" : "x64", "modernui" : 1 } @@ -2645,102 +2717,102 @@ } , "dependency_cache" : [ { - "name" : "oopsy_noise_engineering_versio.png", - "bootpath" : "~/Documents/Max 8/Packages/Oopsy/media", - "patcherrelativepath" : "../media", - "type" : "PNG", + "name" : "demosound.maxpat", + "bootpath" : "C74:/help/msp", + "type" : "JSON", "implicit" : 1 } , { - "name" : "oopsy.suggestions.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", - "patcherrelativepath" : "../code", - "type" : "gDSP", + "name" : "interfacecolor.js", + "bootpath" : "C74:/interfaces", + "type" : "TEXT", "implicit" : 1 } , { - "name" : "oopsy.gate.trig.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", + "name" : "oopsy.ctrl.smooth2.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { - "name" : "oopsy.gate.min.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", + "name" : "oopsy.ctrl.smooth3.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { - "name" : "oopsy.ctrl.smooth3.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", + "name" : "oopsy.gate.min.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { - "name" : "oopsy.ctrl.smooth2.gendsp", - "bootpath" : "~/Documents/Max 8/Packages/Oopsy/code", + "name" : "oopsy.gate.trig.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { - "name" : "demosound.maxpat", - "bootpath" : "C74:/help/msp", + "name" : "oopsy.maxpat", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", + "patcherrelativepath" : "../patchers", "type" : "JSON", "implicit" : 1 } , { - "name" : "sine.svg", - "bootpath" : "C74:/media/max/picts/m4l-picts", - "type" : "svg", + "name" : "oopsy.node4max.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", "implicit" : 1 } , { - "name" : "saw.svg", - "bootpath" : "C74:/media/max/picts/m4l-picts", - "type" : "svg", + "name" : "oopsy.snoop.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", "implicit" : 1 } , { - "name" : "square.svg", - "bootpath" : "C74:/media/max/picts/m4l-picts", - "type" : "svg", + "name" : "oopsy.suggestions.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "patcherrelativepath" : "../code", + "type" : "gDSP", "implicit" : 1 } , { - "name" : "random.svg", - "bootpath" : "C74:/media/max/picts/m4l-picts", - "type" : "svg", + "name" : "oopsy_noise_engineering_versio.png", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/media", + "patcherrelativepath" : "../media", + "type" : "PNG", "implicit" : 1 } , { - "name" : "interfacecolor.js", - "bootpath" : "C74:/interfaces", - "type" : "TEXT", + "name" : "random.svg", + "bootpath" : "C74:/media/max/picts/m4l-picts", + "type" : "svg", "implicit" : 1 } , { - "name" : "oopsy.maxpat", - "bootpath" : "~/Documents/Max 8/Packages/Oopsy/patchers", - "patcherrelativepath" : "../patchers", - "type" : "JSON", + "name" : "saw.svg", + "bootpath" : "C74:/media/max/picts/m4l-picts", + "type" : "svg", "implicit" : 1 } , { - "name" : "oopsy.snoop.js", - "bootpath" : "~/Documents/Max 8/Packages/Oopsy/javascript", - "patcherrelativepath" : "../javascript", - "type" : "TEXT", + "name" : "sine.svg", + "bootpath" : "C74:/media/max/picts/m4l-picts", + "type" : "svg", "implicit" : 1 } , { - "name" : "oopsy.node4max.js", - "bootpath" : "~/Documents/Max 8/Packages/Oopsy/javascript", - "patcherrelativepath" : "../javascript", - "type" : "TEXT", + "name" : "square.svg", + "bootpath" : "C74:/media/max/picts/m4l-picts", + "type" : "svg", "implicit" : 1 } ], From ebd3496575bcdc0a63b3588d534bc1deb73ad505 Mon Sep 17 00:00:00 2001 From: CorvusPrudens Date: Tue, 30 Jan 2024 11:40:33 -0700 Subject: [PATCH 100/100] Added code components to all SOMs --- source/component_defs_patchsm.json | 519 +++++++++++++++-------------- source/component_defs_petalsm.json | 271 ++++++++------- 2 files changed, 407 insertions(+), 383 deletions(-) diff --git a/source/component_defs_patchsm.json b/source/component_defs_patchsm.json index c9968e0..7c12383 100644 --- a/source/component_defs_patchsm.json +++ b/source/component_defs_patchsm.json @@ -1,261 +1,262 @@ { - "Switch": { - "map_init": "{name}.Init(daisy::patch_sm::DaisyPatchSM::{pin}, som.AudioCallbackRate(), {type}, {polarity}, {pull});", - "typename": "daisy::Switch", - "direction": "in", - "pin": "a", - "type": "daisy::Switch::TYPE_MOMENTARY", - "polarity": "daisy::Switch::POLARITY_INVERTED", - "pull": "daisy::Switch::PULL_UP", - "process": "{name}.Debounce();", - "updaterate": "{name}.SetUpdateRate(som.AudioCallbackRate());", - "mapping": [ - { - "name": "{name}", - "get": "({class_name}.{name}.Pressed()?1.f:0.f)", - "range": [ - 0, - 1 - ], - "bool": false - }, - { - "name": "{name}_press", - "get": "({class_name}.{name}.Pressed()?1.f:0.f)", - "range": [ - 0, - 1 - ], - "bool": false - }, - { - "name": "{name}_seconds", - "get": "({class_name}.{name}.TimeHeldMs()*0.001f)", - "bool": false - } - ] - }, - "Switch3": { - "map_init": "{name}.Init(daisy::patch_sm::DaisyPatchSM::{pin_a}, daisy::patch_sm::DaisyPatchSM::{pin_b}));", - "typename": "daisy::Switch3", - "direction": "in", - "pin": "a,b", - "mapping": [ - { - "name": "{name}", - "get": "({class_name}.{name}.Read()*0.5f+0.5f)", - "range": [ - 0, - 2 - ], - "bool": false - } - ] - }, - "Encoder": { - "map_init": "{name}.Init(daisy::patch_sm::DaisyPatchSM::{pin_a}, daisy::patch_sm::DaisyPatchSM::{pin_b}, daisy::patch_sm::DaisyPatchSM::{pin_click}, som.AudioCallbackRate());", - "typename": "daisy::Encoder", - "direction": "in", - "pin": "a,b,click", - "process": "{name}.Debounce();", - "updaterate": "{name}.SetUpdateRate(som.AudioCallbackRate());", - "mapping": [ - { - "name": "{name}", - "get": "({class_name}.{name}.Increment())", - "range": [ - -1, - 1 - ], - "bool": false - }, - { - "name": "{name}_press", - "get": "({class_name}.{name}.Pressed()?1.f:0.f)", - "range": [ - 0, - 1 - ], - "bool": false - }, - { - "name": "{name}_rise", - "get": "({class_name}.{name}.RisingEdge()?1.f:0.f)", - "range": [ - 0, - 1 - ], - "bool": true - }, - { - "name": "{name}_fall", - "get": "({class_name}.{name}.FallingEdge()?1.f:0.f)", - "range": [ - 0, - 1 - ], - "bool": true - }, - { - "name": "{name}_seconds", - "get": "({class_name}.{name}.TimeHeldMs()*0.001f)", - "range": null, - "bool": false - } - ] - }, - "GateIn": { - "map_init": "{name}.Init(&daisy::patch_sm::DaisyPatchSM::{pin});", - "typename": "daisy::GateIn", - "direction": "in", - "pin": "a", - "default_prefix": "som.", - "mapping": [ - { - "name": "{name}", - "get": "({class_name}.{default_prefix}{name}.State()?1.f:0.f)", - "range": [ - 0, - 1 - ], - "bool": false - }, - { - "name": "{name}_trig", - "get": "({class_name}.{default_prefix}{name}.Trig()?1.f:0.f)", - "range": [ - 0, - 1 - ], - "bool": true - } - ] - }, - "AnalogControl": { - "init_single": "cfg[{i}].InitSingle(daisy::patch_sm::DaisyPatchSM::{pin});", - "map_init": "{name}.Init(som.adc.GetPtr({i}), som.AudioCallbackRate(), {flip}, {invert});", - "typename": "daisy::AnalogControl", - "direction": "in", - "pin": "a", - "flip": "false", - "invert": "false", - "slew": "1.0/som.AudioCallbackRate()", - "process": "{name}.Process();", - "updaterate": "{name}.SetSampleRate(som.AudioCallbackRate());", - "mapping": [ - { - "name": "{name}", - "get": "({class_name}.som.GetAdcValue((int)daisy::patch_sm::{name_upper}))", - "range": [ - 0, - 1 - ], - "bool": false - } - ] - }, - "AnalogControlBipolar": { - "init_single": "cfg[{i}].InitSingle(daisy::patch_sm::DaisyPatchSM::{pin});", - "map_init": "{name}.Init(som.adc.GetPtr({i}), som.AudioCallbackRate(), {flip}, {invert});", - "typename": "daisy::AnalogControl", - "direction": "in", - "pin": "a", - "flip": "false", - "invert": "false", - "slew": "1.0/som.AudioCallbackRate()", - "process": "{name}.Process();", - "updaterate": "{name}.SetSampleRate(som.AudioCallbackRate());", - "mapping": [ - { - "name": "{name}", - "get": "({class_name}.som.GetAdcValue((int)daisy::patch_sm::{name_upper}))", - "range": [ - -1, - 1 - ], - "bool": false - } - ] - }, - "Led": { - "map_init": "{name}.Init(daisy::patch_sm::DaisyPatchSM::{pin}, {invert});\n\t\t{name}.Set(0.0f);", - "typename": "daisy::Led", - "direction": "out", - "pin": "a", - "invert": "true", - "postprocess": "{name}.Update();", - "mapping": [ - { - "name": "{name}", - "set": "{class_name}.{name}.Set({value});" - } - ] - }, - "RgbLed": { - "map_init": "{name}.Init(daisy::patch_sm::DaisyPatchSM::{pin_r}, daisy::patch_sm::DaisyPatchSM::{pin_g}, daisy::patch_sm::DaisyPatchSM::{pin_b}, {invert});\n\t\t{name}.Set(0.0f, 0.0f, 0.0f);", - "typename": "daisy::RgbLed", - "direction": "out", - "pin": "r,g,b", - "invert": "true", - "postprocess": "{name}.Update();", - "mapping": [ - { - "name": "{name}_red", - "set": "{class_name}.{name}.SetRed({value});" - }, - { - "name": "{name}_green", - "set": "{class_name}.{name}.SetGreen({value});" - }, - { - "name": "{name}_blue", - "set": "{class_name}.{name}.SetBlue({value});" - }, - { - "name": "{name}", - "set": "{class_name}.{name}.Set(clamp(-{value}, 0.f, 1.f), 0.f, clamp({value}, 0.f, 1.f));" - }, - { - "name": "{name}_white", - "set": "{class_name}.{name}.Set({value},{value},{value});" - } - ] - }, - "GateOut": { - "map_init": "{name}.pin = daisy::patch_sm::DaisyPatchSM::{pin};\n\t\t{name}.mode = {mode};\n\t\t{name}.pull = {pull};\n\t\tdsy_gpio_init(&{name});", - "typename": "dsy_gpio", - "direction": "out", - "pin": "a", - "default_prefix": "som.", - "mode": "DSY_GPIO_MODE_OUTPUT_PP", - "pull": "DSY_GPIO_NOPULL", - "mapping": [ - { - "name": "{name}", - "set": "dsy_gpio_write(&{class_name}.{default_prefix}{name}, {value});" - } - ] - }, - "CVOuts": { - "map_init": "{name}.bitdepth = {bitdepth};\n\t\t{name}.buff_state = {buff_state};\n\t\t{name}.mode = {mode};\n\t\t{name}.chn = {channel};\n\t\tsom.dac.Init({name});\n\t\tsom.dac.WriteValue({channel}, 0);", - "typename": "daisy::DacHandle::Config", - "direction": "out", - "pin": "", - "bitdepth": "daisy::DacHandle::BitDepth::BITS_12", - "buff_state": "daisy::DacHandle::BufferState::ENABLED", - "mode": "daisy::DacHandle::Mode::POLLING", - "channel": "daisy::DacHandle::Channel::BOTH", - "mapping": [ - { - "name": "{name}1", - "set": "{class_name}.som.WriteCvOut(daisy::patch_sm::CV_OUT_1, {value} * 5.f);", - "where": "main" - }, - { - "name": "{name}2", - "set": "{class_name}.som.WriteCvOut(daisy::patch_sm::CV_OUT_2, {value} * 5.f);", - "where": "main" - } - ] - } + "Switch": { + "map_init": "{name}.Init(daisy::patch_sm::DaisyPatchSM::{pin}, som.AudioCallbackRate(), {type}, {polarity}, {pull});", + "typename": "daisy::Switch", + "direction": "in", + "pin": "a", + "type": "daisy::Switch::TYPE_MOMENTARY", + "polarity": "daisy::Switch::POLARITY_INVERTED", + "pull": "daisy::Switch::PULL_UP", + "process": "{name}.Debounce();", + "updaterate": "{name}.SetUpdateRate(som.AudioCallbackRate());", + "mapping": [ + { + "name": "{name}", + "get": "({class_name}.{name}.Pressed()?1.f:0.f)", + "range": [0, 1], + "bool": false + }, + { + "name": "{name}_press", + "get": "({class_name}.{name}.Pressed()?1.f:0.f)", + "range": [0, 1], + "bool": false + }, + { + "name": "{name}_seconds", + "get": "({class_name}.{name}.TimeHeldMs()*0.001f)", + "bool": false + } + ] + }, + "Switch3": { + "map_init": "{name}.Init(daisy::patch_sm::DaisyPatchSM::{pin_a}, daisy::patch_sm::DaisyPatchSM::{pin_b}));", + "typename": "daisy::Switch3", + "direction": "in", + "pin": "a,b", + "mapping": [ + { + "name": "{name}", + "get": "({class_name}.{name}.Read()*0.5f+0.5f)", + "range": [0, 2], + "bool": false + } + ] + }, + "Encoder": { + "map_init": "{name}.Init(daisy::patch_sm::DaisyPatchSM::{pin_a}, daisy::patch_sm::DaisyPatchSM::{pin_b}, daisy::patch_sm::DaisyPatchSM::{pin_click}, som.AudioCallbackRate());", + "typename": "daisy::Encoder", + "direction": "in", + "pin": "a,b,click", + "process": "{name}.Debounce();", + "updaterate": "{name}.SetUpdateRate(som.AudioCallbackRate());", + "mapping": [ + { + "name": "{name}", + "get": "({class_name}.{name}.Increment())", + "range": [-1, 1], + "bool": false + }, + { + "name": "{name}_press", + "get": "({class_name}.{name}.Pressed()?1.f:0.f)", + "range": [0, 1], + "bool": false + }, + { + "name": "{name}_rise", + "get": "({class_name}.{name}.RisingEdge()?1.f:0.f)", + "range": [0, 1], + "bool": true + }, + { + "name": "{name}_fall", + "get": "({class_name}.{name}.FallingEdge()?1.f:0.f)", + "range": [0, 1], + "bool": true + }, + { + "name": "{name}_seconds", + "get": "({class_name}.{name}.TimeHeldMs()*0.001f)", + "range": null, + "bool": false + } + ] + }, + "GateIn": { + "map_init": "{name}.Init(&daisy::patch_sm::DaisyPatchSM::{pin});", + "typename": "daisy::GateIn", + "direction": "in", + "pin": "a", + "default_prefix": "som.", + "mapping": [ + { + "name": "{name}", + "get": "({class_name}.{default_prefix}{name}.State()?1.f:0.f)", + "range": [0, 1], + "bool": false + }, + { + "name": "{name}_trig", + "get": "({class_name}.{default_prefix}{name}.Trig()?1.f:0.f)", + "range": [0, 1], + "bool": true + } + ] + }, + "AnalogControl": { + "init_single": "cfg[{i}].InitSingle(daisy::patch_sm::DaisyPatchSM::{pin});", + "map_init": "{name}.Init(som.adc.GetPtr({i}), som.AudioCallbackRate(), {flip}, {invert});", + "typename": "daisy::AnalogControl", + "direction": "in", + "pin": "a", + "flip": "false", + "invert": "false", + "slew": "1.0/som.AudioCallbackRate()", + "process": "{name}.Process();", + "updaterate": "{name}.SetSampleRate(som.AudioCallbackRate());", + "mapping": [ + { + "name": "{name}", + "get": "({class_name}.som.GetAdcValue((int)daisy::patch_sm::{name_upper}))", + "range": [0, 1], + "bool": false + } + ] + }, + "AnalogControlBipolar": { + "init_single": "cfg[{i}].InitSingle(daisy::patch_sm::DaisyPatchSM::{pin});", + "map_init": "{name}.Init(som.adc.GetPtr({i}), som.AudioCallbackRate(), {flip}, {invert});", + "typename": "daisy::AnalogControl", + "direction": "in", + "pin": "a", + "flip": "false", + "invert": "false", + "slew": "1.0/som.AudioCallbackRate()", + "process": "{name}.Process();", + "updaterate": "{name}.SetSampleRate(som.AudioCallbackRate());", + "mapping": [ + { + "name": "{name}", + "get": "({class_name}.som.GetAdcValue((int)daisy::patch_sm::{name_upper}))", + "range": [-1, 1], + "bool": false + } + ] + }, + "Led": { + "map_init": "{name}.Init(daisy::patch_sm::DaisyPatchSM::{pin}, {invert});\n\t\t{name}.Set(0.0f);", + "typename": "daisy::Led", + "direction": "out", + "pin": "a", + "invert": "true", + "postprocess": "{name}.Update();", + "mapping": [ + { + "name": "{name}", + "set": "{class_name}.{name}.Set({value});" + } + ] + }, + "RgbLed": { + "map_init": "{name}.Init(daisy::patch_sm::DaisyPatchSM::{pin_r}, daisy::patch_sm::DaisyPatchSM::{pin_g}, daisy::patch_sm::DaisyPatchSM::{pin_b}, {invert});\n\t\t{name}.Set(0.0f, 0.0f, 0.0f);", + "typename": "daisy::RgbLed", + "direction": "out", + "pin": "r,g,b", + "invert": "true", + "postprocess": "{name}.Update();", + "mapping": [ + { + "name": "{name}_red", + "set": "{class_name}.{name}.SetRed({value});" + }, + { + "name": "{name}_green", + "set": "{class_name}.{name}.SetGreen({value});" + }, + { + "name": "{name}_blue", + "set": "{class_name}.{name}.SetBlue({value});" + }, + { + "name": "{name}", + "set": "{class_name}.{name}.Set(clamp(-{value}, 0.f, 1.f), 0.f, clamp({value}, 0.f, 1.f));" + }, + { + "name": "{name}_white", + "set": "{class_name}.{name}.Set({value},{value},{value});" + } + ] + }, + "GateOut": { + "map_init": "{name}.pin = daisy::patch_sm::DaisyPatchSM::{pin};\n\t\t{name}.mode = {mode};\n\t\t{name}.pull = {pull};\n\t\tdsy_gpio_init(&{name});", + "typename": "dsy_gpio", + "direction": "out", + "pin": "a", + "default_prefix": "som.", + "mode": "DSY_GPIO_MODE_OUTPUT_PP", + "pull": "DSY_GPIO_NOPULL", + "mapping": [ + { + "name": "{name}", + "set": "dsy_gpio_write(&{class_name}.{default_prefix}{name}, {value});" + } + ] + }, + "CVOuts": { + "map_init": "{name}.bitdepth = {bitdepth};\n\t\t{name}.buff_state = {buff_state};\n\t\t{name}.mode = {mode};\n\t\t{name}.chn = {channel};\n\t\tsom.dac.Init({name});\n\t\tsom.dac.WriteValue({channel}, 0);", + "typename": "daisy::DacHandle::Config", + "direction": "out", + "pin": "", + "bitdepth": "daisy::DacHandle::BitDepth::BITS_12", + "buff_state": "daisy::DacHandle::BufferState::ENABLED", + "mode": "daisy::DacHandle::Mode::POLLING", + "channel": "daisy::DacHandle::Channel::BOTH", + "mapping": [ + { + "name": "{name}1", + "set": "{class_name}.som.WriteCvOut(daisy::patch_sm::CV_OUT_1, {value} * 5.f);", + "where": "main" + }, + { + "name": "{name}2", + "set": "{class_name}.som.WriteCvOut(daisy::patch_sm::CV_OUT_2, {value} * 5.f);", + "where": "main" + } + ] + }, + "CodeClass": { + "map_init": "{name}.Init(&som);", + "typename": "", + "process": "", + "loopprocess": "", + "header_path": "", + "mapping": [] + }, + "CodeInput": { + "direction": "out", + "typename": "", + "parent": "", + "setter": "", + "mapping": [ + { + "name": "{name}", + "set": "{class_name}.{parent}.{setter}({value});", + "permit_scale": false + } + ] + }, + "CodeOutput": { + "direction": "in", + "typename": "", + "parent": "", + "getter": "", + "mapping": [ + { + "name": "{name}", + "get": "{class_name}.{parent}.{getter}()", + "permit_scale": false + } + ] + } } diff --git a/source/component_defs_petalsm.json b/source/component_defs_petalsm.json index e3f072e..a40141a 100644 --- a/source/component_defs_petalsm.json +++ b/source/component_defs_petalsm.json @@ -1,131 +1,154 @@ { "Switch": { - "map_init": "", - "typename": "", - "direction": "in", - "index": 1, - "updaterate": "", - "mapping": [ - { - "name": "{name}", - "get": "({class_name}.som.footswitch{index}.Pressed()?1.f:0.f)", - "range": [ - 0, - 1 - ], - "bool": false - }, - { - "name": "{name}_press", - "get": "({class_name}.som.footswitch{index}.Pressed()?1.f:0.f)", - "range": [ - 0, - 1 - ], - "bool": false - }, - { - "name": "{name}_seconds", - "get": "({class_name}.som.footswitch{index}.TimeHeldMs()*0.001f)", - "bool": false - } - ] - }, + "map_init": "", + "typename": "", + "direction": "in", + "index": 1, + "updaterate": "", + "mapping": [ + { + "name": "{name}", + "get": "({class_name}.som.footswitch{index}.Pressed()?1.f:0.f)", + "range": [0, 1], + "bool": false + }, + { + "name": "{name}_press", + "get": "({class_name}.som.footswitch{index}.Pressed()?1.f:0.f)", + "range": [0, 1], + "bool": false + }, + { + "name": "{name}_seconds", + "get": "({class_name}.som.footswitch{index}.TimeHeldMs()*0.001f)", + "bool": false + } + ] + }, "Switch3": { - "map_init": "", - "typename": "", - "direction": "in", - "index": 0, - "mapping": [ - { - "name": "{name}", - "get": "({class_name}.som.toggle[{index}].Read()*0.5f+0.5f)", - "range": [ - 0, - 2 - ], - "bool": false - } - ] - }, + "map_init": "", + "typename": "", + "direction": "in", + "index": 0, + "mapping": [ + { + "name": "{name}", + "get": "({class_name}.som.toggle[{index}].Read()*0.5f+0.5f)", + "range": [0, 2], + "bool": false + } + ] + }, "AnalogControl": { - "init_single": "", - "map_init": "", - "typename": "", - "direction": "in", - "index": 0, - "updaterate": "", - "mapping": [ - { - "name": "{name}", - "get": "({class_name}.som.knob[{index}].Value())", - "range": [ - 0, - 1 - ], - "bool": false - } - ] - }, - "Expression": { - "direction": "in", - "mapping": [ - { - "name": "{name}", - "get": "({class_name}.som.GetExpressionValue())" - } - ] - }, - "Led": { - "map_init": "", - "typename": "", - "direction": "out", - "index": 2, - "postprocess": "", - "mapping": [ - { - "name": "{name}", - "set": "{class_name}.som.led[{index}].Set({value});" - } - ] - }, + "init_single": "", + "map_init": "", + "typename": "", + "direction": "in", + "index": 0, + "updaterate": "", + "mapping": [ + { + "name": "{name}", + "get": "({class_name}.som.knob[{index}].Value())", + "range": [0, 1], + "bool": false + } + ] + }, + "Expression": { + "direction": "in", + "mapping": [ + { + "name": "{name}", + "get": "({class_name}.som.GetExpressionValue())" + } + ] + }, + "Led": { + "map_init": "", + "typename": "", + "direction": "out", + "index": 2, + "postprocess": "", + "mapping": [ + { + "name": "{name}", + "set": "{class_name}.som.led[{index}].Set({value});" + } + ] + }, "RgbLed": { - "map_init": "", - "typename": "", - "direction": "out", - "index": "r,g,b", - "mapping": [ - { - "name": "{name}_red", - "set": "{class_name}.som.led[{index_r}].Set({value});" - }, - { - "name": "{name}_green", - "set": "{class_name}.som.led[{index_g}].Set({value});" - }, - { - "name": "{name}_blue", + "map_init": "", + "typename": "", + "direction": "out", + "index": "r,g,b", + "mapping": [ + { + "name": "{name}_red", + "set": "{class_name}.som.led[{index_r}].Set({value});" + }, + { + "name": "{name}_green", + "set": "{class_name}.som.led[{index_g}].Set({value});" + }, + { + "name": "{name}_blue", "set": "{class_name}.som.led[{index_b}].Set({value});" - }, - { - "name": "{name}", + }, + { + "name": "{name}", "set": "{class_name}.som.led[{index_r}].Set(clamp(-{value}, 0.f, 1.f)); \n{class_name}.som.led[{index_g}].Set(0); \n{class_name}.som.led[{index_b}].Set(clamp({value}, 0.f, 1.f));" - }, - { - "name": "{name}_white", - "set": "{class_name}.som.led[{index_r}].Set({value}); \n{class_name}.som.led[{index_g}].Set({value}); \n{class_name}.som.led[{index_b}].Set({value});" - } - ] - }, - "Relay": { - "map_init": "", - "typename": "", - "direction": "out", - "mapping": [ - { - "name": "{name}", - "set": "{class_name}.som.SetBypassState({value});" - } - ] - } -} \ No newline at end of file + }, + { + "name": "{name}_white", + "set": "{class_name}.som.led[{index_r}].Set({value}); \n{class_name}.som.led[{index_g}].Set({value}); \n{class_name}.som.led[{index_b}].Set({value});" + } + ] + }, + "Relay": { + "map_init": "", + "typename": "", + "direction": "out", + "mapping": [ + { + "name": "{name}", + "set": "{class_name}.som.SetBypassState({value});" + } + ] + }, + "CodeClass": { + "map_init": "{name}.Init(&som);", + "typename": "", + "process": "", + "loopprocess": "", + "header_path": "", + "mapping": [] + }, + "CodeInput": { + "direction": "out", + "typename": "", + "parent": "", + "setter": "", + "mapping": [ + { + "name": "{name}", + "set": "{class_name}.{parent}.{setter}({value});", + "permit_scale": false + } + ] + }, + "CodeOutput": { + "direction": "in", + "typename": "", + "parent": "", + "getter": "", + "mapping": [ + { + "name": "{name}", + "get": "{class_name}.{parent}.{getter}()", + "permit_scale": false + } + ] + } +} +