Пример #1
0
        void GenSrcs()
        {
            srcs = new List <Source>();
            transform.ClearChildren();
            // 获取音域范围,生成一一对应的AudioSource组件
            var scl = rng.Scales;

            if (scl <= 0)
            {
                return;
            }
            if (scl == 1)
            {
                CreateRange(rng);
            }
            else
            {
                var rngMin = new PitchRange(rng.min, rng.min.sclMax);
                CreateRange(rngMin);
                for (var i = rng.min.scale + 1; i <= rng.max.scale - 1; i++)
                {
                    var min    = new Note(i, Pitch.C);
                    var max    = new Note(i, Pitch.B);
                    var rngMid = new PitchRange(min, max);
                    CreateRange(rngMid);
                }
                var rngMax = new PitchRange(rng.max.sclMin, rng.max);
                CreateRange(rngMax);
            }
        }
Пример #2
0
        void CreateRange(PitchRange rng)
        {
            var min = rng[0];
            var max = rng[1];

            for (Pitch i = min.pitch; i <= max.pitch; i++)
            {
                N(new Note(min.scale, i));
            }
        }