public static void Test() { int pageNo = 0; int pageSize = 2; var musicTracks = MusicGenerator.GenerateMusicTrack(); while (true) { var trackList = ( from musicTrack in musicTracks.Skip(pageNo * pageSize).Take(pageSize) select new TrackDetails { ArtistName = musicTrack.Artist.Name, Title = musicTrack.Title } ).ToList(); if (trackList.Count == 0) { break; } foreach (var track in trackList) { Console.WriteLine($"Artist: {track.ArtistName} Titile: {track.Title}"); } pageNo++; } }
public void Init(MusicGenerator managerIN) { LoadReferences(managerIN); mInstrumentListPanelUI.Init(mMusicGenerator); AddPresets(); FinishInitialization(); }
public void Init(MusicGenerator managerIN) { mMusicGenerator = managerIN; UIManager uimanager = UIManager.Instance; mGeneratorUIPanel = uimanager.mGeneratorUIPanel; mMeasureEditor = uimanager.mMeasureEditor; mInstrumentPanel = uimanager.mInstrumentPanelUI; mMaxPlayedNotes = MusicGenerator.mMaxInstruments * 4 * 16; //number of instruments, times size of chord * number of steps per measure for (int i = 0; i < mMaxPlayedNotes; i++) //In theory, the max number of notes that might play, given maxInstruments. { mPlayedNotes.Add((Instantiate(mBaseNoteImage, mStaffPlayerTransform) as GameObject).GetComponent <StaffPlayerNote>()); mPlayedNotes[i].transform.position = new Vector3(-10000, -10000, 0); mPlayedNotes[i].gameObject.SetActive(false); mShadowNotes.Add((Instantiate(mBaseShadowImage, mStaffPlayerTransform) as GameObject).GetComponent <StaffPlayerNote>()); mShadowNotes[i].transform.position = new Vector3(-10000, -10000, 0); mShadowNotes[i].gameObject.SetActive(false); mEditorNotes.Add((Instantiate(mBaseEditorNote, mStaffPlayerTransform) as GameObject).GetComponent <StaffPlayerNote>()); mEditorNotes[i].transform.position = new Vector3(-10000, -10000, 0); mEditorNotes[i].gameObject.SetActive(false); mPlacedEditorNotes.Add((Instantiate(mBasePlayedEditorNote, mStaffPlayerTransform) as GameObject).GetComponent <EditorNote>()); mPlacedEditorNotes[i].transform.position = new Vector3(-10000, -10000, 0); mPlacedEditorNotes[i].gameObject.SetActive(false); } mTimeSignatureDropdown.value = (int)mMusicGenerator.mInstrumentSet.mTimeSignature.Signature; //ChangeTimeSignature(eTimeSignature.ThreeFour); }
/// <summary> /// Initializes music set. /// </summary> public void Init() { mMusicGenerator = MusicGenerator.Instance; mBeatLength = 0; mCurrentGroupLevel = 0; mTimeSignature.Init(); }
/// Awake is called when the script instance is being loaded. public override void Awake() { base.Awake(); mMusicGenerator = GameObject.Find("MusicGenerator").GetComponent <MusicGenerator>(); mMusicGenerator.Started.AddListener(OnStarted); mMusicGenerator.HasVisiblePlayer += OnHasVisiblePlayer; }
public IEnumerator Init(MusicGenerator managerIN, System.Action <bool> callback) { LoadReferences(managerIN); mInstrumentListPanelUI.Init(mMusicGenerator); yield return(StartCoroutine(AddPresets())); FinishInitialization(); callback(true); yield return(null); }
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 static void Test() { var musicTracks = MusicGenerator.GenerateMusicTrack(); var selectedTracks = (from track in musicTracks where track.Artist.Name == "Rob Miles" select track).ToList(); foreach (var track in selectedTracks) { Console.WriteLine($"Artist: {track.Artist.Name} Titile: {track.Title}"); } }
public void PlayNote() { _audioSource.volume = Art.Volume; if (_diddy == null || _diddyIndex >= _diddy.GetLength(0)) { _diddy = MusicGenerator.GetDiddy(FullName.Length, FullName.GetHashCode()); _diddyIndex = 0; } foreach (Note note in _diddy[_diddyIndex]) { _audioSource.PlayOneShot(note.AudioClip); } _diddyIndex++; }
public static void Test() { var musicData = MusicGenerator.GenerateMusicTrack(); var formatter = new BinaryFormatter(); using (FileStream outputStream = new FileStream("MusicTracks.bin", FileMode.OpenOrCreate, FileAccess.Write)) { formatter.Serialize(outputStream, musicData); } using (FileStream inputStream = new FileStream("MusicTracks.bin", FileMode.Open, FileAccess.Read)) { var inputData = (IList <MusicTrack>)formatter.Deserialize(inputStream); } }
public void Test() { var(musicTracksId, artistsId) = MusicGenerator.GenerateMusicTrackId(); var artistSummary = musicTracksId .Join(artistsId, track => track.ArtistId, artist => artist.Id, (track, artist) => new { track = track, artist = artist }) .GroupBy(temp0 => temp0.artist.Name, temp0 => temp0.track) .Select(artistTrackSummary => new { Id = artistTrackSummary.Key, Lenght = artistTrackSummary.Sum(lnq => lnq.Lenght) }) .ToList(); }
public void Init(MusicGenerator managerIN) { mMusicGenerator = managerIN; Tooltips tooltiops = UIManager.Instance.mTooltips; Component[] components = this.GetComponentsInChildren(typeof(Transform), true); foreach (Component cp in components) { if (cp.name == "AddInstrumentPoint") { mAddInstrumentPoint = cp.gameObject.GetComponent <RectTransform>(); mBaseAddInstrumentPos = mAddInstrumentPoint.localPosition; } if (cp.name == "NewInstrumentButton") { tooltiops.AddTooltip("NewInstrument", cp.gameObject.GetComponent <RectTransform>()); } } }
public static void Test() { var(musicTracksId, artistsId) = MusicGenerator.GenerateMusicTrackId(); var trackDetails = ( from artist in artistsId where artist.Name == "Rob Miles" join track in musicTracksId on artist.Id equals track.ArtistId select new TrackDetails { ArtistName = artist.Name, Title = track.Title } ); foreach (var track in trackDetails) { Console.WriteLine($"Artist: {track.ArtistName} Titile: {track.Title}"); } }
public static void Test() { var(musicTracksId, artistsId) = MusicGenerator.GenerateMusicTrackId(); var artistSummary = ( from track in musicTracksId join artist in artistsId on track.ArtistId equals artist.Id group track by artist.Name into artistTrackSummary select new { Id = artistTrackSummary.Key, Count = artistTrackSummary.Count() } ).ToList(); foreach (var item in artistSummary) { Console.WriteLine($"Artist: {item.Id} Tracks recorded: {item.Count}"); } }
protected override void LoadContent() { keyBoardReader = new KeyBoardReader(); _spriteBatch = new SpriteBatch(GraphicsDevice); #region add worlds to level1 levelsWorld1 = new List <IRoomLayout>(); levelsWorld1.Add(new StartWorldLayout()); levelsWorld1.Add(new World1Room1Layout()); levelsWorld1.Add(new World1Room2Layout()); levelsWorld1.Add(new World1Room3Layout()); levelsWorld1.Add(new World1Room4Layout()); #endregion #region add menu items to the menus startMenuItems = new List <string> { "Pigit", "Play", "Exit Game", "->" }; pauseMenuItems = new List <string> { "Pause", "Resume", "Main Menu", "->" }; deadMenuItems = new List <string> { "Dead", "Main Menu", "Exit Game", "->" }; endMenuItems = new List <string> { "End", "Main Menu", "Exit Game", "->" }; #endregion #region generate fontGenerator = new FontGenerator(Content); generateSprites = new SpriteGenerator(Content); musicGenerator = new MusicGenerator(Content); #endregion InitializeGameObjects(); }
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>()); }
// Use this for initialization protected override void OnStart() { generator = GetComponent <WaveGenerator>(); Player = GetComponent <Instrument> (); uint octave = (uint)Random.Range(LowLevel, HighLevel); List <MelodyTansitionInfo> transitions = new List <MelodyTansitionInfo>(); List <Note> scale = MusicGenerator.GenerateScale(BaseNote, Octave, !IsMinor); for (int i = 0; i < scale.Count; i++) { transitions.Add(new MelodyTansitionInfo(i, Random.Range(0, scale.Count), 1)); } int transitionCount = Random.Range(7, 15); for (int i = 0; i < transitionCount; i++) { transitions.Add(new MelodyTansitionInfo( Random.Range(0, scale.Count), Random.Range(0, scale.Count), Random.value * 2)); } machine = new MelodyMachine(scale, transitions); machine.SetOctave(octave); if (Repeat && PatternLength > 0) { for (int i = 0; i < PatternLength; i++) { melody.Add(machine.CurrentNote); machine.Next(); } } }
public void OnStarted() { mMusicGenerator = MusicGenerator.Instance; mMusicGenerator.StateSet.AddListener(OnStateSet); mMusicGenerator.VolumeFaded.AddListener(OnVolumeFaded); mMusicGenerator.ProgressionGenerated.AddListener(OnProgressionGenerated); mMusicGenerator.InstrumentsCleared.AddListener(OnInstrumentsCleared); mMusicGenerator.KeyChanged.AddListener(OnKeyChanged); mMusicGenerator.NormalMeasureExited.AddListener(OnNormalMeasureExited); mMusicGenerator.RepeatNotePlayed.AddListener(OnRepeatNotePlayed); mMusicGenerator.RepeatedMeasureExited.AddListener(OnRepeatedMeasureExited); mMusicGenerator.BarlineColorSet.AddListener(OnSetBarlineColor); mMusicGenerator.UIPlayerIsEditing += (OnUIPlayerIsEditing); mMusicGenerator.UIStaffNotePlayed.AddListener(OnUIStaffNotePlayed); mMusicGenerator.ClipLoaded.AddListener(OnClipLoaded); mMusicGenerator.EditorClipPlayed.AddListener(OnEditorClipPlayed); mMusicGenerator.PlayerReset.AddListener(OnPlayerReset); mMusicGenerator.UIStaffNoteStrummed.AddListener(OnUIStaffNoteStrummed); #if !UNITY_EDITOR && UNITY_ANDROID StartCoroutine(Init()); #else Init(); #endif //#if !UNITY_EDITOR && UNITY_ANDROID }
public EnemyEffects(MusicGenerator musicGenerator) { this.musicGenerator = musicGenerator; }
public HumanEffect(MusicGenerator musicGenerator) { this.musicGenerator = musicGenerator; }
/// <summary> /// Initializes this note genereator. /// </summary> /// <param name="instrument"></param> /// <param name="fallback"></param> public void Init(Instrument instrument, Fallback fallback) { mInstrument = instrument; mFallback = fallback; mMusicGenerator = mInstrument.mMusicGenerator; }
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); } }
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"); } } }
public List <Toggle> mExcludedSteps = new List <Toggle>(); //< list of which steps are excluded from chord progressions public void Init() { GetComponentInParent <CanvasGroup>().interactable = false; GetComponentInParent <CanvasGroup>().blocksRaycasts = false; mUIManager = UIManager.Instance; mAnimator = GetComponentInParent <Animator>(); Component[] components = this.GetComponentsInChildren(typeof(Transform), true); mMusicGenerator = MusicGenerator.Instance; Tooltips tooltips = mUIManager.mTooltips; ChordProgressions progressions = mMusicGenerator.mChordProgressions; mTonicInfluence.value = progressions.mData.TonicInfluence; mSubdominantInfluence.value = progressions.mData.SubdominantInfluence; mDominantInfluence.value = progressions.mData.DominantInfluence; mTritoneSubInfluence.value = progressions.mData.TritoneSubInfluence; mGroupRate.value = (int)mMusicGenerator.mGeneratorData.mGroupRate; //sets up our UI elements: foreach (Component cp in components) { if (cp.name == "AsyncLoading") { tooltips.AddUIElement(ref mAsyncLoading, cp, "AsyncLoading"); } if (cp.name == "GroupRate") { tooltips.AddUIElement(ref mGroupRate, cp, "GroupRate"); } if (cp.name == "DynamicStyle") { tooltips.AddUIElement(ref mDynamicStyle, cp, "DynamicStyle"); } if (cp.name == "DominantInfluence") { tooltips.AddUIElement(ref mDominantInfluence, cp, "DominantInfluence"); } if (cp.name == "TonicInfluence") { tooltips.AddUIElement(ref mTonicInfluence, cp, "TonicInfluence"); } if (cp.name == "SubdominantInflunce") { tooltips.AddUIElement(ref mSubdominantInfluence, cp, "SubdominantInfluence"); } if (cp.name == "TritoneSubInf") { tooltips.AddUIElement(ref mTritoneSubInfluence, cp, "TritoneSubstitution"); } if (cp.name == "AscendDescendKey") { tooltips.AddUIElement(ref mAscendDescendKey, cp, "KeyAscendDescend"); } if (cp.name == "VolumeFadeRate") { tooltips.AddUIElement(ref mVolumeFadeRate, cp, "VolumeFadeRate"); } if (cp.name == "DominantInfluenceOutput") { mDominantInfluenceOutput = cp.GetComponentInChildren <Text>(); } if (cp.name == "TonicInfluenceOutput") { mTonicInfluenceOutput = cp.GetComponentInChildren <Text>(); } if (cp.name == "SubdominantInfluenceOutput") { mSubdominantInfluenceOutput = cp.GetComponentInChildren <Text>(); } if (cp.name == "TritoneSubInfOutput") { mTritoneSubInfluenceOutput = cp.GetComponentInChildren <Text>(); } if (cp.name == "AscendDescendKeyOutput") { mAscendDescendKeyOutput = cp.GetComponentInChildren <Text>(); } if (cp.name == "VolumeFadeRateOutput") { mVolumeFadeRateOutput = cp.GetComponentInChildren <Text>(); } } //these ui objects have a bunch of parts. Handled differently: for (int i = 0; i < mExcludedSteps.Count; i++) { Component[] components2 = this.GetComponentsInChildren(typeof(Transform), true); foreach (Component cp2 in components2) { if (cp2.name.Contains("Exclude")) { tooltips.AddTooltip("TonicSubdominantDominantExcludes", cp2.GetComponent <RectTransform>()); } } } }
public void Init(MusicGenerator managerIN) { mMusicGenerator = managerIN; Tooltips tooltips = UIManager.Instance.mTooltips; mAnimator = GetComponentInParent <Animator>(); mOptions.Clear(); /// we create an EffectsOption for each slider, which will set its base value, tooltip, etc. Component[] components = this.GetComponentsInChildren(typeof(Transform), true); foreach (Component cp in components) { if (cp.name == "MasterDistortion") { mOptions.Add(mDistortion = new EffectsOption(mMusicGenerator.mGeneratorData.mDistortion, (x) => mMusicGenerator.mGeneratorData.mDistortion.Second = x, tooltips, cp, 0.0f)); } if (cp.name == "MasterCenterFrequency") { mOptions.Add(mCenterFrequency = new EffectsOption(mMusicGenerator.mGeneratorData.mCenterFreq, (x) => mMusicGenerator.mGeneratorData.mCenterFreq.Second = x, tooltips, cp, mBaseCenterFrequency)); } if (cp.name == "MasterOctaveRange") { mOptions.Add(mOctaveRange = new EffectsOption(mMusicGenerator.mGeneratorData.mOctaveRange, (x) => mMusicGenerator.mGeneratorData.mOctaveRange.Second = x, tooltips, cp, mBaseOctaveRange)); } if (cp.name == "MasterFrequencyGain") { mOptions.Add(mFrequencyGain = new EffectsOption(mMusicGenerator.mGeneratorData.mFreqGain, (x) => mMusicGenerator.mGeneratorData.mFreqGain.Second = x, tooltips, cp, mBaseFrequencyGain)); } if (cp.name == "MasterLowpassCutoffFreq") { mOptions.Add(mLowpassCutoffFreq = new EffectsOption(mMusicGenerator.mGeneratorData.mLowpassCutoffFreq, (x) => mMusicGenerator.mGeneratorData.mLowpassCutoffFreq.Second = x, tooltips, cp, mBaseLowpassCutoffFreq)); } if (cp.name == "MasterLowpassResonance") { mOptions.Add(mLowpassResonance = new EffectsOption(mMusicGenerator.mGeneratorData.mLowpassResonance, (x) => mMusicGenerator.mGeneratorData.mLowpassResonance.Second = x, tooltips, cp, mBaseLowpassResonance)); } if (cp.name == "MasterHighpassCutoffFreq") { mOptions.Add(mHighpassCutoffFreq = new EffectsOption(mMusicGenerator.mGeneratorData.mHighpassCutoffFreq, (x) => mMusicGenerator.mGeneratorData.mHighpassCutoffFreq.Second = x, tooltips, cp, mBaseHighpassCutoffFreq)); } if (cp.name == "MasterHighpassResonance") { mOptions.Add(mHighpassResonance = new EffectsOption(mMusicGenerator.mGeneratorData.mHighpassResonance, (x) => mMusicGenerator.mGeneratorData.mHighpassResonance.Second = x, tooltips, cp, mBaseHighpassResonance)); } if (cp.name == "MasterEchoDelay") { mOptions.Add(mEchoDelay = new EffectsOption(mMusicGenerator.mGeneratorData.mEchoDelay, (x) => mMusicGenerator.mGeneratorData.mEchoDelay.Second = x, tooltips, cp, mBaseEchoDelay)); } if (cp.name == "MasterEchoDecay") { mOptions.Add(mEchoDecay = new EffectsOption(mMusicGenerator.mGeneratorData.mEchoDecay, (x) => mMusicGenerator.mGeneratorData.mEchoDecay.Second = x, tooltips, cp, mBaseEchoDecay)); } if (cp.name == "MasterEchoDry") { mOptions.Add(mEchoDry = new EffectsOption(mMusicGenerator.mGeneratorData.mEchoDry, (x) => mMusicGenerator.mGeneratorData.mEchoDry.Second = x, tooltips, cp, mBaseEchoDry)); } if (cp.name == "MasterEchoWet") { mOptions.Add(mEchoWet = new EffectsOption(mMusicGenerator.mGeneratorData.mEchoWet, (x) => mMusicGenerator.mGeneratorData.mEchoWet.Second = x, tooltips, cp, mBaseEchoWet)); } if (cp.name == "MasterNumEchoChannels") { mOptions.Add(mNumEchoChannels = new EffectsOption(mMusicGenerator.mGeneratorData.mNumEchoChannels, (x) => mMusicGenerator.mGeneratorData.mNumEchoChannels.Second = x, tooltips, cp, mBaseNumEchoChannels)); } if (cp.name == "MasterReverb") { mOptions.Add(mReverb = new EffectsOption(mMusicGenerator.mGeneratorData.mReverb, (x) => mMusicGenerator.mGeneratorData.mReverb.Second = x, tooltips, cp, mBaseReverb)); } if (cp.name == "MasterRoomSize") { mOptions.Add(mRoomSize = new EffectsOption(mMusicGenerator.mGeneratorData.mRoomSize, (x) => mMusicGenerator.mGeneratorData.mRoomSize.Second = x, tooltips, cp, mBaseRoomSize)); } if (cp.name == "MasterReverbDecay") { mOptions.Add(mReverbDecay = new EffectsOption(mMusicGenerator.mGeneratorData.mReverbDecay, (x) => mMusicGenerator.mGeneratorData.mReverbDecay.Second = x, tooltips, cp, mBaseReverbDecay)); } } GetComponentInParent <CanvasGroup>().interactable = false; GetComponentInParent <CanvasGroup>().blocksRaycasts = false; }
public GameMusic(MusicGenerator musicGenerator) { this.musicGenerator = musicGenerator; }