/// 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(); } }
/// 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(); } }
/// Updates the helper notes showing/not showing, whether mShowEditorHints.isOn. public void ToggleHelperNotes(Dropdown colorDropdownIN = null) { if (mMusicGenerator.mState >= eGeneratorState.editing) { if (mShowEditorHints.isOn) { if (mLoadedClip.mInstrumentSet.mInstruments.Count == 0) { return; } int currentInstIndex = (int)mInstrumentPanel.mInstrument.InstrumentIndex; if (colorDropdownIN != null) { mLoadedClip.mInstrumentSet.mInstruments[currentInstIndex].mData.mStaffPlayerColor = (eStaffPlayerColors)colorDropdownIN.value; } mStaffPlayer.ClearNotes(true, true); Instrument instrument = mLoadedClip.mInstrumentSet.mInstruments[currentInstIndex]; mStaffPlayer.ShowHighlightedNotes(instrument); if (mShowAllInstruments.isOn) { InstrumentSet set = mLoadedClip.mInstrumentSet; for (int i = 0; i < set.mInstruments.Count; i++) { int[][] notes = set.mInstruments[i].mClipNotes[mCurrentMeasure.value]; mStaffPlayer.ShowSetEditorNotes(notes, i); } } else { mStaffPlayer.ShowSetEditorNotes(instrument.mClipNotes[mCurrentMeasure.value], instrument.InstrumentIndex); } } else { mStaffPlayer.ClearNotes(false, true); } } }