@openbrt/audioctl 0.1.9 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/bin/audioctl.mjs +18 -3
- package/lib/index.mjs +6 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -113,7 +113,9 @@ audioctl led flash amber --repeat 1
|
|
|
113
113
|
`feedback effect` is for continuous device-local effects such as beat/pulse or
|
|
114
114
|
breathing animations. It sends one control message; the timing loop belongs on
|
|
115
115
|
the device, not in the agent process. `feedback clear` stops the current
|
|
116
|
-
device-local effect and clears the indicator.
|
|
116
|
+
device-local effect and clears the indicator. Beat-style names such as
|
|
117
|
+
`music_beat` are treated as effects, not as a signal that should be published in
|
|
118
|
+
a loop.
|
|
117
119
|
|
|
118
120
|
Physical keys/touch surfaces are reported as VM capabilities such as
|
|
119
121
|
`input.touch.read`, `input.gesture.read`, and `input.button.bind`. A VM app can
|
package/bin/audioctl.mjs
CHANGED
|
@@ -329,12 +329,12 @@ async function commandFeedback(values) {
|
|
|
329
329
|
"playing",
|
|
330
330
|
"paused",
|
|
331
331
|
"wake",
|
|
332
|
-
"music_beat",
|
|
333
332
|
"volume_step_up",
|
|
334
333
|
"volume_step_down",
|
|
335
334
|
"button_press",
|
|
336
335
|
"button_long_press",
|
|
337
336
|
]);
|
|
337
|
+
const shorthandEffects = new Set(["music_beat", "pulse", "breathing"]);
|
|
338
338
|
const options = parseOptions(values.slice(1), {
|
|
339
339
|
credentials: credentialsPath(),
|
|
340
340
|
timeout: 12,
|
|
@@ -345,11 +345,26 @@ async function commandFeedback(values) {
|
|
|
345
345
|
let command = subcommand;
|
|
346
346
|
const payload = {};
|
|
347
347
|
if (!command) throw new Error("feedback_requires_subcommand");
|
|
348
|
-
if (
|
|
348
|
+
if (shorthandEffects.has(command)) {
|
|
349
|
+
payload.effect = command;
|
|
350
|
+
payload.bpm = options.bpm;
|
|
351
|
+
payload.color = options.color;
|
|
352
|
+
payload.alpha = options.alpha;
|
|
353
|
+
command = "effect";
|
|
354
|
+
} else if (shorthandSignals.has(command)) {
|
|
349
355
|
payload.semantic = command;
|
|
350
356
|
command = "signal";
|
|
351
357
|
} else if (command === "signal") {
|
|
352
|
-
|
|
358
|
+
const semantic = String(options._[0] || "").replace(/-/gu, "_").toLowerCase();
|
|
359
|
+
if (shorthandEffects.has(semantic)) {
|
|
360
|
+
payload.effect = semantic;
|
|
361
|
+
payload.bpm = options.bpm;
|
|
362
|
+
payload.color = options.color;
|
|
363
|
+
payload.alpha = options.alpha;
|
|
364
|
+
command = "effect";
|
|
365
|
+
} else {
|
|
366
|
+
payload.semantic = options._[0];
|
|
367
|
+
}
|
|
353
368
|
} else if (command === "flash") {
|
|
354
369
|
payload.color = options._[0] || options.color;
|
|
355
370
|
payload.repeat = options.repeat;
|
package/lib/index.mjs
CHANGED
|
@@ -71,7 +71,6 @@ export const FEEDBACK_SIGNALS = Object.freeze([
|
|
|
71
71
|
"playing",
|
|
72
72
|
"paused",
|
|
73
73
|
"wake",
|
|
74
|
-
"music_beat",
|
|
75
74
|
"volume_step_up",
|
|
76
75
|
"volume_step_down",
|
|
77
76
|
"button_press",
|
|
@@ -425,6 +424,12 @@ export function normalizeFeedbackCommand(command, options = {}) {
|
|
|
425
424
|
options.value ||
|
|
426
425
|
"button_press",
|
|
427
426
|
).replace(/-/gu, "_").toLowerCase();
|
|
427
|
+
if (FEEDBACK_EFFECTS.includes(semantic)) {
|
|
428
|
+
return normalizeFeedbackCommand("effect", {
|
|
429
|
+
...options,
|
|
430
|
+
effect: semantic,
|
|
431
|
+
});
|
|
432
|
+
}
|
|
428
433
|
if (!/^[a-z0-9_.:]{1,64}$/u.test(semantic)) {
|
|
429
434
|
throw new Error("feedback_signal_invalid");
|
|
430
435
|
}
|