public override InstrumentData GetData() { MIDIinData data = new MIDIinData(); data.deviceType = menuItem.deviceType.MIDIIN; GetTransformData(data); data.connection = _midiComponentInterface.connectedDevice; List <simpleMIDI> compiledInputs = new List <simpleMIDI>(); for (int i = 0; i < 17; i++) { // midiCC foreach (KeyValuePair <int, midiCC> entry in midiCCchannels[i]) { int val = Mathf.FloorToInt((entry.Value.curValue + 1) / 2f * 127); compiledInputs.Add(new simpleMIDI(i, entry.Key, val, true, entry.Value.GetJackID())); } // midi note foreach (KeyValuePair <int, midiNote> entry in midiNotechannels[i]) { compiledInputs.Add(new simpleMIDI(i, entry.Key, entry.Value.noteOn ? 127 : 0, false, entry.Value.GetJackID())); } } data.outputs = compiledInputs.ToArray(); return(data); }
public override void Load(InstrumentData d) { MIDIinData data = d as MIDIinData; base.Load(data); if (data.connection != "") { _midiComponentInterface.ConnectByName(data.connection); } for (int i = 0; i < data.outputs.Length; i++) { midiToDo.Add(new simpleMIDI(data.outputs[i].channel, data.outputs[i].ID, data.outputs[i].value, data.outputs[i].CC, data.outputs[i].jackID)); } Update(); }