Skip to content

Commit

Permalink
UI: b/trackvolume.js: add data bubble with dB value
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Westerfeld <[email protected]>
  • Loading branch information
swesterfeld committed Nov 19, 2023
1 parent dbba95a commit 4801503
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ui/b/trackvolume.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ class BTrackVolume extends LitComponent {
updated (changed_props)
{
this.update_value();
var db_value = 20 * Math.log10 (2*this.value**3);
var db_string;
if (this.value === 0)
db_string = "-" + "\u221E";
else
db_string = db_value.toFixed (1);
this.setAttribute ('data-bubble', "Volume " + db_string + " dB");
}
async update_value()
{
Expand Down

0 comments on commit 4801503

Please sign in to comment.