Skip to content

Commit 56264ae

Browse files
committed
WIP: plugin control widget.
1 parent af5371c commit 56264ae

File tree

4 files changed

+246
-29
lines changed

4 files changed

+246
-29
lines changed

src/__zam.json

+100-27
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,53 @@
11
{
2-
"author": { "email": null, "homepage": null, "name": "Damien Zammit" },
3-
"binary": "/usr/lib/lv2/ZamPhono.lv2/ZamPhono_dsp.so",
4-
"brand": null,
5-
"bundles": ["/usr/lib/lv2/ZamPhono.lv2"],
6-
"category": ["Utility"],
7-
"comment": null,
8-
"errors": ["plugin comment is missing"],
9-
"label": "ZamPhono",
2+
"author": {
3+
"email": null,
4+
"homepage": "http://www.zamaudio.com",
5+
"name": "Damien Zammit"
6+
},
7+
"binary": "/usr/lib/lv2/ZamVerb.lv2/ZamVerb_dsp.so",
8+
"brand": "ZamAudio",
9+
"bundles": ["/usr/lib/lv2/ZamVerb.lv2"],
10+
"category": ["Reverb"],
11+
"comment": "Convolution Reverb effect",
12+
"errors": [],
13+
"label": "ZamVerb",
1014
"license": "GPL v2+",
1115
"microVersion": 12,
1216
"minorVersion": 2,
13-
"name": "ZamPhono",
17+
"name": "ZamVerb",
1418
"ports": {
19+
"atom": {
20+
"input": [
21+
{
22+
"comment": null,
23+
"designation": null,
24+
"index": 4,
25+
"name": "Events Input",
26+
"properties": [],
27+
"rangeSteps": null,
28+
"ranges": {},
29+
"scalePoints": [],
30+
"shortName": "Events Input",
31+
"symbol": "lv2_events_in",
32+
"units": {}
33+
}
34+
],
35+
"output": [
36+
{
37+
"comment": null,
38+
"designation": null,
39+
"index": 5,
40+
"name": "Events Output",
41+
"properties": [],
42+
"rangeSteps": null,
43+
"ranges": {},
44+
"scalePoints": [],
45+
"shortName": "Events Output",
46+
"symbol": "lv2_events_out",
47+
"units": {}
48+
}
49+
]
50+
},
1551
"audio": {
1652
"input": [
1753
{
@@ -26,13 +62,26 @@
2662
"shortName": "Audio Input 1",
2763
"symbol": "lv2_audio_in_1",
2864
"units": {}
65+
},
66+
{
67+
"comment": null,
68+
"designation": null,
69+
"index": 1,
70+
"name": "Audio Input 2",
71+
"properties": [],
72+
"rangeSteps": null,
73+
"ranges": {},
74+
"scalePoints": [],
75+
"shortName": "Audio Input 2",
76+
"symbol": "lv2_audio_in_2",
77+
"units": {}
2978
}
3079
],
3180
"output": [
3281
{
3382
"comment": null,
3483
"designation": null,
35-
"index": 1,
84+
"index": 2,
3685
"name": "Audio Output 1",
3786
"properties": [],
3887
"rangeSteps": null,
@@ -41,6 +90,19 @@
4190
"shortName": "Audio Output 1",
4291
"symbol": "lv2_audio_out_1",
4392
"units": {}
93+
},
94+
{
95+
"comment": null,
96+
"designation": null,
97+
"index": 3,
98+
"name": "Audio Output 2",
99+
"properties": [],
100+
"rangeSteps": null,
101+
"ranges": {},
102+
"scalePoints": [],
103+
"shortName": "Audio Output 2",
104+
"symbol": "lv2_audio_out_2",
105+
"units": {}
44106
}
45107
]
46108
},
@@ -49,40 +111,51 @@
49111
{
50112
"comment": null,
51113
"designation": null,
52-
"index": 2,
53-
"name": "Reproduction/Production",
54-
"properties": ["toggled"],
114+
"index": 6,
115+
"name": "Master level",
116+
"properties": [],
55117
"rangeSteps": null,
56-
"ranges": { "default": 0.0, "maximum": 1.0, "minimum": 0.0 },
118+
"ranges": { "default": 0.0, "maximum": 30.0, "minimum": -30.0 },
57119
"scalePoints": [],
58-
"shortName": "Reproduction/Pro",
59-
"symbol": "inv",
60-
"units": { "label": " ", "render": "%f ", "symbol": " " }
120+
"shortName": "Master level",
121+
"symbol": "master",
122+
"units": { "label": "decibels", "render": "%f dB", "symbol": "dB" }
61123
},
62124
{
63125
"comment": null,
64126
"designation": null,
65-
"index": 3,
66-
"name": "Phono Filter Type",
127+
"index": 7,
128+
"name": "Wet / Dry",
129+
"properties": [],
130+
"rangeSteps": null,
131+
"ranges": { "default": 50.0, "maximum": 100.0, "minimum": 0.0 },
132+
"scalePoints": [],
133+
"shortName": "Wet / Dry",
134+
"symbol": "wetdry",
135+
"units": { "label": "percent", "render": "%f%%", "symbol": "%" }
136+
},
137+
{
138+
"comment": null,
139+
"designation": null,
140+
"index": 8,
141+
"name": "Room",
67142
"properties": ["integer"],
68143
"rangeSteps": null,
69-
"ranges": { "default": 3, "maximum": 4, "minimum": 0 },
144+
"ranges": { "default": 0, "maximum": 6, "minimum": 0 },
70145
"scalePoints": [],
71-
"shortName": "Phono Filter Typ",
72-
"symbol": "type",
146+
"shortName": "Room",
147+
"symbol": "room",
73148
"units": { "label": " ", "render": "%f ", "symbol": " " }
74149
}
75150
],
76151
"output": []
77152
},
78153
"midi": { "input": [], "output": [] }
79154
},
80-
"presets": [
81-
{ "label": "RIAA (Playback)", "uri": "urn:zamaudio:ZamPhono#preset001" }
82-
],
155+
"presets": [{ "label": "Default", "uri": "urn:zamaudio:ZamVerb#preset001" }],
83156
"properties": {},
84157
"stability": "stable",
85-
"uri": "urn:zamaudio:ZamPhono",
158+
"uri": "urn:zamaudio:ZamVerb",
86159
"version": "2.12",
87-
"warnings": ["plugin brand is missing", "plugin label is missing"]
160+
"warnings": []
88161
}

src/layout.js

+20-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const PluginListWidget = require("./widgets/pluginList");
1212
const StatusWidget = require("./widgets/status");
1313
const LogWidget = require("./widgets/log");
1414
const PluginInfoWidget = require("./widgets/pluginInfo");
15+
const PluginControlWidget = require("./widgets/pluginControls");
1516
const RackWidget = require("./widgets/rack");
1617
const MainMenuWidget = require("./widgets/mainMenu");
1718
const AudioIO = require("./widgets/audioIO");
@@ -24,6 +25,7 @@ var statusWidget,
2425
categoryWidget,
2526
pluginListWidget,
2627
pluginInfoWidget,
28+
pluginControlWidget,
2729
rackWidget,
2830
inputWidget,
2931
outputWidget,
@@ -57,6 +59,23 @@ function setUpLayout(screen) {
5759
mainScreen.focusPush(categoryWidget);
5860
}
5961

62+
/**
63+
*
64+
* Perform Page
65+
* @param {*} screen
66+
*/
67+
function page2(screen) {
68+
mainMenu = MainMenuWidget.make(grid, 0, 0, 18, 2, 2);
69+
rackWidget = RackWidget.make(grid, 0, 2, 6, 12);
70+
pluginInfoWidget = PluginInfoWidget.make(grid, 0, 14, 6, 7);
71+
statusWidget = StatusWidget.make(grid, 0, 21, 6, 7);
72+
pluginControlWidget = PluginControlWidget.make(grid, 6, 2, 7, 12);
73+
logWidget = LogWidget.make(grid, 13, 2, 5, 26);
74+
75+
mainScreen = screen;
76+
mainScreen.focusPush(rackWidget);
77+
}
78+
6079
/**
6180
* Input/Output page
6281
*
@@ -72,7 +91,7 @@ function setUpLayout(screen) {
7291
mainScreen.focusPush(inputWidget);
7392
}
7493

75-
carousel = new contrib.carousel([page0, page0, page0, page0, page4, page0], {
94+
carousel = new contrib.carousel([page0, page0, page2, page0, page4, page0], {
7695
screen: screen,
7796
interval: 0, //how often to switch views (set 0 to never swicth automatically)
7897
controlKeys: false, //should right and left keyboard arrows control view rotation

src/widgets/pluginControls.js

+125
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
const blessed = require("blessed");
2+
const contrib = require("blessed-contrib");
3+
const PubSub = require("pubsub-js");
4+
const Layout = require("../layout");
5+
const store = require("../store");
6+
7+
var pluginControls = {};
8+
9+
function progressControl(value, top, pluginControl) {
10+
const {
11+
comment,
12+
designation,
13+
index,
14+
name,
15+
properties,
16+
rangeSteps,
17+
ranges,
18+
scalePoints,
19+
shortName,
20+
symbolm,
21+
units,
22+
} = pluginControl;
23+
24+
// {
25+
// "comment": null,
26+
// "designation": null,
27+
// "index": 6,
28+
// "name": "Master level",
29+
// "properties": [],
30+
// "rangeSteps": null,
31+
// "ranges": { "default": 0.0, "maximum": 30.0, "minimum": -30.0 },
32+
// "scalePoints": [],
33+
// "shortName": "Master level",
34+
// "symbol": "master",
35+
// "units": { "label": "decibels", "render": "%f dB", "symbol": "dB" }
36+
// },
37+
38+
var box = blessed.box({
39+
keys: true,
40+
mouse: true,
41+
focusable: true,
42+
top: top,
43+
});
44+
45+
var label = blessed.text({
46+
content: shortName,
47+
left: 1,
48+
top: 1,
49+
// focusable: true,
50+
// keyable: true,
51+
// input: true,
52+
});
53+
54+
var progress = blessed.progressbar({
55+
border: {
56+
type: "line",
57+
fg: "#512725",
58+
// underline: true,
59+
// ch: "",
60+
},
61+
style: {
62+
focus: {
63+
border: {
64+
fg: "#637373",
65+
},
66+
bar: {
67+
fg: "#5faf5f",
68+
},
69+
},
70+
},
71+
input: true,
72+
ch: "░",
73+
height: 3,
74+
top: 0,
75+
left: "35%",
76+
right: "2",
77+
filled: value,
78+
width: "65%",
79+
});
80+
81+
progress.key("right", function (a, b) {
82+
Layout.wlogError(`TODO: INC plugin ${this.id}`);
83+
Layout.renderScreen();
84+
});
85+
86+
box.append(label);
87+
box.append(progress);
88+
89+
return box;
90+
}
91+
92+
function make(grid, x, y, xSpan, ySpan) {
93+
pluginControls = grid.set(y, x, ySpan, xSpan, blessed.box, {
94+
label: "Plugin Controls",
95+
input: true,
96+
mouse: true,
97+
interactive: true,
98+
keys: true,
99+
padding: { left: 1, right: 1 },
100+
style: {
101+
focus: {
102+
border: { fg: "red" },
103+
// enabled: false,
104+
},
105+
},
106+
});
107+
108+
const plugin = store.getSelectedPlugin();
109+
110+
var token = PubSub.subscribe("selectedPlugin", update);
111+
112+
return pluginControls;
113+
}
114+
115+
function update(msg, plugin) {
116+
pluginControls.children = [];
117+
if (plugin) {
118+
pluginControls.append(progressControl(45, "param1", 3, "assaassasa"));
119+
pluginControls.append(progressControl(45, "param2", 6));
120+
// TODO clear Screen
121+
return;
122+
}
123+
}
124+
125+
exports.make = make;

0 commit comments

Comments
 (0)