Commit b0503914 by krocard Committed by Oliver Woodman

Clarify that set/getVolume is in fact a linear gain.

The API is a lot more useful if apps can rely on the fact
that the gain is linear and applied to all channels.

This is already guaranty by AudioTrack and should be too
by any reasonable implementation.

PiperOrigin-RevId: 359706113
parent 27c8679c
...@@ -127,13 +127,17 @@ public interface Player { ...@@ -127,13 +127,17 @@ public interface Player {
void clearAuxEffectInfo(); void clearAuxEffectInfo();
/** /**
* Sets the audio volume, with 0 being silence and 1 being unity gain. * Sets the audio volume, with 0 being silence and 1 being unity gain (signal unchanged).
* *
* @param audioVolume The audio volume. * @param audioVolume Linear output gain to apply to all audio channels.
*/ */
void setVolume(float audioVolume); void setVolume(float audioVolume);
/** Returns the audio volume, with 0 being silence and 1 being unity gain. */ /**
* Returns the audio volume, with 0 being silence and 1 being unity gain (signal unchanged).
*
* @return The linear gain applied to all audio channels.
*/
float getVolume(); float getVolume();
/** /**
......
...@@ -428,7 +428,7 @@ public interface AudioSink { ...@@ -428,7 +428,7 @@ public interface AudioSink {
/** /**
* Sets the playback volume. * Sets the playback volume.
* *
* @param volume A volume in the range [0.0, 1.0]. * @param volume Linear output gain to apply to all channels. Should be in the range [0.0, 1.0].
*/ */
void setVolume(float volume); void setVolume(float volume);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment