diff options
author | Florrie <towerofnix@gmail.com> | 2019-01-24 23:32:42 -0400 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2019-01-24 23:32:42 -0400 |
commit | 5762a825d589704a53aaabb425d9470c726bbc0d (patch) | |
tree | 6b772bd8eccc16fd81dadca30ee65a6a56454de2 /ui.js | |
parent | b4e575f4ec8b65464f9a8f109ddf3907cf30b853 (diff) |
(v), (V) - Volume controls
"v" increases because it's lowercase and therefore more likely to be accidentally pressed, hence more likely to confuse the user when it decreases the volume (if it decreased the volume - since it increases the volume, it generally doesn't seem to have any effect until you've already discovered that v and V are used for volume controls).
Diffstat (limited to 'ui.js')
-rw-r--r-- | ui.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/ui.js b/ui.js index 4a8f0a4..67f1bf4 100644 --- a/ui.js +++ b/ui.js @@ -409,6 +409,10 @@ class AppElement extends FocusElement { this.togglePause() } else if (telc.isCaselessLetter(keyBuf, 'l')) { this.toggleLoop() + } else if (telc.isCharacter(keyBuf, 'v')) { + this.volUp() + } else if (telc.isCharacter(keyBuf, 'V')) { + this.volDown() } else if (telc.isEscape(keyBuf)) { this.clearPlayingTrack() } else if (telc.isShiftUp(keyBuf) || telc.isCaselessLetter(keyBuf, 'p')) { @@ -503,6 +507,14 @@ class AppElement extends FocusElement { this.player.toggleLoop() } + volUp(amount = 10) { + this.player.volUp(amount) + } + + volDown(amount = 10) { + this.player.volDown(amount) + } + stopPlaying() { // We emit this so playTrack doesn't immediately start a new track. // We aren't *actually* about to play a new track. @@ -1664,6 +1676,9 @@ class PlaybackInfoElement extends DisplayElement { if (player.isLooping) { this.progressTextLabel.text += ' [Looping]' } + if (player.volume !== 100) { + this.progressTextLabel.text += ` [Volume: ${Math.round(player.volume)}%]` + } this.fixLayout() } |