-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.js
54 lines (46 loc) · 1.11 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
* App initialization is done here.
* @module app
*/
const blessed = require("blessed");
const Layout = require("./layout");
const Keyboard = require("./keyboard");
const Jack = require("./jack_client");
const { settings } = require("../settings");
const LV2 = require("./lv2");
const store = require("./store");
const program = blessed.program();
const screen = blessed.screen({
// smartCSR: true,
});
try {
store.loadUserSettings();
LV2.init();
Jack.init();
// Create a screen object.
Layout.setUpLayout(screen);
Keyboard.registerKeyboardShortcuts(screen);
} catch (error) {
console.trace("ERROR: " + error);
console.log("Aborting...");
process.exit(0);
}
screen.render();
program.enableMouse();
store.app.INITIALIZED = true;
Jack.poll();
// Set up polling
let jackPoll = setInterval(() => {
Jack.poll();
}, store.app.SETTINGS.JACK_POLLING_RATE);
let uiPoll = setInterval(() => {
store.notifySubscribers();
screen.render();
}, store.app.SETTINGS.UI_UPDATE_RATE);
function exit() {
store.clearRack();
program.clear();
screen.detach();
return process.exit(0);
}
exports.exit = exit;