Mute default source/sink if none selected
This commit is contained in:
parent
fb6ce97b55
commit
143dcce068
|
@ -55,6 +55,9 @@ const {
|
||||||
getModuleSourceOutputs,
|
getModuleSourceOutputs,
|
||||||
|
|
||||||
getSinkSinkInputs,
|
getSinkSinkInputs,
|
||||||
|
|
||||||
|
getDefaultSinkPai,
|
||||||
|
getDefaultSourcePai,
|
||||||
} = require('../../selectors');
|
} = require('../../selectors');
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
@ -980,6 +983,8 @@ class Graph extends React.Component {
|
||||||
|
|
||||||
hotKeyMute() {
|
hotKeyMute() {
|
||||||
if (!this.state.selected) {
|
if (!this.state.selected) {
|
||||||
|
const defaultSink = getDefaultSinkPai({ pulse: this.props });
|
||||||
|
this.toggleMute(defaultSink);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -994,6 +999,8 @@ class Graph extends React.Component {
|
||||||
|
|
||||||
hotKeyShiftMute() {
|
hotKeyShiftMute() {
|
||||||
if (!this.state.selected) {
|
if (!this.state.selected) {
|
||||||
|
const defaultSource = getDefaultSourcePai({ pulse: this.props });
|
||||||
|
this.toggleMute(defaultSource);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,11 @@ const {
|
||||||
prop,
|
prop,
|
||||||
path,
|
path,
|
||||||
filter,
|
filter,
|
||||||
|
find,
|
||||||
indexBy,
|
indexBy,
|
||||||
pickBy,
|
pickBy,
|
||||||
|
propEq,
|
||||||
|
values,
|
||||||
} = require('ramda');
|
} = require('ramda');
|
||||||
|
|
||||||
const { createSelector } = require('reselect');
|
const { createSelector } = require('reselect');
|
||||||
|
@ -51,6 +54,18 @@ const getDerivedMonitorSources = createSelector(
|
||||||
}), filter(source => source.monitorSourceIndex >= 0, sources)),
|
}), filter(source => source.monitorSourceIndex >= 0, sources)),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const getDefaultSourcePai = createSelector(
|
||||||
|
state => state.pulse.infos.sources,
|
||||||
|
state => state.pulse.serverInfo.defaultSourceName,
|
||||||
|
(sources, defaultSourceName) => find(propEq('name', defaultSourceName), values(sources)),
|
||||||
|
);
|
||||||
|
|
||||||
|
const getDefaultSinkPai = createSelector(
|
||||||
|
state => state.pulse.infos.sinks,
|
||||||
|
state => state.pulse.serverInfo.defaultSinkName,
|
||||||
|
(sinks, defaultSinkName) => find(propEq('name', defaultSinkName), values(sinks)),
|
||||||
|
);
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
getPaiByTypeAndIndex,
|
getPaiByTypeAndIndex,
|
||||||
getDerivedMonitorSources,
|
getDerivedMonitorSources,
|
||||||
|
@ -62,4 +77,7 @@ module.exports = {
|
||||||
getModuleSourceOutputs,
|
getModuleSourceOutputs,
|
||||||
|
|
||||||
getSinkSinkInputs,
|
getSinkSinkInputs,
|
||||||
|
|
||||||
|
getDefaultSinkPai,
|
||||||
|
getDefaultSourcePai,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user