Esempio n. 1
0
        ///returns selected octaves:
        private void GetOctaves()
        {
            mOctavesToUse.Clear();
            if (mOctave1.isOn)
            {
                mOctavesToUse.Add(0);
            }
            if (mOctave2.isOn)
            {
                mOctavesToUse.Add(1);
            }
            if (mOctave3.isOn)
            {
                mOctavesToUse.Add(2);
            }

            // Safety check.
            if (mOctavesToUse.Count == 0)
            {
                mOctavesToUse.Add(0);
                mOctave1.isOn = true;
            }

            mInstrument.mData.mOctavesToUse.Clear();
            for (int i = 0; i < mOctavesToUse.Count; i++)
            {
                mInstrument.mData.mOctavesToUse.Add(mOctavesToUse[i]);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the chord interval.
        /// </summary>
        /// <param name="chords"></param>
        /// <param name="modeIN"></param>
        /// <param name="isMajorScale"></param>
        /// <param name="keyChange"></param>
        /// <returns></returns>
        private int GetProgressionSteps(int[] chords, eMode modeIN, eScale isMajorScale, int keyChange)
        {
            temp.Clear();
            //create a new array of possible chord steps, excluding the steps we'd like to avoid:
            for (int i = 0; i < chords.Length; i++)
            {
                /// we're going to ignore excluded steps when changing keys, if it's not an avoid note.
                /// it's too likely that the note that's excluded is the only available note that's shared between
                /// the two keys for that chord type (like, if V is excluded, VII is never shared in major key ascending fifth step up)
                if ((keyChange != 0 && CheckKeyChangeAvoid(isMajorScale, keyChange, chords[i], modeIN)) ||
                    mData.mExcludedProgSteps[chords[i] - 1] != true)
                {
                    temp.Add(chords[i]);
                }
            }

            if (temp.Count == 0)
            {
                Debug.Log("progression steps == 0");
            }

            return(temp[Random.Range(0, temp.Count)]);
        }