public void CopyFrom(ScaleSet scaleSet) { if (null == scaleSet) { throw new ArgumentNullException(nameof(scaleSet)); } foreach (Scale sourceScale in scaleSet) { bool found = false; foreach (NamedInterval namedInterval in _namedIntervals) { Scale scale = (Scale)namedInterval; if (sourceScale == scale) { found = true; break; } } // Only add if it wasn't found if (!found) { Add(sourceScale.Name, sourceScale.Intervals); } } }
public IScale GetScale() { string longName = Settings[Prefix + "scale"]; string level = ScaleLevel; if (null != _cachedScale) { if (_cachedScale.LongName == longName && _cachedScale.Level == level) { return(_cachedScale); } } ScaleSet scales = _configFile.Scales; while (null != scales) { if (scales.Level == level) { if (scales.TryGet(longName, out Scale scale)) { _cachedScale = scale; break; } } scales = scales.Parent; } return(_cachedScale); }
public ConfigFile(string level) { Level = level; ChordiousSettings = new ChordiousSettings(level); DiagramStyle = new DiagramStyle(level); Instruments = new InstrumentSet(level); ChordQualities = new ChordQualitySet(level); Scales = new ScaleSet(level); DiagramLibrary = new DiagramLibrary(DiagramStyle); }
internal Scale(ScaleSet parent, string name, int[] intervals) : base(parent) { if (null == parent) { throw new ArgumentNullException("parent"); } Name = name; Intervals = intervals; UpdateParent = true; }
internal Scale(ScaleSet parent, XmlReader xmlReader) : base(parent) { if (null == parent) { throw new ArgumentNullException("parent"); } if (null == xmlReader) { throw new ArgumentNullException("xmlReader"); } using (xmlReader) { ReadBase(xmlReader, "scale"); } UpdateParent = true; }
internal ScaleSet(ScaleSet parent, string level) : base(parent, level) { }