Skip to content

Commit 6fcc7c9

Browse files
committed
cheaper reconnections
1 parent 24e673e commit 6fcc7c9

File tree

3 files changed

+30
-11
lines changed

3 files changed

+30
-11
lines changed

Diff for: py/calvo_cli_tools

Diff for: src/jack_client.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function processQueue(prop) {
102102
}
103103

104104
const items = queue[prop];
105-
const command = items.join(" && ");
105+
const command = items.join(" & ");
106106
const cp = require("child_process");
107107
try {
108108
const status = cp.execSync(command, { encoding: "utf8" });

Diff for: src/store.js

+28-9
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ async function reconectAll() {
144144
disconnectAll();
145145
connectAll();
146146
}
147-
148147
/**
149148
* Disconnects all plugin outputs
150149
*
@@ -322,7 +321,30 @@ function removePluginAt(index, skipReconnect = false) {
322321

323322
notifySubscribers("rack", rack);
324323

325-
if (settings.AUTO_RECONNECT && !skipReconnect) reconectAll();
324+
// if (settings.AUTO_RECONNECT && !skipReconnect) reconectAll();
325+
if (settings.AUTO_RECONNECT && !skipReconnect) {
326+
if (rack.length === 0) {
327+
return;
328+
}
329+
330+
let previous = "";
331+
let next = "";
332+
let previousLength = rack.length + 1;
333+
334+
// If we deleted first item
335+
if (index === 0) {
336+
previous = "input";
337+
next = rack[0];
338+
} // If we deleted last item
339+
else if (index === previousLength - 1) {
340+
previous = rack[rack.length - 1];
341+
next = "output";
342+
} else {
343+
previous = rack[index - 1];
344+
next = rack[index];
345+
}
346+
Jack.connectPlugins(previous, next, false, false);
347+
}
326348
}
327349

328350
/**
@@ -363,14 +385,11 @@ function moveRackItem(rackIndex, direction, max = false) {
363385
// store.wlogError(`${rackIndex} => ${direction} => ${max}`);
364386
// TODO: This could be better but for now we will disconnect and reconnect everything.
365387

366-
if (settings.AUTO_RECONNECT) reconectAll();
367-
}
388+
// if (settings.AUTO_RECONNECT) reconectAll();
368389

369-
/**
370-
* This function will process
371-
*
372-
*/
373-
function processConnections() {}
390+
const oldPrevious = "";
391+
const oldNext = "";
392+
}
374393

375394
/**
376395
* This function will force connection between 2 plugins. If one of them is mono, adjust as necesary

0 commit comments

Comments
 (0)