public IInstrument GetInstrument() { string name = Settings[Prefix + "instrument"]; string level = InstrumentTuningLevel; if (null != _cachedInstrument) { if (_cachedInstrument.Name == name && _cachedInstrument.Level == level) { return(_cachedInstrument); } _cachedInstrument = null; _cachedTuning = null; } InstrumentSet instruments = _configFile.Instruments; while (null != instruments) { if (instruments.Level == level) { Instrument i; if (instruments.TryGet(name, out i)) { _cachedInstrument = i; break; } } instruments = instruments.Parent; } return(_cachedInstrument); }
internal InstrumentSet(InstrumentSet parent, string level) : this(level) { if (null == parent) { throw new ArgumentNullException("parent"); } Parent = parent; }
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); }
public void CopyFrom(InstrumentSet instrumentSet) { if (null == instrumentSet) { throw new ArgumentNullException(nameof(instrumentSet)); } foreach (Instrument sourceInstrument in instrumentSet) { if (!TryGet(sourceInstrument.Name, out Instrument instrument)) { instrument = Add(sourceInstrument.Name, sourceInstrument.NumStrings); } if (sourceInstrument.NumStrings == instrument.NumStrings) { instrument.Tunings.CopyFrom(sourceInstrument.Tunings); } } }
public InstrumentNameAlreadyExistsException(InstrumentSet instrumentSet, string name) : base(instrumentSet, name) { }
public InstrumentNotFoundException(InstrumentSet instrumentSet, string name) : base(instrumentSet, name) { }
public TargetInstrumentException(InstrumentSet instrumentSet, string name) : base(instrumentSet) { Name = name; }
public InstrumentSetException(InstrumentSet instrumentSet) : base() { InstrumentSet = instrumentSet; }
internal InstrumentSet(InstrumentSet parent, string level) : this(level) { Parent = parent ?? throw new ArgumentNullException(nameof(parent)); }
internal Instrument(InstrumentSet parent, XmlReader xmlReader) : this(parent) { Read(xmlReader); }
internal Instrument(InstrumentSet parent, string name, int numStrings) : this(parent) { Name = name; NumStrings = numStrings; }
private Instrument(InstrumentSet parent) { ReadOnly = false; _tunings = new TuningSet(this); Parent = parent; }