Compare commits
12 Commits
3507899eb3
...
more-dj-in
| Author | SHA1 | Date | |
|---|---|---|---|
| 9b1a9f2e03 | |||
| b96f2aa53b | |||
| edcddde844 | |||
| e41567c101 | |||
| 8002ae8bdb | |||
| 286a43b0b2 | |||
| 229ddb9c37 | |||
| bbcfd8faab | |||
| 5d092a607c | |||
| de28fd87fa | |||
|
|
07c4826bd9 | ||
|
|
501fca079e |
679
example.maxpat
679
example.maxpat
File diff suppressed because one or more lines are too long
36
lfogui.css
36
lfogui.css
@@ -3,12 +3,31 @@
|
||||
--unlocked-color: #ff5153;
|
||||
}
|
||||
|
||||
:root {
|
||||
--background: ivory;
|
||||
--active: royalblue;
|
||||
--nonactive: lightsteelblue;
|
||||
--alert: red;
|
||||
--textcolor: #737373;
|
||||
}
|
||||
|
||||
@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');
|
||||
|
||||
html {
|
||||
background-color: var(--background);
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: "Poppins", sans-serif;
|
||||
}
|
||||
|
||||
html, body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0px;
|
||||
border: 0;
|
||||
overflow: hidden; /* Disable scrollbars */
|
||||
overflow-x: hidden; /* no horizontal scrollbar*/
|
||||
overflow-y: scroll;
|
||||
display: block; /* No floating content on sides */
|
||||
}
|
||||
|
||||
@@ -24,6 +43,9 @@ li {
|
||||
float: left;
|
||||
}
|
||||
|
||||
table {
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
input[type=number] {
|
||||
width: 50px;
|
||||
@@ -183,7 +205,15 @@ h5 {
|
||||
#pulse {
|
||||
animation: pulse-animation 0.2s normal;
|
||||
}
|
||||
/* :::::::::::::: SELECTING MODULATORS/ENUMERATORS */
|
||||
|
||||
.highlighted-button {
|
||||
background-color: gray;
|
||||
}
|
||||
|
||||
.unhighlighted-button {
|
||||
background-color: white;
|
||||
}
|
||||
/* :::::::::::::: LOCK CSS */
|
||||
|
||||
.locked-component {
|
||||
@@ -192,10 +222,10 @@ h5 {
|
||||
color : white;
|
||||
}
|
||||
|
||||
.container {
|
||||
.header {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
justify-content: space-between;
|
||||
flex-direction: flex;
|
||||
}
|
||||
|
||||
/* Locked */
|
||||
|
||||
58
lfogui.js
58
lfogui.js
@@ -9,8 +9,8 @@ else
|
||||
const e = React.createElement;
|
||||
|
||||
let lfos = [];
|
||||
const MAXLFOS = 20;
|
||||
const MAXENUMS = 20;
|
||||
const MAXLFOS = 200;
|
||||
const MAXENUMS = 200;
|
||||
const MAXENUMPOINTS = 10;
|
||||
const MAXUSERDEFINED = 4;
|
||||
|
||||
@@ -30,8 +30,8 @@ const LockModes = Object.freeze({
|
||||
var modPhases = Array(MAXLFOS).fill(0);
|
||||
var firstUpdateTime = Date.now();
|
||||
|
||||
const MODULATORLABELS = ["inst", "-type-", "---shape---", "-------param-------", "--timebase--", "-min-", "-max", "-phase-", "center"];
|
||||
const ENUMERATORLABELS = ["inst", "---parameter---", "-# points-"];
|
||||
const MODULATORLABELS = ["inst", "type", "shape", "param", "timebase", "min", "max", "phase", "center"];
|
||||
const ENUMERATORLABELS = ["inst", "parameter", "# points"];
|
||||
|
||||
|
||||
function parseLfoTimeNonMusical(lfoTime) {
|
||||
@@ -65,14 +65,8 @@ function MasterLfoHandler(){
|
||||
initVisArr[0] = true;
|
||||
|
||||
const [viewMode, setViewMode] = React.useState(ViewModes.MOD);
|
||||
const toggleViewMode = () => {
|
||||
if (viewMode === ViewModes.MOD)
|
||||
setViewMode(ViewModes.ENUM);
|
||||
else
|
||||
setViewMode(ViewModes.MOD);
|
||||
};
|
||||
|
||||
const [lockMode, setLockMode] = React.useState(LockModes.LOCK);
|
||||
const [lockMode, setLockMode] = React.useState(LockModes.UNLOCK);
|
||||
const toggleLockMode = () => {
|
||||
if (lockMode === LockModes.UNLOCK)
|
||||
setLockMode(LockModes.LOCK);
|
||||
@@ -80,6 +74,18 @@ function MasterLfoHandler(){
|
||||
setLockMode(LockModes.UNLOCK);
|
||||
};
|
||||
|
||||
const [enabled, setEnabled] = React.useState(false);
|
||||
const toggleEnabled = () => {
|
||||
setEnabled(!enabled);
|
||||
};
|
||||
|
||||
const displayIfEnabled = (content) => {
|
||||
if (enabled)
|
||||
return content
|
||||
}
|
||||
|
||||
let toggleEnabledText = enabled ? "Hide" : "Show";
|
||||
|
||||
/// MODULATOR ARRAYS
|
||||
let userDefinedWavesBase = [];
|
||||
let userDefinedFunctionsBase = [];
|
||||
@@ -96,7 +102,7 @@ function MasterLfoHandler(){
|
||||
const [modTypeArr, setModTypeArr] = React.useState(Array(MAXLFOS).fill('LFO'));
|
||||
const [modInstanceNumArr, setModInstanceNumArr] = React.useState(Array(MAXLFOS).fill('1'));
|
||||
|
||||
const [modCenterVals, setModCenterVals] = React.useState({'1':{}, '2':{}, '3':{}, '4':{}});
|
||||
const [modCenterVals, setModCenterVals] = React.useState({ '1': {}, '2': {}, '3': {}, '4': {}, '5': {}, '6': {}});
|
||||
|
||||
const [ticks, setTicks] = React.useState(0);
|
||||
const [beatsInMeasure, setBeatsInMeasure] = React.useState(4);
|
||||
@@ -534,16 +540,19 @@ function MasterLfoHandler(){
|
||||
|
||||
|
||||
var grid;
|
||||
var title;
|
||||
var modButtonClass;
|
||||
var enumButtonClass;
|
||||
var labels;
|
||||
if (viewMode === ViewModes.MOD) {
|
||||
grid = modContents;
|
||||
title = "MODULATORS";
|
||||
modButtonClass = "highlighted-button";
|
||||
enumButtonClass = "unhighlighted-button";
|
||||
labels = MODULATORLABELS;
|
||||
}
|
||||
else {
|
||||
grid = enumContents;
|
||||
title = "ENUMERATORS";
|
||||
modButtonClass = "unhighlighted-button";
|
||||
enumButtonClass = "highlighted-button";
|
||||
labels = ENUMERATORLABELS;
|
||||
}
|
||||
|
||||
@@ -556,13 +565,20 @@ function MasterLfoHandler(){
|
||||
}
|
||||
|
||||
return e('div', null,
|
||||
e('div', {className: 'container'},
|
||||
e(Switch, {ontoggle: toggleViewMode}, null),
|
||||
e('span', {className: lockClass, onClick: toggleLockMode}, null)),
|
||||
e('div', { className: 'header' },
|
||||
displayIfEnabled(e('button', { onClick: () => setViewMode(ViewModes.MOD), className: modButtonClass}, 'Modulators')),
|
||||
displayIfEnabled(e('button', { onClick: () => setViewMode(ViewModes.ENUM), className: enumButtonClass }, 'Enumerators')),
|
||||
e('button', { onClick: toggleEnabled, }, toggleEnabledText),
|
||||
|
||||
e('h5', null, title),
|
||||
e('ul', null, ...labels.map(x => ListItem(Label(x)))),
|
||||
e('div', {id: 'grid'}, ...grid)
|
||||
//allows lock mode
|
||||
//e('span', { className: lockClass, onClick: toggleLockMode }, null)
|
||||
),
|
||||
|
||||
displayIfEnabled(
|
||||
e('table', { id: 'table' },
|
||||
e('thead', null, e('tr', { id: 'headers' }, ...labels.map(x => e('th', null, x)))),
|
||||
e('tbody', null, ...grid)
|
||||
))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ var TYPEOPTIONS = ["LFO", "Noise"];
|
||||
var SHAPETYPES = ["Sine", "SawUp", "SawDown", "Tri", "Square", "Custom_1", "Custom_2", "Custom_3", "Custom_4"];
|
||||
var NOISETYPES = ["Rand", "Line Int.", "Sine Int."]
|
||||
|
||||
var INSTANCEOPTIONS = ["1", "2", "3", "4"];
|
||||
var INSTANCEOPTIONS = ["1", "2", "3", "4", "5", "6"];
|
||||
|
||||
const MODPARAMOPTIONS = ["NONE", "stream", "pulse_length", "eventfulness", "event_length", "metriclarity",
|
||||
"harmoniclarity", "melodic_cohesion", "melody_scope", "tonic_pitch", "pitch_center", "pitch_range", "dynamics",
|
||||
@@ -22,7 +22,9 @@ function ControlType(){
|
||||
return e('select', {className: 'control-type'}, Option("LFO"));
|
||||
}
|
||||
|
||||
|
||||
function DataCell(element) {
|
||||
return e('td', null, element);
|
||||
}
|
||||
|
||||
function LfoRow(props){
|
||||
|
||||
@@ -34,27 +36,27 @@ function LfoRow(props){
|
||||
let typeOption = null;
|
||||
|
||||
if (props.type == "LFO"){
|
||||
typeOption = ListItem(DropDown({locked:props.locked, onChange: props.setShape, value:props.shape, options: SHAPETYPES}));
|
||||
typeOption = DataCell(DropDown({locked:props.locked, onChange: props.setShape, value:props.shape, options: SHAPETYPES}));
|
||||
}
|
||||
else if (props.type == "Noise"){
|
||||
typeOption = ListItem(DropDown({locked:props.locked, onChange: props.setNoise, value:props.noise, options: NOISETYPES}));
|
||||
typeOption = DataCell(DropDown({locked:props.locked, onChange: props.setNoise, value:props.noise, options: NOISETYPES}));
|
||||
}
|
||||
|
||||
let content = e('ul', {className: 'lfo-item'},
|
||||
ListItem(DropDown({locked:props.locked, onChange: props.setInstanceNum, value:props.instanceNum, options: INSTANCEOPTIONS})),
|
||||
ListItem(DropDown({locked:props.locked, options: TYPEOPTIONS, onChange: props.setType, value:props.type})),
|
||||
let content = e('tr', {className: 'lfo-item'},
|
||||
DataCell(DropDown({locked:props.locked, onChange: props.setInstanceNum, value:props.instanceNum, options: INSTANCEOPTIONS})),
|
||||
DataCell(DropDown({locked:props.locked, options: TYPEOPTIONS, onChange: props.setType, value:props.type})),
|
||||
typeOption,
|
||||
ListItem(DropDown({locked:props.locked, onChange: props.setDjParam, value: props.djParam, options: MODPARAMOPTIONS})),
|
||||
ListItem(e("input", {onChange:props.setFreq, value:props.freq, className:"timeInput"}, null)),
|
||||
ListItem(e(NumberBox, {onChange:props.setMin, value:props.min, step:0.1}, null)),
|
||||
ListItem(e(NumberBox, {onChange:props.setMax, value:props.max, step:0.1}, null)),
|
||||
//ListItem(e(NumberBox, {onChange:props.setAmp, value:props.amp, step:0.1}, null)),
|
||||
ListItem(e(NumberBox, {onChange:props.setPhase, value:props.phase, step:0.1}, null)),
|
||||
ListItem(e("div", {className:"base-val"}, center.toString())),
|
||||
ListItem(e("input", {type: 'range', min: 0, max: 1, step: 0.01, readonly: true, id: `slider-${props.instanceNum}-${props.djParam}`})),
|
||||
ListItem(e(Button, {text:'+', onClick: props.addLfo, locked: props.locked}, null)),
|
||||
ListItem(e(Button, {text:'-', onClick: props.removeLfo, locked: props.locked}, null)),
|
||||
ListItem(e("div", {className:"linked"}, linkedText)),
|
||||
DataCell(DropDown({locked:props.locked, onChange: props.setDjParam, value: props.djParam, options: MODPARAMOPTIONS})),
|
||||
DataCell(e("input", {onChange:props.setFreq, value:props.freq, className:"timeInput"}, null)),
|
||||
DataCell(e(NumberBox, {onChange:props.setMin, value:props.min, step:0.1}, null)),
|
||||
DataCell(e(NumberBox, {onChange:props.setMax, value:props.max, step:0.1}, null)),
|
||||
//DataCell(e(NumberBox, {onChange:props.setAmp, value:props.amp, step:0.1}, null)),
|
||||
DataCell(e(NumberBox, {onChange:props.setPhase, value:props.phase, step:0.1}, null)),
|
||||
DataCell(e("div", {className:"base-val"}, center.toString())),
|
||||
DataCell(e("input", {type: 'range', min: 0, max: 1, step: 0.01, readonly: true, id: `slider-${props.instanceNum}-${props.djParam}`})),
|
||||
DataCell(e(Button, {text:'+', onClick: props.addLfo, locked: props.locked}, null)),
|
||||
DataCell(e(Button, {text:'-', onClick: props.removeLfo, locked: props.locked}, null)),
|
||||
DataCell(e("div", {className:"linked"}, linkedText)),
|
||||
);
|
||||
if (props.visible){
|
||||
return content;
|
||||
@@ -65,7 +67,6 @@ function indexUserWave(phase, index, userDefinedWaves){
|
||||
return parseFloat(userDefinedWaves[index][Math.floor(phase * 50)]) / 127;
|
||||
}
|
||||
|
||||
//TODO doesn't work well yet
|
||||
function indexUserFunction(phase, index, userDefinedFunctions){
|
||||
return parseFloat(userDefinedFunctions[index][Math.floor(phase * 101)]) / 127;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user