Add shift mute hotkey
This commit is contained in:
parent
68e008a9f5
commit
6659fc9e96
|
@ -44,8 +44,14 @@ const {
|
||||||
const {
|
const {
|
||||||
getPaiByTypeAndIndex,
|
getPaiByTypeAndIndex,
|
||||||
getDerivedMonitorSources,
|
getDerivedMonitorSources,
|
||||||
|
|
||||||
getClientSinkInputs,
|
getClientSinkInputs,
|
||||||
getModuleSinkInputs,
|
getModuleSinkInputs,
|
||||||
|
|
||||||
|
getClientSourceOutputs,
|
||||||
|
getModuleSourceOutputs,
|
||||||
|
|
||||||
|
getSinkSinkInputs,
|
||||||
} = require('../../selectors');
|
} = require('../../selectors');
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
@ -732,7 +738,7 @@ class Graph extends React.Component {
|
||||||
pais.forEach(pai => this.toggleMute(pai, !allMuted));
|
pais.forEach(pai => this.toggleMute(pai, !allMuted));
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleMute(pai, muted = !pai.muted) {
|
toggleMute(pai, muted = !pai.muted, shift = false) {
|
||||||
if (pai.muted === muted) {
|
if (pai.muted === muted) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -742,15 +748,30 @@ class Graph extends React.Component {
|
||||||
} else if (pai.type === 'sourceOutput') {
|
} else if (pai.type === 'sourceOutput') {
|
||||||
this.props.setSourceOutputMuteByIndex(pai.index, muted);
|
this.props.setSourceOutputMuteByIndex(pai.index, muted);
|
||||||
} else if (pai.type === 'sink') {
|
} else if (pai.type === 'sink') {
|
||||||
this.props.setSinkMute(pai.index, muted);
|
if (shift) {
|
||||||
|
const sinkInputs = getSinkSinkInputs(pai)({ pulse: this.props });
|
||||||
|
this.toggleAllMute(sinkInputs);
|
||||||
|
} else {
|
||||||
|
this.props.setSinkMute(pai.index, muted);
|
||||||
|
}
|
||||||
} else if (pai.type === 'source') {
|
} else if (pai.type === 'source') {
|
||||||
this.props.setSourceMute(pai.index, muted);
|
this.props.setSourceMute(pai.index, muted);
|
||||||
} else if (pai.type === 'client') {
|
} else if (pai.type === 'client') {
|
||||||
const sinkInputs = getClientSinkInputs(pai)({ pulse: this.props });
|
if (shift) {
|
||||||
this.toggleAllMute(sinkInputs);
|
const sourceOutputs = getClientSourceOutputs(pai)({ pulse: this.props });
|
||||||
|
this.toggleAllMute(sourceOutputs);
|
||||||
|
} else {
|
||||||
|
const sinkInputs = getClientSinkInputs(pai)({ pulse: this.props });
|
||||||
|
this.toggleAllMute(sinkInputs);
|
||||||
|
}
|
||||||
} else if (pai.type === 'module') {
|
} else if (pai.type === 'module') {
|
||||||
const sinkInputs = getModuleSinkInputs(pai)({ pulse: this.props });
|
if (shift) {
|
||||||
this.toggleAllMute(sinkInputs);
|
const sourceOutputs = getModuleSourceOutputs(pai)({ pulse: this.props });
|
||||||
|
this.toggleAllMute(sourceOutputs);
|
||||||
|
} else {
|
||||||
|
const sinkInputs = getModuleSinkInputs(pai)({ pulse: this.props });
|
||||||
|
this.toggleAllMute(sinkInputs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -776,6 +797,20 @@ class Graph extends React.Component {
|
||||||
this.toggleMute(pai);
|
this.toggleMute(pai);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hotKeyShiftMute() {
|
||||||
|
if (!this.state.selected) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const pai = dgoToPai.get(this.state.selected);
|
||||||
|
|
||||||
|
if (!pai) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.toggleMute(pai, undefined, true);
|
||||||
|
}
|
||||||
|
|
||||||
_hotKeyVolume(direction) {
|
_hotKeyVolume(direction) {
|
||||||
if (!this.state.selected) {
|
if (!this.state.selected) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -28,6 +28,7 @@ const keyMap = {
|
||||||
hotKeyVolumeUp: [ '*', '0' ],
|
hotKeyVolumeUp: [ '*', '0' ],
|
||||||
|
|
||||||
hotKeyMute: 'm',
|
hotKeyMute: 'm',
|
||||||
|
hotKeyShiftMute: 'M',
|
||||||
};
|
};
|
||||||
|
|
||||||
class MyHotKeys extends React.Component {
|
class MyHotKeys extends React.Component {
|
||||||
|
|
|
@ -26,6 +26,21 @@ const getModuleSinkInputs = module => state => pickBy(
|
||||||
state.pulse.infos.sinkInputs,
|
state.pulse.infos.sinkInputs,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const getClientSourceOutputs = client => state => pickBy(
|
||||||
|
so => so.clientIndex === client.index,
|
||||||
|
state.pulse.infos.sourceOutputs,
|
||||||
|
);
|
||||||
|
|
||||||
|
const getModuleSourceOutputs = module => state => pickBy(
|
||||||
|
so => so.moduleIndex === module.index,
|
||||||
|
state.pulse.infos.sourceOutputs,
|
||||||
|
);
|
||||||
|
|
||||||
|
const getSinkSinkInputs = sink => state => pickBy(
|
||||||
|
si => si.sinkIndex === sink.index,
|
||||||
|
state.pulse.infos.sinkInputs,
|
||||||
|
);
|
||||||
|
|
||||||
const getDerivedMonitorSources = createSelector(
|
const getDerivedMonitorSources = createSelector(
|
||||||
state => state.pulse.infos.sources,
|
state => state.pulse.infos.sources,
|
||||||
sources => map(source => ({
|
sources => map(source => ({
|
||||||
|
@ -39,6 +54,12 @@ const getDerivedMonitorSources = createSelector(
|
||||||
module.exports = {
|
module.exports = {
|
||||||
getPaiByTypeAndIndex,
|
getPaiByTypeAndIndex,
|
||||||
getDerivedMonitorSources,
|
getDerivedMonitorSources,
|
||||||
|
|
||||||
getClientSinkInputs,
|
getClientSinkInputs,
|
||||||
getModuleSinkInputs,
|
getModuleSinkInputs,
|
||||||
|
|
||||||
|
getClientSourceOutputs,
|
||||||
|
getModuleSourceOutputs,
|
||||||
|
|
||||||
|
getSinkSinkInputs,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user