Skip to content

Custom Seed Targets

Graham Wakefield edited this page Jan 30, 2021 · 11 revisions

Work in progress alpha-level support at this stage

For a custom seed-based target (i.e. not Patch/Field/Petal/Pod/Versio etc.):

You will need to create a JSON file specific to the hardware target. You can compare to /source/daisy.patch.json etc. for examples.

The path to this JSON file can be configured in the [oopsy] patcher using either the "browse" button, by sending the "target " message to it, or including it in the [oopsy] patcher arguments.

JSON configuration file

WARNING THIS IS ALL SUBJECT TO CHANGE!

Minimal starting point:

{
	"defines": {
		"OOPSY_TARGET_SEED": 1
	},
	"labels": {
		"params": {},
		"outs": {},
		"datas": {}
	},
	"inputs": {},
	"outputs": {},
	"datahandlers": {},
	"inserts": [],
	"max_apps": 1
}

defines: Any C preprocessor #define values. For example, add "OOPSY_TARGET_HAS_MIDI_INPUT": 1 to ensure MIDI input handling code is included in the binary; "OOPSY_IO_COUNT": 4 if the device has 4x4 audio rather than the default 2x2 audio IO.

labels: These are the "magic" names that [param]s etc. will recognize, and should map to a string that exists as a key in the "inputs", "outputs" etc. sections of the JSON. More than one label can map to the same key.

inputs: These define how code is generated for control-rate inputs (knobs, cvs, gates, switches, etc.). Any feature marked "automap": true will be mapped to any otherwise unmapped [param] in the gen~ patch. The "code" section is a C/C++ statement to derive the control value from the Seed hardware.

outputs: These define how code is generated for non-audio [out] objects. The "code" section is a C/C++ statement to set the value on the Seed hardware; use $<name> to insert the gen~ variable value into the expression. The "where" key can define where this code should be inserted; use "audio" to place in the audio callback (e.g. gates, some LEDs) or "main" to place this in the main while loop (most other outputs).

datahandlers: These define how custom [data] objects can be used to map to hardware features. This is pretty experimental at the moment and is likely to change.

inserts: A way to insert arbitrary "code" into different sections of the template (according to the "where" tag). "where" can be "header", "init", "main", "display", "audio".

max_apps: Assumes 1 if not defined. If greater than 1 this will enable multi-app binaries, but limits how many can be included.

Here is an example custom seed JSON config that has been used by a forum poster (note careful escaping of quotes):

{
  "defines": {
    "OOPSY_TARGET_SEED": 1
  },
  "labels": {
    "params": {
      "knob1": "kn1",
      "knob2": "kn2",
      "knob3": "kn3"
    },
    "outs": {},
    "datas": {}
  },
  "inputs": {
    "kn1": {
      "automap": true,
      "code": "hardware.seed.adc.GetFloat(0);"
    },
    "kn2": {
      "automap": true,
      "code": "hardware.seed.adc.GetFloat(1);"
    },
    "kn3": {
      "automap": true,
      "code": "hardware.seed.adc.GetFloat(2);"
    }
  },
  "outputs": {},
  "datahandlers": {},
  "inserts": [
    {
      "where": "init",
      "code": "AdcChannelConfig cfg[3];"
    },
    {
      "where": "init",
      "code": "cfg[0].InitSingle(oopsy::daisy.hardware.seed.GetPin(21));"
    },
    {
      "where": "init",
      "code": "cfg[1].InitSingle(oopsy::daisy.hardware.seed.GetPin(22));"
    },
    {
      "where": "init",
      "code": "cfg[2].InitSingle(oopsy::daisy.hardware.seed.GetPin(23));"
    },
    {
      "where": "init",
      "code": "oopsy::daisy.hardware.seed.adc.Init(cfg, 3);"
    },
    {
      "where": "header",
      "code": "#include \"daisy_seed.h\""
    },
    {
      "where": "header",
      "code": "using namespace daisy;"
    }
  ],
  "max_apps": 1
}
Clone this wiki locally