Handle volume up/down for clients/modules
This commit is contained in:
parent
810c77cc85
commit
d9f178f1f6
|
@ -1079,23 +1079,7 @@ class Graph extends React.Component {
|
||||||
this.toggleMute(pai, undefined, sourceBiased);
|
this.toggleMute(pai, undefined, sourceBiased);
|
||||||
}
|
}
|
||||||
|
|
||||||
_hotKeyVolume(direction) {
|
_volume(pai, direction) {
|
||||||
let pai;
|
|
||||||
|
|
||||||
if (this.state.selected) {
|
|
||||||
pai = dgoToPai.get(this.state.selected);
|
|
||||||
} else {
|
|
||||||
pai = getDefaultSinkPai({ pulse: this.props });
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pai) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (![ 'sink', 'source', 'sinkInput', 'sourceOutput' ].includes(pai.type)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { lockChannelsTogether, maxVolume, volumeStep } = this.props.preferences;
|
const { lockChannelsTogether, maxVolume, volumeStep } = this.props.preferences;
|
||||||
|
|
||||||
const d = direction === 'up' ? 1 : -1;
|
const d = direction === 'up' ? 1 : -1;
|
||||||
|
@ -1121,6 +1105,41 @@ class Graph extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_volumeAll(pais, direction) {
|
||||||
|
forEach(pai => this._volume(pai, direction), values(pais));
|
||||||
|
}
|
||||||
|
|
||||||
|
_hotKeyVolume(direction) {
|
||||||
|
let pai;
|
||||||
|
|
||||||
|
if (this.state.selected) {
|
||||||
|
pai = dgoToPai.get(this.state.selected);
|
||||||
|
} else {
|
||||||
|
pai = getDefaultSinkPai({ pulse: this.props });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pai) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pai.type === 'client') {
|
||||||
|
const sinkInputs = getClientSinkInputs(pai)({ pulse: this.props });
|
||||||
|
this._volumeAll(sinkInputs, direction);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (pai.type === 'module') {
|
||||||
|
const sinkInputs = getModuleSinkInputs(pai)({ pulse: this.props });
|
||||||
|
this._volumeAll(sinkInputs, direction);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (![ 'sink', 'source', 'sinkInput', 'sourceOutput' ].includes(pai.type)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._volume(pai, direction);
|
||||||
|
}
|
||||||
|
|
||||||
hotKeyVolumeDown() {
|
hotKeyVolumeDown() {
|
||||||
this._hotKeyVolume('down');
|
this._hotKeyVolume('down');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user