Compare commits
2 Commits
hotfix
...
0b7dbbb775
| Author | SHA1 | Date | |
|---|---|---|---|
| 0b7dbbb775 | |||
| 541ab6d459 |
65
ModEnum.maxhelp
Normal file
65
ModEnum.maxhelp
Normal file
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"patcher" : {
|
||||
"fileversion" : 1,
|
||||
"appversion" : {
|
||||
"major" : 9,
|
||||
"minor" : 0,
|
||||
"revision" : 5,
|
||||
"architecture" : "x64",
|
||||
"modernui" : 1
|
||||
}
|
||||
,
|
||||
"classnamespace" : "box",
|
||||
"rect" : [ 203.0, 196.0, 750.0, 734.0 ],
|
||||
"gridsize" : [ 15.0, 15.0 ],
|
||||
"boxes" : [ {
|
||||
"box" : {
|
||||
"bgmode" : 0,
|
||||
"border" : 0,
|
||||
"clickthrough" : 0,
|
||||
"enablehscroll" : 0,
|
||||
"enablevscroll" : 0,
|
||||
"id" : "obj-1",
|
||||
"lockeddragscroll" : 0,
|
||||
"lockedsize" : 0,
|
||||
"maxclass" : "bpatcher",
|
||||
"name" : "ModEnum.maxpat",
|
||||
"numinlets" : 1,
|
||||
"numoutlets" : 6,
|
||||
"offset" : [ 0.0, 0.0 ],
|
||||
"outlettype" : [ "", "", "", "", "", "" ],
|
||||
"patching_rect" : [ 25.30120575428009, 154.216873168945312, 838.631580829620361, 601.0 ],
|
||||
"varname" : "ModEnum",
|
||||
"viewvisibility" : 1
|
||||
}
|
||||
|
||||
}
|
||||
],
|
||||
"lines" : [ ],
|
||||
"originid" : "pat-3701",
|
||||
"parameters" : {
|
||||
"obj-1::obj-25" : [ "dict", "dict", 0 ],
|
||||
"parameterbanks" : {
|
||||
"0" : {
|
||||
"index" : 0,
|
||||
"name" : "",
|
||||
"parameters" : [ "-", "-", "-", "-", "-", "-", "-", "-" ]
|
||||
}
|
||||
|
||||
}
|
||||
,
|
||||
"inherited_shortname" : 1
|
||||
}
|
||||
,
|
||||
"dependency_cache" : [ {
|
||||
"name" : "ModEnum.maxpat",
|
||||
"bootpath" : "~/Documents/max-mod-enum",
|
||||
"patcherrelativepath" : ".",
|
||||
"type" : "JSON",
|
||||
"implicit" : 1
|
||||
}
|
||||
],
|
||||
"autosave" : 0
|
||||
}
|
||||
|
||||
}
|
||||
3260
ModEnum.maxpat
Normal file
3260
ModEnum.maxpat
Normal file
File diff suppressed because it is too large
Load Diff
14
common.js
14
common.js
@@ -43,19 +43,15 @@ function Switch(props){
|
||||
e('span', {className: 'slider round'}, null))
|
||||
}
|
||||
|
||||
function SendSaveEvent(){
|
||||
setTimeout(() => {
|
||||
window.dispatchEvent(new CustomEvent('saveDict', {'detail' : "localStorage"}));
|
||||
}, 50)
|
||||
}
|
||||
|
||||
function CreateParamChanger(arr, setArr, index, postCB=() => {}, preCB=(val) => val){
|
||||
return (event) => {
|
||||
let newArr = arr.slice();
|
||||
newArr[index] = preCB(event.target.value);
|
||||
setArr(newArr);
|
||||
postCB();
|
||||
SendSaveEvent();
|
||||
setTimeout(() => {
|
||||
window.dispatchEvent(new CustomEvent('saveDict', {'detail' : "localStorage"}));
|
||||
}, 50)
|
||||
|
||||
log(`${index} ${event.target.value}`);
|
||||
}
|
||||
@@ -68,7 +64,9 @@ function CreateMatrixParamChanger(matrix, setMatrix, i, j){
|
||||
});
|
||||
newMatrix[i][j] = event.target.value;
|
||||
setMatrix(newMatrix);
|
||||
SendSaveEvent();
|
||||
setTimeout(() => {
|
||||
window.dispatchEvent(new CustomEvent('saveDict', {'detail' : "localStorage"}));
|
||||
}, 50)
|
||||
log(`${i}, ${j} ${event.target.value}`);
|
||||
|
||||
}
|
||||
|
||||
24
enums.js
24
enums.js
@@ -4,18 +4,14 @@
|
||||
|
||||
|
||||
|
||||
function DataCell(element) {
|
||||
return e('td', null, element);
|
||||
}
|
||||
|
||||
// NOT A REACT FUNCTIONAL COMPONENT. MERELY RETURNS AN ARRAY WHICH IS UNPACKED
|
||||
function EnumeratorItems(index, enumBreakPoints, setEnumBreakPoints, enumNames, setEnumNames, djParam, locked){
|
||||
let items = [];
|
||||
for (let i = 0; i < MAXENUMPOINTS; i++){
|
||||
|
||||
items.push(DataCell(e(TextBox, {locked, onChange: CreateMatrixParamChanger(enumNames, setEnumNames, index, i), value: enumNames[index][i], id:`text-${djParam}-${enumNames[index][i]}`}, null)));
|
||||
items.push(ListItem(e(TextBox, {locked, onChange: CreateMatrixParamChanger(enumNames, setEnumNames, index, i), value: enumNames[index][i], id:`text-${djParam}-${enumNames[index][i]}`}, null)));
|
||||
// Add 1 to make up for the lower enum bound
|
||||
items.push(DataCell(e(NumberBox, {locked, onChange: CreateMatrixParamChanger(enumBreakPoints, setEnumBreakPoints, index, i + 1), value:enumBreakPoints[index][i + 1]}, null)));
|
||||
items.push(ListItem(e(NumberBox, {locked, onChange: CreateMatrixParamChanger(enumBreakPoints, setEnumBreakPoints, index, i + 1), value:enumBreakPoints[index][i + 1]}, null)));
|
||||
}
|
||||
return items;
|
||||
}
|
||||
@@ -23,15 +19,15 @@ function EnumeratorItems(index, enumBreakPoints, setEnumBreakPoints, enumNames,
|
||||
function EnumeratorRow(props){
|
||||
let linkedText = props.linked ? "<- mods" : "";
|
||||
|
||||
let content = e('tr', {className: 'lfo-item', id: `${props.djParam}-enum-row`},
|
||||
DataCell(DropDown({locked:props.locked, onChange: props.setInstanceNum, value:props.instanceNum, options: INSTANCEOPTIONS})),
|
||||
DataCell(DropDown({locked:props.locked, onChange: props.setDjParam, value: props.djParam, options: MODPARAMOPTIONS})),
|
||||
DataCell(e(NumberBox, {locked:props.locked, onChange: props.setEnumItemCounts, step:1, value:props.enumItems, className: 'enum-count'}, null)),
|
||||
DataCell(e(NumberBox, {locked:props.locked, onChange: CreateMatrixParamChanger(props.enumBreakPoints, props.setEnumBreakPoints, props.index, 0), value:props.enumBreakPoints[props.index][0], step:0.1}, null)),
|
||||
let content = e('ul', {className: 'lfo-item', id: `${props.djParam}-enum-row`},
|
||||
ListItem(DropDown({locked:props.locked, onChange: props.setInstanceNum, value:props.instanceNum, options: INSTANCEOPTIONS})),
|
||||
ListItem(DropDown({locked:props.locked, onChange: props.setDjParam, value: props.djParam, options: MODPARAMOPTIONS})),
|
||||
ListItem(e(NumberBox, {locked:props.locked, onChange: props.setEnumItemCounts, step:1, value:props.enumItems, className: 'enum-count'}, null)),
|
||||
ListItem(e(NumberBox, {locked:props.locked, onChange: CreateMatrixParamChanger(props.enumBreakPoints, props.setEnumBreakPoints, props.index, 0), value:props.enumBreakPoints[props.index][0], step:0.1}, null)),
|
||||
...(EnumeratorItems(props.index, props.enumBreakPoints, props.setEnumBreakPoints, props.enumNames, props.setEnumNames, props.djParam, props.locked).slice(0, props.enumItems * 2)),
|
||||
DataCell(e(Button, {locked:props.locked, text:'+', onClick: props.addEnum}, null)),
|
||||
DataCell(e(Button, {locked:props.locked, text:'-', onClick: props.removeEnum}, null)),
|
||||
DataCell(e("div", {className:"linked"}, linkedText))
|
||||
ListItem(e(Button, {locked:props.locked, text:'+', onClick: props.addEnum}, null)),
|
||||
ListItem(e(Button, {locked:props.locked, text:'-', onClick: props.removeEnum}, null)),
|
||||
ListItem(e("div", {className:"linked"}, linkedText))
|
||||
);
|
||||
if (props.visible){
|
||||
return content;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
291
example.maxpat
291
example.maxpat
File diff suppressed because one or more lines are too long
14
lfogui.js
14
lfogui.js
@@ -445,7 +445,6 @@ function MasterLfoHandler() {
|
||||
allModSetters[j](array);
|
||||
}
|
||||
}
|
||||
SendSaveEvent();
|
||||
rerender(!render);
|
||||
|
||||
}
|
||||
@@ -455,7 +454,6 @@ function MasterLfoHandler() {
|
||||
let newArr = modVisibleArr.slice();
|
||||
newArr[id] = false;
|
||||
setModVisibleArr(newArr);
|
||||
SendSaveEvent();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -479,15 +477,9 @@ function MasterLfoHandler() {
|
||||
enumItems: enumItemCounts[i],
|
||||
setEnumItemCounts: CreateParamChanger(enumItemCounts, setEnumItemCounts, i),
|
||||
enumBreakPoints: enumBreakPoints,
|
||||
setEnumBreakPoints: (val) => {
|
||||
setEnumBreakPoints(val);
|
||||
SendSaveEvent
|
||||
},
|
||||
setEnumBreakPoints: setEnumBreakPoints,
|
||||
enumNames: enumNames,
|
||||
setEnumNames: (val) => {
|
||||
setEnumNames(val);
|
||||
SendSaveEvent
|
||||
},
|
||||
setEnumNames: setEnumNames,
|
||||
visible: enumVisibleArr[i],
|
||||
djParam: enumDjParamArr[i],
|
||||
setDjParam: CreateParamChanger(enumDjParamArr, setEnumDjParamArr, i),
|
||||
@@ -533,7 +525,6 @@ function MasterLfoHandler() {
|
||||
}
|
||||
}
|
||||
rerender(!render);
|
||||
SendSaveEvent();
|
||||
}
|
||||
},
|
||||
removeEnum: () => {
|
||||
@@ -541,7 +532,6 @@ function MasterLfoHandler() {
|
||||
let newArr = enumVisibleArr.slice();
|
||||
newArr[id] = false;
|
||||
setEnumVisibleArr(newArr);
|
||||
SendSaveEvent();
|
||||
}
|
||||
}
|
||||
}, null)
|
||||
|
||||
Reference in New Issue
Block a user