sonicake-pocket-master-mcp 0.12.1 → 0.12.3

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.
@@ -31,22 +31,9 @@ var GLOBAL_SETTINGS = {
31
31
  powerConfirm: { 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
- var EditCommand = { PRESET_FIELD: 66, CHAIN: 68, MODEL: 71, PARAM: 72, BLOCK_ON: 73, FOOTSWITCH: 77 };
36
+ var EditCommand = { PRESET_FIELD: 66, CHAIN: 68, MODEL: 71, PARAM: 72, BLOCK_ON: 73 };
50
37
  var ALLOWED_EDITS = new Set(Object.values(EditCommand));
51
38
 
52
39
  // ../../packages/core/src/slots.ts
package/dist/server.js CHANGED
@@ -125,7 +125,7 @@ function isReply(frame, kind) {
125
125
 
126
126
  // ../../packages/core/src/catalog.json
127
127
  var catalog_default = {
128
- _source: "Copied from github.com/voronkovd/pocket-master-mcp (MIT), src/pocket_master_mcp/data/device_map.json, which derives it from PocketEdit (github.com/suckyble/PocketEdit). See NOTICE. Sync and Trail switches added from SonicMaster (github.com/skyggedans/SonicMaster, MIT, effect_library.json at 931a68f).",
128
+ _source: "Copied from github.com/voronkovd/pocket-master-mcp (MIT), src/pocket_master_mcp/data/device_map.json, which derives it from PocketEdit (github.com/suckyble/PocketEdit). See NOTICE.",
129
129
  blocks: [
130
130
  {
131
131
  key: "nr",
@@ -323,8 +323,7 @@ var catalog_default = {
323
323
  max: 10,
324
324
  step: 0.1,
325
325
  unit: "Hz",
326
- default: 0.5,
327
- syncedBy: 6
326
+ default: 0.5
328
327
  },
329
328
  {
330
329
  name: "Vol",
@@ -357,12 +356,6 @@ var catalog_default = {
357
356
  max: 100,
358
357
  step: 1,
359
358
  default: 60
360
- },
361
- {
362
- name: "Sync",
363
- alg: 6,
364
- type: "switch",
365
- default: 0
366
359
  }
367
360
  ]
368
361
  },
@@ -413,8 +406,7 @@ var catalog_default = {
413
406
  max: 10,
414
407
  step: 0.1,
415
408
  unit: "Hz",
416
- default: 0.5,
417
- syncedBy: 3
409
+ default: 0.5
418
410
  },
419
411
  {
420
412
  name: "Tone",
@@ -423,12 +415,6 @@ var catalog_default = {
423
415
  max: 100,
424
416
  step: 1,
425
417
  default: 50
426
- },
427
- {
428
- name: "Sync",
429
- alg: 3,
430
- type: "switch",
431
- default: 0
432
418
  }
433
419
  ]
434
420
  },
@@ -452,8 +438,7 @@ var catalog_default = {
452
438
  max: 10,
453
439
  step: 0.1,
454
440
  unit: "Hz",
455
- default: 0.5,
456
- syncedBy: 3
441
+ default: 0.5
457
442
  },
458
443
  {
459
444
  name: "Vol",
@@ -462,12 +447,6 @@ var catalog_default = {
462
447
  max: 100,
463
448
  step: 1,
464
449
  default: 50
465
- },
466
- {
467
- name: "Sync",
468
- alg: 3,
469
- type: "switch",
470
- default: 0
471
450
  }
472
451
  ]
473
452
  },
@@ -491,8 +470,7 @@ var catalog_default = {
491
470
  max: 10,
492
471
  step: 0.1,
493
472
  unit: "Hz",
494
- default: 0.5,
495
- syncedBy: 4
473
+ default: 0.5
496
474
  },
497
475
  {
498
476
  name: "P.Delay",
@@ -509,12 +487,6 @@ var catalog_default = {
509
487
  max: 100,
510
488
  step: 1,
511
489
  default: 50
512
- },
513
- {
514
- name: "Sync",
515
- alg: 4,
516
- type: "switch",
517
- default: 0
518
490
  }
519
491
  ]
520
492
  },
@@ -530,14 +502,7 @@ var catalog_default = {
530
502
  max: 10,
531
503
  step: 0.1,
532
504
  unit: "Hz",
533
- default: 0.5,
534
- syncedBy: 1
535
- },
536
- {
537
- name: "Sync",
538
- alg: 1,
539
- type: "switch",
540
- default: 0
505
+ default: 0.5
541
506
  }
542
507
  ]
543
508
  },
@@ -561,14 +526,7 @@ var catalog_default = {
561
526
  max: 10,
562
527
  step: 0.1,
563
528
  unit: "Hz",
564
- default: 0.5,
565
- syncedBy: 2
566
- },
567
- {
568
- name: "Sync",
569
- alg: 2,
570
- type: "switch",
571
- default: 0
529
+ default: 0.5
572
530
  }
573
531
  ]
574
532
  },
@@ -592,14 +550,7 @@ var catalog_default = {
592
550
  max: 10,
593
551
  step: 0.1,
594
552
  unit: "Hz",
595
- default: 0.5,
596
- syncedBy: 2
597
- },
598
- {
599
- name: "Sync",
600
- alg: 2,
601
- type: "switch",
602
- default: 0
553
+ default: 0.5
603
554
  }
604
555
  ]
605
556
  },
@@ -623,14 +574,7 @@ var catalog_default = {
623
574
  max: 10,
624
575
  step: 0.1,
625
576
  unit: "Hz",
626
- default: 0.5,
627
- syncedBy: 2
628
- },
629
- {
630
- name: "Sync",
631
- alg: 2,
632
- type: "switch",
633
- default: 0
577
+ default: 0.5
634
578
  }
635
579
  ]
636
580
  },
@@ -654,8 +598,7 @@ var catalog_default = {
654
598
  max: 10,
655
599
  step: 0.1,
656
600
  unit: "Hz",
657
- default: 0.5,
658
- syncedBy: 3
601
+ default: 0.5
659
602
  },
660
603
  {
661
604
  name: "Vol",
@@ -664,12 +607,6 @@ var catalog_default = {
664
607
  max: 100,
665
608
  step: 1,
666
609
  default: 50
667
- },
668
- {
669
- name: "Sync",
670
- alg: 3,
671
- type: "switch",
672
- default: 0
673
610
  }
674
611
  ]
675
612
  },
@@ -693,8 +630,7 @@ var catalog_default = {
693
630
  max: 10,
694
631
  step: 0.1,
695
632
  unit: "Hz",
696
- default: 0.5,
697
- syncedBy: 3
633
+ default: 0.5
698
634
  },
699
635
  {
700
636
  name: "Vol",
@@ -704,12 +640,6 @@ var catalog_default = {
704
640
  step: 1,
705
641
  default: 50
706
642
  },
707
- {
708
- name: "Sync",
709
- alg: 3,
710
- type: "switch",
711
- default: 0
712
- },
713
643
  {
714
644
  name: "Bias",
715
645
  alg: 4,
@@ -2756,8 +2686,7 @@ var catalog_default = {
2756
2686
  max: 10,
2757
2687
  step: 0.1,
2758
2688
  unit: "Hz",
2759
- default: 0.5,
2760
- syncedBy: 6
2689
+ default: 0.5
2761
2690
  },
2762
2691
  {
2763
2692
  name: "Vol",
@@ -2790,12 +2719,6 @@ var catalog_default = {
2790
2719
  max: 100,
2791
2720
  step: 1,
2792
2721
  default: 60
2793
- },
2794
- {
2795
- name: "Sync",
2796
- alg: 6,
2797
- type: "switch",
2798
- default: 0
2799
2722
  }
2800
2723
  ]
2801
2724
  },
@@ -2956,8 +2879,7 @@ var catalog_default = {
2956
2879
  max: 10,
2957
2880
  step: 0.1,
2958
2881
  unit: "Hz",
2959
- default: 0.5,
2960
- syncedBy: 3
2882
+ default: 0.5
2961
2883
  },
2962
2884
  {
2963
2885
  name: "Tone",
@@ -2966,12 +2888,6 @@ var catalog_default = {
2966
2888
  max: 100,
2967
2889
  step: 1,
2968
2890
  default: 50
2969
- },
2970
- {
2971
- name: "Sync",
2972
- alg: 3,
2973
- type: "switch",
2974
- default: 0
2975
2891
  }
2976
2892
  ]
2977
2893
  },
@@ -2995,8 +2911,7 @@ var catalog_default = {
2995
2911
  max: 10,
2996
2912
  step: 0.1,
2997
2913
  unit: "Hz",
2998
- default: 0.5,
2999
- syncedBy: 3
2914
+ default: 0.5
3000
2915
  },
3001
2916
  {
3002
2917
  name: "Vol",
@@ -3005,12 +2920,6 @@ var catalog_default = {
3005
2920
  max: 100,
3006
2921
  step: 1,
3007
2922
  default: 50
3008
- },
3009
- {
3010
- name: "Sync",
3011
- alg: 3,
3012
- type: "switch",
3013
- default: 0
3014
2923
  }
3015
2924
  ]
3016
2925
  },
@@ -3034,8 +2943,7 @@ var catalog_default = {
3034
2943
  max: 10,
3035
2944
  step: 0.1,
3036
2945
  unit: "Hz",
3037
- default: 0.5,
3038
- syncedBy: 4
2946
+ default: 0.5
3039
2947
  },
3040
2948
  {
3041
2949
  name: "P.Delay",
@@ -3052,12 +2960,6 @@ var catalog_default = {
3052
2960
  max: 100,
3053
2961
  step: 1,
3054
2962
  default: 50
3055
- },
3056
- {
3057
- name: "Sync",
3058
- alg: 4,
3059
- type: "switch",
3060
- default: 0
3061
2963
  }
3062
2964
  ]
3063
2965
  },
@@ -3073,14 +2975,7 @@ var catalog_default = {
3073
2975
  max: 10,
3074
2976
  step: 0.1,
3075
2977
  unit: "Hz",
3076
- default: 0.5,
3077
- syncedBy: 1
3078
- },
3079
- {
3080
- name: "Sync",
3081
- alg: 1,
3082
- type: "switch",
3083
- default: 0
2978
+ default: 0.5
3084
2979
  }
3085
2980
  ]
3086
2981
  },
@@ -3104,14 +2999,7 @@ var catalog_default = {
3104
2999
  max: 10,
3105
3000
  step: 0.1,
3106
3001
  unit: "Hz",
3107
- default: 0.5,
3108
- syncedBy: 2
3109
- },
3110
- {
3111
- name: "Sync",
3112
- alg: 2,
3113
- type: "switch",
3114
- default: 0
3002
+ default: 0.5
3115
3003
  }
3116
3004
  ]
3117
3005
  },
@@ -3135,14 +3023,7 @@ var catalog_default = {
3135
3023
  max: 10,
3136
3024
  step: 0.1,
3137
3025
  unit: "Hz",
3138
- default: 0.5,
3139
- syncedBy: 2
3140
- },
3141
- {
3142
- name: "Sync",
3143
- alg: 2,
3144
- type: "switch",
3145
- default: 0
3026
+ default: 0.5
3146
3027
  }
3147
3028
  ]
3148
3029
  },
@@ -3166,14 +3047,7 @@ var catalog_default = {
3166
3047
  max: 10,
3167
3048
  step: 0.1,
3168
3049
  unit: "Hz",
3169
- default: 0.5,
3170
- syncedBy: 2
3171
- },
3172
- {
3173
- name: "Sync",
3174
- alg: 2,
3175
- type: "switch",
3176
- default: 0
3050
+ default: 0.5
3177
3051
  }
3178
3052
  ]
3179
3053
  },
@@ -3197,8 +3071,7 @@ var catalog_default = {
3197
3071
  max: 10,
3198
3072
  step: 0.1,
3199
3073
  unit: "Hz",
3200
- default: 0.5,
3201
- syncedBy: 3
3074
+ default: 0.5
3202
3075
  },
3203
3076
  {
3204
3077
  name: "Vol",
@@ -3207,12 +3080,6 @@ var catalog_default = {
3207
3080
  max: 100,
3208
3081
  step: 1,
3209
3082
  default: 50
3210
- },
3211
- {
3212
- name: "Sync",
3213
- alg: 3,
3214
- type: "switch",
3215
- default: 0
3216
3083
  }
3217
3084
  ]
3218
3085
  },
@@ -3236,8 +3103,7 @@ var catalog_default = {
3236
3103
  max: 10,
3237
3104
  step: 0.1,
3238
3105
  unit: "Hz",
3239
- default: 0.5,
3240
- syncedBy: 3
3106
+ default: 0.5
3241
3107
  },
3242
3108
  {
3243
3109
  name: "Vol",
@@ -3247,12 +3113,6 @@ var catalog_default = {
3247
3113
  step: 1,
3248
3114
  default: 50
3249
3115
  },
3250
- {
3251
- name: "Sync",
3252
- alg: 3,
3253
- type: "switch",
3254
- default: 0
3255
- },
3256
3116
  {
3257
3117
  name: "Bias",
3258
3118
  alg: 4,
@@ -3285,8 +3145,7 @@ var catalog_default = {
3285
3145
  max: 1e3,
3286
3146
  step: 1,
3287
3147
  unit: "ms",
3288
- default: 500,
3289
- syncedBy: 3
3148
+ default: 500
3290
3149
  },
3291
3150
  {
3292
3151
  name: "F.Back",
@@ -3295,18 +3154,6 @@ var catalog_default = {
3295
3154
  max: 100,
3296
3155
  step: 1,
3297
3156
  default: 30
3298
- },
3299
- {
3300
- name: "Sync",
3301
- alg: 3,
3302
- type: "switch",
3303
- default: 0
3304
- },
3305
- {
3306
- name: "Trail",
3307
- alg: 4,
3308
- type: "switch",
3309
- default: 0
3310
3157
  }
3311
3158
  ]
3312
3159
  },
@@ -3339,12 +3186,6 @@ var catalog_default = {
3339
3186
  max: 100,
3340
3187
  step: 1,
3341
3188
  default: 30
3342
- },
3343
- {
3344
- name: "Trail",
3345
- alg: 4,
3346
- type: "switch",
3347
- default: 0
3348
3189
  }
3349
3190
  ]
3350
3191
  },
@@ -3368,8 +3209,7 @@ var catalog_default = {
3368
3209
  max: 1e3,
3369
3210
  step: 1,
3370
3211
  unit: "ms",
3371
- default: 500,
3372
- syncedBy: 3
3212
+ default: 500
3373
3213
  },
3374
3214
  {
3375
3215
  name: "F.Back",
@@ -3378,18 +3218,6 @@ var catalog_default = {
3378
3218
  max: 100,
3379
3219
  step: 1,
3380
3220
  default: 30
3381
- },
3382
- {
3383
- name: "Sync",
3384
- alg: 3,
3385
- type: "switch",
3386
- default: 0
3387
- },
3388
- {
3389
- name: "Trail",
3390
- alg: 4,
3391
- type: "switch",
3392
- default: 0
3393
3221
  }
3394
3222
  ]
3395
3223
  },
@@ -3413,8 +3241,7 @@ var catalog_default = {
3413
3241
  max: 1e3,
3414
3242
  step: 1,
3415
3243
  unit: "ms",
3416
- default: 500,
3417
- syncedBy: 3
3244
+ default: 500
3418
3245
  },
3419
3246
  {
3420
3247
  name: "F.Back",
@@ -3423,18 +3250,6 @@ var catalog_default = {
3423
3250
  max: 100,
3424
3251
  step: 1,
3425
3252
  default: 30
3426
- },
3427
- {
3428
- name: "Sync",
3429
- alg: 3,
3430
- type: "switch",
3431
- default: 0
3432
- },
3433
- {
3434
- name: "Trail",
3435
- alg: 4,
3436
- type: "switch",
3437
- default: 0
3438
3253
  }
3439
3254
  ]
3440
3255
  },
@@ -3458,8 +3273,7 @@ var catalog_default = {
3458
3273
  max: 1e3,
3459
3274
  step: 1,
3460
3275
  unit: "ms",
3461
- default: 500,
3462
- syncedBy: 3
3276
+ default: 500
3463
3277
  },
3464
3278
  {
3465
3279
  name: "F.Back",
@@ -3468,18 +3282,6 @@ var catalog_default = {
3468
3282
  max: 100,
3469
3283
  step: 1,
3470
3284
  default: 30
3471
- },
3472
- {
3473
- name: "Sync",
3474
- alg: 3,
3475
- type: "switch",
3476
- default: 0
3477
- },
3478
- {
3479
- name: "Trail",
3480
- alg: 4,
3481
- type: "switch",
3482
- default: 0
3483
3285
  }
3484
3286
  ]
3485
3287
  },
@@ -3503,8 +3305,7 @@ var catalog_default = {
3503
3305
  max: 500,
3504
3306
  step: 1,
3505
3307
  unit: "ms",
3506
- default: 500,
3507
- syncedBy: 3
3308
+ default: 500
3508
3309
  },
3509
3310
  {
3510
3311
  name: "F.Back",
@@ -3513,18 +3314,6 @@ var catalog_default = {
3513
3314
  max: 100,
3514
3315
  step: 1,
3515
3316
  default: 30
3516
- },
3517
- {
3518
- name: "Sync",
3519
- alg: 3,
3520
- type: "switch",
3521
- default: 0
3522
- },
3523
- {
3524
- name: "Trail",
3525
- alg: 4,
3526
- type: "switch",
3527
- default: 0
3528
3317
  }
3529
3318
  ]
3530
3319
  },
@@ -3548,8 +3337,7 @@ var catalog_default = {
3548
3337
  max: 1e3,
3549
3338
  step: 1,
3550
3339
  unit: "ms",
3551
- default: 500,
3552
- syncedBy: 3
3340
+ default: 500
3553
3341
  },
3554
3342
  {
3555
3343
  name: "F.Back",
@@ -3558,18 +3346,6 @@ var catalog_default = {
3558
3346
  max: 100,
3559
3347
  step: 1,
3560
3348
  default: 30
3561
- },
3562
- {
3563
- name: "Sync",
3564
- alg: 3,
3565
- type: "switch",
3566
- default: 0
3567
- },
3568
- {
3569
- name: "Trail",
3570
- alg: 4,
3571
- type: "switch",
3572
- default: 0
3573
3349
  }
3574
3350
  ]
3575
3351
  },
@@ -3593,8 +3369,7 @@ var catalog_default = {
3593
3369
  max: 1e3,
3594
3370
  step: 1,
3595
3371
  unit: "ms",
3596
- default: 500,
3597
- syncedBy: 6
3372
+ default: 500
3598
3373
  },
3599
3374
  {
3600
3375
  name: "F.Back",
@@ -3619,18 +3394,6 @@ var catalog_default = {
3619
3394
  max: 100,
3620
3395
  step: 1,
3621
3396
  default: 50
3622
- },
3623
- {
3624
- name: "Trail",
3625
- alg: 5,
3626
- type: "switch",
3627
- default: 0
3628
- },
3629
- {
3630
- name: "Sync",
3631
- alg: 6,
3632
- type: "switch",
3633
- default: 0
3634
3397
  }
3635
3398
  ]
3636
3399
  },
@@ -3654,8 +3417,7 @@ var catalog_default = {
3654
3417
  max: 500,
3655
3418
  step: 1,
3656
3419
  unit: "ms",
3657
- default: 500,
3658
- syncedBy: 3
3420
+ default: 500
3659
3421
  },
3660
3422
  {
3661
3423
  name: "F.Back",
@@ -3664,18 +3426,6 @@ var catalog_default = {
3664
3426
  max: 100,
3665
3427
  step: 1,
3666
3428
  default: 30
3667
- },
3668
- {
3669
- name: "Sync",
3670
- alg: 3,
3671
- type: "switch",
3672
- default: 0
3673
- },
3674
- {
3675
- name: "Trail",
3676
- alg: 4,
3677
- type: "switch",
3678
- default: 0
3679
3429
  }
3680
3430
  ]
3681
3431
  }
@@ -4204,16 +3954,8 @@ function findCloneModel(code) {
4204
3954
  return modelsFor(CLONE_KEY).find((m) => (m.code & LOW_24_BITS) === (code & LOW_24_BITS));
4205
3955
  }
4206
3956
 
4207
- // ../../packages/core/src/sync.ts
4208
- var SYNC_DIVISIONS = ["1/1", "1/2", "1/2D", "1/2T", "1/4", "1/4D", "1/4T", "1/8", "1/8D", "1/8T", "1/16"];
4209
- function effectiveSpec(spec, valueOf) {
4210
- if (spec.syncedBy === void 0 || (valueOf(spec.syncedBy) ?? 0) < 0.5) return spec;
4211
- return { name: spec.name, alg: spec.alg, type: "select", options: SYNC_DIVISIONS, default: 4, syncedBy: spec.syncedBy };
4212
- }
4213
-
4214
3957
  // ../../packages/core/src/dump.ts
4215
3958
  var Tag = { VOLUME: 8193, BPM: 8194, STATES: 12289, CHAIN: 12290, EFFECTS: 12291, PARAMS: 12292 };
4216
- var FOOTSWITCH_GROUP = 3;
4217
3959
  var REQUIRED = [Tag.STATES, Tag.CHAIN, Tag.EFFECTS, Tag.PARAMS];
4218
3960
  var MIN_SIZE = /* @__PURE__ */ new Map([
4219
3961
  [Tag.STATES, 4],
@@ -4249,9 +3991,6 @@ function decodePreset(payload) {
4249
3991
  const order = readChain(tags.get(Tag.CHAIN));
4250
3992
  const volume = tags.has(Tag.VOLUME) ? view(Tag.VOLUME).getUint32(0, true) : null;
4251
3993
  const bpm = tags.has(Tag.BPM) ? view(Tag.BPM).getUint32(0, true) : null;
4252
- const switches = groups.get(FOOTSWITCH_GROUP);
4253
- const masks = switches && switches.length >= 8 ? [dataView(switches).getUint32(0, true), dataView(switches).getUint32(4, true)] : [0, 0];
4254
- const footswitchOf = (module) => masks[0] >> module & 1 ? "fs1" : masks[1] >> module & 1 ? "fs2" : null;
4255
3994
  const chain = order.map((module) => {
4256
3995
  const source = module === AMP_MODULE && ampMode === "clone" ? CLONE_MODULE : module;
4257
3996
  const spec = blockByModule(module);
@@ -4263,7 +4002,6 @@ function decodePreset(payload) {
4263
4002
  label: spec?.label ?? key.toUpperCase(),
4264
4003
  module,
4265
4004
  on: (mask >> module & 1) === 1,
4266
- footswitch: footswitchOf(module),
4267
4005
  model: model?.name ?? `0x${code.toString(16).toUpperCase().padStart(8, "0")}`,
4268
4006
  code,
4269
4007
  params: decodeParams(model, params, source)
@@ -4273,10 +4011,7 @@ function decodePreset(payload) {
4273
4011
  }
4274
4012
  function decodeParams(model, view, module) {
4275
4013
  if (!model) return [];
4276
- return model.params.filter((p) => view.byteLength >= PARAM_STRIDE * module + 4 * p.alg + 4).map((p) => {
4277
- const raw = (alg) => view.byteLength >= PARAM_STRIDE * module + 4 * alg + 4 ? view.getFloat32(PARAM_STRIDE * module + 4 * alg, true) : void 0;
4278
- return toParam(effectiveSpec(p, raw), raw(p.alg));
4279
- });
4014
+ return model.params.filter((p) => view.byteLength >= PARAM_STRIDE * module + 4 * p.alg + 4).map((p) => toParam(p, view.getFloat32(PARAM_STRIDE * module + 4 * p.alg, true)));
4280
4015
  }
4281
4016
  function toParam(p, value) {
4282
4017
  const kind = p.type ?? "number";
@@ -4401,27 +4136,6 @@ var GLOBAL_SETTINGS = {
4401
4136
  powerConfirm: { address: [5, 2], ...FLAG },
4402
4137
  battOnly: { address: [6, 2], ...FLAG }
4403
4138
  };
4404
- var EXP_TARGETS = ["VOL", "FX1", "DRV", "AMP", "IR", "FX2", "DLY", "RVB"];
4405
- var FS_TARGETS = [
4406
- "Preset-",
4407
- "Preset+",
4408
- "Tap Tempo",
4409
- "NR",
4410
- "FX1",
4411
- "DRV",
4412
- "AMP",
4413
- "IR",
4414
- "EQ",
4415
- "FX2",
4416
- "DLY",
4417
- "RVB",
4418
- "CTRL 1",
4419
- "CTRL 2",
4420
- "Drum",
4421
- "REC/Play",
4422
- "Loop Stop",
4423
- "Tuner"
4424
- ];
4425
4139
  var SET_GLOBAL = 17;
4426
4140
  var FACTORY_RESET = 63;
4427
4141
  var EXP_REGISTER = 23;
@@ -4435,12 +4149,6 @@ function setGlobal(setting, value) {
4435
4149
  const u = value >>> 0;
4436
4150
  return buildFrame([MessageType.SET, SET_GLOBAL, ...spec.address, 0, 0, u & 255, u >>> 8 & 255, u >>> 16 & 255, u >>> 24]);
4437
4151
  }
4438
- function setExpFsTarget(slot2, value) {
4439
- const targets = slot2 === "exp" ? EXP_TARGETS : FS_TARGETS;
4440
- checkRange(`${slot2} target`, value, 0, targets.length - 1);
4441
- const [register, sub] = { exp: [EXP_REGISTER, 1], fs: [FS_REGISTER, 0], fs1: [FS_REGISTER, 2], fs2: [FS_REGISTER, 4] }[slot2];
4442
- return buildFrame([MessageType.SET, register, sub, value]);
4443
- }
4444
4152
  var TARGET_LENGTH = 4;
4445
4153
  var SETTING_LENGTH = 10;
4446
4154
  function isGlobalWrite(payload) {
@@ -4453,39 +4161,40 @@ function isGlobalWrite(payload) {
4453
4161
  function factoryReset() {
4454
4162
  return buildFrame([MessageType.SET, FACTORY_RESET]);
4455
4163
  }
4456
- var OFFSET = {
4457
- masterVolume: 22,
4458
- backlight: 35,
4459
- inputLevel: 40,
4460
- fxRecLevel: 45,
4461
- monitorLevel: 50,
4462
- mode: 60,
4463
- btRecLevel: 65,
4464
- reamp: 70,
4465
- eco: 75,
4466
- expFsType: 80
4467
- };
4468
- var MIN_LENGTH = OFFSET.btRecLevel + 1;
4469
4164
  function decodeGlobals(payload) {
4470
- if (payload[0] !== MessageType.GET || payload[1] !== Query.GLOBALS || payload.length < MIN_LENGTH) return null;
4471
- const signed = (o) => payload[o] << 24 >> 24;
4472
- const optional = (o) => o < payload.length ? payload[o] : null;
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;
4473
4181
  return {
4474
- masterVolume: payload[OFFSET.masterVolume],
4475
- backlight: payload[OFFSET.backlight],
4476
- inputLevel: signed(OFFSET.inputLevel),
4477
- fxRecLevel: signed(OFFSET.fxRecLevel),
4478
- monitorLevel: signed(OFFSET.monitorLevel),
4479
- mode: payload[OFFSET.mode],
4480
- btRecLevel: signed(OFFSET.btRecLevel),
4481
- reamp: optional(OFFSET.reamp),
4482
- eco: optional(OFFSET.eco),
4483
- expFsType: optional(OFFSET.expFsType)
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
+ powerConfirm: byte("powerConfirm"),
4190
+ reamp: byte("reamp"),
4191
+ eco: byte("eco"),
4192
+ expFsType: byte("expFsType")
4484
4193
  };
4485
4194
  }
4486
4195
 
4487
4196
  // ../../packages/core/src/commands.ts
4488
- var EditCommand = { PRESET_FIELD: 66, CHAIN: 68, MODEL: 71, PARAM: 72, BLOCK_ON: 73, FOOTSWITCH: 77 };
4197
+ var EditCommand = { PRESET_FIELD: 66, CHAIN: 68, MODEL: 71, PARAM: 72, BLOCK_ON: 73 };
4489
4198
  var ALLOWED_EDITS = new Set(Object.values(EditCommand));
4490
4199
  var MODULE_COUNT2 = 9;
4491
4200
  var FIXED_GROUP = [2, 3, 4, 5];
@@ -4551,14 +4260,9 @@ function editKey(sysex) {
4551
4260
  if (command === EditCommand.CHAIN) return "chain";
4552
4261
  if (isGlobalWrite(payload)) return payload[1] === 17 ? `global:${payload[2]}:${payload[3]}` : `target:${payload[1]}:${payload[2]}`;
4553
4262
  if (command === EditCommand.PRESET_FIELD) return `field:${payload[2]}`;
4554
- if (command === EditCommand.FOOTSWITCH) return `footswitch:${payload[2]}:${payload[3]}`;
4555
4263
  const module = view.getUint32(2, true);
4556
4264
  return command === EditCommand.PARAM ? `${command}:${module}:${view.getUint32(6, true)}` : `${command}:${module}`;
4557
4265
  }
4558
- function setFootswitch(footswitch, module, on) {
4559
- if (!Number.isInteger(module) || module < 0 || module >= MODULE_COUNT2) throw new Error(`module must be 0..${MODULE_COUNT2 - 1}`);
4560
- return buildFrame([MessageType.SET, EditCommand.FOOTSWITCH, footswitch === "fs2" ? 1 : 0, module, on ? 1 : 0]);
4561
- }
4562
4266
  function encodeValue(spec, input) {
4563
4267
  if (spec.type === "switch") return input === true || input === 1 || input === "on" ? 1 : 0;
4564
4268
  if (spec.type === "select") {
@@ -4663,7 +4367,6 @@ function userIrSlot(code) {
4663
4367
  }
4664
4368
 
4665
4369
  // ../../packages/core/src/edit.ts
4666
- var FOOTSWITCH_CAPACITY = 3;
4667
4370
  var AMP_MODULE2 = 3;
4668
4371
  var IR_MODULE = 4;
4669
4372
  var NR_MODULE = 0;
@@ -4672,8 +4375,6 @@ function applyEdit(preset, edit) {
4672
4375
  case "volume":
4673
4376
  setPresetVolume(edit.value);
4674
4377
  return { ...preset, volume: edit.value };
4675
- case "footswitch":
4676
- return mapBlock(preset, edit.module, (b) => ({ ...b, footswitch: edit.footswitch }));
4677
4378
  case "chain": {
4678
4379
  validateChain(edit.order);
4679
4380
  const byModule = new Map(preset.chain.map((b) => [b.module, b]));
@@ -4686,15 +4387,7 @@ function applyEdit(preset, edit) {
4686
4387
  const specs = modelOf(preset, b)?.params ?? [];
4687
4388
  const spec = specs.find((p) => p.alg === edit.alg);
4688
4389
  if (!spec) throw new Error(`${b.label} (${b.model}) has no parameter in slot ${edit.alg}`);
4689
- const value = (alg) => alg === edit.alg ? edit.value : b.params.find((p) => p.alg === alg)?.value;
4690
- return {
4691
- ...b,
4692
- params: b.params.map((p) => {
4693
- const s = specs.find((x) => x.alg === p.alg);
4694
- if (!s || p.alg !== edit.alg && s.syncedBy !== edit.alg) return p;
4695
- return toParam(effectiveSpec(s, value), value(p.alg));
4696
- })
4697
- };
4390
+ return { ...b, params: b.params.map((p) => p.alg === edit.alg ? toParam(spec, edit.value) : p) };
4698
4391
  });
4699
4392
  case "model": {
4700
4393
  const clone = edit.module === AMP_MODULE2 && edit.clone === true;
@@ -4717,8 +4410,6 @@ function editToCommands(preset, edit) {
4717
4410
  switch (edit.kind) {
4718
4411
  case "volume":
4719
4412
  return [setPresetVolume(edit.value)];
4720
- case "footswitch":
4721
- return footswitchCommands(preset, edit.module, edit.footswitch);
4722
4413
  case "chain":
4723
4414
  return [setChain(edit.order)];
4724
4415
  case "on":
@@ -4761,29 +4452,8 @@ function diffPresets(from, to) {
4761
4452
  }
4762
4453
  }
4763
4454
  if (to.volume !== null && to.volume !== from.volume) edits.push({ kind: "volume", value: to.volume });
4764
- const moving = afterModels.chain.filter((b) => target.get(b.module).footswitch !== b.footswitch);
4765
- for (const b of moving) if (b.footswitch !== null) edits.push({ kind: "footswitch", module: b.module, footswitch: null });
4766
- for (const b of moving) {
4767
- const want = target.get(b.module).footswitch;
4768
- if (want !== null) edits.push({ kind: "footswitch", module: b.module, footswitch: want });
4769
- }
4770
4455
  return edits;
4771
4456
  }
4772
- function footswitchCommands(preset, module, target) {
4773
- const block2 = preset.chain.find((b) => b.module === module);
4774
- if (!block2) throw new Error(`no block with module ${module}`);
4775
- if (block2.footswitch === target) return [];
4776
- if (target !== null) {
4777
- const used = preset.chain.filter((b) => b.footswitch === target).length;
4778
- if (used >= FOOTSWITCH_CAPACITY) {
4779
- throw new Error(`${target.toUpperCase()} already switches ${FOOTSWITCH_CAPACITY} blocks; take one off it first`);
4780
- }
4781
- }
4782
- return [
4783
- ...target !== null ? [setFootswitch(target, module, true)] : [],
4784
- ...block2.footswitch !== null ? [setFootswitch(block2.footswitch, module, false)] : []
4785
- ];
4786
- }
4787
4457
  function mapBlock(preset, module, fn) {
4788
4458
  if (!preset.chain.some((b) => b.module === module)) throw new Error(`no block with module ${module}`);
4789
4459
  return { ...preset, chain: preset.chain.map((b) => b.module === module ? fn(b) : b) };
@@ -5703,8 +5373,7 @@ function resolveBlock(preset, input) {
5703
5373
  function resolveParam(preset, block2, input) {
5704
5374
  const params = modelOf(preset, block2)?.params ?? [];
5705
5375
  if (params.length === 0) throw new Error(`${block2.label} has an unknown model (${block2.model}); its parameters cannot be set by name`);
5706
- const spec = pick("parameter", input, params.map((p) => ({ names: [p.name], value: p, label: p.name })));
5707
- return effectiveSpec(spec, (alg) => block2.params.find((p) => p.alg === alg)?.value);
5376
+ return pick("parameter", input, params.map((p) => ({ names: [p.name], value: p, label: p.name })));
5708
5377
  }
5709
5378
  function modelChoices(blockKey, slots) {
5710
5379
  const models = modelsFor(blockKey).map((m) => {
@@ -6582,59 +6251,33 @@ async function connectPocketMaster(onLog = () => void 0) {
6582
6251
  import { constants } from "node:fs";
6583
6252
 
6584
6253
  // src/globals.ts
6585
- var JACK = ["expression pedal", "single footswitch", "dual footswitch"];
6586
- var TARGET_FOR_TYPE = { expTarget: 0, fsTarget: 1, fs1Target: 2, fs2Target: 2 };
6587
- var TARGET_SLOT = { expTarget: "exp", fsTarget: "fs", fs1Target: "fs1", fs2Target: "fs2" };
6254
+ var EDITABLE = ["masterVolume", "inputLevel", "fxRecLevel", "monitorLevel", "btRecLevel", "backlight", "powerConfirm"];
6588
6255
  var LABEL = {
6589
6256
  masterVolume: "Master volume",
6590
6257
  inputLevel: "Input level",
6591
6258
  fxRecLevel: "FX rec level",
6592
6259
  monitorLevel: "Monitor level",
6593
6260
  btRecLevel: "BT rec level",
6594
- mode: "USB recording",
6595
- reamp: "Re-amp",
6596
- expFsType: "EXP/FS jack",
6597
6261
  backlight: "Backlight",
6598
- eco: "ECO",
6599
- powerConfirm: "Power-off confirm",
6600
- battOnly: "Battery only"
6262
+ powerConfirm: "Power-off confirm"
6601
6263
  };
6602
6264
  var db = (v) => `${v} dB`;
6603
- var onOff = (v) => v === null ? "unknown" : v ? "on" : "off";
6265
+ var onOff = (v) => v ? "on" : "off";
6604
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);
6605
6269
  return [
6606
6270
  `Master volume ${g.masterVolume}`,
6607
- `Levels: Input ${db(g.inputLevel)}, FX rec ${db(g.fxRecLevel)}, Monitor ${db(g.monitorLevel)}, BT rec ${db(g.btRecLevel)}`,
6608
- `USB recording: ${g.mode === null ? "unknown" : g.mode ? "wet" : "dry"}; re-amp ${onOff(g.reamp)}`,
6609
- `EXP/FS jack: ${g.expFsType === null ? "unknown" : JACK[g.expFsType] ?? `type ${g.expFsType}`}`,
6610
- `Backlight ${g.backlight ?? "unknown"}; ECO ${onOff(g.eco)}`,
6611
- "Not reported by the pedal: EXP/FS targets, power-off confirm, battery only."
6612
- ].join("\n");
6613
- }
6614
- function globalWrites(changes, current) {
6615
- const bytes = [];
6616
- const summary = [];
6617
- const settings = Object.keys(GLOBAL_SETTINGS).filter((k) => changes[k] !== void 0);
6618
- const ordered = [...settings.filter((k) => k === "expFsType"), ...settings.filter((k) => k !== "expFsType")];
6619
- for (const key of ordered) {
6620
- const value = changes[key];
6621
- bytes.push(setGlobal(key, value));
6622
- summary.push(`${LABEL[key]} ${key.endsWith("Level") ? db(value) : value}`);
6623
- }
6624
- const type = changes.expFsType ?? current.expFsType;
6625
- for (const key of Object.keys(TARGET_FOR_TYPE)) {
6626
- const name = changes[key];
6627
- if (name === void 0) continue;
6628
- if (type !== TARGET_FOR_TYPE[key]) {
6629
- 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).`);
6630
- }
6631
- const names = key === "expTarget" ? EXP_TARGETS : FS_TARGETS;
6632
- const index = names.findIndex((n) => n.toLowerCase() === name.trim().toLowerCase());
6633
- if (index < 0) throw new Error(`${key} options: ${names.join(", ")}`);
6634
- bytes.push(setExpFsTarget(TARGET_SLOT[key], index));
6635
- summary.push(`${key} ${names[index]}`);
6636
- }
6637
- 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("Power-off confirm", g.powerConfirm, 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 === "powerConfirm" ? onOff(changes[k]) : changes[k]}`);
6638
6281
  return { bytes, summary };
6639
6282
  }
6640
6283
 
@@ -6954,9 +6597,9 @@ ${await this.#describe(io)}`;
6954
6597
  return this.#use(async (io) => describeGlobals(await io.readGlobals()));
6955
6598
  }
6956
6599
  /** Changes device-wide settings; every value is checked before anything is sent. Never a factory reset. */
6957
- setGlobals(changes) {
6600
+ async setGlobals(changes) {
6601
+ const { bytes, summary } = globalWrites(changes);
6958
6602
  return this.#use(async (io) => {
6959
- const { bytes, summary } = globalWrites(changes, await io.readGlobals());
6960
6603
  await io.writeGlobals(bytes);
6961
6604
  return `Set ${summary.join(", ")}. These are device-wide settings, stored by the pedal at once (no preset save needed).`;
6962
6605
  });
@@ -7032,8 +6675,6 @@ function toEdit(preset, change2, slots) {
7032
6675
  }
7033
6676
  case "block":
7034
6677
  return { kind: "on", module: block2.module, on: change2.on };
7035
- case "footswitch":
7036
- return { kind: "footswitch", module: block2.module, footswitch: parseFootswitch(change2.switch) };
7037
6678
  case "model": {
7038
6679
  const model = resolveModel(block2.key, change2.model, slots);
7039
6680
  return { kind: "model", module: block2.module, code: model.code, clone: model.clone };
@@ -7048,12 +6689,6 @@ function toEdit(preset, change2, slots) {
7048
6689
  }
7049
6690
  }
7050
6691
  }
7051
- function parseFootswitch(input) {
7052
- const key = input.trim().toLowerCase();
7053
- if (key === "fs1" || key === "fs2") return key;
7054
- if (key === "none" || key === "") return null;
7055
- throw new Error(`switch must be FS1, FS2 or none, got "${input}"`);
7056
- }
7057
6692
  function formatPreset(index, name, preset, slots, modified) {
7058
6693
  const head = [
7059
6694
  `${presetLabel(index)} "${name}"`,
@@ -7066,8 +6701,7 @@ function formatPreset(index, name, preset, slots, modified) {
7066
6701
  const blocks = preset.chain.map((b) => {
7067
6702
  const model = blockModelLabel(b, preset.ampMode, slots.irNames, slots.profileNames);
7068
6703
  const params = b.params.map((p) => `${p.name} ${p.display}`).join(", ");
7069
- const footswitch = b.footswitch ? `[${b.footswitch.toUpperCase()}] ` : "";
7070
- return `${b.label.padEnd(width)} ${b.on ? "on " : "off"} ${footswitch}${model}${params ? `: ${params}` : ""}`;
6704
+ return `${b.label.padEnd(width)} ${b.on ? "on " : "off"} ${model}${params ? `: ${params}` : ""}`;
7071
6705
  });
7072
6706
  return [head, chain, ...blocks].join("\n");
7073
6707
  }
@@ -7124,7 +6758,7 @@ import { z } from "zod";
7124
6758
  // package.json
7125
6759
  var package_default = {
7126
6760
  name: "sonicake-pocket-master-mcp",
7127
- version: "0.12.1",
6761
+ version: "0.12.3",
7128
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.",
7129
6763
  keywords: [
7130
6764
  "mcp",
@@ -7198,12 +6832,7 @@ var change = z.discriminatedUnion("kind", [
7198
6832
  z.object({ kind: z.literal("block"), block, on: z.boolean() }),
7199
6833
  z.object({ kind: z.literal("model"), block, model: z.string().describe("Model name from list_models; for AMP, a captured profile name selects clone mode") }),
7200
6834
  z.object({ kind: z.literal("move"), block, position: z.number().int().describe("1-based position in the chain; DRV, AMP, IR and EQ move together") }),
7201
- z.object({ kind: z.literal("volume"), value: z.number().int().min(0).max(100).describe("Preset volume 0..100") }),
7202
- z.object({
7203
- kind: z.literal("footswitch"),
7204
- block,
7205
- switch: z.string().describe("FS1, FS2 or none: which footswitch toggles the block (a switch takes at most 3 blocks)")
7206
- })
6835
+ z.object({ kind: z.literal("volume"), value: z.number().int().min(0).max(100).describe("Preset volume 0..100") })
7207
6836
  ]);
7208
6837
  async function reply(tool, options, run) {
7209
6838
  const started = performance.now();
@@ -7325,31 +6954,22 @@ function createServer(session2, options = {}) {
7325
6954
  }, (args) => reply("rename_slot", options, () => session2.renameSlot(args)));
7326
6955
  server.registerTool("get_global_settings", {
7327
6956
  title: "Get global settings",
7328
- description: "Device-wide settings that are not part of any preset: master volume, input/FX-rec/monitor/BT-rec levels, USB recording mode, re-amp, EXP/FS jack type, backlight, ECO.",
6957
+ description: "Device-wide settings that are not part of any preset: master volume, input/FX-rec/monitor/BT-rec levels, backlight, power-off confirm.",
7329
6958
  annotations: READ
7330
6959
  }, () => reply("get_global_settings", options, () => session2.getGlobals()));
7331
6960
  const level = z.number().int().min(-20).max(20);
7332
6961
  const flag = z.number().int().min(0).max(1);
7333
6962
  server.registerTool("set_global_settings", {
7334
6963
  title: "Change global settings",
7335
- description: "Changes device-wide settings (they affect every preset and are kept by the pedal at once). Levels are dB -20..20; mode 0 dry / 1 wet; expFsType 0 expression pedal, 1 single footswitch, 2 dual footswitch; targets by name (expression: VOL, FX1, DRV, AMP, IR, FX2, DLY, RVB; footswitch: Preset-, Preset+, Tap Tempo, NR, FX1, DRV, AMP, IR, EQ, FX2, DLY, RVB, CTRL 1, CTRL 2, Drum, REC/Play, Loop Stop, Tuner). Ask the user before changing these. Factory reset is not available here.",
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; powerConfirm 0 off / 1 on. Ask the user before changing these. Factory reset is not available here.",
7336
6965
  inputSchema: {
7337
6966
  masterVolume: z.number().int().min(0).max(100).optional(),
7338
6967
  inputLevel: level.optional(),
7339
6968
  fxRecLevel: level.optional(),
7340
6969
  monitorLevel: level.optional(),
7341
6970
  btRecLevel: level.optional(),
7342
- mode: flag.optional(),
7343
- reamp: flag.optional(),
7344
- eco: flag.optional(),
7345
6971
  powerConfirm: flag.optional(),
7346
- battOnly: flag.optional(),
7347
- expFsType: z.number().int().min(0).max(2).optional(),
7348
- backlight: z.number().int().min(0).max(100).optional(),
7349
- expTarget: z.string().optional(),
7350
- fsTarget: z.string().optional(),
7351
- fs1Target: z.string().optional(),
7352
- fs2Target: z.string().optional()
6972
+ backlight: z.number().int().min(0).max(100).optional()
7353
6973
  },
7354
6974
  annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: false }
7355
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.12.1",
3
+ "version": "0.12.3",
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",