-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MIDI plugins -- partial implemetnation, temporarily disabled.
- Loading branch information
Showing
24 changed files
with
892 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
// Copyright (c) 2022 Robin Davies | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
// this software and associated documentation files (the "Software"), to deal in | ||
// the Software without restriction, including without limitation the rights to | ||
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
// the Software, and to permit persons to whom the Software is furnished to do so, | ||
// subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in all | ||
// copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
import React from 'react'; | ||
import Button from '@mui/material/Button'; | ||
import DialogEx from './DialogEx'; | ||
import DialogActions from '@mui/material/DialogActions'; | ||
import DialogContent from '@mui/material/DialogContent'; | ||
import Typography from '@mui/material/Typography'; | ||
import ResizeResponsiveComponent from './ResizeResponsiveComponent'; | ||
import Divider from '@mui/material/Divider'; | ||
//import TextFieldEx from './TextFieldEx'; | ||
|
||
|
||
export interface ChannelBindingHelpDialogProps { | ||
open: boolean, | ||
onClose: () => void, | ||
}; | ||
|
||
export interface ChannelBindingHelpDialogState { | ||
fullScreen: boolean; | ||
}; | ||
|
||
export default class ChannelBindingHelpDialog extends ResizeResponsiveComponent<ChannelBindingHelpDialogProps, ChannelBindingHelpDialogState> { | ||
|
||
refText: React.RefObject<HTMLInputElement>; | ||
|
||
constructor(props: ChannelBindingHelpDialogProps) { | ||
super(props); | ||
this.state = { | ||
fullScreen: false | ||
}; | ||
this.refText = React.createRef<HTMLInputElement>(); | ||
} | ||
mounted: boolean = false; | ||
|
||
|
||
|
||
onWindowSizeChanged(width: number, height: number): void | ||
{ | ||
this.setState({fullScreen: height < 200}) | ||
} | ||
|
||
|
||
componentDidMount() | ||
{ | ||
super.componentDidMount(); | ||
this.mounted = true; | ||
} | ||
componentWillUnmount() | ||
{ | ||
super.componentWillUnmount(); | ||
this.mounted = false; | ||
} | ||
|
||
componentDidUpdate() | ||
{ | ||
} | ||
render() { | ||
let props = this.props; | ||
let { open, onClose } = props; | ||
|
||
const handleClose = () => { | ||
onClose(); | ||
}; | ||
|
||
return ( | ||
<DialogEx tag="bindingHelp" open={open} fullWidth maxWidth="sm" | ||
onClose={handleClose} | ||
aria-labelledby="Rename-dialog-title" | ||
style={{userSelect: "none"}} | ||
fullwidth | ||
onEnterKey={()=>{}} | ||
> | ||
<DialogContent style={{minHeight: 96}}> | ||
<Typography variant="h5" style={{marginBottom: 8}}> | ||
MIDI Control Binding Priority | ||
</Typography> | ||
<div style={{fontSize: "0.9em", lineHeight: "18pt" }}> | ||
<p style={{lineHeight: "1.4em"}}>MIDI Channel Filters determine which MIDI messages get sent to a plugin that accepts MIDI messages. Note that the | ||
MIDI Channel Filters do NOT affect system MIDI bindings or control bindings. | ||
</p> | ||
<p> | ||
MIDI message processing occurs in the following order | ||
</p> | ||
<ul> | ||
<li>If the message is a Program Change message, the message is first offered to any MIDI plugins in the currently loaded preset (Message Filters permitting). | ||
The message is sent to each MIDI plugin in the current preset that wants it. If any MIDI plugin accepts the program change, | ||
no futher processing occurs. Specifically, the program change will not change the currently selected PiPedal preset. | ||
<br/> | ||
</li> | ||
<li> | ||
If the message is a Program Change message, and no MIDI plugin has accepted the message, PiPedal selects the PiPedal preset that corresponds | ||
to the requested program. | ||
<br/> | ||
</li> | ||
<li> | ||
The message is then checked to see if it has been bound to a Pipedal feature using the System Midi Bindings settings. If it has, | ||
Pipedal processes the message, and it is not forwarded to MIDI plugins. | ||
<br/> | ||
</li> | ||
<li> | ||
Otherwise, the message is sent to each MIDI plugin in the currently loaded Pipedal preset (channel filters permitting).) | ||
<br/> | ||
</li> | ||
</ul> | ||
</div> | ||
|
||
</DialogContent> | ||
<Divider/> | ||
<DialogActions style={{flexShrink: 1}}> | ||
<Button onClick={handleClose} variant="dialogPrimary" > | ||
OK | ||
</Button> | ||
</DialogActions> | ||
</DialogEx> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright (c) 2024 Robin E. R. Davies | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
// this software and associated documentation files (the "Software"), to deal in | ||
// the Software without restriction, including without limitation the rights to | ||
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
// the Software, and to permit persons to whom the Software is furnished to do so, | ||
// subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in all | ||
// copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
|
||
export enum MidiDeviceSelection { | ||
DeviceAny = 0, | ||
DeviceNone = 1, | ||
DeviceList = 2 | ||
} | ||
|
||
export default class MidiChannelBinding { | ||
deserialize(input: any) : MidiChannelBinding { | ||
this.deviceSelection = input.deviceSelection; | ||
this.midiDevices = input.midiDevices; | ||
|
||
this.channel = input.channel; | ||
this.acceptProgramChanges = input.acceptProgramChanges; | ||
this.acceptCommonMessages = input.acceptCommonMessages; | ||
return this; | ||
} | ||
|
||
clone() { return new MidiChannelBinding().deserialize(this);} | ||
|
||
deviceSelection: number = MidiDeviceSelection.DeviceAny as number; | ||
midiDevices: string[] = []; | ||
channel: number = -1; | ||
acceptProgramChanges: boolean = true; | ||
acceptCommonMessages: boolean = true; | ||
|
||
|
||
static CreateMissingValue() : MidiChannelBinding { | ||
let result = new MidiChannelBinding(); | ||
return result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
// Copyright (c) 2024 Robin E. R. Davies | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
// this software and associated documentation files (the "Software"), to deal in | ||
// the Software without restriction, including without limitation the rights to | ||
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
// the Software, and to permit persons to whom the Software is furnished to do so, | ||
// subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in all | ||
// copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
import React from 'react'; | ||
|
||
import { Component } from 'react'; | ||
import { Theme } from '@mui/material/styles'; | ||
import { WithStyles } from '@mui/styles'; | ||
import withStyles from '@mui/styles/withStyles'; | ||
import { PiPedalModel, PiPedalModelFactory } from './PiPedalModel'; | ||
import { pluginControlStyles } from './PluginControl'; | ||
import MidiChannelBinding from './MidiChannelBinding'; | ||
import Tooltip from '@mui/material/Tooltip'; | ||
import Typography from '@mui/material/Typography'; | ||
import Divider from '@mui/material/Divider'; | ||
import ButtonBase from '@mui/material/ButtonBase'; | ||
import { ReactComponent as MidiIcon } from "./svg/ic_midi.svg"; | ||
import MidiChannelBindingDialog from './MidiChannelBindingDialog'; | ||
|
||
|
||
export const StandardItemSize = { width: 80, height: 140 } | ||
|
||
|
||
|
||
export interface MidiChannelBindingControlProps extends WithStyles<typeof pluginControlStyles> { | ||
midiChannelBinding: MidiChannelBinding | ||
theme: Theme; | ||
onChange: (result: MidiChannelBinding) => void; | ||
} | ||
type MidiChannelBindingControlState = { | ||
dialogOpen: boolean; | ||
}; | ||
|
||
const MidiChannelBindingControl = | ||
withStyles(pluginControlStyles, { withTheme: true })( | ||
class extends Component<MidiChannelBindingControlProps, MidiChannelBindingControlState> { | ||
model: PiPedalModel; | ||
|
||
constructor(props: MidiChannelBindingControlProps) { | ||
super(props); | ||
|
||
this.state = { | ||
dialogOpen: false | ||
}; | ||
this.model = PiPedalModelFactory.getInstance(); | ||
|
||
} | ||
|
||
render() { | ||
let classes = this.props.classes; | ||
let item_width = 80; | ||
return ( | ||
<div | ||
className={classes.controlFrame} | ||
style={{ width: item_width }} | ||
> | ||
{/* TITLE SECTION */} | ||
<div className={this.props.classes.titleSection} | ||
style={ | ||
{ | ||
alignSelf: "stretch" | ||
|
||
}}> | ||
<Tooltip title={( | ||
<React.Fragment> | ||
<Typography variant="caption">title</Typography> | ||
<Divider /> | ||
<Typography variant="caption">Controls which MIDI messages get forward to the instrument.</Typography> | ||
|
||
</React.Fragment> | ||
)} | ||
placement="top-start" arrow enterDelay={1500} enterNextDelay={1500} | ||
> | ||
<Typography variant="caption" display="block" noWrap style={{ | ||
width: "100%", | ||
textAlign: "center" | ||
}}> MIDI</Typography> | ||
</Tooltip> | ||
|
||
</div> | ||
{/* CONTROL SECTION */} | ||
|
||
<div className={this.props.classes.midSection}> | ||
<ButtonBase style={{ width: 48, height: 48, borderRadius: 9999 }} | ||
onClick={()=> { | ||
this.setState({dialogOpen: true}); | ||
}} | ||
sx={{ | ||
':hover': { | ||
bgcolor: 'action.hover', // theme.palette.primary.main | ||
color: 'white', | ||
}, | ||
}} | ||
> | ||
<MidiIcon fill={this.props.theme.palette.text.secondary} style={{ width: 36, height: 36 }} /> | ||
</ButtonBase> | ||
</div> | ||
<div className={this.props.classes.editSection} | ||
style={{ display: "flex", flexFlow: "column nowrap", justifyContent: "center" }} | ||
> | ||
<Typography variant="caption" display="block" noWrap | ||
style={{ width: "100%", textAlign: "center" }} | ||
>OMNI</Typography> | ||
</div> | ||
{this.state.dialogOpen&&( | ||
<MidiChannelBindingDialog | ||
open={this.state.dialogOpen} | ||
midiChannelBinding={this.props.midiChannelBinding} | ||
onClose={() =>{ this.setState({dialogOpen: false});}} | ||
onChanged={(midiChannelBinding: MidiChannelBinding)=> {}} | ||
midiDevices={[]} | ||
|
||
/> | ||
|
||
)} | ||
</div > | ||
); | ||
} | ||
}); | ||
|
||
export default MidiChannelBindingControl; | ||
|
Oops, something went wrong.