sonicake-pocket-master-mcp 0.12.2 → 0.13.0
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/dist/convert-worker.js +1 -14
- package/dist/server.js +50 -111
- package/package.json +1 -1
package/dist/convert-worker.js
CHANGED
|
@@ -28,22 +28,9 @@ var GLOBAL_SETTINGS = {
|
|
|
28
28
|
// 0..100: the unit reports 100 at full brightness (SonicMaster's dialog stops at 10).
|
|
29
29
|
backlight: { address: [3, 2], min: 0, max: 100 },
|
|
30
30
|
eco: { address: [4, 2], ...FLAG },
|
|
31
|
-
|
|
31
|
+
bootProtection: { address: [5, 2], ...FLAG },
|
|
32
32
|
battOnly: { address: [6, 2], ...FLAG }
|
|
33
33
|
};
|
|
34
|
-
var OFFSET = {
|
|
35
|
-
masterVolume: 22,
|
|
36
|
-
backlight: 35,
|
|
37
|
-
inputLevel: 40,
|
|
38
|
-
fxRecLevel: 45,
|
|
39
|
-
monitorLevel: 50,
|
|
40
|
-
mode: 60,
|
|
41
|
-
btRecLevel: 65,
|
|
42
|
-
reamp: 70,
|
|
43
|
-
eco: 75,
|
|
44
|
-
expFsType: 80
|
|
45
|
-
};
|
|
46
|
-
var MIN_LENGTH = OFFSET.btRecLevel + 1;
|
|
47
34
|
|
|
48
35
|
// ../../packages/core/src/commands.ts
|
|
49
36
|
var EditCommand = { PRESET_FIELD: 66, CHAIN: 68, MODEL: 71, PARAM: 72, BLOCK_ON: 73 };
|
package/dist/server.js
CHANGED
|
@@ -4133,30 +4133,9 @@ var GLOBAL_SETTINGS = {
|
|
|
4133
4133
|
// 0..100: the unit reports 100 at full brightness (SonicMaster's dialog stops at 10).
|
|
4134
4134
|
backlight: { address: [3, 2], min: 0, max: 100 },
|
|
4135
4135
|
eco: { address: [4, 2], ...FLAG },
|
|
4136
|
-
|
|
4136
|
+
bootProtection: { address: [5, 2], ...FLAG },
|
|
4137
4137
|
battOnly: { address: [6, 2], ...FLAG }
|
|
4138
4138
|
};
|
|
4139
|
-
var EXP_TARGETS = ["VOL", "FX1", "DRV", "AMP", "IR", "FX2", "DLY", "RVB"];
|
|
4140
|
-
var FS_TARGETS = [
|
|
4141
|
-
"Preset-",
|
|
4142
|
-
"Preset+",
|
|
4143
|
-
"Tap Tempo",
|
|
4144
|
-
"NR",
|
|
4145
|
-
"FX1",
|
|
4146
|
-
"DRV",
|
|
4147
|
-
"AMP",
|
|
4148
|
-
"IR",
|
|
4149
|
-
"EQ",
|
|
4150
|
-
"FX2",
|
|
4151
|
-
"DLY",
|
|
4152
|
-
"RVB",
|
|
4153
|
-
"CTRL 1",
|
|
4154
|
-
"CTRL 2",
|
|
4155
|
-
"Drum",
|
|
4156
|
-
"REC/Play",
|
|
4157
|
-
"Loop Stop",
|
|
4158
|
-
"Tuner"
|
|
4159
|
-
];
|
|
4160
4139
|
var SET_GLOBAL = 17;
|
|
4161
4140
|
var FACTORY_RESET = 63;
|
|
4162
4141
|
var EXP_REGISTER = 23;
|
|
@@ -4170,12 +4149,6 @@ function setGlobal(setting, value) {
|
|
|
4170
4149
|
const u = value >>> 0;
|
|
4171
4150
|
return buildFrame([MessageType.SET, SET_GLOBAL, ...spec.address, 0, 0, u & 255, u >>> 8 & 255, u >>> 16 & 255, u >>> 24]);
|
|
4172
4151
|
}
|
|
4173
|
-
function setExpFsTarget(slot2, value) {
|
|
4174
|
-
const targets = slot2 === "exp" ? EXP_TARGETS : FS_TARGETS;
|
|
4175
|
-
checkRange(`${slot2} target`, value, 0, targets.length - 1);
|
|
4176
|
-
const [register, sub] = { exp: [EXP_REGISTER, 1], fs: [FS_REGISTER, 0], fs1: [FS_REGISTER, 2], fs2: [FS_REGISTER, 4] }[slot2];
|
|
4177
|
-
return buildFrame([MessageType.SET, register, sub, value]);
|
|
4178
|
-
}
|
|
4179
4152
|
var TARGET_LENGTH = 4;
|
|
4180
4153
|
var SETTING_LENGTH = 10;
|
|
4181
4154
|
function isGlobalWrite(payload) {
|
|
@@ -4188,34 +4161,35 @@ function isGlobalWrite(payload) {
|
|
|
4188
4161
|
function factoryReset() {
|
|
4189
4162
|
return buildFrame([MessageType.SET, FACTORY_RESET]);
|
|
4190
4163
|
}
|
|
4191
|
-
var OFFSET = {
|
|
4192
|
-
masterVolume: 22,
|
|
4193
|
-
backlight: 35,
|
|
4194
|
-
inputLevel: 40,
|
|
4195
|
-
fxRecLevel: 45,
|
|
4196
|
-
monitorLevel: 50,
|
|
4197
|
-
mode: 60,
|
|
4198
|
-
btRecLevel: 65,
|
|
4199
|
-
reamp: 70,
|
|
4200
|
-
eco: 75,
|
|
4201
|
-
expFsType: 80
|
|
4202
|
-
};
|
|
4203
|
-
var MIN_LENGTH = OFFSET.btRecLevel + 1;
|
|
4204
4164
|
function decodeGlobals(payload) {
|
|
4205
|
-
if (payload[0] !== MessageType.GET || payload[1] !== Query.GLOBALS
|
|
4206
|
-
const
|
|
4207
|
-
|
|
4165
|
+
if (payload[0] !== MessageType.GET || payload[1] !== Query.GLOBALS) return null;
|
|
4166
|
+
const values = /* @__PURE__ */ new Map();
|
|
4167
|
+
for (let o = 2; o + 4 <= payload.length; ) {
|
|
4168
|
+
const length = payload[o + 2] | payload[o + 3] << 8;
|
|
4169
|
+
if (o + 4 + length > payload.length) break;
|
|
4170
|
+
values.set(`${payload[o]}:${payload[o + 1]}`, payload.subarray(o + 4, o + 4 + length));
|
|
4171
|
+
o += 4 + length;
|
|
4172
|
+
}
|
|
4173
|
+
const raw = (setting) => values.get(GLOBAL_SETTINGS[setting].address.join(":"));
|
|
4174
|
+
const byte = (setting) => raw(setting)?.[0] ?? null;
|
|
4175
|
+
const level = (setting) => {
|
|
4176
|
+
const b = byte(setting);
|
|
4177
|
+
return b === null ? null : b << 24 >> 24;
|
|
4178
|
+
};
|
|
4179
|
+
const masterVolume = byte("masterVolume");
|
|
4180
|
+
if (masterVolume === null) return null;
|
|
4208
4181
|
return {
|
|
4209
|
-
masterVolume
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4182
|
+
masterVolume,
|
|
4183
|
+
inputLevel: level("inputLevel"),
|
|
4184
|
+
fxRecLevel: level("fxRecLevel"),
|
|
4185
|
+
monitorLevel: level("monitorLevel"),
|
|
4186
|
+
btRecLevel: level("btRecLevel"),
|
|
4187
|
+
backlight: byte("backlight"),
|
|
4188
|
+
mode: byte("mode"),
|
|
4189
|
+
bootProtection: byte("bootProtection"),
|
|
4190
|
+
reamp: byte("reamp"),
|
|
4191
|
+
eco: byte("eco"),
|
|
4192
|
+
expFsType: byte("expFsType")
|
|
4219
4193
|
};
|
|
4220
4194
|
}
|
|
4221
4195
|
|
|
@@ -6277,59 +6251,33 @@ async function connectPocketMaster(onLog = () => void 0) {
|
|
|
6277
6251
|
import { constants } from "node:fs";
|
|
6278
6252
|
|
|
6279
6253
|
// src/globals.ts
|
|
6280
|
-
var
|
|
6281
|
-
var TARGET_FOR_TYPE = { expTarget: 0, fsTarget: 1, fs1Target: 2, fs2Target: 2 };
|
|
6282
|
-
var TARGET_SLOT = { expTarget: "exp", fsTarget: "fs", fs1Target: "fs1", fs2Target: "fs2" };
|
|
6254
|
+
var EDITABLE = ["masterVolume", "inputLevel", "fxRecLevel", "monitorLevel", "btRecLevel", "backlight", "bootProtection"];
|
|
6283
6255
|
var LABEL = {
|
|
6284
6256
|
masterVolume: "Master volume",
|
|
6285
6257
|
inputLevel: "Input level",
|
|
6286
6258
|
fxRecLevel: "FX rec level",
|
|
6287
6259
|
monitorLevel: "Monitor level",
|
|
6288
6260
|
btRecLevel: "BT rec level",
|
|
6289
|
-
mode: "USB recording",
|
|
6290
|
-
reamp: "Re-amp",
|
|
6291
|
-
expFsType: "EXP/FS jack",
|
|
6292
6261
|
backlight: "Backlight",
|
|
6293
|
-
|
|
6294
|
-
powerConfirm: "Power-off confirm",
|
|
6295
|
-
battOnly: "Battery only"
|
|
6262
|
+
bootProtection: "Boot anti-touch protection"
|
|
6296
6263
|
};
|
|
6297
6264
|
var db = (v) => `${v} dB`;
|
|
6298
|
-
var onOff = (v) => v
|
|
6265
|
+
var onOff = (v) => v ? "on" : "off";
|
|
6299
6266
|
function describeGlobals(g) {
|
|
6267
|
+
const shown = (label, value, text) => value === null ? null : `${label} ${text(value)}`;
|
|
6268
|
+
const levels = [shown("Input", g.inputLevel, db), shown("FX rec", g.fxRecLevel, db), shown("Monitor", g.monitorLevel, db), shown("BT rec", g.btRecLevel, db)].filter((l) => l !== null);
|
|
6300
6269
|
return [
|
|
6301
6270
|
`Master volume ${g.masterVolume}`,
|
|
6302
|
-
`Levels:
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
const bytes = [];
|
|
6311
|
-
const summary = [];
|
|
6312
|
-
const settings = Object.keys(GLOBAL_SETTINGS).filter((k) => changes[k] !== void 0);
|
|
6313
|
-
const ordered = [...settings.filter((k) => k === "expFsType"), ...settings.filter((k) => k !== "expFsType")];
|
|
6314
|
-
for (const key of ordered) {
|
|
6315
|
-
const value = changes[key];
|
|
6316
|
-
bytes.push(setGlobal(key, value));
|
|
6317
|
-
summary.push(`${LABEL[key]} ${key.endsWith("Level") ? db(value) : value}`);
|
|
6318
|
-
}
|
|
6319
|
-
const type = changes.expFsType ?? current.expFsType;
|
|
6320
|
-
for (const key of Object.keys(TARGET_FOR_TYPE)) {
|
|
6321
|
-
const name = changes[key];
|
|
6322
|
-
if (name === void 0) continue;
|
|
6323
|
-
if (type !== TARGET_FOR_TYPE[key]) {
|
|
6324
|
-
throw new Error(`${key} needs the jack set to ${JACK[TARGET_FOR_TYPE[key]]}; the EXP/FS jack is set to ${type === null ? "an unknown type" : JACK[type]} (change expFsType in the same call).`);
|
|
6325
|
-
}
|
|
6326
|
-
const names = key === "expTarget" ? EXP_TARGETS : FS_TARGETS;
|
|
6327
|
-
const index = names.findIndex((n) => n.toLowerCase() === name.trim().toLowerCase());
|
|
6328
|
-
if (index < 0) throw new Error(`${key} options: ${names.join(", ")}`);
|
|
6329
|
-
bytes.push(setExpFsTarget(TARGET_SLOT[key], index));
|
|
6330
|
-
summary.push(`${key} ${names[index]}`);
|
|
6331
|
-
}
|
|
6332
|
-
if (bytes.length === 0) throw new Error("Nothing to change: give at least one setting.");
|
|
6271
|
+
levels.length > 0 ? `Levels: ${levels.join(", ")}` : null,
|
|
6272
|
+
shown("Backlight", g.backlight, String),
|
|
6273
|
+
shown("Boot anti-touch protection", g.bootProtection, onOff)
|
|
6274
|
+
].filter((l) => l !== null).join("\n");
|
|
6275
|
+
}
|
|
6276
|
+
function globalWrites(changes) {
|
|
6277
|
+
const keys = EDITABLE.filter((k) => changes[k] !== void 0);
|
|
6278
|
+
if (keys.length === 0) throw new Error("Nothing to change: give at least one setting.");
|
|
6279
|
+
const bytes = keys.map((k) => setGlobal(k, changes[k]));
|
|
6280
|
+
const summary = keys.map((k) => `${LABEL[k]} ${k.endsWith("Level") ? db(changes[k]) : k === "bootProtection" ? onOff(changes[k]) : changes[k]}`);
|
|
6333
6281
|
return { bytes, summary };
|
|
6334
6282
|
}
|
|
6335
6283
|
|
|
@@ -6649,9 +6597,9 @@ ${await this.#describe(io)}`;
|
|
|
6649
6597
|
return this.#use(async (io) => describeGlobals(await io.readGlobals()));
|
|
6650
6598
|
}
|
|
6651
6599
|
/** Changes device-wide settings; every value is checked before anything is sent. Never a factory reset. */
|
|
6652
|
-
setGlobals(changes) {
|
|
6600
|
+
async setGlobals(changes) {
|
|
6601
|
+
const { bytes, summary } = globalWrites(changes);
|
|
6653
6602
|
return this.#use(async (io) => {
|
|
6654
|
-
const { bytes, summary } = globalWrites(changes, await io.readGlobals());
|
|
6655
6603
|
await io.writeGlobals(bytes);
|
|
6656
6604
|
return `Set ${summary.join(", ")}. These are device-wide settings, stored by the pedal at once (no preset save needed).`;
|
|
6657
6605
|
});
|
|
@@ -6810,7 +6758,7 @@ import { z } from "zod";
|
|
|
6810
6758
|
// package.json
|
|
6811
6759
|
var package_default = {
|
|
6812
6760
|
name: "sonicake-pocket-master-mcp",
|
|
6813
|
-
version: "0.
|
|
6761
|
+
version: "0.13.0",
|
|
6814
6762
|
description: "Unofficial MCP server for the Sonicake Pocket Master: let an AI assistant build tones from a record, edit and save presets over USB MIDI.",
|
|
6815
6763
|
keywords: [
|
|
6816
6764
|
"mcp",
|
|
@@ -7006,31 +6954,22 @@ function createServer(session2, options = {}) {
|
|
|
7006
6954
|
}, (args) => reply("rename_slot", options, () => session2.renameSlot(args)));
|
|
7007
6955
|
server.registerTool("get_global_settings", {
|
|
7008
6956
|
title: "Get global settings",
|
|
7009
|
-
description: "Device-wide settings that are not part of any preset: master volume, input/FX-rec/monitor/BT-rec levels,
|
|
6957
|
+
description: "Device-wide settings that are not part of any preset: master volume, input/FX-rec/monitor/BT-rec levels, backlight, boot anti-touch protection.",
|
|
7010
6958
|
annotations: READ
|
|
7011
6959
|
}, () => reply("get_global_settings", options, () => session2.getGlobals()));
|
|
7012
6960
|
const level = z.number().int().min(-20).max(20);
|
|
7013
6961
|
const flag = z.number().int().min(0).max(1);
|
|
7014
6962
|
server.registerTool("set_global_settings", {
|
|
7015
6963
|
title: "Change global settings",
|
|
7016
|
-
description: "Changes device-wide settings (they affect every preset and are kept by the pedal at once). Levels are dB -20..20;
|
|
6964
|
+
description: "Changes device-wide settings (they affect every preset and are kept by the pedal at once). Levels are dB -20..20; backlight 0..100; bootProtection 0 off / 1 on. Ask the user before changing these. Factory reset is not available here.",
|
|
7017
6965
|
inputSchema: {
|
|
7018
6966
|
masterVolume: z.number().int().min(0).max(100).optional(),
|
|
7019
6967
|
inputLevel: level.optional(),
|
|
7020
6968
|
fxRecLevel: level.optional(),
|
|
7021
6969
|
monitorLevel: level.optional(),
|
|
7022
6970
|
btRecLevel: level.optional(),
|
|
7023
|
-
|
|
7024
|
-
|
|
7025
|
-
eco: flag.optional(),
|
|
7026
|
-
powerConfirm: flag.optional(),
|
|
7027
|
-
battOnly: flag.optional(),
|
|
7028
|
-
expFsType: z.number().int().min(0).max(2).optional(),
|
|
7029
|
-
backlight: z.number().int().min(0).max(100).optional(),
|
|
7030
|
-
expTarget: z.string().optional(),
|
|
7031
|
-
fsTarget: z.string().optional(),
|
|
7032
|
-
fs1Target: z.string().optional(),
|
|
7033
|
-
fs2Target: z.string().optional()
|
|
6971
|
+
bootProtection: flag.optional(),
|
|
6972
|
+
backlight: z.number().int().min(0).max(100).optional()
|
|
7034
6973
|
},
|
|
7035
6974
|
annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: false }
|
|
7036
6975
|
}, (args) => reply("set_global_settings", options, () => session2.setGlobals(args)));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sonicake-pocket-master-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Unofficial MCP server for the Sonicake Pocket Master: let an AI assistant build tones from a record, edit and save presets over USB MIDI.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|