public void RefreshMIDIDeviceList() { Dropdown dd = GetComponent <Dropdown>(); int?push2OptionIndex = null; int deviceCount = listAs == ListAs.MIDIInDevices ? MIDIManager.midiInDeviceCount : MIDIManager.midiOutDeviceCount; if (deviceCount == deviceCountBefore) { return; } dd.ClearOptions(); for (var i = 0; i < deviceCount; i++) { var option = listAs == ListAs.MIDIInDevices ? MIDIManager.MidiInDevices[i] : MIDIManager.MidiOutDevices[i]; dd.options.Add(new Dropdown.OptionData(option.ToString())); if (option.Name.IndexOf("Ableton Push 2") == 0) { push2OptionIndex = i; } } if (push2OptionIndex != null) { dd.value = (int)push2OptionIndex; MIDIManager.WakeupPush2(); } dd.RefreshShownValue(); deviceCountBefore = deviceCount; }
protected override void StartCore(dynamic parameters = null) { MidiInput = MIDIManager.GetDevice(parameters?.DeviceID); MidiInput.AddChannelMessageAction(HandleMidi); MidiInput.StartRecording(); ColorsToSend = new Dictionary <int, Color>(); Zone.SortedLights.Keys.ToList().ForEach(lightIndex => ColorsToSend.Add(lightIndex, Color.Black)); }
protected override void StartCore(dynamic parameters = null) { if (parameters != null) { int?deviceID = parameters?.DeviceID; var freeDevices = MIDIManager.FreeDevices; var freeDeviceIDs = freeDevices?.Select(x => x.DeviceID).ToList(); var isDeviceNull = parameters?.DeviceID == null; if (!isDeviceNull && freeDeviceIDs?.Contains(deviceID)) { MidiInput = MIDIManager.GetDevice(parameters.DeviceID); MidiInput.AddChannelMessageAction(HandleMidi); MidiInput.StartRecording(); } else { throw new WarningException("Supplied MIDI Device ID is either in use or invalid."); } } base.StartCore(null); }
protected override void StopCore(bool force) { MidiInput.StopRecording(); MIDIManager.RemoveDevice(MidiInput); }
protected override void StartCore(dynamic parameters = null) { MidiInput = MIDIManager.GetDevice(parameters?.DeviceID); MidiInput.AddChannelMessageAction(TwoDimensionalFade); MidiInput.StartRecording(); }
public void OnValueChanged(Dropdown dropdown) { MIDIManager.SetPush2MIDIOutDevice(dropdown.value); }