Skip to content

Commit abf79e1

Browse files
committed
UI: b/trackvolume.js: add data bubble with dB value
Signed-off-by: Stefan Westerfeld <stefan@space.twc.de>
1 parent 9c0df38 commit abf79e1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ui/b/trackvolume.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ class BTrackVolume extends LitComponent {
6565
updated (changed_props)
6666
{
6767
this.update_value();
68+
var db_value = 20 * Math.log10 (2*this.value**3);
69+
var db_string;
70+
if (this.value === 0)
71+
db_string = "-" + "\u221E";
72+
else
73+
db_string = db_value.toFixed (1);
74+
this.setAttribute ('data-bubble', "Volume " + db_string + " dB");
6875
}
6976
async update_value()
7077
{

0 commit comments

Comments
 (0)