示例#1
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);
        }
 private void PrepareConfigLoading()
 {
     mMusicGenerator.ClearInstruments(mMusicGenerator.mInstrumentSet);
     mMusicGenerator.ResetPlayer();
     mMusicGenerator.SetState(eGeneratorState.initializing);
 }
示例#3
0
 /// resets all our timing variables and starts over, but will continue playing:
 public void Reset()
 {
     mMusicGenerator.ResetPlayer();
 }