private void Start() { md = GameObject.Find("Melodrive").GetComponent <MelodrivePlugin>(); md.Init("ambient", "happy"); // When changing styles, we reccomend they are preloaded first to avoid any audio jitters md.PreloadStyles(); md.Play(); }
public void MDInit() { md.Init(initStyle, initEmotion); }
// Use this for initialization void Start() { lastSavePath = System.IO.Path.Combine(Application.streamingAssetsPath, "Melodrive"); if (!Directory.Exists(lastSavePath)) { Directory.CreateDirectory(lastSavePath); } // Setup Melodrive.... md = GameObject.Find("Melodrive").GetComponent <MelodrivePlugin>(); md.Beat += new MelodrivePlugin.BeatHandler(Beat); md.NewMusicalSeed += new MelodrivePlugin.NewMusicalSeedHandler(NewMusicalSeed); md.CueChange += new MelodrivePlugin.CueChangeHandler(CueChange); md.ProjectLoad += new MelodrivePlugin.ProjectLoadHandler(ProjectLoad); // init style dropdown Dropdown styleChange = GameObject.Find("StyleSelect").GetComponent <Dropdown>(); styleChange.ClearOptions(); string[] styles = md.GetStyles(); List <Dropdown.OptionData> options = new List <Dropdown.OptionData>(); int selectedValue = -1; for (int i = 0; i < styles.Length; i++) { Dropdown.OptionData item = new Dropdown.OptionData(); item.text = styles[i]; options.Add(item); if (style == styles[i]) { selectedValue = i; } } styleChange.AddOptions(options); if (selectedValue > -1) { styleChange.value = selectedValue; } md.Init(style, emotion); md.PreloadStyles(); Vector3 initPos = new Vector3(); GameObject[] points = { GameObject.Find("Happy"), GameObject.Find("Tender"), GameObject.Find("Sad"), GameObject.Find("Angry") }; for (int i = 0; i < points.Length; i++) { GameObject p = points[i]; Vector3 pos = p.transform.position; if (p.name.ToLower() == emotion) { target = p; initPos = pos; } md.AddEmotionalPoint(pos.x, pos.z, p.name.ToLower()); } listener = GameObject.Find("Listener"); listener.transform.position = initPos; targetScale = listener.transform.localScale; targetScale2 = new Vector3(1, 1, 1); md.SetListenerPosition(listener.transform.position.x, listener.transform.position.z); init = true; //updateMusicalSeeds = true; //updateEnsembles = true; OnUIAutoPlay(); }
public void MDInit() { md.Init(initStyle, Emotion.Neutral); }