afternoon / microgroove

8-track open-source hardware MIDI sequence generator
MIT License
13 stars 1 forks source link

Extract Params from Machines #5

Closed afternoon closed 1 year ago

afternoon commented 2 years ago

Machines should be pure sequence generators, with no knowledge of MIDI, the UI, etc. Params in Machines violates this principle.

One pattern to decouple Params from Machines might be to create an adaptor object for each machine, which can call the methods of Machine, passing regular values.

class TuringMachineParams {
  Param* param0() { */ ... */ }
  Note next_note() {
    return turing_machine.next_note(int prob, int low, int range, int bend_amount);
  }
};