Instrument.fromInfo constructor
Instrument.fromInfo(
- InstrumentInfo info,
- List<
Zone> zones, - 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);
}