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

added bass and treble control #226

Merged
merged 2 commits into from
Apr 21, 2024
Merged
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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ Please note: highlighting current playing favorite is not supported.
### **WORK IN PROGRESS**
-->
## Changelog

### WORK IN PROGRESS

(seb2010) Added support to control bass and treble of a player (NO updates of these states on external events!)

### 3.0.0 (2023-10-09)
* (udondan) Added support for the playing Sonos playlists (added new state `playlist_set`)
* (bluefox) The minimal node.js version is 16
Expand Down
32 changes: 32 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ function startAdapter(options) {
}
} else if (id.state === 'volume') {
promise = player.setVolume(state.val);
} else if (id.state === 'treble') {
promise = player.setTreble(state.val);
} else if (id.state === 'bass') {
promise = player.setBass(state.val);
} else if (id.state === 'state') {
//stop,play,pause,next,previous,mute,unmute
if (state.val && typeof state.val === 'string') {
Expand Down Expand Up @@ -608,6 +612,28 @@ async function createChannel(name, ip, room) {
desc: 'State and control of volume',
name: 'Player volume'
},
treble: {
// level.treble - treble level (only write)
type: 'number',
read: false,
write: true,
role: 'level.treble',
min: -10,
max: 10,
desc: 'State and control of treble',
name: 'Player treble'
},
bass: {
// level.bass - bass level (only write)
type: 'number',
read: false,
write: true,
role: 'level.bass',
min: -10,
max: 10,
desc: 'State and control of bass',
name: 'Player bass'
},
muted: {
// media.muted - is muted (read only)
def: false,
Expand Down Expand Up @@ -1780,6 +1806,12 @@ function processSonosEvents(event, data) {
adapter.log.debug(`volume: Volume for ${player.baseUrl}: ${data.newVolume}`);
}
}
} else if (event === 'treble') {
// node-sonos-discovery is not emitting any events on treble changes yet, so it is not
// possible to get the externally set treble value, yet.
} else if (event === 'bass') {
// node-sonos-discovery is not emitting any events on bass changes yet, so it is not
// possible to get the externally set bass value, yet.
} else if (event === 'mute') {
// {
// uuid: _this.uuid,
Expand Down
Loading