All Packages Class Hierarchy This Package Previous Next Index
Class guinea.player.Volume
java.lang.Object
|
+----guinea.player.Volume
- public abstract class Volume
- extends Object
- implements Serializable
The Volume class is a base class used for expressing volume levels
is different scales. Three volume scales can be used: linear, decibel
and percent scale.
- See Also:
- VolumeLinear, VolumeDecibel, VolumePercent
Variable Index
- ·
FULL
-
- ·
SILENCE
-
- ·
VOLUME_DECIBEL
- The volume type for decibel scale.
- ·
VOLUME_LINEAR
- The volume type for linear scale.
- ·
VOLUME_PERCENT
- The volume type for percent scale.
Constructor Index
- ·
Volume()
-
Method Index
- ·
compareTo(Object)
-
- ·
dB2linear(double)
- Convert a decibel value to linear scale.
- ·
dBVolume()
- Get the volume level in decibel scale.
- ·
linear2dB(double)
- Convert a linear volume level to decibel scale.
- ·
linearVolume()
- Get the volume level in linear scale.
- ·
percentVolume()
- Get the volume level in percentage scale.
- ·
scaleVolume(int)
- Get the volume level in given scale.
- ·
toDecibel()
- Convert this volume object to a volume level object in decibel
scale.
- ·
toDecibel(double)
- Convert a given volume level to a volume level object in decibel
scale.
- ·
toDecibel(Volume)
- Convert a given volume object to a volume level object in decibel
scale.
- ·
toLinear()
- Convert this volume object to a volume level object in linear
scale.
- ·
toLinear(double)
- Convert a given volume level to a volume level object in linear
scale.
- ·
toLinear(Volume)
- Convert a given volume object to a volume level object in linear
scale.
- ·
toPercent()
- Convert this volume object to a volume level object in percent
scale.
- ·
toPercent(double)
- Convert a given volume level to a volume level object in percent
scale.
- ·
toPercent(Volume)
- Convert a given volume object to a volume level object in percent
scale.
- ·
toScale(int)
- Convert the volume level of this volume object to a given scale.
- ·
toScale(int, double)
- Convert a volume level to an instance of given volume scale.
- ·
toScale(int, Volume)
- Convert a volume level to an instance of given volume scale.
- ·
valueOf(String)
- Get a Volume object from a string.
- ·
volumeType()
- Get the volume scale type of this Volume object.
Variables
·
VOLUME_DECIBEL
public static final int VOLUME_DECIBEL
- The volume type for decibel scale.
·
VOLUME_LINEAR
public static final int VOLUME_LINEAR
- The volume type for linear scale.
·
VOLUME_PERCENT
public static final int VOLUME_PERCENT
- The volume type for percent scale.
·
SILENCE
public static final Volume SILENCE
·
FULL
public static final Volume FULL
Constructors
·
Volume
public Volume()
Methods
·
dBVolume
public abstract double dBVolume()
- Get the volume level in decibel scale.
- Returns:
- the volume in decibel scale as a double.
·
linearVolume
public abstract double linearVolume()
- Get the volume level in linear scale.
- Returns:
- the volume in linear scale as a double.
·
percentVolume
public double percentVolume()
- Get the volume level in percentage scale. The percentage scale
is the same as the linear scale but multiplied with 100 to
transform linear scale to percents.
- Returns:
- the volume in percent scale as a double.
·
scaleVolume
public double scaleVolume(int scale)
- Get the volume level in given scale.
- Parameters:
- scale - The scale in which the value is wanted.
- Returns:
- Volume level in given scale.
·
volumeType
public int volumeType()
- Get the volume scale type of this Volume object.
- Returns:
- the volume scale type, one of VOLUME_LINEAR, VOLUME_DECIBEL or
VOLUME_PERCENT.
·
toScale
public static Volume toScale(int scale,
Volume v)
- Convert a volume level to an instance of given volume scale.
- Parameters:
- scale - the volume scale to which to convert. Must be one of
VOLUME_LINEAR, VOLUME_DECIBEL or VOLUME_PERCENT.
- v - the Volume level to convert.
- Returns:
- a volume object in a given scale.
·
toScale
public static Volume toScale(int scale,
double v)
- Convert a volume level to an instance of given volume scale.
- Parameters:
- scale - the volume scale to which to convert. Must be one of
VOLUME_LINEAR, VOLUME_DECIBEL or VOLUME_PERCENT.
- v - the volume level as a double appropiate for the given scale.
- Returns:
- a volume object in a given scale.
·
toScale
public Volume toScale(int scale)
- Convert the volume level of this volume object to a given scale.
- Parameters:
- scale - the volume scale to which to convert. Must be one of
VOLUME_LINEAR, VOLUME_DECIBEL or VOLUME_PERCENT.
- Returns:
- a volume object converted to a given scale.
·
toDecibel
public Volume toDecibel()
- Convert this volume object to a volume level object in decibel
scale.
- Returns:
- a Volume object in decibel scale.
·
toDecibel
public static Volume toDecibel(Volume v)
- Convert a given volume object to a volume level object in decibel
scale.
- Parameters:
- v - a Volume level object.
- Returns:
- a Volume object in decibel scale.
·
toDecibel
public static Volume toDecibel(double v)
- Convert a given volume level to a volume level object in decibel
scale.
- Parameters:
- v - a double value in decibel scale.
- Returns:
- a Volume object in decibel scale.
·
toLinear
public Volume toLinear()
- Convert this volume object to a volume level object in linear
scale.
- Returns:
- a Volume object in linear scale.
·
toLinear
public static Volume toLinear(Volume v)
- Convert a given volume object to a volume level object in linear
scale.
- Parameters:
- v - a Volume level object.
- Returns:
- a Volume object in linear scale.
·
toLinear
public static Volume toLinear(double v)
- Convert a given volume level to a volume level object in linear
scale.
- Parameters:
- v - a double value in linear scale.
- Returns:
- a Volume object in linear scale.
·
toPercent
public Volume toPercent()
- Convert this volume object to a volume level object in percent
scale.
- Returns:
- a Volume object in percent scale.
·
toPercent
public static Volume toPercent(Volume v)
- Convert a given volume object to a volume level object in percent
scale.
- Parameters:
- v - a Volume level object.
- Returns:
- a Volume object in percent scale.
·
toPercent
public static Volume toPercent(double v)
- Convert a given volume level to a volume level object in percent
scale.
- Parameters:
- v - a double value in percent scale.
- Returns:
- a Volume object in percent scale.
·
compareTo
public int compareTo(Object o)
·
dB2linear
public static double dB2linear(double db)
- Convert a decibel value to linear scale.
- Parameters:
- db - value in decibel scale.
- Returns:
- the value in decibel scale converted to linear scale.
·
linear2dB
public static double linear2dB(double vol)
- Convert a linear volume level to decibel scale.
- Parameters:
- vol - value as linear volume level.
- Returns:
- the linear vol parameter converted to decibel scale.
·
valueOf
public static Volume valueOf(String s) throws NumberFormatException
- Get a Volume object from a string. If the string ends with 'dB',
the value is in decibel scale (ex.: the string '-6dB' returns
about 0.5). If the string ends with the percent sign '%', the scale
is interpreted in percent scale. Otherwise the linear scale is
assumed.
- Parameters:
- s - the string to convert.
- Returns:
- a volume value as a Volume object.
- Throws: NumberFormatException
- if the string doesn't represent
a valid volume level.
All Packages Class Hierarchy This Package Previous Next Index