Open
Description
The current way of handling subscriptions was copied from the X32 project but is not perfect for our purpose. Furthermore, the index.ts file is a bit of a mess and gets more bloated.
There are several cases to distinguish to handle feedback from the console
- a command needs state information and must ensure that this data is available (e.g. toggle a button) when it is called
- a command needs state information that is not automatically published by the console (e.g. the state of the USB player)
- a feedback needs to be notified when new data is available
The universal way to to read and write state data would look like this:
const currentVal = state.get('/path/to/var')
state.set('/path/to/var', value)
The only thing that changes is the way that the data is requested. The state structure receives a function pointer to send out an OSC command.
The three cases are as follows:
- to ensure that data is loaded, the module sends out the path that is requested and waits for an answer (is implemented like this at the moment, but would change location)
- a command that needs information that is not automatically published creates a timeout that periodically requests data. Ideally, this period can be defined per-command
- feedback handling also remains roughly the same as it is now. A reference to the command that needs the feedback is stored alongside the path. when that path arrives, the corresponding feedback is activated
In addition, the state has a list of paths and values that are important to update e.g. actions. This would be the case for things like channel
Metadata
Metadata
Assignees
Labels
No labels