public void ClearAll() { Helpers.ListPracticePause.Clear(); Helpers.ListPracticePreAdd.Clear(); Helpers.IsPracticePlaying = true; MidiOut.AllSoundOff(); foreach (Transform child in transform) { int keyValue; if (int.TryParse(child.name, out keyValue)) { var sr = child.GetComponent <SpriteRenderer>(); if (sr.sprite == KeyBlackDown) { sr.sprite = KeyBlack; } if (sr.sprite == KeyWhiteDown) { sr.sprite = KeyWhite; } if (sr.color != Helpers.ColorWhite10) { sr.color = Helpers.ColorWhite10; } ParticleSystem particle = child.GetComponentInChildren <ParticleSystem>(); particle.Clear(); particle.Stop(); } } }
public void Stop() { CancelPickUpBarCounting(); if (midiFile == null) { return; } state = State.None; ResetSequencer(); if (midiOut) { MidiOut.AllPedalsOff(); MidiOut.AllSoundOff(); } if (audioMusic) { audioMusic.Stop(); } if (audioVocals) { audioVocals.Stop(); } if (repeatBarSelection) { SetBar(startBar, false); } if (OnStop != null) { OnStop(); } }
IEnumerator Repeat(int waitTime) { maimMenu.StopPlaying(); MidiOut.AllSoundOff(); panelMeasure.UpdateSliderValue(transform.localPosition.y); Debug.Log("Repeat Wait for " + waitTime + " seconds"); yield return(new WaitForSeconds(waitTime)); maimMenu.StartPlaying(); }
public void StopPlaying() { if (ButtonPlayPause != null) { ButtonPlayPause.GetComponent <Image>().sprite = PlayIcon; } Helpers.IsPlaying = false; MidiOut.AllSoundOff(); }
IEnumerator StartPlaying(int waitTime) { maimMenu.StopPlaying(); MidiOut.AllSoundOff(); //transform.localPosition = new Vector3(0, Camera.main.orthographicSize * (1 / Helpers.ScaleMin), 0); transform.localPosition = new Vector3(0, Helpers.OffSet, 0); panelMeasure.UpdateSliderValue(transform.localPosition.y); Debug.Log("Wait for " + waitTime + " seconds"); yield return(new WaitForSeconds(waitTime)); maimMenu.StartPlaying(); }
public void Pause() { CancelPickUpBarCounting(); if (midiFile == null) { return; } audioMusic.Pause(); audioVocals.Pause(); if (midiOut) { MidiOut.AllSoundOff(); } state = State.Pausing; }
void Start() { MidiOut.AllSoundOff(); ////turn off all channel //for (int i = 0; i < 88; i++) //{ // for (int j = 0; j < 16; j++) // { // MidiOut.NoteOff(i + 20, j); // } //} Helpers.IsPlaying = true; if (!Helpers.NotesClipReady) { //var coroutine = BuildSoundCr(); //StartCoroutine(coroutine); } }
void DrawINOUT() { backgroundColor = GUI.backgroundColor; int count = MidiINPlugin.deviceNames.Count > MidiOUTPlugin.deviceNames.Count ? MidiINPlugin.deviceNames.Count : MidiOUTPlugin.deviceNames.Count; if (count == 0) { EditorGUILayout.HelpBox("No MIDI connection found!!!", MessageType.Info); } float selectionHeight = count * (lineHeight + 5); float dialogHeight = selectionHeight + 65; Rect defaultRect = new Rect(0, 0, window.position.width, dialogHeight); GUI.BeginGroup(defaultRect); float width = defaultRect.width; float halfWidth = width / 2f; GUI.Box(new Rect(-5f, -5f, defaultRect.width + 10, defaultRect.height + 10), ""); GUILayout.BeginHorizontal(); GUILayout.Box("Midi IN", GUILayout.Width(halfWidth)); GUILayout.Box("Midi OUT", GUILayout.Width(halfWidth)); GUILayout.EndHorizontal(); GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(5)); bool exists = false; for (int i = 0; i < count; i++) { GUILayout.BeginHorizontal(); if (i < MidiINPlugin.deviceNames.Count) { exists = false; foreach (MidiDevice inDevice in MidiINPlugin.connectedEditorDevices) { if (MidiINPlugin.deviceNames [i] == inDevice.name) { exists = true; break; } } GUI.backgroundColor = exists ? Color.green : backgroundColor; if (GUILayout.Button(MidiINPlugin.deviceNames [i], GUILayout.Width(halfWidth), GUILayout.Height(lineHeight))) { if (exists) { MidiINPlugin.DisconnectDeviceByName(MidiINPlugin.deviceNames [i], true); } else { MidiINPlugin.ConnectDevice(i, true); } MidiINPlugin.StoreEditorConnections(); } GUI.backgroundColor = backgroundColor; } else { GUILayout.Label("", GUILayout.Width(halfWidth), GUILayout.Height(lineHeight)); } if (i < MidiOUTPlugin.deviceNames.Count) { exists = false; foreach (MidiDevice outDevice in MidiOUTPlugin.connectedEditorDevices) { if (MidiOUTPlugin.deviceNames [i] == outDevice.name) { exists = true; break; } } GUI.backgroundColor = exists ? Color.green : backgroundColor; if (GUILayout.Button(MidiOUTPlugin.deviceNames [i], GUILayout.Width(halfWidth), GUILayout.Height(lineHeight))) { if (exists) { MidiOUTPlugin.DisconnectDeviceByName(MidiOUTPlugin.deviceNames [i], true); } else { MidiOUTPlugin.ConnectDevice(i, true); } MidiOUTPlugin.StoreEditorConnections(); } GUI.backgroundColor = backgroundColor; } else { GUILayout.Label("", GUILayout.Width(halfWidth), GUILayout.Height(lineHeight)); } GUILayout.EndHorizontal(); } GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(5)); GUILayout.BeginHorizontal(); if (GUILayout.Button("Refresh", GUILayout.Width(halfWidth))) { MidiINPlugin.Refresh(); MidiOUTPlugin.Refresh(); } if (GUILayout.Button("Reset", GUILayout.Width(halfWidth))) { MidiOut.AllSoundOff(); MidiOut.ResetAllControllers(); } GUILayout.EndHorizontal(); GUI.EndGroup(); }
public void Reset() { MidiOut.AllSoundOff(); MidiOut.ResetAllControllers(); }