Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.DS_Store
.vscode
.VSCodeCounter
node_modules
node_modules
**/deleteme*
91 changes: 58 additions & 33 deletions age.maxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name" : "age",
"version" : 1,
"creationdate" : 3832120215,
"modificationdate" : 3836830145,
"viewrect" : [ 860.0, 187.0, 1720.0, 1119.0 ],
"modificationdate" : 3837775182,
"viewrect" : [ 2940.0, 1087.0, 500.0, 319.0 ],
"autoorganize" : 0,
"hideprojectwindow" : 0,
"showdependencies" : 1,
Expand Down Expand Up @@ -31,6 +31,31 @@
"kind" : "patcher",
"local" : 1
}
,
"isMode.maxpat" : {
"kind" : "patcher",
"local" : 1
}
,
"isShifted.maxpat" : {
"kind" : "patcher",
"local" : 1
}
,
"rackButton.maxpat" : {
"kind" : "patcher",
"local" : 1
}
,
"rackConfig.maxpat" : {
"kind" : "patcher",
"local" : 1
}
,
"rackConfigRackButton.maxpat" : {
"kind" : "patcher",
"local" : 1
}
,
"reasonRack.maxpat" : {
"kind" : "patcher",
Expand All @@ -46,6 +71,11 @@
"kind" : "patcher",
"local" : 1
}
,
"debugState.maxpat" : {
"kind" : "patcher",
"local" : 1
}

}
,
Expand Down Expand Up @@ -74,6 +104,11 @@
"kind" : "javascript",
"local" : 1
}
,
"PerformanceModeUpdater.js" : {
"kind" : "javascript",
"local" : 1
}
,
"RackToggler.js" : {
"kind" : "javascript",
Expand Down Expand Up @@ -105,37 +140,32 @@
"local" : 1
}
,
"isCombinatorDevice.js" : {
"kind" : "javascript",
"local" : 1
}
,
"isPlaySwitch.js" : {
"padIdToLaunchpadIndex.js" : {
"kind" : "javascript",
"local" : 1
}
,
"playSwitchLabels.js" : {
"isCombinatorDevice.js" : {
"kind" : "javascript",
"local" : 1
}
,
"rackDevices.js" : {
"isPlaySwitch.js" : {
"kind" : "javascript",
"local" : 1
}
,
"colours.js" : {
"launchpadIndexToPadId.js" : {
"kind" : "javascript",
"local" : 1
}
,
"padIdToLaunchpadIndex.js" : {
"playSwitchLabels.js" : {
"kind" : "javascript",
"local" : 1
}
,
"launchpadIndexToPadId.js" : {
"rackDevices.js" : {
"kind" : "javascript",
"local" : 1
}
Expand All @@ -145,26 +175,6 @@
"data" : {
"reason-rack-1.maxsnap" : {
"kind" : "maxsnapshot",
"local" : 1,
"singleton" : {
"bootpath" : "~/.Trash/Age 13.02.32",
"projectrelativepath" : "../../../../.Trash/Age 13.02.32"
}

}
,
"ctqBeats.json" : {
"kind" : "json",
"local" : 1
}
,
"ctqLabel.json" : {
"kind" : "json",
"local" : 1
}
,
"colours.json" : {
"kind" : "json",
"local" : 1
}
,
Expand Down Expand Up @@ -242,6 +252,21 @@
"kind" : "maxsnapshot",
"local" : 1
}
,
"ctqBeats.json" : {
"kind" : "json",
"local" : 1
}
,
"ctqLabel.json" : {
"kind" : "json",
"local" : 1
}
,
"colours.json" : {
"kind" : "json",
"local" : 1
}
,
"example-state.json" : {
"kind" : "json",
Expand Down
1 change: 1 addition & 0 deletions code/PadHitProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ module.exports = class PadHitProcessor {
break;
default:
}
post(`state ${currentState} -> ${nextState}\n`);
if (nextState !== currentState) {
this.#state.replace(`pads::${padId}::state`, nextState);
this.#padMidiSender.send(padId, outlet);
Expand Down
21 changes: 18 additions & 3 deletions code/PadMidiSender.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,18 @@ module.exports = class PadMidiSender {

send(padId, outlet) {
const currentState = this.#state.get(`pads::${padId}::state`);
const rackId = this.#state.get(`pads::${padId}::clip::rackId`);
const colourId = this.#state.get(`racks::${rackId}::colourId`);
const lpColourIndex = this.#colours.get(`${colourId}::lp`);
const rackId =
currentState === clipState.EMPTY
? null
: this.#state.get(`pads::${padId}::clip::rackId`);
const colourId = rackId
? this.#state.get(`racks::${rackId}::colourId`)
: null;
const lpColourIndex = colourId
? this.#colours.get(`${colourId}::lp`)
: null;
const launchpadIndex = padIdToLaunchpadIndex(padId);
post(`Pad MIDI sender state ${currentState}\n`);
switch (currentState) {
case clipState.TRIGGERED:
case clipState.STOPPING:
Expand Down Expand Up @@ -54,6 +62,13 @@ module.exports = class PadMidiSender {
lpColourIndex,
]);
break;
case clipState.EMPTY:
outlet(this.#outletIndex, [
padChannel.STATIC + padCC,
launchpadIndex,
this.#colours.get("black::lp"),
]);
break;
}
}
};
53 changes: 53 additions & 0 deletions code/PerformanceModeUpdater.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
const {
numberOfPads,
defaultMidiOutletIndex,
defaultSimPadControlOutletIndex,
} = require("./constants");
const SimPadControlSender = require("./SimPadControlSender");
const PadMidiSender = require("./PadMidiSender");

module.exports = class PerformanceModeUpdater {
#numberOfPads;
#simPadControlSender;
#padMidiSender;

constructor({
state,
colours,
numberOfPads: customNumberOfPads,
midiOutletIndex: customMidiOutletIndex,
simPadControlOutletIndex: customSimPadControlOutletIndex,
}) {
const midiOutletIndex =
customMidiOutletIndex === undefined
? defaultMidiOutletIndex
: customMidiOutletIndex;
const simPadControlOutletIndex =
customSimPadControlOutletIndex === undefined
? defaultSimPadControlOutletIndex
: customSimPadControlOutletIndex;
this.#numberOfPads =
customNumberOfPads === undefined ? numberOfPads : customNumberOfPads;
this.#simPadControlSender = new SimPadControlSender({
state,
colours,
outletIndex: simPadControlOutletIndex,
});
this.#padMidiSender = new PadMidiSender({
state,
colours,
outletIndex: midiOutletIndex,
});
}

update(outlet, padId) {
this.#padMidiSender.send(padId, outlet);
this.#simPadControlSender.send(padId, outlet);
}

updateAll(outlet) {
for (let padId = 1; padId <= this.#numberOfPads; padId++) {
this.update(outlet, padId);
}
}
};
Loading