예제 #1
0
        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);
                }
            }
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        internal Scale(ScaleSet parent, string name, int[] intervals) : base(parent)
        {
            if (null == parent)
            {
                throw new ArgumentNullException("parent");
            }

            Name      = name;
            Intervals = intervals;

            UpdateParent = true;
        }
예제 #5
0
        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;
        }
예제 #6
0
 internal ScaleSet(ScaleSet parent, string level) : base(parent, level)
 {
 }