Skip to content

Commit e26f0bc

Browse files
committed
Implement proper user settings.
1 parent 9133d79 commit e26f0bc

15 files changed

+111
-77
lines changed

.config.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Add here the settings you wish to override
2+
INPUT_L: "PulseAudio JACK Sink:front-left"
3+
INPUT_MODE: "stereo"

README.md

+10-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ Calvo is a [jalv](http://drobilla.net/software/jalv) based LV2 plugin browser an
55
![calvo](static/img/2020-07-27.png)
66
![connections](static/img/2020-07-27-connections.gif)
77

8-
# Features
8+
# Features
9+
910
- Runs entirely on the terminal.
1011
- Suports launching multiple instances of jalv and eventually calvo.
1112
- Category based plugin browser.
@@ -15,16 +16,17 @@ Calvo is a [jalv](http://drobilla.net/software/jalv) based LV2 plugin browser an
1516
- Load plugin presets.
1617
- Move plugins order.
1718
- Alpha
18-
19+
1920
# Limitations
21+
2022
- No GUI customization is loaded, any plugin which has a UI based workflow won't work properly.
2123
- Only works with mono or stereo inputs/outputs.
2224
- Monitoring is best effort and should not be taken too seriously.
2325

2426
### Roadmap to 1.0: [Milestone](https://github.com/ajboni/calvo/milestone/1)
2527

26-
2728
# Dependencies
29+
2830
It uses:
2931

3032
- [jalv](http://drobilla.net/software/jalv) to host plugins
@@ -33,7 +35,8 @@ It uses:
3335
- nodejs to glue all together
3436

3537
# Settings
36-
Modify `settings.js` with your settings, more info [in the docs](https://ajboni.github.io/calvo/module-settings.html).
38+
39+
Modify `.config.yaml` with your settings, more info [in the docs](https://ajboni.github.io/calvo/module-settings.html).
3740

3841
# Keyboard shortcuts
3942

@@ -49,12 +52,13 @@ Modify `settings.js` with your settings, more info [in the docs](https://ajboni.
4952
- `CTRL + up/down` Swap plugins up/down
5053

5154
### Plugin parameters widget
55+
5256
- `up/down / TAB` Cycle through each parameter.
5357
- `left/right` Change parameter value by default step.
5458
- `SHIFT + left/right` Change parameter value by small step.
5559
- `CTRL + left/right` Change parameter value by big step.
5660
- `page_up/page_down` Change parameter value by 1/5 of the maximum allowed
57-
61+
5862
# DEV
5963

6064
Still need to figure out a way to distribute this.
@@ -74,6 +78,7 @@ npm start
7478
Dev Documentation is available at: https://ajboni.github.io/calvo/
7579

7680
To build doc locally:
81+
7782
```
7883
npm run document
7984
```

package-lock.json

+10-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"dependencies": {
2424
"blessed": "^0.1.81",
2525
"blessed-contrib": "^4.8.20",
26+
"js-yaml": "^3.14.0",
2627
"nanoid": "^3.1.10",
2728
"neo-blessed": "^0.2.0",
2829
"pubsub-js": "^1.8.0"

settings.js

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* User configurable settings to alter how the app works.
2+
* Default settings.
33
* @module settings
44
*/
55

@@ -16,22 +16,21 @@ const settings = {
1616
/** @type {string} Location where to scan folders. */
1717
LV2_PLUGINS_FOLDER: "/user/lib/lv2",
1818
/** @type {boolean} If false, it will not scan for plugins on startup (use with caution). */
19-
SCAN_PLUGINS: false,
19+
SCAN_PLUGINS: true,
2020
/** @type {number} Ammount to scroll when using page up or page dow keys. */
2121
SCROLL_AMMOUNT: 10,
2222
/** @type {"mono"|"stereo"} Define what the default input mode will be.*/
23-
DEFAULT_INPUT_MODE: "mono",
23+
INPUT_MODE: "mono",
2424
/** @type {string} Define what the default left input port mode will be. (jack port name: ex: system:capture_1*/
25-
DEFAULT_INPUT_L: "PulseAudio JACK Sink:front-left",
26-
// DEFAULT_INPUT_L: "system:capture_1",
25+
INPUT_L: "system:capture_1",
2726
/** @type {string} Define what the default right input port mode will be. (jack port name: ex: system:capture_1*/
28-
DEFAULT_INPUT_R: "system:capture_2",
27+
INPUT_R: "system:capture_2",
2928
/** @type {"mono"|"stereo"} Define what the default output mode will be.*/
30-
DEFAULT_OUTPUT_MODE: "stereo",
29+
OUTPUT_MODE: "stereo",
3130
/** @type {string} Left Channel for the master output. Last plug in will connect to this. */
32-
DEFAULT_OUTPUT_L: "system:playback_1",
31+
OUTPUT_L: "system:playback_1",
3332
/** @type {string} Right Channel for the master output. Last plugin will connect to this. */
34-
DEFAULT_OUTPUT_R: "system:playback_2",
33+
OUTPUT_R: "system:playback_2",
3534
/** @type {boolean} Each time a plugin is added its connected to the previous and to the master output. Setting this to false will leave connections to the user. */
3635
AUTO_CONNECT: true,
3736
/** @type {boolean} Whether to reconnect all plugins or not automatically after significant changes. If false, user will have to manually reconnect with the button */

src/app.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const screen = blessed.screen({
1616
});
1717

1818
try {
19+
store.loadUserSettings();
1920
LV2.init();
2021
Jack.init();
2122

@@ -36,12 +37,12 @@ Jack.poll();
3637
// Set up polling
3738
let jackPoll = setInterval(() => {
3839
Jack.poll();
39-
}, settings.JACK_POLLING_RATE);
40+
}, store.app.SETTINGS.JACK_POLLING_RATE);
4041

4142
let uiPoll = setInterval(() => {
4243
store.notifySubscribers();
4344
screen.render();
44-
}, settings.UI_UPDATE_RATE);
45+
}, store.app.SETTINGS.UI_UPDATE_RATE);
4546

4647
function exit() {
4748
store.clearRack();

src/jack_client.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,12 @@ async function connectPorts(
151151
* @param {boolean} [addToQueue=false] If true, add it to the 'connectPlugins' queue instead of inmediately firing. Queue should be processed manually after.
152152
*/
153153
function connectPlugins(src, dst, disconnect = false, addToQueue = false) {
154-
const il = store.getJackStatus().CONNECTIONS.inputLeft;
155-
const ir = store.getJackStatus().CONNECTIONS.inputRight;
156-
const im = store.getJackStatus().CONNECTIONS.inputMode;
157-
const ol = store.getJackStatus().CONNECTIONS.outputLeft;
158-
const or = store.getJackStatus().CONNECTIONS.outputRight;
159-
const om = store.getJackStatus().CONNECTIONS.outputMode;
154+
const il = store.app.SETTINGS.INPUT_L;
155+
const ir = store.app.SETTINGS.INPUT_R;
156+
const im = store.app.SETTINGS.INPUT_MODE;
157+
const ol = store.app.SETTINGS.OUTPUT_L;
158+
const or = store.app.SETTINGS.OUTPUT_R;
159+
const om = store.app.SETTINGS.OUTPUT_MODE;
160160
const instanceName = `calvo_${store.app.APP_ID}`;
161161

162162
// Direct Monitor not supported right now (It may conflict on multi instance mode.)

src/jalv.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ async function spawn_plugin(plugin, rackIndex) {
104104
plugin.process = process;
105105
plugin.info.processQueueInterval = setInterval(
106106
() => processQueue(plugin),
107-
settings.JALV_POLLING_RATE
107+
store.app.SETTINGS.JALV_POLLING_RATE
108108
);
109109

110110
return process;
@@ -156,7 +156,10 @@ async function processQueue(plugin) {
156156
store.notifySubscribers("pluginControlsChanged", plugin);
157157
} else {
158158
// At last, if nothing else is printing output, we can now get some monitor info.
159-
if (settings.JALV_MONITORING && plugin.ports.control.output.length > 0) {
159+
if (
160+
store.app.SETTINGS.JALV_MONITORING &&
161+
plugin.ports.control.output.length > 0
162+
) {
160163
const result = await writeWait(plugin.process, "monitors");
161164
// Sometimes we cannot get info and we get corrupted result, lets use the previous value for now.
162165
if (result) {

src/lv2.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const Layout = require("./layout");
1616
function init() {
1717
if (
1818
existsSync(path.join(__dirname, "pluginCatalog.json")) &&
19-
!settings.SCAN_PLUGINS
19+
!store.app.SETTINGS.SCAN_PLUGINS
2020
) {
2121
console.log("Loading plugins cache...");
2222
store.loadCache();

0 commit comments

Comments
 (0)