electro-smith / oopsy

gen~ to Daisy: exporting Max Gen patchers for the ElectroSmith Daisy hardware platforms
MIT License
126 stars 30 forks source link

C++ Inserts #76

Closed CorvusPrudens closed 9 months ago

CorvusPrudens commented 2 years ago

This PR adds a simple C++ insertion format. An example JSON description might look like:

{
  "name": "board",
  "som": "seed",
  "audio": {
    "channels": 2
  },
  "parents": {
    "bsp": {
      "component": "CodeClass",
      "typename": "Hardware",
      "header": "Hardware.h",
      "process": "ProcessAllControls"
    }
  },
  "components": {
    "LedRed": {
      "component": "CodeInput",
      "parent": "bsp",
      "setter": "SetLedRed"
    },
    "Knob": {
      "component": "CodeOutput",
      "parent": "bsp",
      "getter": "GetKnob"
    }
  }
}

Where the Hardware class has void ProcessAllControls(), void SetLedRed(float), and float GetKnob() methods defined. The header path may be absolute or relative to the board description JSON.

This also fixes a somewhat significant bug where the generated code's inputs would not be processed every audio block.