worldmaking / mischmasch

https://www.alicelab.world/msvr
MIT License
9 stars 1 forks source link

Need Graham: Feedback cables #246

Open michaelpalumbo opened 1 year ago

michaelpalumbo commented 1 year ago

note that this progress is on branch feature/fb

When adding a history object, gen does not know how to handle it:

no gen found: {
  inputs: [
    {
      name: 'history_ddd4c7c47a6847138c6f1c715f23da0d_name',
      min: -20000,
      max: 20000,
      initialValue: 0,
      defaultValue: 0,
      waapi: null,
      isWorklet: false,
      memory: [Object]
    }
  ],
  memory: { value: { length: 1, idx: null } },
  recorder: null,
  in: [Function: _in] { _name: '_in' },       
  out: {
    gen: [Function: gen],
    memory: { value: [Object] },
    name: 'historyddd4c7c47a6847138c6f1c715f23da0d0_out'
  },
  uid: 'ddd4c7c47a6847138c6f1c715f23da0d0',   
  name: '_in'
} undefined
TypeError: Cannot read properties of undefined (reading 'gen')
    at EventEmitter.getInput (D:\github\mischmasch\Components\Audio\genish.js:2164:28)      
    at EventEmitter.createCallback (D:\github\mischmasch\Components\Audio\genish.js:1908:71)
    at MessagePort.<anonymous> (D:\github\mischmasch\Components\Audio\genish_worker.js:131:34)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:735:20)
    at exports.emitMessage (node:internal/per_context/messageport:23:28)

Given a doc with a history op patched between two ops to allow for a feedback connection:

{
  "08b47f807ecb4c6da50f883ab9f05f22": {
    "category": "speaker",
    "inputs": [
      {
        "_props": {
          "index": 0,
          "kind": "inlet",
          "range": [
            -1,
            1
          ]
        },
        "index": 0,
        "kind": "inlet",
        "name": "audio"
      }
    ],
    "name": "speaker",
    "outputs": [],
    "position": [
      -0.9731054306030273,
      1.4882835149765015,
      -0.8715433478355408
    ],
    "quaternion": [
      -0.22191412873643246,
      0.5373903859580326,
      0.21893395575937835,
      0.7836029436142239
    ],
    "uuid": "08b47f807ecb4c6da50f883ab9f05f22"
  },
  "21073a74b9b64ac6b2d79ae7e0bb2d1f": {
    "category": "source",
    "inputs": [
      {
        "_props": {
          "index": 0,
          "kind": "knob",
          "range": [
            -10,
            7
          ],
          "value": 0
        },
        "index": 0,
        "kind": "knob",
        "name": "freq",
        "range": [
          -10,
          7
        ],
        "trim": "add",
        "value": 0
      },
      {
        "_props": {
          "index": 1,
          "kind": "knob",
          "range": [
            0,
            1
          ],
          "value": 0.5
        },
        "index": 1,
        "kind": "knob",
        "name": "width",
        "range": [
          0,
          1
        ],
        "trim": "add",
        "value": 0.5
      }
    ],
    "name": "train",
    "outputs": [
      {
        "_props": {
          "index": 0,
          "kind": "outlet"
        },
        "connections": {
          "08b47f807ecb4c6da50f883ab9f05f22": {
            "audio": "cable"
          },
          "3361c581862a4c169d79befcf6d3e438": {
            "value": "cable"
          }
        },
        "name": "out1"
      }
    ],
    "position": [
      -1.0601496770977974,
      1.404109589041096,
      -0.44617831707000727
    ],
    "quaternion": [
      0,
      0.7071067811865475,
      0,
      0.7071067811865476
    ],
    "uuid": "21073a74b9b64ac6b2d79ae7e0bb2d1f"
  },
  "4c39b8a07ad54b049f99a6820b0d013d": {
    "category": "source",
    "inputs": [
      {
        "_props": {
          "index": 0,
          "kind": "knob",
          "range": [
            -10,
            7
          ],
          "value": 0
        },
        "index": 0,
        "kind": "knob",
        "name": "freq",
        "range": [
          -10,
          7
        ],
        "trim": "add",
        "value": 0
      },
      {
        "_props": {
          "index": 1,
          "kind": "inlet",
          "range": [
            0,
            1
          ],
          "value": 0
        },
        "index": 1,
        "kind": "inlet",
        "name": "reset"
      }
    ],
    "name": "cycle",
    "outputs": [
      {
        "_props": {
          "index": 0,
          "kind": "outlet"
        },
        "connections": {
          "21073a74b9b64ac6b2d79ae7e0bb2d1f": {
            "freq": "cable"
          }
        },
        "name": "sinusoid"
      }
    ],
    "position": [
      -1.174831748008728,
      1.7946621179580688,
      -0.3505764901638031
    ],
    "quaternion": [
      0.07133083330147283,
      0.7352801471657078,
      -0.0951293482608725,
      0.6672520209383382
    ],
    "uuid": "4c39b8a07ad54b049f99a6820b0d013d"
  },
  "3361c581862a4c169d79befcf6d3e438": {
    "category": "delay",
    "inputs": [
      {
        "_props": {
          "index": 0,
          "kind": "buffer",
          "range": [
            0,
            100
          ],
          "value": 0
        },
        "index": 0,
        "kind": "buffer",
        "name": "name",
        "range": [
          0,
          100
        ],
        "trim": "add",
        "value": 0
      },
      {
        "_props": {
          "index": 1,
          "kind": "inlet",
          "range": [
            1,
            2
          ],
          "value": 1
        },
        "index": 1,
        "kind": "inlet",
        "name": "value"
      }
    ],
    "name": "history",
    "outputs": [
      {
        "_props": {
          "history": false,
          "index": 0,
          "kind": "outlet"
        },
        "connections": {
          "4c39b8a07ad54b049f99a6820b0d013d": {
            "freq": "cable"
          }
        },
        "name": "out1"
      }
    ],
    "position": [
      -0.8165416255546141,
      0.9931506849315068,
      -0.7936076286083759
    ],
    "quaternion": [
      0,
      0.5555702330196022,
      0,
      0.8314696123025452
    ],
    "uuid": "3361c581862a4c169d79befcf6d3e438"
  }
}
michaelpalumbo commented 1 year ago

note that this progress is on branch feature/fb