diff --git a/components/graph/index.js b/components/graph/index.js index f8e239c..7316bdd 100644 --- a/components/graph/index.js +++ b/components/graph/index.js @@ -55,6 +55,9 @@ const { getModuleSourceOutputs, getSinkSinkInputs, + + getDefaultSinkPai, + getDefaultSourcePai, } = require('../../selectors'); const { @@ -980,6 +983,8 @@ class Graph extends React.Component { hotKeyMute() { if (!this.state.selected) { + const defaultSink = getDefaultSinkPai({ pulse: this.props }); + this.toggleMute(defaultSink); return; } @@ -994,6 +999,8 @@ class Graph extends React.Component { hotKeyShiftMute() { if (!this.state.selected) { + const defaultSource = getDefaultSourcePai({ pulse: this.props }); + this.toggleMute(defaultSource); return; } diff --git a/selectors/index.js b/selectors/index.js index 622de62..0a00846 100644 --- a/selectors/index.js +++ b/selectors/index.js @@ -4,8 +4,11 @@ const { prop, path, filter, + find, indexBy, pickBy, + propEq, + values, } = require('ramda'); const { createSelector } = require('reselect'); @@ -51,6 +54,18 @@ const getDerivedMonitorSources = createSelector( }), 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 = { getPaiByTypeAndIndex, getDerivedMonitorSources, @@ -62,4 +77,7 @@ module.exports = { getModuleSourceOutputs, getSinkSinkInputs, + + getDefaultSinkPai, + getDefaultSourcePai, };