private void Form1_Shown(object sender, EventArgs e) { f2 = new FormSettings(); cm = new ChooseModule(); int k = 0; k = MidiOut.NumberOfDevices; for (int i = 0; i < k; i++) { f2.comboBox1.Items.Add(MidiOut.DeviceInfo(i).ProductName.ToString()); } if (k > 0) { f2.comboBox1.SelectedIndex = 0; } k = 0; k = MidiIn.NumberOfDevices; for (int i = 0; i < k; i++) { f2.comboBox3.Items.Add(MidiIn.DeviceInfo(i).ProductName.ToString()); } if (k > 0) { f2.comboBox3.SelectedIndex = 0; } f2.comboBox2.SelectedIndex = 0; f2.StartPosition = FormStartPosition.CenterParent; f2.FormClosing += SettingsClose; f2.ShowDialog(); cm.StartPosition = FormStartPosition.CenterScreen; cm.FormClosing += ChooseModuleClose; }
void CheckBoxMidiOutMessagesCheckedChanged(object sender, EventArgs e) { if (midiOut == null) { midiOut = new MidiOut(comboBoxMidiOutDevices.SelectedIndex); } }
public static void Init(Chart a_chart, string param) { ParseParam(param); chart = a_chart; if (chart.Series.IsUniqueName("Feedback")) { s_feedback = Misc.AddSeries("Feedback", Color.Lime, true); } sound_timer = new System.Timers.Timer(2000); sound_timer.AutoReset = true; sound_timer.Elapsed += OnTimerEvent; sound_timer.Enabled = true; stop_timer = new System.Timers.Timer(1900); stop_timer.AutoReset = false; stop_timer.Elapsed += OnStopEvent; if (midiOut == null) { midiOut = new MidiOut(0); } midiOut.Volume = 65535; //var panSettingCenter = 64; //var cce = new ControlChangeEvent(0L, 1, MidiController.Pan, panSettingCenter); //midiOut.Send(cce.GetAsShortMessage()); Enabled = true; }
/* * Creates controls and listeners for nanoKontrol2 */ public Controller(string inputDeviceName, string outputDeviceName) { this.midiIn = MidiInformation.GetInputDeviceWithName(inputDeviceName); this.midiIn.Start(); this.midiIn.MessageReceived += MessageReceived; this.midiOut = MidiInformation.GetOutputDeviceWithName(outputDeviceName); }
private static void IterateMidiOutDevices() { for (int device = 0; device < MidiOut.NumberOfDevices; device++) { Console.WriteLine(MidiOut.DeviceInfo(device).ProductName); } }
public void Reset() { foreach (int i in notes) { MidiOut.SendNoteOn(MidiChannel.Ch1, i, 12 / 127f); } }
public Fader(MidiDevice midiDevice, int faderNum, FaderDef _faderDef) { parent = midiDevice; midiOut = midiDevice.midiOut; faderNumber = faderNum; faderDef = _faderDef; }
IEnumerator _OutputNote(int note, float value) { MidiOut.SendNoteOn(midiChannel, note, Mathf.Clamp01(value)); yield return(new WaitForSeconds(noteDurationSec)); MidiOut.SendNoteOff(midiChannel, note); }
public void PlayBack(MidiOut midiOut, int milliSecondsPerNote) { PlayBack( note => midiOut.Send(MidiMessage.StartNote(note, 100, 1).RawData), note => midiOut.Send(MidiMessage.StopNote(note, 100, 1).RawData), milliSecondsPerNote); }
public static IEnumerable <MidiOutCapabilities> GetConnectedOutDevices() { for (var i = 0; i < MidiOut.NumberOfDevices; ++i) { yield return(MidiOut.DeviceInfo(i)); } }
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(); } } }
// Get the specific list based on the property name. public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { List <string>?rec = null; switch (context.PropertyDescriptor.Name) { case "Latency": rec = new List <string>() { "25", "50", "100", "150", "200", "300", "400", "500" }; break; case "WavOutDevice": rec = new List <string>(); for (int id = -1; id < WaveOut.DeviceCount; id++) // –1 indicates the default output device, while 0 is the first output device { var cap = WaveOut.GetCapabilities(id); rec.Add(cap.ProductName); } break; case "MidiOutDevice": rec = new List <string>(); for (int devindex = 0; devindex < MidiOut.NumberOfDevices; devindex++) { rec.Add(MidiOut.DeviceInfo(devindex).ProductName); } break; } return(new StandardValuesCollection(rec)); }
public Launchpad(int deviceID) { midiout = new MidiOut(deviceID); int[] leftColumn = new int[32]; int[] rightColumn = new int[32]; for (int i = 0; i < 32; i++) { leftColumn[i] = i + 36; } for (int i = 0; i < 32; i++) { rightColumn[i] = i + 68; } mainPad = new int[72]; for (int i = 0, l = 0; i < 8; i++) { for (int z = 3; z >= 0; z--, l++) { mainPad[l] = leftColumn[31 - (z + (i * 4))]; } for (int z = 3; z >= 0; z--, l++) { mainPad[l] = rightColumn[31 - (z + (i * 4))]; } } for (int i = 0; i < rightPadButtonsCount; i++) { mainPad[64 + i] = 100 + i; } noteStatus = new bool[72]; }
public void RefreshConnectedDevices() { _connectedInputDevices = new ConcurrentDictionary <string, List <int> >(); for (var i = 0; i < MidiIn.NumberOfDevices; i++) { var infoIn = MidiIn.DeviceInfo(i); if (!_connectedInputDevices.ContainsKey(infoIn.ProductName)) { _connectedInputDevices.TryAdd(infoIn.ProductName, new List <int>()); } _connectedInputDevices[infoIn.ProductName].Add(i); } _connectedOutputDevices = new ConcurrentDictionary <string, List <int> >(); for (int i = 0; i < MidiOut.NumberOfDevices; i++) { var infoOut = MidiOut.DeviceInfo(i); if (!_connectedOutputDevices.ContainsKey(infoOut.ProductName)) { _connectedOutputDevices.TryAdd(infoOut.ProductName, new List <int>()); } _connectedOutputDevices[infoOut.ProductName].Add(i); } BuildInputDeviceList(); BuildOutputDeviceList(); }
public Fader(MidiDevice midiDevice, int faderNum) { parent = midiDevice; midiOut = midiDevice.midiOut; faderNumber = faderNum; faderDef = parent.DefaultFaderDef; }
public void SettingsClose(object sender, FormClosingEventArgs e) { if (f2.open == true) { try { //midiin.MessageReceived += null; //midiin.Close(); midiout.Close(); } catch (NullReferenceException) { } try { //midiin = new MidiIn(f2.deviceIDIn); //midiin.MessageReceived += Midiin_MessageReceived; //midiin.Start(); } catch (Exception) { MessageBox.Show("Устройство на вход не было открыто. Попробуйте изменить настройки"); } try { midiout = new MidiOut(f2.deviceIDOut); } catch (Exception) { MessageBox.Show("Устройство на выход не было открыто. Попробуйте изменить настройки"); } try { com.Close(); } catch (Exception) { } try { com.BaudRate = 115200; com.PortName = f2.deviceCOM; com.Open(); Thread.Sleep(2000); String message = "I hear you!"; for (int i = 0; i < 16; i++) { try { String[] colset = File.ReadAllLines("c:\\ProgramData\\PorMIDITool\\profiles\\profile" + profile + ".pmt")[i + 1].Split(' '); message = message + colset[0] + colset[1] + "_"; } catch (Exception) { message = message + "20_"; } } com.Write(message); SerialTask.Start(); } catch (Exception ex) { } channel = f2.channel; } else { Close(); } }
public MidiOutput(int devId) { base.DeviceID = new DeviceId(); base.DeviceID.id = devId; base.DeviceID.t = EDeviceType.Out; base.DeviceName = MidiOut.DeviceInfo(devId).ProductName; this.OutputDevice = new MidiOut(base.DeviceID.id); }
void OnMouseUp() { OnNoteOff(midiIndex, 0); if (midiOut && channel != ChannelEnum.None) { MidiOut.NoteOff(midiIndex, (int)channel); } }
public override void VJPerformAction(GameObject go, float value) { if (m_lastValue != value) { MidiOut.SendControlChange(midiChannel, knobNumber, Mathf.Clamp01(value)); m_lastValue = value; } }
void OnMouseDown() { OnNoteOn(midiIndex, volume); if (midiOut && channel != ChannelEnum.None) { MidiOut.NoteOn(midiIndex, volume, (int)channel); } }
public MidiSingleNoteTracker(MidiOut midiOut, int channel, int patch) { _midiOut = midiOut; _channel = channel; _patch = patch; midiOut.Send(new PatchChangeEvent(0, channel, patch).GetAsShortMessage()); // Flute }
public static void Init(int device) { if (midiOut != null) { midiOut.Dispose(); } midiOut = new MidiOut(device); }
public void CloseOut() { if (midiOut != null) { midiOut.Close(); midiOut = null; } }
public static string[] GetOutputDevices() { string[] names = new string[MidiOut.NumberOfDevices]; for (int i = 0; i < MidiOut.NumberOfDevices; i++) { names[i] = MidiOut.DeviceInfo(i).ProductName; } return(names); }
internal void Start() { Stop(); bar = 0; midi = new MidiOut(0); previousTime = DateTime.Now; timer = new System.Threading.Timer(Timer_Elapsed, null, 0, 1000 / 60); PlayBar(); }
public void sendCC(float val) { float adjustedVal = Mathf.Min(1, val * ccScale); currentVal = (adjustedVal * kFilteringFactor) + (currentVal * (1.0f - kFilteringFactor)); MidiOut.SendControlChange(channel, controlNumber, currentVal); //highestVal = Mathf.Max (val, highestVal); //Debug.Log ("CC Val: " + val + ", Highest: " + currentVal); }
public Button(ref MidiOut midiOutRef, ButtonType butType, int cont, bool initialState, MidiCommandCode code = MidiCommandCode.ControlChange) { commandCode = code; channel = 1; buttonType = butType; controller = cont; midiOut = midiOutRef; SetLight(initialState); }
public void Play() { ResetCounters(); _midi = new MidiOut(MidiDevice); if (_sr != null) { _sr.Start(); } }
private static void PlayChannelSetup() { if (PlayChannelInstrument == "Mute") { return; } MidiOut.SetInstrument((ProgramEnum)Enum.Parse(typeof(ProgramEnum), PlayChannelInstrument), (ChannelEnum)1); Debug.Log("Set PlayChannelSetup " + 1 + " to " + PlayChannelInstrument); }
public void SetDevice(MidiDeviceInfo deviceInfo) { if (midiOut != null) { midiOut.Close(); midiOut.Dispose(); } midiOut = new MidiOut(deviceInfo.DeviceId); }