Skip to content

Commit

Permalink
Updates before hardening progression mode (#46)
Browse files Browse the repository at this point in the history
* other updates before working on "what goes on" performance

* config indentation

* lint
  • Loading branch information
mickmister authored Mar 4, 2024
1 parent e63f946 commit 18fceb5
Show file tree
Hide file tree
Showing 27 changed files with 598 additions and 100 deletions.
200 changes: 161 additions & 39 deletions data/config.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
{
"wled": {
"ctrls": [
]
"ctrls": []
},
"midi": {
"inputs": [
{
"name": "Teensy MIDI",
"controlButtons": {},
"clock": false,
"sustainPedal": null,
"mainTrigger": {
"channel": 0,
"note": 81
}
},
{
"name": "Digital Piano",
"keyboard": {
"channel": 0
},
"controlButtons": {},
"clock": false,
"sustainPedal": true
"sustainPedal": true,
"mainTrigger": null
},
{
"name": "VI49 Out",
Expand All @@ -21,20 +32,39 @@
},
{
"name": "DTX drums",
"alias": "iojijxdwdcwcwcv",
"controlButtons": {
"A1": { "channel": 9, "note": 59 }
"A1": {
"channel": 9,
"note": 62
}
},
"clock": false,
"sustainPedal": null,
"mainTrigger": {
"channel": 9, "note": 59
"channel": 9,
"note": 59
}
},
{
"name": "IAC Driver Bus 1",
"controlButtons": {
"A1": { "channel": 0, "note": 50 },
"A2": { "channel": 9, "note": 61 },
"A3": { "channel": 9, "note": 66 },
"B3": { "channel": 9, "note": 60 }
"A1": {
"channel": 0,
"note": 50
},
"A2": {
"channel": 9,
"note": 61
},
"A3": {
"channel": 9,
"note": 66
},
"B3": {
"channel": 9,
"note": 60
}
}
},
{
Expand All @@ -46,23 +76,59 @@
{
"name": "SPD-SX",
"controlButtons": {
"A1": { "channel": 9, "note": 65 },
"A2": { "channel": 9, "note": 61 },
"A3": { "channel": 9, "note": 66 },
"B3": { "channel": 9, "note": 60 }
"A1": {
"channel": 9,
"note": 65
},
"A2": {
"channel": 9,
"note": 61
},
"A3": {
"channel": 9,
"note": 66
},
"B3": {
"channel": 9,
"note": 60
}
}
},
{
"name": "Launchkey Mini MK3 MIDI Port",
"controlButtons": {
"A1": { "channel": 9, "note": 40 },
"A2": { "channel": 9, "note": 41 },
"A3": { "channel": 9, "note": 42 },
"A4": { "channel": 9, "note": 43 },
"B1": { "channel": 9, "note": 36 },
"B2": { "channel": 9, "note": 37 },
"B3": { "channel": 9, "note": 38 },
"B4": { "channel": 9, "note": 39 }
"A1": {
"channel": 9,
"note": 40
},
"A2": {
"channel": 9,
"note": 41
},
"A3": {
"channel": 9,
"note": 42
},
"A4": {
"channel": 9,
"note": 43
},
"B1": {
"channel": 9,
"note": 36
},
"B2": {
"channel": 9,
"note": 37
},
"B3": {
"channel": 9,
"note": 38
},
"B4": {
"channel": 9,
"note": 39
}
},
"keyboard": {
"channel": 0
Expand All @@ -73,46 +139,102 @@
{
"name": "nanoKEY Studio Bluetooth",
"controlButtons": {
"A1": { "channel": 1, "note": 40 },
"A2": { "channel": 1, "note": 41 },
"A3": { "channel": 1, "note": 42 },
"A4": { "channel": 1, "note": 43 },
"B1": { "channel": 1, "note": 44 },
"B2": { "channel": 1, "note": 45 },
"B3": { "channel": 1, "note": 46 },
"B4": { "channel": 1, "note": 47 }
"A1": {
"channel": 1,
"note": 40
},
"A2": {
"channel": 1,
"note": 41
},
"A3": {
"channel": 1,
"note": 42
},
"A4": {
"channel": 1,
"note": 43
},
"B1": {
"channel": 1,
"note": 44
},
"B2": {
"channel": 1,
"note": 45
},
"B3": {
"channel": 1,
"note": 46
},
"B4": {
"channel": 1,
"note": 47
}
},
"keyboard": {
"channel": 0
},
"mainTrigger": {
"channel": 1, "note": 40
"channel": 1,
"note": 40
}
},
{
"name": "nanoKEY Studio KEYBOARD/CTRL",
"controlButtons": {
"A1": { "channel": 1, "note": 40 },
"A2": { "channel": 1, "note": 41 },
"A3": { "channel": 1, "note": 42 },
"A4": { "channel": 1, "note": 43 },
"B1": { "channel": 1, "note": 44 },
"B2": { "channel": 1, "note": 45 },
"B3": { "channel": 1, "note": 46 },
"B4": { "channel": 1, "note": 47 }
"A1": {
"channel": 1,
"note": 40
},
"A2": {
"channel": 1,
"note": 41
},
"A3": {
"channel": 1,
"note": 42
},
"A4": {
"channel": 1,
"note": 43
},
"B1": {
"channel": 1,
"note": 44
},
"B2": {
"channel": 1,
"note": 45
},
"B3": {
"channel": 1,
"note": 46
},
"B4": {
"channel": 1,
"note": 47
}
},
"keyboard": {
"channel": 0
},
"mainTrigger": {
"channel": 1, "note": 40
"channel": 1,
"note": 40
}
},
{
"name": "microKEY2-37 Air Bluetooth",
"keyboard": {
"channel": 0
}
},
{
"name": "microKEY2 Air KEYBOARD",
"keyboard": {
"channel": 0
}
}
],
"outputs": [
Expand Down
15 changes: 14 additions & 1 deletion server/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import http from 'http';
import fs from 'fs';

import express from 'express';
import cors from 'cors';

import {SerializedAction, getActionMap} from '@shared/actions/control_panel_actions';
import type App from '@shared/app';
import {GlobalState} from '@shared/state/global_state';
import {SubmitControlPanelActionAPIResponse, GetStateAPIResponse} from '@shared/types/api_types';
import {SubmitControlPanelActionAPIResponse, GetStateAPIResponse, SetConfigAPIRequest, SetConfigAPIResponse} from '@shared/types/api_types';

import {initWebsocketServer} from './websocket_server';

Expand Down Expand Up @@ -36,6 +37,18 @@ export default async function initServer(app: App): Promise<http.Server> {
});
});

server.post<undefined, SetConfigAPIResponse, SetConfigAPIRequest>('/config', async (req, res) => {
const config = req.body.config;

app.setConfig(config);

await fs.promises.writeFile('../data/config.json', JSON.stringify(config, null, 2));

res.json({
data: app.getState(),
});
});

server.post<undefined, SubmitControlPanelActionAPIResponse, SerializedAction>('/action', async (req, res) => {
const action = req.body.action;

Expand Down
2 changes: 1 addition & 1 deletion shared/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
}
],
"multiline-ternary": [1, "never"],
"new-cap": 2,
"new-cap": "off",
"new-parens": 2,
"newline-before-return": 0,
"newline-per-chained-call": 0,
Expand Down
Loading

0 comments on commit 18fceb5

Please sign in to comment.