public override void Load(InstrumentData d) { XyloRollData data = d as XyloRollData; base.Load(data); for (int i = 0; i < 3; i++) { _adsrInterface.xyHandles[i].setPercent(data.ADSRdata[i]); } _adsrInterface.setDefaults = false; octaveSlider.setVal(data.octaveSetting); seqEnableButton.startToggled = data.seqon; arpEnableButton.startToggled = data.arpon; arpPatternSlider.switchVal = data.arpSetting; arpSpeedSlider.switchVal = data.arpSpeed; inputSwitch.setSwitch(data.inputSetting == 1); sampleBank.GetComponent <samplerLoad>().QueueSample(data.inputSample[0], data.inputSample[1]); oscBank.GetComponent <oscillatorBankComponentInterface>().setValues(data.oscAamp, data.oscAfreq, data.oscAwave, data.oscBamp, data.oscBfreq, data.oscBwave); if (data.midiInConnection != null && data.midiInConnection != "") { midiInButton.startToggled = true; _midiIn.ConnectByName(data.midiInConnection); } if (data.midiOutConnection != null && data.midiOutConnection != "") { midiOutButton.startToggled = true; _midiOut.ConnectByName(data.midiOutConnection); } output.ID = data.jackOutID; if (data.timelinePresent) { _timeline.SetTimelineData(data.timelineData); Vector3 pos = _timeline.heightHandle.transform.localPosition; pos.y = data.timelineHeight; _timeline.heightHandle.transform.localPosition = pos; _timeline.setStartHeight(data.timelineHeight); for (int i = 0; i < data.timelineEvents.Length; i++) { _timeline.SpawnTimelineEvent(data.timelineEvents[i].track, data.timelineEvents[i].in_out); } } else { if (data.seqInID != 0) { _timeline.playInput.ID = data.seqInID; } } }
public override InstrumentData GetData() { XyloRollData data = new XyloRollData(); data.deviceType = menuItem.deviceType.XyloRoll; GetTransformData(data); data.ADSRdata = new Vector2[3]; for (int i = 0; i < 3; i++) { data.ADSRdata[i] = _adsrInterface.xyHandles[i].percent; } data.octaveSetting = octaveSlider.switchVal; data.seqon = seqEnableButton.isHit; data.arpon = arpEnableButton.isHit; data.arpSetting = arpPattern; data.arpSpeed = arpSpeed; data.inputSetting = inputVal ? 1 : 0; data.inputSample = new string[2]; samplerLoad tempSampLoad = sampleBank.GetComponent <samplerLoad>(); if (tempSampLoad.queuedSample[0] != "") { data.inputSample[0] = tempSampLoad.queuedSample[0]; data.inputSample[1] = tempSampLoad.queuedSample[1]; } else { tempSampLoad.getTapeInfo(out data.inputSample[0], out data.inputSample[1]); } oscillatorBankComponentInterface _oscInterface = oscBank.GetComponent <oscillatorBankComponentInterface>(); data.oscAamp = _oscInterface.ampPercent[0]; data.oscAfreq = _oscInterface.freqPercent[0]; data.oscAwave = _oscInterface.wavePercent[0]; data.oscBamp = _oscInterface.ampPercent[1]; data.oscBfreq = _oscInterface.freqPercent[1]; data.oscBwave = _oscInterface.wavePercent[1]; data.jackOutID = output.transform.GetInstanceID(); data.midiInConnection = _midiIn.connectedDevice; data.midiOutConnection = _midiOut.connectedDevice; data.timelinePresent = true; data.timelineData = _timeline.GetTimelineData(); data.timelineHeight = _timeline.heightHandle.transform.localPosition.y; List <timelineEvent.eventData> tempevents = new List <timelineEvent.eventData>(); for (int i = 0; i < _timeline._tlEvents.Count; i++) { if (_timeline._tlEvents[i] != null) { tempevents.Add(_timeline._tlEvents[i].getEventInfo()); } } data.timelineEvents = tempevents.ToArray(); return(data); }