Precached images. ToobTuner. key additions.

This commit is contained in:
Robin Davies
2022-02-23 04:29:21 -05:00
parent ac51296782
commit f677b8b608
24 changed files with 589 additions and 137 deletions
+39 -5
View File
@@ -25,7 +25,7 @@ import createStyles from '@mui/styles/createStyles';
import withStyles from '@mui/styles/withStyles';
import IControlViewFactory from './IControlViewFactory';
import { PiPedalModelFactory, PiPedalModel } from "./PiPedalModel";
import { PiPedalModelFactory, PiPedalModel,ControlValueChangedHandle } from "./PiPedalModel";
import { PedalBoardItem } from './PedalBoard';
import PluginControlView, { ControlGroup,ControlViewCustomization } from './PluginControlView';
import ToobFrequencyResponseView from './ToobFrequencyResponseView';
@@ -41,7 +41,7 @@ interface ToobToneStackProps extends WithStyles<typeof styles> {
}
interface ToobToneStackState {
isBaxandall: boolean;
}
const ToobToneStackView =
@@ -57,14 +57,48 @@ const ToobToneStackView =
super(props);
this.model = PiPedalModelFactory.getInstance();
this.state = {
isBaxandall: this.IsBaxandall()
}
}
IsBaxandall() : boolean {
return this.props.item.getControl("ampmodel").value === 2.0;
}
controlValueChangedHandle?: ControlValueChangedHandle;
componentDidMount()
{
this.controlValueChangedHandle = this.model.addControlValueChangeListener(
this.props.instanceId,
(key,value) => {
if (key === "ampmodel")
{
this.setState({isBaxandall: value === 2.0});
}
}
);
}
componentWillUnmount() {
if (this.controlValueChangedHandle)
{
this.model.removeControlValueChangeListener(this.controlValueChangedHandle);
this.controlValueChangedHandle = undefined;
}
}
ModifyControls(controls: (React.ReactNode| ControlGroup)[]): (React.ReactNode| ControlGroup)[]
{
controls.splice(0,0,
( <ToobFrequencyResponseView instanceId={this.props.instanceId} />)
);
if (this.state.isBaxandall)
{
controls.splice(0,0,
( <ToobFrequencyResponseView instanceId={this.props.instanceId}
minDb={-20} maxDb={20} />)
);
} else {
controls.splice(0,0,
( <ToobFrequencyResponseView instanceId={this.props.instanceId} />)
);
}
return controls;
}
render() {