create static method

List<Instrument> create(
  1. List<InstrumentInfo> infos,
  2. List<Zone> zones,
  3. List<SampleHeader> samples
)

Implementation

static List<Instrument> create(List<InstrumentInfo> infos, List<Zone> zones, List<SampleHeader> samples) {
  if (infos.length <= 1) {
    throw "No valid instrument was found.";
  }

  // The last one is the terminator.
  int count = infos.length - 1;

  List<Instrument> instruments = [];

  for (var i = 0; i < count; i++) {
    instruments.add(Instrument.fromInfo(infos[i], zones, samples));
  }

  return instruments;
}