From 63efc3e2a0f824142c4fa7b344b105c3a6467681 Mon Sep 17 00:00:00 2001
From: "[poww10s]" <[theironminer@gmail.com]>
Date: Fri, 20 Nov 2020 08:02:37 -0500
Subject: [PATCH] section switching added
---
src/App.js | 7 +---
src/features/timbre/Timbre.js | 2 +-
src/features/timbre/parameters/Levels.js | 16 ++++++++
.../timbre/parameters/Parameters.module.css | 17 +++++++-
src/features/timbre/parameters/Patches.js | 4 +-
.../timbre/parameters/parameterSlice.js | 25 +++++++++++-
src/features/timbre/timbreSlice.js | 10 ++++-
src/features/timbre/timbreSwitcher.js | 40 +++++++++++++++++++
8 files changed, 110 insertions(+), 11 deletions(-)
create mode 100644 src/features/timbre/parameters/Levels.js
create mode 100644 src/features/timbre/timbreSwitcher.js
diff --git a/src/App.js b/src/App.js
index f02b37c..c69195a 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,15 +1,12 @@
import React from 'react';
-import Timbre from './features/timbre/Timbre';
-import Vocoder from './features/timbre/Vocoder';
+import TimbreSwitcher from './features/timbre/timbreSwitcher';
import './App.css';
function App() {
return (
);
diff --git a/src/features/timbre/Timbre.js b/src/features/timbre/Timbre.js
index c968b4b..493fe1b 100644
--- a/src/features/timbre/Timbre.js
+++ b/src/features/timbre/Timbre.js
@@ -123,9 +123,9 @@ export default function Timbre(props) {
+
-
selectById(state, props.id));
+ const dispatch = useDispatch();
+
+ return (
+
+
+
+ );
+}
diff --git a/src/features/timbre/parameters/Parameters.module.css b/src/features/timbre/parameters/Parameters.module.css
index 0900284..c12267e 100644
--- a/src/features/timbre/parameters/Parameters.module.css
+++ b/src/features/timbre/parameters/Parameters.module.css
@@ -26,7 +26,22 @@
width: 420px;
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;
width: 100%;
margin: 10pt 0;
diff --git a/src/features/timbre/parameters/Patches.js b/src/features/timbre/parameters/Patches.js
index 96c6b72..27e4f54 100644
--- a/src/features/timbre/parameters/Patches.js
+++ b/src/features/timbre/parameters/Patches.js
@@ -6,7 +6,7 @@ import styles from './Parameters.module.css';
const Patch = (props) => {
return (
-
+
Source
+
diff --git a/src/features/timbre/parameters/parameterSlice.js b/src/features/timbre/parameters/parameterSlice.js
index a9c52f2..adc473c 100644
--- a/src/features/timbre/parameters/parameterSlice.js
+++ b/src/features/timbre/parameters/parameterSlice.js
@@ -273,7 +273,30 @@ const parametersSlice = createSlice({
modIntensity: 0,
},
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',
modIntensity: 0,
},
diff --git a/src/features/timbre/timbreSlice.js b/src/features/timbre/timbreSlice.js
index 5e33a51..da4b94e 100644
--- a/src/features/timbre/timbreSlice.js
+++ b/src/features/timbre/timbreSlice.js
@@ -49,8 +49,12 @@ const timbreSlice = createSlice({
lfo2: 'lfo6',
},
},
+ currentTimbre: 'timbre1',
}),
reducers: {
+ timbreCurrentUpdate(state, action) {
+ state.currentTimbre = action.payload;
+ },
timbreAdded: timbreAdapter.addOne,
timbreUpdated: timbreAdapter.updateOne,
},
@@ -63,6 +67,10 @@ export const {
selectIds,
} = timbreAdapter.getSelectors((state) => state.timbres);
-export const { timbreAdded, timbreUpdated } = timbreSlice.actions;
+export const {
+ timbreCurrentUpdate,
+ timbreAdded,
+ timbreUpdated,
+} = timbreSlice.actions;
export default timbreSlice.reducer;
diff --git a/src/features/timbre/timbreSwitcher.js b/src/features/timbre/timbreSwitcher.js
new file mode 100644
index 0000000..aa03ab4
--- /dev/null
+++ b/src/features/timbre/timbreSwitcher.js
@@ -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 (
+
+
+
+
+
+
+
+ {currentTimbre === 'timbre1' ? (
+
+ ) : currentTimbre === 'timbre2' ? (
+
+ ) : (
+
+ )}
+
+
+ );
+}