Instrument.fromInfo constructor

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

Implementation

factory Instrument.fromInfo(InstrumentInfo info, List<Zone> zones, List<SampleHeader> samples)
{
    int zoneCount = info.zoneEndIndex - info.zoneStartIndex + 1;
    if (zoneCount <= 0)
    {
        throw "The instrument '${info.name}' has no zone.";
    }

    List<Zone> zoneSpan = zones.sublist(info.zoneStartIndex, info.zoneStartIndex + zoneCount);

    List<InstrumentRegion> regions = InstrumentRegion.create(zoneSpan, samples);

    return Instrument(name: info.name, regions: regions);
}