Permalink
Browse files

yet another occurrence of MIDIIn.connectAll...

... replace by a try/catch block

Signed-off-by: Stefan Nussbaumer <st9fan@gmail.com>
  • Loading branch information...
nuss committed Aug 9, 2018
1 parent c9d87db commit 8549a734e50a5c50387903bee5f62d254e4959fb
Showing with 13 additions and 6 deletions.
  1. +13 −6 CVCenter/CVCenterLoadDialog.sc
@@ -8,7 +8,7 @@ CVCenterLoadDialog {
*new {
var staticTextFont, staticTextFontBold, staticTextColor, textFieldFont, textFieldFontColor, textFieldBg;
var buildCheckbox;
var buildCheckbox, midiConnectAll;
var flow, replaceBg, midiBg, oscBg, actionsBg, shortcutsBg;
var replaceFlow, midiFlow, oscFlow, actionsFlow, shortcutsFlow;
var replaceExisting, textReplaceExisting;
@@ -66,6 +66,13 @@ CVCenterLoadDialog {
cBox;
};
midiConnectAll = {
try { MIDIIn.connectAll } { |error|
error.postln;
"MIDIIn.connectAll failed. Please establish the necessary connections manually".warn;
}
};
if(window.isNil or:{ window.isClosed }, {
window = Window("load a new setup from disk", Rect(
(Window.screenBounds.width-500).div(2),
@@ -189,11 +196,11 @@ CVCenterLoadDialog {
midiSources = ();
if(MIDIClient.initialized, {
MIDIClient.restart;
try { MIDIIn.connectAll } { |error|
error.postln;
"MIDIIn.connectAll failed. Please establish the necessary connections manually".warn;
}
}, { MIDIClient.init; MIDIIn.connectAll });
midiConnectAll.value;
}, {
MIDIClient.init;
midiConnectAll.value;
});
if(MIDIClient.initialized, {
b.states_([
["restart MIDI", Color.black, Color.green]

0 comments on commit 8549a73

Please sign in to comment.