- Edited
I have a few more GUI questions
I've been defining a few classes, but within the class functions I'm not able to call p5 functions or other custom classes, because they are apparently "undefined". Do I have to keep them external or is there a way to store them as class members?
class Space { constructor() { this.x = 0; this.y = 0; this.specIn = createInput('0'); // Uncaught ReferenceError: createInput is not defined } }
Edit: I found this: https://github.com/processing/p5.js/wiki/p5.js-overview#instantiation--namespace but on-deman global mode and instance mode don't seem to play well with loadScript and loadImage which are Bela functions I'm guessing that are intended to be added to the p5 object.
Also on the subject of the data Buffers, are the same bufferIDs used for both Bela-to-GUI and GUI-to-Bela communication? For example if I use
// C++
gui.sendBuffer(0, data)
// JavaScript
let data = Bela.data.buffers[0];
and also
// javascript
Bela.data.sendBuffer(0, 'float', buffer);
// C++
gui.setBuffer('f', 2);
DataBuffer& buffer = gui.getDataBuffer(0)
in the same project, would that be the same buffer 0 or would they be different because one is sent from the bela and one is sent by the gui?