From 93e838ceb346d5901a1a790571386e440ca7cf25 Mon Sep 17 00:00:00 2001 From: olivierjc <35304326+olivierjc@users.noreply.github.com> Date: Wed, 10 Jan 2018 17:36:16 +0100 Subject: [PATCH 1/7] Add base for SetLoudness --- lib/actions/equalizer.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/actions/equalizer.js b/lib/actions/equalizer.js index beba3655..8a547fa4 100644 --- a/lib/actions/equalizer.js +++ b/lib/actions/equalizer.js @@ -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); } From 5a46650028e65507f3ecf63369c02a681f2f3566 Mon Sep 17 00:00:00 2001 From: olivierjc <35304326+olivierjc@users.noreply.github.com> Date: Thu, 11 Jan 2018 17:23:06 +0100 Subject: [PATCH 2/7] Add support for Balance --- lib/actions/equalizer.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/actions/equalizer.js b/lib/actions/equalizer.js index 8a547fa4..c365a26e 100644 --- a/lib/actions/equalizer.js +++ b/lib/actions/equalizer.js @@ -25,10 +25,16 @@ function loudness(player, values) { return player.setLoudness(enable); } +function balance(player, values) { + const balance = parseInt(values[0]); + return player.setBalance(balance); +} + module.exports = function (api) { api.registerAction('nightmode', nightMode); api.registerAction('speechenhancement', speechEnhancement); api.registerAction('bass', bass); api.registerAction('treble', treble); api.registerAction('loudness', loudness); + api.registerAction('balance', balance); } From 3d876359df056b36ad43417bbd8da23051bfa9d3 Mon Sep 17 00:00:00 2001 From: olivierjc <35304326+olivierjc@users.noreply.github.com> Date: Thu, 11 Jan 2018 17:24:11 +0100 Subject: [PATCH 3/7] Add support for Balance --- lib/actions/volume.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/actions/volume.js b/lib/actions/volume.js index 31fe8eb2..a6d2bb20 100644 --- a/lib/actions/volume.js +++ b/lib/actions/volume.js @@ -1,7 +1,9 @@ 'use strict'; + function volume(player, values) { var volume = values[0]; - return player.setVolume(volume); + var channel = values[1] || 'Master'; + return player.setVolume(volume, channel); } function groupVolume(player, values) { @@ -11,4 +13,4 @@ function groupVolume(player, values) { module.exports = function (api) { api.registerAction('volume', volume); api.registerAction('groupvolume', groupVolume); -} \ No newline at end of file +} From 716827178fffc85b8272d25919f4e9f92d0cfbb4 Mon Sep 17 00:00:00 2001 From: olivierjc <35304326+olivierjc@users.noreply.github.com> Date: Mon, 15 Jan 2018 17:42:00 +0100 Subject: [PATCH 4/7] Update equalizer.js --- lib/actions/equalizer.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/actions/equalizer.js b/lib/actions/equalizer.js index c365a26e..8a547fa4 100644 --- a/lib/actions/equalizer.js +++ b/lib/actions/equalizer.js @@ -25,16 +25,10 @@ function loudness(player, values) { return player.setLoudness(enable); } -function balance(player, values) { - const balance = parseInt(values[0]); - return player.setBalance(balance); -} - module.exports = function (api) { api.registerAction('nightmode', nightMode); api.registerAction('speechenhancement', speechEnhancement); api.registerAction('bass', bass); api.registerAction('treble', treble); api.registerAction('loudness', loudness); - api.registerAction('balance', balance); } From 99e964499c648391e6f1cafc0d0a28780e905082 Mon Sep 17 00:00:00 2001 From: olivierjc <35304326+olivierjc@users.noreply.github.com> Date: Mon, 15 Jan 2018 17:42:40 +0100 Subject: [PATCH 5/7] Create surround.js --- lib/actions/surround.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 lib/actions/surround.js diff --git a/lib/actions/surround.js b/lib/actions/surround.js new file mode 100644 index 00000000..32d81551 --- /dev/null +++ b/lib/actions/surround.js @@ -0,0 +1,20 @@ +'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) + + return Promise.resolve({ + message: 'Valid options are on, off, mode, level, musiclevel' + }); +} + +module.exports = function (api) { + api.registerAction('surround', surround); +} From 49e2b88a0f8662d5fa0e7592385992a4c37eecd3 Mon Sep 17 00:00:00 2001 From: olivierjc <35304326+olivierjc@users.noreply.github.com> Date: Mon, 15 Jan 2018 17:43:03 +0100 Subject: [PATCH 6/7] Update volume.js --- lib/actions/volume.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/actions/volume.js b/lib/actions/volume.js index a6d2bb20..fcc7c75b 100644 --- a/lib/actions/volume.js +++ b/lib/actions/volume.js @@ -1,16 +1,29 @@ 'use strict'; function volume(player, values) { - var volume = values[0]; - var channel = values[1] || 'Master'; + 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) { return player.coordinator.setGroupVolume(values[0]); } module.exports = function (api) { api.registerAction('volume', volume); + api.registerAction('balance', balance); api.registerAction('groupvolume', groupVolume); } From 19bd1b0f70279bec78cd53a514c935fdbd5c6e3d Mon Sep 17 00:00:00 2001 From: olivierjc <35304326+olivierjc@users.noreply.github.com> Date: Tue, 16 Jan 2018 09:43:08 +0100 Subject: [PATCH 7/7] Update surround.js --- lib/actions/surround.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/actions/surround.js b/lib/actions/surround.js index 32d81551..14c3a0e9 100644 --- a/lib/actions/surround.js +++ b/lib/actions/surround.js @@ -8,11 +8,8 @@ function surround(player, values) { const action = values[0]; const value = values[1]; - return player.setSurround(action, value) + return player.setSurround(action, value); - return Promise.resolve({ - message: 'Valid options are on, off, mode, level, musiclevel' - }); } module.exports = function (api) {