From 99e2babad4520ea3a7ad429ff11283d57588545e Mon Sep 17 00:00:00 2001 From: Aoife Date: Tue, 6 Apr 2021 01:46:23 -0400 Subject: [PATCH] redesign complete .remove unused import --- src/features/editor/Arpeggio.js | 213 +++++++- src/features/editor/Effects.js | 23 +- src/features/editor/index.js | 1 - src/features/editor/parameters/Arpeggios.js | 5 +- src/features/editor/parameters/ModFX.js | 535 ++++++++++---------- src/features/editor/parameters/Pitch.js | 1 - src/features/editor/timbreSlice.js | 2 + src/features/menu/index.js | 9 +- src/features/utils/components.js | 5 +- 9 files changed, 518 insertions(+), 276 deletions(-) diff --git a/src/features/editor/Arpeggio.js b/src/features/editor/Arpeggio.js index 206662d..28072a2 100644 --- a/src/features/editor/Arpeggio.js +++ b/src/features/editor/Arpeggio.js @@ -1,6 +1,9 @@ import React from 'react'; -import { useSelector } from 'react-redux'; -import { selectById } from './timbreSlice.js'; +import { useSelector, useDispatch } from 'react-redux'; +import { selectById } from './parameters/parameterSlice.js'; +import Card from './card'; +import { Knob, Select, Checkbox } from '../utils/components'; +import { parameterUpdated } from './parameters/parameterSlice'; import { ArpeggA, ArpeggB } from './parameters/Arpeggios'; export default function Arpeggio(props) { @@ -12,3 +15,209 @@ export default function Arpeggio(props) { ); } + +export function Arpeggiator(props) { + const parameters_1 = useSelector((state) => selectById(state, props.id1)); + const parameters_2 = useSelector((state) => selectById(state, props.id2)); + const dispatch = useDispatch(); + return ( + +
+
+
+

Type

+ `${v.value} Oct`} + value={parameters_1.range} + list={[{ value: 1 }, { value: 2 }, { value: 3 }, { value: 4 }]} + onChange={(value) => + dispatch( + parameterUpdated({ + id: props.id1, + changes: { range: value }, + }) + ) + } + /> +
+
+

Resolution

+ + dispatch( + parameterUpdated({ + id: props.id2, + changes: { target: value }, + }) + ) + } + /> +
+
+

Last Step

+ + dispatch( + parameterUpdated({ + id: props.id, + changes: { type: value }, + }) + ) + } + /> +
+
+

LFO Speed

+ + dispatch( + parameterUpdated({ + id: props.id, + changes: { lfoSpeed: value }, + }) + ) + } + /> +
+
+

Mod FX Depth

+ + dispatch( + parameterUpdated({ + id: props.id, + changes: { effectDepth: value }, + }) + ) + } + /> +
+ ); }; @@ -64,102 +69,109 @@ const Delay = (props) => { const dispatch = useDispatch(); return ( -
- Delay - Delay Type - - dispatch( - parameterUpdated({ - id: props.id, - changes: { type: value }, - }) - ) - } - /> - - dispatch( - parameterUpdated({ - id: props.id, - changes: { tempoSync: value }, - }) - ) - } - /> - {parameters.tempoSync ? ( -
- Sync Note - - dispatch( - parameterUpdated({ - id: props.id, - changes: { syncNote: value }, - }) - ) - } - /> -
- ) : ( -
- Delay Time - +
+

Delay Type

+ + dispatch( + parameterUpdated({ + id: props.id, + changes: { syncNote: value }, + }) + ) + } + /> +
+ ) : ( +
+

Delay Time

+ + dispatch( + parameterUpdated({ + id: props.id, + changes: { delayTime: value }, + }) + ) + } + /> +
+ )} +
+

Delay Depth

+ dispatch( parameterUpdated({ id: props.id, - changes: { delayTime: value }, + changes: { delayDepth: value }, }) ) } />
- )} - Delay Depth - - dispatch( - parameterUpdated({ - id: props.id, - changes: { delayDepth: value }, - }) - ) - } - /> -
+
+ ); }; @@ -168,127 +180,138 @@ const EQ = (props) => { const dispatch = useDispatch(); return ( -
- EQ - Low EQ Frequency - `${e.value}kHz`} - value={parameters.lowFrequency} - list={[ - { value: 40 }, - { value: 50 }, - { value: 60 }, - { value: 80 }, - { value: 100 }, - { value: 120 }, - { value: 140 }, - { value: 160 }, - { value: 180 }, - { value: 200 }, - { value: 220 }, - { value: 240 }, - { value: 260 }, - { value: 280 }, - { value: 300 }, - { value: 320 }, - { value: 340 }, - { value: 360 }, - { value: 380 }, - { value: 400 }, - { value: 420 }, - { value: 440 }, - { value: 460 }, - { value: 480 }, - { value: 500 }, - { value: 600 }, - { value: 700 }, - { value: 800 }, - { value: 900 }, - { value: 1000 }, - ]} - onChange={(value) => - dispatch( - parameterUpdated({ - id: props.id, - changes: { lowFrequency: value }, - }) - ) - } - /> - Low EQ Gain - - dispatch( - parameterUpdated({ - id: props.id, - changes: { lowGain: value }, - }) - ) - } - /> - High EQ Frequency - `${e.value}kHz`} - value={parameters.highFrequency} - list={[ - { value: 1.0 }, - { value: 1.25 }, - { value: 1.5 }, - { value: 1.75 }, - { value: 2.0 }, - { value: 2.25 }, - { value: 2.5 }, - { value: 2.75 }, - { value: 3.0 }, - { value: 3.25 }, - { value: 3.5 }, - { value: 3.75 }, - { value: 4.0 }, - { value: 4.25 }, - { value: 4.5 }, - { value: 4.75 }, - { value: 5.0 }, - { value: 5.25 }, - { value: 5.5 }, - { value: 5.75 }, - { value: 6.0 }, - { value: 7.0 }, - { value: 8.0 }, - { value: 9.0 }, - { value: 10.0 }, - { value: 11.0 }, - { value: 12.0 }, - { value: 14.0 }, - { value: 16.0 }, - { value: 18.0 }, - ]} - onChange={(value) => - dispatch( - parameterUpdated({ - id: props.id, - changes: { highFrequency: value }, - }) - ) - } - /> - High EQ Gain - - dispatch( - parameterUpdated({ - id: props.id, - changes: { highGain: value }, - }) - ) - } - /> -
+ +
+

Low Freq

+ `${e.value}kHz`} + value={parameters.highFrequency} + list={[ + { value: 1.0 }, + { value: 1.25 }, + { value: 1.5 }, + { value: 1.75 }, + { value: 2.0 }, + { value: 2.25 }, + { value: 2.5 }, + { value: 2.75 }, + { value: 3.0 }, + { value: 3.25 }, + { value: 3.5 }, + { value: 3.75 }, + { value: 4.0 }, + { value: 4.25 }, + { value: 4.5 }, + { value: 4.75 }, + { value: 5.0 }, + { value: 5.25 }, + { value: 5.5 }, + { value: 5.75 }, + { value: 6.0 }, + { value: 7.0 }, + { value: 8.0 }, + { value: 9.0 }, + { value: 10.0 }, + { value: 11.0 }, + { value: 12.0 }, + { value: 14.0 }, + { value: 16.0 }, + { value: 18.0 }, + ]} + onChange={(value) => + dispatch( + parameterUpdated({ + id: props.id, + changes: { highFrequency: value }, + }) + ) + } + /> +
+
+
+

Low Gain

+ + dispatch( + parameterUpdated({ + id: props.id, + changes: { lowGain: value }, + }) + ) + } + /> +
+
+

High Gain

+ + dispatch( + parameterUpdated({ + id: props.id, + changes: { highGain: value }, + }) + ) + } + /> +
+
+
); }; diff --git a/src/features/editor/parameters/Pitch.js b/src/features/editor/parameters/Pitch.js index 11e64e2..a718d2e 100644 --- a/src/features/editor/parameters/Pitch.js +++ b/src/features/editor/parameters/Pitch.js @@ -3,7 +3,6 @@ import Card from '../card'; import { useSelector, useDispatch } from 'react-redux'; import { selectById, parameterUpdated } from './parameterSlice.js'; import { Select, Knob } from '../../utils/components'; -import { Slider } from '../../helpers/Helpers'; export default function Pitch(props) { const parameters = useSelector((state) => selectById(state, props.id)); diff --git a/src/features/editor/timbreSlice.js b/src/features/editor/timbreSlice.js index eaaa8eb..e44355f 100644 --- a/src/features/editor/timbreSlice.js +++ b/src/features/editor/timbreSlice.js @@ -56,6 +56,8 @@ const timbreSlice = createSlice({ modfx: 'modfx', delay: 'delay', eq: 'eq', + arpeggA: 'arpeggA', + arpeggB: 'arpeggB', }, arpeggio: { arpeggA: 'arpeggA', diff --git a/src/features/menu/index.js b/src/features/menu/index.js index 3d44d2f..0000ca5 100644 --- a/src/features/menu/index.js +++ b/src/features/menu/index.js @@ -142,14 +142,7 @@ export default function Menu() { onClick={() => { dispatch(parameterUpdateTab('Effects')); }}> - Effects - -
diff --git a/src/features/utils/components.js b/src/features/utils/components.js index 36a7d40..46be707 100644 --- a/src/features/utils/components.js +++ b/src/features/utils/components.js @@ -10,7 +10,7 @@ const Select = (props) => { value={props.value}> {props.list.map((element) => ( ))} @@ -89,6 +89,7 @@ function Knob({ value = 0, fillWidth = 4, onChange, + offset = 0, }) { value = value / max; const uid = useMemo(() => knob_id++, []); @@ -160,7 +161,7 @@ function Knob({ className={` ${ isDragging ? 'opacity-100' : 'opacity-0 hidden' } transition duration-75 ease-in select-none pointer-events-none absolute -mt-6 bg-gray-800 text-white truncate text-xs box-content rounded text-center w-8 py-0.5`}> - {Math.round(value * max)} + {Math.round(value * max + offset)}