void storeSliderWidget(WidgetAdapter sysexWidget, Xmlparam param) {
storeMessages(param, sysexWidget);
}
void storeMessages(Xmlparam param, WidgetAdapter sysexWidget) {
Xmlmessages messages = param.addNewXmlmessages();
if (sysexWidget.getValue() == sysexWidget.getMin()) {
sysexWidget.getValueSetter().setValue(sysexWidget.getMax());
}
int incr = (sysexWidget.getMax() / 4);
if (incr == 0 || incr == 1) {
incr++;
}
for (int i = sysexWidget.getMin(); i <= sysexWidget.getMax(); i += incr) {
MidiRecordSession session = midiDeviceProvider.openSession();
if (i > sysexWidget.getMax()) {
i = sysexWidget.getMax();
}
log.debug("Sliding to: " + i);
sysexWidget.getValueSetter().setValue(i);
try {
Thread.sleep(5);
} catch (InterruptedException e) {
}
String sysex = midiDeviceProvider.closeSession(session);
if (sysex == null || sysex.isEmpty()) {
log.warn("Value is empty for param " + param.getLabel());
// if (!param.getLabel().equals("Corresponding Voice?")) {
// System.exit(0);
// }
}
Xmlmessage message = messages.addNewXmlmessage();
Xmlinput input = message.addNewXmlinput();
input.setValue(i);
message.setSysex(sysex);
}
}