Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Balance, Loudness and Surround #588

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/actions/equalizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@ function treble(player, values) {
return player.setTreble(level);
}

function loudness(player, values) {
const enable = values[0] === 'on';
return player.setLoudness(enable);
}

module.exports = function (api) {
api.registerAction('nightmode', nightMode);
api.registerAction('speechenhancement', speechEnhancement);
api.registerAction('bass', bass);
api.registerAction('treble', treble);
api.registerAction('loudness', loudness);
}
17 changes: 17 additions & 0 deletions lib/actions/surround.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict';

function surround(player, values) {
if (!player.hasSurround) {
return Promise.reject(new Error('This zone doesn\'t have Surround'));
}

const action = values[0];
const value = values[1];

return player.setSurround(action, value);

}

module.exports = function (api) {
api.registerAction('surround', surround);
}
21 changes: 18 additions & 3 deletions lib/actions/volume.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
'use strict';

function volume(player, values) {
var volume = values[0];
return player.setVolume(volume);
let channel;
let volume;
if (/^\d+$/i.test(values[0])) {
channel = 'Master';
volume = values[0];
} else {
channel = values[0];
volume = values[1];
}
return player.setVolume(volume, channel);
}

function balance(player, values) {
let level = values[0];
return player.setBalance(level);
}

function groupVolume(player, values) {
Expand All @@ -10,5 +24,6 @@ function groupVolume(player, values) {

module.exports = function (api) {
api.registerAction('volume', volume);
api.registerAction('balance', balance);
api.registerAction('groupvolume', groupVolume);
}
}