Example #1
0
        //set code values from UI values
        void Update()
        {
            if (mMusicGenerator == null || mMusicGenerator.mState == eGeneratorState.initializing)
            {
                return;
            }

            ChordProgressions progressions = mMusicGenerator.mChordProgressions;

            if (progressions.mData.TonicInfluence != mTonicInfluence.value)
            {
                progressions.mData.TonicInfluence = mTonicInfluence.value;
                mTonicInfluenceOutput.text        = ((int)mTonicInfluence.value).ToString() + "%";
            }
            if (progressions.mData.DominantInfluence != mDominantInfluence.value)
            {
                progressions.mData.DominantInfluence = mDominantInfluence.value;
                mDominantInfluenceOutput.text        = ((int)mDominantInfluence.value).ToString() + "%";
            }
            if (progressions.mData.SubdominantInfluence != mSubdominantInfluence.value)
            {
                progressions.mData.SubdominantInfluence = mSubdominantInfluence.value;
                mSubdominantInfluenceOutput.text        = ((int)mSubdominantInfluence.value).ToString() + "%";
            }
            if (progressions.mData.TritoneSubInfluence != mTritoneSubInfluence.value)
            {
                progressions.mData.TritoneSubInfluence = mTritoneSubInfluence.value;
                mTritoneSubInfluenceOutput.text        = ((int)mTritoneSubInfluence.value).ToString() + "%";
            }
            if (mMusicGenerator.mGeneratorData.mKeyChangeAscendDescend != mAscendDescendKey.value)
            {
                mMusicGenerator.mGeneratorData.mKeyChangeAscendDescend = mAscendDescendKey.value;
                mAscendDescendKeyOutput.text = ((int)mAscendDescendKey.value).ToString() + "%";
            }
            mMusicGenerator.mGeneratorData.mGroupRate    = (eGroupRate)mGroupRate.value;
            mMusicGenerator.mGeneratorData.mDynamicStyle = (eDynamicStyle)mDynamicStyle.value;
            if (mMusicGenerator.mGeneratorData.mVolFadeRate != mVolumeFadeRate.value)
            {
                mMusicGenerator.SetVolFadeRate(mVolumeFadeRate.value);
                mVolumeFadeRateOutput.text = ((int)mVolumeFadeRate.value).ToString();
            }
            mMusicGenerator.UseAsyncLoading = mAsyncLoading.isOn;
            CheckAvoidSteps();
        }
Example #2
0
        public List <Toggle> mExcludedSteps    = new List <Toggle>();    //< list of which steps are excluded from chord progressions

        public void Init()
        {
            GetComponentInParent <CanvasGroup>().interactable   = false;
            GetComponentInParent <CanvasGroup>().blocksRaycasts = false;

            mUIManager = UIManager.Instance;
            mAnimator  = GetComponentInParent <Animator>();
            Component[] components = this.GetComponentsInChildren(typeof(Transform), true);
            mMusicGenerator = MusicGenerator.Instance;
            Tooltips          tooltips     = mUIManager.mTooltips;
            ChordProgressions progressions = mMusicGenerator.mChordProgressions;

            mTonicInfluence.value       = progressions.mData.TonicInfluence;
            mSubdominantInfluence.value = progressions.mData.SubdominantInfluence;
            mDominantInfluence.value    = progressions.mData.DominantInfluence;
            mTritoneSubInfluence.value  = progressions.mData.TritoneSubInfluence;
            mGroupRate.value            = (int)mMusicGenerator.mGeneratorData.mGroupRate;

            //sets up our UI elements:
            foreach (Component cp in components)
            {
                if (cp.name == "AsyncLoading")
                {
                    tooltips.AddUIElement(ref mAsyncLoading, cp, "AsyncLoading");
                }
                if (cp.name == "GroupRate")
                {
                    tooltips.AddUIElement(ref mGroupRate, cp, "GroupRate");
                }
                if (cp.name == "DynamicStyle")
                {
                    tooltips.AddUIElement(ref mDynamicStyle, cp, "DynamicStyle");
                }
                if (cp.name == "DominantInfluence")
                {
                    tooltips.AddUIElement(ref mDominantInfluence, cp, "DominantInfluence");
                }
                if (cp.name == "TonicInfluence")
                {
                    tooltips.AddUIElement(ref mTonicInfluence, cp, "TonicInfluence");
                }
                if (cp.name == "SubdominantInflunce")
                {
                    tooltips.AddUIElement(ref mSubdominantInfluence, cp, "SubdominantInfluence");
                }
                if (cp.name == "TritoneSubInf")
                {
                    tooltips.AddUIElement(ref mTritoneSubInfluence, cp, "TritoneSubstitution");
                }
                if (cp.name == "AscendDescendKey")
                {
                    tooltips.AddUIElement(ref mAscendDescendKey, cp, "KeyAscendDescend");
                }
                if (cp.name == "VolumeFadeRate")
                {
                    tooltips.AddUIElement(ref mVolumeFadeRate, cp, "VolumeFadeRate");
                }
                if (cp.name == "DominantInfluenceOutput")
                {
                    mDominantInfluenceOutput = cp.GetComponentInChildren <Text>();
                }
                if (cp.name == "TonicInfluenceOutput")
                {
                    mTonicInfluenceOutput = cp.GetComponentInChildren <Text>();
                }
                if (cp.name == "SubdominantInfluenceOutput")
                {
                    mSubdominantInfluenceOutput = cp.GetComponentInChildren <Text>();
                }
                if (cp.name == "TritoneSubInfOutput")
                {
                    mTritoneSubInfluenceOutput = cp.GetComponentInChildren <Text>();
                }
                if (cp.name == "AscendDescendKeyOutput")
                {
                    mAscendDescendKeyOutput = cp.GetComponentInChildren <Text>();
                }
                if (cp.name == "VolumeFadeRateOutput")
                {
                    mVolumeFadeRateOutput = cp.GetComponentInChildren <Text>();
                }
            }

            //these ui objects have a bunch of parts. Handled differently:
            for (int i = 0; i < mExcludedSteps.Count; i++)
            {
                Component[] components2 = this.GetComponentsInChildren(typeof(Transform), true);
                foreach (Component cp2 in components2)
                {
                    if (cp2.name.Contains("Exclude"))
                    {
                        tooltips.AddTooltip("TonicSubdominantDominantExcludes", cp2.GetComponent <RectTransform>());
                    }
                }
            }
        }