Esempio n. 1
0
        public void Init()
        {
            mMusicGenerator.SetState(eGeneratorState.initializing);
            mMusicGenerator.mMusicFileConfig.LoadConfig(mMusicGenerator.mDefaultConfig, eGeneratorState.ready);

            mTooltips = Tooltips.Instance;
            mTooltips.Init();

            mStaffPlayer = StaffPlayerUI.Instance;

            mInstrumentListPanelUI = InstrumentListPanelUI.Instance;

            mMeasureEditor = MeasureEditor.Instance;
            mMeasureEditor.Init(mMusicGenerator);

            mInstrumentPanelUI = InstrumentPanelUI.Instance;
            mInstrumentPanelUI.Init();

            mAdvancedSettingsPanel = AdvancedSettingsPanel.Instance;
            mAdvancedSettingsPanel.Init();

            mGlobalEffectsPanel = GlobalEffectsPanel.Instance;
            mGlobalEffectsPanel.Init(mMusicGenerator);

            mGeneratorUIPanel = MusicGeneratorUIPanel.Instance;
            mGeneratorUIPanel.Init(mMusicGenerator);
            mStaffPlayer.Init(mMusicGenerator);
            mStaffPlayer.ChangeTimeSignature(-1);
            //mInstrumentListPanelUI.Init(mMusicGenerator);
        }
 private void LoadReferences(MusicGenerator managerIN)
 {
     mMusicGenerator        = managerIN;
     mTooltips              = UIManager.Instance.mTooltips;
     mAdvSettingsPanel      = UIManager.Instance.mAdvancedSettingsPanel;
     mGlobalEffectsPanel    = UIManager.Instance.mGlobalEffectsPanel;
     mInstrumentPanelUI     = UIManager.Instance.mInstrumentPanelUI;
     mInstrumentListPanelUI = UIManager.Instance.mInstrumentListPanelUI;
     mStaffPlayerUI         = UIManager.Instance.mStaffPlayer;
     mAnimator              = GetComponentInParent <Animator>();
     mMeasureEditor         = UIManager.Instance.mMeasureEditor;
 }
Esempio n. 3
0
 /// changes our selected instrument
 public void ChangeInstrument(Instrument instrumentIN)
 {
     if (mMusicGenerator.mState >= eGeneratorState.editorInitializing)
     {
         StaffPlayerUI staffPlayer = mStaffPlayer;
         staffPlayer.SetMeasure(instrumentIN);
         if (mShowEditorHints.isOn)
         {
             List <Instrument> instruments = mCurrentInstSet.mInstruments;
             int instrumentIndex           = (int)mInstrumentPanel.mInstrument.InstrumentIndex;
             staffPlayer.ShowHighlightedNotes(instruments[instrumentIndex]);
         }
         UIToggleAllInstruments();
     }
 }
Esempio n. 4
0
        /// sets the staff player measure, shows highlighted notes:
        public void SetMeasure()
        {
            if (mMusicGenerator.mState >= eGeneratorState.editorInitializing)
            {
                StaffPlayerUI staffPlayer = mStaffPlayer;
                Instrument    instrument  = mInstrumentPanel.mInstrument;
                staffPlayer.SetMeasure(instrument);

                if (mLoadedClip.mInstrumentSet != null && mShowEditorHints.isOn && mLoadedClip.mInstrumentSet.mInstruments.Count > 0)
                {
                    List <Instrument> instruments = mLoadedClip.mInstrumentSet.mInstruments;
                    staffPlayer.ShowHighlightedNotes(instruments[(int)instrument.InstrumentIndex]);
                }
                UIToggleAllInstruments();
            }
        }
Esempio n. 5
0
        public IEnumerator Init()
        {
            mMusicGenerator.SetState(eGeneratorState.initializing);
            yield return(StartCoroutine(mMusicGenerator.mMusicFileConfig.LoadConfig(mMusicGenerator.mDefaultConfig, eGeneratorState.initializing)));

            mTooltips = Tooltips.Instance;
            yield return(StartCoroutine(mTooltips.Init()));

            mStaffPlayer = StaffPlayerUI.Instance;

            mInstrumentListPanelUI = InstrumentListPanelUI.Instance;

            mMeasureEditor = MeasureEditor.Instance;
            mMeasureEditor.Init(mMusicGenerator);

            mInstrumentPanelUI = InstrumentPanelUI.Instance;
            mInstrumentPanelUI.Init();

            mAdvancedSettingsPanel = AdvancedSettingsPanel.Instance;
            mAdvancedSettingsPanel.Init();

            mGlobalEffectsPanel = GlobalEffectsPanel.Instance;
            mGlobalEffectsPanel.Init(mMusicGenerator);

            mGeneratorUIPanel = MusicGeneratorUIPanel.Instance;
            bool finished = false;

            yield return(StartCoroutine(mGeneratorUIPanel.Init(mMusicGenerator, (x) => { finished = x; })));

            yield return(new WaitUntil(() => finished));

            mStaffPlayer.Init(mMusicGenerator);
            mStaffPlayer.ChangeTimeSignature(-1);
            mMusicGenerator.SetState(eGeneratorState.ready);
            //mInstrumentListPanelUI.Init(mMusicGenerator);
            yield return(null);
        }
Esempio n. 6
0
        /// Toggles all the instruments not currently being edited
        public void UIToggleAllInstruments(bool clear = false)
        {
            StaffPlayerUI     staffPlayer     = mStaffPlayer;
            InstrumentPanelUI instrumentPanel = mInstrumentPanel;

            if (clear)
            {
                staffPlayer.ClearNotes(true, false);
            }
            if (mInstrumentPanel.mInstrument != null)
            {
                InstrumentSet set = mLoadedClip.mInstrumentSet;
                if (set == null || set.mInstruments.Count == 0)
                {
                    return;
                }
                int currentInstrument = (int)set.mInstruments[(int)instrumentPanel.mInstrument.InstrumentIndex].InstrumentIndex;

                if (set.mInstruments.Count > currentInstrument)
                {
                    int[][] clipNotes = set.mInstruments[currentInstrument].mClipNotes[mCurrentMeasure.value];
                    if (mShowAllInstruments.isOn)
                    {
                        for (int i = 0; i < set.mInstruments.Count; i++)
                        {
                            int[][] notes = set.mInstruments[i].mClipNotes[mCurrentMeasure.value];
                            staffPlayer.ShowSetEditorNotes(notes, i);
                        }
                    }
                    else
                    {
                        staffPlayer.ShowSetEditorNotes(clipNotes, currentInstrument);
                    }
                }
            }
        }
Esempio n. 7
0
        public void Init()
        {
            mMusicGenerator   = MusicGenerator.Instance;
            mTooltips         = UIManager.Instance.mTooltips;
            mInstrumentListUI = UIManager.Instance.mInstrumentListPanelUI;
            mStaffPlayerUI    = UIManager.Instance.mStaffPlayer;
            mMeasureEditor    = UIManager.Instance.mMeasureEditor;
            Component[] components = this.GetComponentsInChildren(typeof(Transform), true);
            foreach (Component cp in components)
            {
                if (cp.name == "Arpeggio")
                {
                    mTooltips.AddUIElement(ref mArpeggio, cp, "Arpeggio");
                }
                if (cp.name == "Pentatonic")
                {
                    mTooltips.AddUIElement(ref mPentatonic, cp, "PentatonicLead");
                }
                if (cp.name == "LeadAvoidNotes")
                {
                    foreach (Toggle toggle in cp.GetComponentsInChildren <Toggle>())
                    {
                        int x = 0;
                        Int32.TryParse(toggle.name, out x);
                        mTooltips.AddUIElement(ref mLeadAvoidSteps[x], toggle, "LeadAvoids");
                    }
                }
                if (cp.name == "LeadVariation")
                {
                    mTooltips.AddUIElement <Slider>(ref mLeadVariation, cp, "LeadVariation");
                }
                if (cp.name == "LeadMaxSteps")
                {
                    mTooltips.AddUIElement(ref mLeadMaxSteps, cp, "LeadMaxSteps");
                }
                if (cp.name == "InstrumentPanel")
                {
                    mMasterObject = cp.gameObject;
                }

                if (cp.name == "PatternRelease")
                {
                    mTooltips.AddUIElement <Slider>(ref mPatternReleaseSlider, cp, "PatternRelease");
                }
                if (cp.name == "PatternLength")
                {
                    mTooltips.AddUIElement <Slider>(ref mPatternLengthSlider, cp, "PatternLength");
                }
                if (cp.name == "StrumLength")
                {
                    mTooltips.AddUIElement <Slider>(ref mStrumLength, cp, "StrumLength");
                }
                if (cp.name == "StrumVariation")
                {
                    mTooltips.AddUIElement <Slider>(ref mStrumVariation, cp, "StrumVariation");
                }
                if (cp.name == "UseSevenths")
                {
                    mTooltips.AddUIElement <Toggle>(ref mUseSevenths, cp, "UseSevenths");
                }
                if (cp.name == "OddsOfPlaying")
                {
                    mTooltips.AddUIElement <Slider>(ref mOddsOfPlayingSlider, cp, "OddsOfPlaying");
                }
                if (cp.name == "MultiplierOdds")
                {
                    mTooltips.AddUIElement <Slider>(ref mMultiplierSlider, cp, "MultiplierOdds");
                }
                if (cp.name == "VolumeSlider")
                {
                    mTooltips.AddUIElement <Slider>(ref mVolumeSlider, cp, "Volume");
                }
                if (cp.name == "Mute")
                {
                    mTooltips.AddUIElement <Toggle>(ref mMuteToggle, cp, "Mute");
                }
                if (cp.name == "Echo")
                {
                    mTooltips.AddUIElement <Slider>(ref mEchoSlider, cp, "Echo");
                }
                if (cp.name == "EchoDecay")
                {
                    mTooltips.AddUIElement <Slider>(ref mEchoDecaySlider, cp, "EchoDecay");
                }
                if (cp.name == "EchoDelay")
                {
                    mTooltips.AddUIElement <Slider>(ref mEchoDelaySlider, cp, "EchoDelay");
                }
                if (cp.name == "Reverb")
                {
                    mTooltips.AddUIElement <Slider>(ref mReverbSlider, cp, "Reverb");
                }
                if (cp.name == "RoomSize")
                {
                    mTooltips.AddUIElement <Slider>(ref mRoomSizeSlider, cp, "RoomSize");
                }
                if (cp.name == "Timestep")
                {
                    mTooltips.AddUIElement <Dropdown>(ref mTimestep, cp, "Timestep");
                }
                if (cp.name == "Flanger")
                {
                    mTooltips.AddUIElement <Slider>(ref mFlangerSlider, cp, "Flanger");
                }
                if (cp.name == "Distortion")
                {
                    mTooltips.AddUIElement <Slider>(ref mDistortionSlider, cp, "Distortion");
                }
                if (cp.name == "Chorus")
                {
                    mTooltips.AddUIElement <Slider>(ref mChorusSlider, cp, "Chorus");
                }
                if (cp.name == "Succession")
                {
                    mTooltips.AddUIElement <Dropdown>(ref mSuccession, cp, "Succession");
                }
                if (cp.name == "OddsOfPlayingChordNote")
                {
                    mTooltips.AddUIElement <Slider>(ref mOddsOfPlayingChordNoteSlider, cp, "ChordNote");
                }
                if (cp.name == "Octave1")
                {
                    mTooltips.AddUIElement <Toggle>(ref mOctave1, cp, "OctavesToUse");
                }
                if (cp.name == "Octave2")
                {
                    mTooltips.AddUIElement <Toggle>(ref mOctave2, cp, "OctavesToUse");
                }
                if (cp.name == "Octave3")
                {
                    mTooltips.AddUIElement <Toggle>(ref mOctave3, cp, "OctavesToUse");
                }
                if (cp.name == "Group")
                {
                    mTooltips.AddUIElement <Dropdown>(ref mGroup, cp, "Group");
                }
                if (cp.name == "Color")
                {
                    mTooltips.AddUIElement <Dropdown>(ref mColor, cp, "Color");
                }
                if (cp.name == "StereoPan")
                {
                    mTooltips.AddUIElement <Slider>(ref mStereoPan, cp, "StereoPan");
                }
                if (cp.name == "UsePattern")
                {
                    mTooltips.AddUIElement <Dropdown>(ref mUsePattern, cp, "Pattern");
                }
                if (cp.name == "FreeMelody")
                {
                    mTooltips.AddUIElement <Toggle>(ref mFreeMelody, cp, "Lead");
                }
                if (cp.name == "AudioGroupVolume")
                {
                    mTooltips.AddUIElement <Slider>(ref mAudioGroupVolume, cp, "AudioGroupVolume");
                }

                //output:
                if (cp.name == "PatternLengthOutput")
                {
                    mPatternLengthOutput = cp.gameObject.GetComponentInChildren <Text>();
                }
                if (cp.name == "PatternReleaseOutput")
                {
                    mPatternReleaseOutput = cp.gameObject.GetComponentInChildren <Text>();
                }
                if (cp.name == "StrumLengthOutput")
                {
                    mStrumLengthOutput = cp.gameObject.GetComponentInChildren <Text>();
                }
                if (cp.name == "StrumVariationOutput")
                {
                    mStrumVariationOutput = cp.gameObject.GetComponentInChildren <Text>();
                }
                if (cp.name == "LeadVariationOutput")
                {
                    mLeadVariationOutput = cp.gameObject.GetComponentInChildren <Text>();
                }
                if (cp.name == "LeadMaxStepsOutput")
                {
                    mLeadMaxStepsOutput = cp.gameObject.GetComponentInChildren <Text>();
                }
                if (cp.name == "OddsOfPlayingOutput")
                {
                    mOddsOfPlayingValueText = cp.gameObject.GetComponentInChildren <Text>();
                }
                if (cp.name == "MultiplierOutput")
                {
                    mMultiplierText = cp.gameObject.GetComponentInChildren <Text>();
                }
                if (cp.name == "VolumeOutput")
                {
                    mVolumeText = cp.gameObject.GetComponentInChildren <Text>();
                }
                if (cp.name == "RoomSizeOutput")
                {
                    mRoomSizeOutput = cp.gameObject.GetComponentInChildren <Text>();
                }
                if (cp.name == "ReverbOutput")
                {
                    mReverbOutput = cp.gameObject.GetComponentInChildren <Text>();
                }
                if (cp.name == "EchoOutput")
                {
                    mEchoOutput = cp.gameObject.GetComponentInChildren <Text>();
                }
                if (cp.name == "EchoDelayOutput")
                {
                    mEchoDelayOutput = cp.gameObject.GetComponentInChildren <Text>();
                }
                if (cp.name == "EchoDecayOutput")
                {
                    mEchoDecayOutput = cp.gameObject.GetComponentInChildren <Text>();
                }
                if (cp.name == "FlangerOutput")
                {
                    mFlangerOutput = cp.gameObject.GetComponentInChildren <Text>();
                }
                if (cp.name == "DistortionOutput")
                {
                    mDistortionOutput = cp.gameObject.GetComponentInChildren <Text>();
                }
                if (cp.name == "ChorusOutput")
                {
                    mChorusOutput = cp.gameObject.GetComponentInChildren <Text>();
                }
                if (cp.name == "OddsOfPlayingChordNoteOutput")
                {
                    mOddsOfPlayingChordNoteText = cp.gameObject.GetComponentInChildren <Text>();
                }
                if (cp.name == "AudioGroupVolumeOutput")
                {
                    mAudioGroupVolumeOutput = cp.gameObject.GetComponentInChildren <Text>();
                }
            }

            mMasterObject.SetActive(false);
            mColor.options.Clear();
            for (int i = 0; i < mStaffPlayerUI.mColors.Count; i++)
            {
                Texture2D texture = new Texture2D(1, 1);
                texture.SetPixel(0, 0, mStaffPlayerUI.mColors[i]);
                texture.Apply();
                Dropdown.OptionData data = new Dropdown.OptionData(Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0, 0)));
                mColor.options.Add(data);
            }
        }
Esempio n. 8
0
        public void Init(MusicGenerator managerIN)
        {
            GetComponentInParent <CanvasGroup>().interactable   = false;
            GetComponentInParent <CanvasGroup>().blocksRaycasts = false;
            mStaffPlayer     = StaffPlayerUI.Instance;
            mInstrumentPanel = InstrumentPanelUI.Instance;
            mGeneratorPanel  = MusicGeneratorUIPanel.Instance;

            mAnimator       = GetComponentInParent <Animator>();
            mMusicGenerator = managerIN;
            Tooltips tooltips = UIManager.Instance.mTooltips;

            Component[] components = this.GetComponentsInChildren(typeof(Transform), true);
            foreach (Component cp in components)
            {
                if (cp.name == "CurrentEditorMeasure")
                {
                    tooltips.AddUIElement <Dropdown>(ref mCurrentMeasure, cp, "CurrentEditorMeasure");
                }
                if (cp.name == "PlayClipDropdown")
                {
                    tooltips.AddUIElement <Dropdown>(ref mPlayClipDropdown, cp, "PlayClipDropdown");
                }
                if (cp.name == "ShowEditorHints")
                {
                    tooltips.AddUIElement <Toggle>(ref mShowEditorHints, cp, "ShowEditorHints");
                }
                if (cp.name == "ShowAllInstruments")
                {
                    tooltips.AddUIElement <Toggle>(ref mShowAllInstruments, cp, "ShowAllInstruments");
                }
                if (cp.name == "NumberOfMeasures")
                {
                    tooltips.AddUIElement <Dropdown>(ref mNumberOfMeasures, cp, "NumberOfMeasures");
                }
                if (cp.name == "ProgressionRate")
                {
                    tooltips.AddUIElement <Dropdown>(ref mProgressionRate, cp, "ProgressionRate");
                }
                if (cp.name == "Mode")
                {
                    tooltips.AddUIElement <Dropdown>(ref mMode, cp, "Mode");
                }
                if (cp.name == "Scale")
                {
                    tooltips.AddUIElement <Dropdown>(ref mScale, cp, "Scale");
                }
                if (cp.name == "Key")
                {
                    tooltips.AddUIElement <Dropdown>(ref mKey, cp, "Key");
                }
                if (cp.name == "Tempo")
                {
                    tooltips.AddUIElement <Slider>(ref mTempo, cp, "Tempo");
                }
                if (cp.name == "ClipRepeat")
                {
                    tooltips.AddUIElement <Toggle>(ref mClipIsRepeating, cp, "ClipRepeat");
                }
            }
        }