Closed Bug 880579 Opened 11 years ago Closed 6 years ago

Use floats to define volumes in audio.volume.* settings

Categories

(Firefox OS Graveyard :: General, defect)

All
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: mwu, Unassigned)

Details

From my comment bug 876334:

The main problem I have is exposing the int value in mozSettings. There's nothing special about having 16 different volume levels - it's just an implementation detail in AudioFlinger. I would argue it was actually a bad decision there too - it's usually only hardware mixers that require 2^n volume levels. For any audio buffers that come from the host side, float volume levels simply involve multiplying the sample. To work with AudioFlinger, we can just round(volume * max_volume_index). Gaia would have to make sure to use powers of twos to ensure the volume changes mean anything though.
Hi,

No matter we adjust volume by index or floating value, the most important thing is that how does gaia know what value is legal. Currently we hardcode the max_volume_index in sound_manager.js (gaia) so it can know what value is available to have a real level changing.

So I would like to propose we should have Web APIs for
  1. exposing how many levels are available on a specific AudioChannel.
     (ex: Normal/content channel is 15 levels but telephony is 5 levels)
     (ex: different audio backend may have different settings.)

  2. setting the volume directly not via settings, because 
     a. we can't pass the error back to Gaia side when error is occurred during ::observer(). 
     b. On the other hands, any apps declared setting permission can control the system volume. I would like to have individual permission to limit this.
     c. we can check the legal value in this web API not do it by Gaia itself only.

Does it make sense? Thanks.
Firefox OS is not being worked on
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.