Beispiel #1
0
        private void FinalizeStagingClip()
        {
            mCurrentInstSet = mLoadedClip.mInstrumentSet;

            InstrumentListPanelUI listPanel = InstrumentListPanelUI.Instance;

            for (int i = 0; i < mCurrentInstSet.mInstruments.Count; i++)
            {
                listPanel.AddInstrument(mCurrentInstSet.mInstruments[i]);
                InstrumentListUIObject icon = listPanel.mInstrumentIcons[listPanel.mInstrumentIcons.Count - 1];
                icon.ToggleSelected();
                bool isPercussion = icon.mInstrument.mData.InstrumentType.Contains("p_") ? true : false;
                icon.SetDropdown(isPercussion);

                InstrumentPanelUI.Instance.SetInstrument(icon.mInstrument);
                mInstrumentPanel.mInstrument = mCurrentInstSet.mInstruments[i];
            }
            InstrumentPanelUI.Instance.SetInstrument(mCurrentInstSet.mInstruments[0]);
            mInstrumentPanel.mInstrument = mCurrentInstSet.mInstruments[0];

            mClipIsRepeating.isOn = mLoadedClip.mIsRepeating;
            mCurrentMeasure.value = 0;
            mLoadedClip.SetState(eClipState.Stop);
            mMusicGenerator.ClipLoaded.Invoke(mCurrenClipSave);
            mMusicGenerator.ResetPlayer();
            mMusicGenerator.SetState(eGeneratorState.editing);
            ToggleHelperNotes();
            UIToggleAllInstruments();
            mStaffPlayer.ChangeTimeSignature((int)mCurrentInstSet.mTimeSignature.Signature);
        }
Beispiel #2
0
        /// Loads a new instrument from UI "AddNewInstrument" button.
        public void LoadNewInstrument(Instrument instrumentIN, Color colorIN)
        {
            bool isPercussion = instrumentIN.mData.InstrumentType.Contains("p_") ? true : false;

            AddInstrument(instrumentIN);
            int iconIndex = mInstrumentIcons.Count - 1;
            InstrumentListUIObject icon = mInstrumentIcons[iconIndex];

            icon.mInstrument = instrumentIN;
            icon.ToggleSelected();
            icon.SetDropdown(isPercussion);
            int instIndex = (int)instrumentIN.InstrumentIndex;

            mInstrumentIcons[instIndex].mGroupText.text  = ("Group: " + (instrumentIN.mData.Group + 1).ToString());
            mInstrumentIcons[instIndex].mPanelBack.color = colorIN;
        }
Beispiel #3
0
        /// Adds an instrument to the Music generator and creates its ui object.
        public void AddMusicGeneratorInstrument(bool isPercussion)
        {
            InstrumentSet     set         = (mMusicGenerator.mState >= eGeneratorState.editorInitializing) ? MeasureEditor.Instance.mCurrentInstSet : mMusicGenerator.mInstrumentSet;
            List <Instrument> instruments = set.mInstruments;

            if (instruments.Count < MusicGenerator.mMaxInstruments)
            {
                mMusicGenerator.AddInstrument(set);
                Instrument instrument = set.mInstruments[set.mInstruments.Count - 1];
                AddInstrument(instrument);
                InstrumentListUIObject icon = mInstrumentIcons[mInstrumentIcons.Count - 1];

                icon.mInstrument = instruments[instruments.Count - 1];
                Color color = StaffPlayerUI.Instance.mColors[(int)icon.mInstrument.mData.mStaffPlayerColor];
                icon.mPanelBack.color = color;

                icon.SetDropdown(isPercussion);
            }
        }
Beispiel #4
0
        ///stages a clip for playing. Async version (will load assets on the fly).
        public IEnumerator AsyncStageClipForPlaying()
        {
            ClearCurrentInstruments();

            bool isFinished = false;

            StartCoroutine(AsyncLoadClip(((x) => { isFinished = x; }), mPlayClipDropdown.options[mPlayClipDropdown.value].text));
            yield return(new WaitUntil(() => isFinished));

            mCurrentInstSet = mLoadedClip.mInstrumentSet;

            InstrumentListPanelUI listPanel = InstrumentListPanelUI.Instance;

            for (int i = 0; i < mCurrentInstSet.mInstruments.Count; i++)
            {
                listPanel.AddInstrument(mCurrentInstSet.mInstruments[i]);
                InstrumentListUIObject icon = listPanel.mInstrumentIcons[listPanel.mInstrumentIcons.Count - 1];
                icon.mInstrument = mCurrentInstSet.mInstruments[i];
                icon.ToggleSelected();
                bool isPercussion = icon.mInstrument.mData.InstrumentType.Contains("p_") ? true : false;
                icon.SetDropdown(isPercussion);

                InstrumentPanelUI.Instance.SetInstrument(icon.mInstrument);
                mInstrumentPanel.mInstrument = mCurrentInstSet.mInstruments[i];
            }
            InstrumentPanelUI.Instance.SetInstrument(mCurrentInstSet.mInstruments[0]);
            mInstrumentPanel.mInstrument = mCurrentInstSet.mInstruments[0];

            mClipIsRepeating.isOn = mLoadedClip.mIsRepeating;
            mCurrentMeasure.value = 0;
            mLoadedClip.SetState(eClipState.Stop);
            mMusicGenerator.ClipLoaded.Invoke(mCurrenClipSave);
            mMusicGenerator.ResetPlayer();
            mMusicGenerator.SetState(eGeneratorState.editing);
            ToggleHelperNotes();
            UIToggleAllInstruments();
            yield return(null);
        }