section switching added
This commit is contained in:
+2
-5
@@ -1,15 +1,12 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Timbre from './features/timbre/Timbre';
|
import TimbreSwitcher from './features/timbre/timbreSwitcher';
|
||||||
import Vocoder from './features/timbre/Vocoder';
|
|
||||||
import './App.css';
|
import './App.css';
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
return (
|
return (
|
||||||
<div className="App">
|
<div className="App">
|
||||||
<header className="App-header">
|
<header className="App-header">
|
||||||
<Timbre id="timbre1" />
|
<TimbreSwitcher />
|
||||||
{/*<Timbre id="timbre2" />
|
|
||||||
<Vocoder id="vocoder" />*/}
|
|
||||||
</header>
|
</header>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -123,9 +123,9 @@ export default function Timbre(props) {
|
|||||||
<Mixer id={ids.mixer} />
|
<Mixer id={ids.mixer} />
|
||||||
<Pitch id={ids.pitch} />
|
<Pitch id={ids.pitch} />
|
||||||
<Filter id={ids.filter} />
|
<Filter id={ids.filter} />
|
||||||
|
<Amp id={ids.amp} />
|
||||||
<div className="linebreak" style={lineBreak} />
|
<div className="linebreak" style={lineBreak} />
|
||||||
<EG id={ids.eg1} />
|
<EG id={ids.eg1} />
|
||||||
<Amp id={ids.amp} />
|
|
||||||
<EG id={ids.eg2} />
|
<EG id={ids.eg2} />
|
||||||
<LFO
|
<LFO
|
||||||
id={ids.lfo1}
|
id={ids.lfo1}
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { useSelector, useDispatch } from 'react-redux';
|
||||||
|
import { selectById, parameterUpdated } from './parameterSlice.js';
|
||||||
|
import { Slider, SelectList } from '../../helpers/Helpers';
|
||||||
|
import styles from './Parameters.module.css';
|
||||||
|
|
||||||
|
export default function Levels(props) {
|
||||||
|
const parameters = useSelector((state) => selectById(state, props.id));
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.horizontalContainer}>
|
||||||
|
<Slider />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -26,7 +26,22 @@
|
|||||||
width: 420px;
|
width: 420px;
|
||||||
height: 214px;
|
height: 214px;
|
||||||
}
|
}
|
||||||
.horizontalContainer > .container {
|
|
||||||
|
.patchesContainer {
|
||||||
|
font-size: small;
|
||||||
|
display: inline-flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
padding: 16pt 8pt 16pt 8pt;
|
||||||
|
margin: 10pt;
|
||||||
|
border: solid 1pt black;
|
||||||
|
width: 680px;
|
||||||
|
height: 214px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.horizontalContainer > .container,
|
||||||
|
.patchesContainer > .container {
|
||||||
padding: 0 16pt;
|
padding: 0 16pt;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin: 10pt 0;
|
margin: 10pt 0;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import styles from './Parameters.module.css';
|
|||||||
|
|
||||||
const Patch = (props) => {
|
const Patch = (props) => {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div className={styles.container}>
|
||||||
Source
|
Source
|
||||||
<SelectList
|
<SelectList
|
||||||
value={props.patch.source}
|
value={props.patch.source}
|
||||||
@@ -71,7 +71,7 @@ export default function Patches(props) {
|
|||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.horizontalContainer}>
|
<div id="patches" className={styles.patchesContainer}>
|
||||||
<Patch
|
<Patch
|
||||||
patch={parameters.patch1}
|
patch={parameters.patch1}
|
||||||
onChange={(value) =>
|
onChange={(value) =>
|
||||||
|
|||||||
@@ -273,7 +273,30 @@ const parametersSlice = createSlice({
|
|||||||
modIntensity: 0,
|
modIntensity: 0,
|
||||||
},
|
},
|
||||||
patch2: {
|
patch2: {
|
||||||
source: 'Amp EG',
|
source: 'Filter EG',
|
||||||
|
destination: 'Pitch',
|
||||||
|
modIntensity: 0,
|
||||||
|
},
|
||||||
|
patch3: {
|
||||||
|
source: 'LFO 1',
|
||||||
|
destination: 'Pitch',
|
||||||
|
modIntensity: 0,
|
||||||
|
},
|
||||||
|
patch4: {
|
||||||
|
source: 'LFO 2',
|
||||||
|
destination: 'Pitch',
|
||||||
|
modIntensity: 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'patches2': {
|
||||||
|
id: 'patches2',
|
||||||
|
patch1: {
|
||||||
|
source: 'Filter EG',
|
||||||
|
destination: 'Pitch',
|
||||||
|
modIntensity: 0,
|
||||||
|
},
|
||||||
|
patch2: {
|
||||||
|
source: 'Filter EG',
|
||||||
destination: 'Pitch',
|
destination: 'Pitch',
|
||||||
modIntensity: 0,
|
modIntensity: 0,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -49,8 +49,12 @@ const timbreSlice = createSlice({
|
|||||||
lfo2: 'lfo6',
|
lfo2: 'lfo6',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
currentTimbre: 'timbre1',
|
||||||
}),
|
}),
|
||||||
reducers: {
|
reducers: {
|
||||||
|
timbreCurrentUpdate(state, action) {
|
||||||
|
state.currentTimbre = action.payload;
|
||||||
|
},
|
||||||
timbreAdded: timbreAdapter.addOne,
|
timbreAdded: timbreAdapter.addOne,
|
||||||
timbreUpdated: timbreAdapter.updateOne,
|
timbreUpdated: timbreAdapter.updateOne,
|
||||||
},
|
},
|
||||||
@@ -63,6 +67,10 @@ export const {
|
|||||||
selectIds,
|
selectIds,
|
||||||
} = timbreAdapter.getSelectors((state) => state.timbres);
|
} = timbreAdapter.getSelectors((state) => state.timbres);
|
||||||
|
|
||||||
export const { timbreAdded, timbreUpdated } = timbreSlice.actions;
|
export const {
|
||||||
|
timbreCurrentUpdate,
|
||||||
|
timbreAdded,
|
||||||
|
timbreUpdated,
|
||||||
|
} = timbreSlice.actions;
|
||||||
|
|
||||||
export default timbreSlice.reducer;
|
export default timbreSlice.reducer;
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import Timbre from './Timbre';
|
||||||
|
import Vocoder from './Vocoder';
|
||||||
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
|
import { timbreCurrentUpdate } from './timbreSlice';
|
||||||
|
|
||||||
|
export default function TimbreSwitcher(props) {
|
||||||
|
const currentTimbre = useSelector((state) => state.timbres.currentTimbre);
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
|
function handleClick(e, value) {
|
||||||
|
e.preventDefault();
|
||||||
|
dispatch(timbreCurrentUpdate(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
<button onClick={(e) => handleClick(e, 'timbre1')}>
|
||||||
|
set to timbre 1
|
||||||
|
</button>
|
||||||
|
<button onClick={(e) => handleClick(e, 'timbre2')}>
|
||||||
|
set to timbre 2
|
||||||
|
</button>
|
||||||
|
<button onClick={(e) => handleClick(e, 'vocoder')}>
|
||||||
|
set to vocoder
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{currentTimbre === 'timbre1' ? (
|
||||||
|
<Timbre id="timbre1" />
|
||||||
|
) : currentTimbre === 'timbre2' ? (
|
||||||
|
<Timbre id="timbre2" />
|
||||||
|
) : (
|
||||||
|
<Vocoder id="vocoder" />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user