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); }
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; }
public void Init(MusicGenerator managerIN) { mMusicGenerator = managerIN; mTooltips = UIManager.Instance.mTooltips; mMeasureEditor = UIManager.Instance.mMeasureEditor; mInstrumentPanelUI = UIManager.Instance.mInstrumentPanelUI; mInstrumentListPanelUI = UIManager.Instance.mInstrumentListPanelUI; Component[] components = this.GetComponentsInChildren(typeof(Transform), true); foreach (Component cp in components) { if (cp.name == "SelectButton") { mSelectIcon = cp.gameObject.GetComponentInChildren <Image>(); mSelectIcon.color = Color.white; mTooltips.AddTooltip("Edit", mSelectIcon.GetComponent <RectTransform>()); } if (cp.name == "MuteToggle") { mMuteToggle = cp.gameObject.GetComponentInChildren <Toggle>(); mTooltips.AddTooltip("Mute", mMuteToggle.GetComponent <RectTransform>()); } if (cp.name == "GroupText") { mGroupText = cp.gameObject.GetComponent <Text>(); mTooltips.AddTooltip("Group", mGroupText.GetComponent <RectTransform>()); } if (cp.name == "SoloToggle") { mSoloToggle = cp.gameObject.GetComponentInChildren <Toggle>(); mTooltips.AddTooltip("Solo", mSoloToggle.GetComponent <RectTransform>()); } if (cp.name == "ColorButton") { mPanelBack = cp.gameObject.GetComponent <Image>(); } } mTooltips.AddTooltip("InstrumentDropdown", GetComponentInChildren <Dropdown>().GetComponent <RectTransform>()); }
///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); }
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); }
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); } }