# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Ctors | Methods | Inherited Methods

# VolumeShaper.Configuration.Builder

`public static final class VolumeShaper.Configuration.Builder`
`extends Object` ``

java.lang.Object
↳ | android.media.VolumeShaper.Configuration.Builder

Builder class for a `VolumeShaper.Configuration` object.

Here is an example where `Builder` is used to define the `VolumeShaper.Configuration`.

     VolumeShaper.Configuration LINEAR_RAMP =
             new VolumeShaper.Configuration.Builder()
                 .setInterpolatorType(VolumeShaper.Configuration.INTERPOLATOR_TYPE_LINEAR)
                 .setCurve(new float[] { 0.f, 1.f }, // times
                           new float[] { 0.f, 1.f }) // volumes
                 .setDuration(1000)
                 .build();

## Summary

### Public constructors
`Builder()` Constructs a new `Builder` with the defaults.
`Builder(VolumeShaper.Configuration configuration)` Constructs a new `Builder` with settings copied from a given `VolumeShaper.Configuration`.

### Public methods
`VolumeShaper.Configuration` | `build()` Builds a new `VolumeShaper` object.
`VolumeShaper.Configuration.Builder` | `invertVolumes()` Inverts the volume curve so that the max volume becomes the min volume and vice versa.
`VolumeShaper.Configuration.Builder` | `reflectTimes()` Reflects the volume curve so that the shaper changes volume from the end to the start.
`VolumeShaper.Configuration.Builder` | `scaleToEndVolume(float volume)` Scale the curve end volume to a target value.
`VolumeShaper.Configuration.Builder` | `scaleToStartVolume(float volume)` Scale the curve start volume to a target value.
`VolumeShaper.Configuration.Builder` | `setCurve(float[] times, float[] volumes)` Sets the volume curve.
`VolumeShaper.Configuration.Builder` | `setDuration(long durationMillis)` Sets the `VolumeShaper` duration in milliseconds.
`VolumeShaper.Configuration.Builder` | `setInterpolatorType(int interpolatorType)` Sets the interpolator type.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.

## Public constructors

### Builder

    public Builder ()

Constructs a new `Builder` with the defaults.

### Builder

    public Builder (VolumeShaper.Configuration configuration)

Constructs a new `Builder` with settings copied from a given `VolumeShaper.Configuration`.

Parameters
`configuration` | `VolumeShaper.Configuration`: prototypical configuration which will be reused in the new `Builder`. This value cannot be `null`.

## Public methods

### build

    public VolumeShaper.Configuration build ()

Builds a new `VolumeShaper` object.

Returns
`VolumeShaper.Configuration` | a new `VolumeShaper` object. This value cannot be `null`.

Throws
`IllegalStateException` | if curve is not properly set.

### invertVolumes

    public VolumeShaper.Configuration.Builder invertVolumes ()

Inverts the volume curve so that the max volume becomes the min volume and vice versa.

Returns
`VolumeShaper.Configuration.Builder` | the same `Builder` instance. This value cannot be `null`.

Throws
`IllegalStateException` | if curve has not been set.

### reflectTimes

    public VolumeShaper.Configuration.Builder reflectTimes ()

Reflects the volume curve so that the shaper changes volume from the end to the start.

Returns
`VolumeShaper.Configuration.Builder` | the same `Builder` instance. This value cannot be `null`.

Throws
`IllegalStateException` | if curve has not been set.

### scaleToEndVolume

    public VolumeShaper.Configuration.Builder scaleToEndVolume (float volume)

Scale the curve end volume to a target value. Keeps the start volume the same. This works best if the volume curve is monotonic.

Parameters
`volume` | `float`: the target end volume to use.

Returns
`VolumeShaper.Configuration.Builder` | the same `Builder` instance. This value cannot be `null`.

Throws
`IllegalArgumentException` | if `volume` is not valid.
`IllegalStateException` | if curve has not been set.

### scaleToStartVolume

    public VolumeShaper.Configuration.Builder scaleToStartVolume (float volume)

Scale the curve start volume to a target value. Keeps the end volume the same. This works best if the volume curve is monotonic.

Parameters
`volume` | `float`: the target start volume to use.

Returns
`VolumeShaper.Configuration.Builder` | the same `Builder` instance. This value cannot be `null`.

Throws
`IllegalArgumentException` | if `volume` is not valid.
`IllegalStateException` | if curve has not been set.

### setCurve

    public VolumeShaper.Configuration.Builder setCurve (float[] times,
                    float[] volumes)

Sets the volume curve. The volume curve is represented by a set of control points given by two float arrays of equal length, one representing the time (x) coordinates and one corresponding to the volume (y) coordinates. The length must be at least 2 and no greater than `VolumeShaper.Configuration#getMaximumCurvePoints()`.

The volume curve is normalized as follows: time (x) coordinates should be monotonically increasing, from 0.f to 1.f; volume (y) coordinates must be within 0.f to 1.f.

The time scale is set by `setDuration(long)`.

Parameters
`times` | `float`: an array of float values representing the time line of the volume curve. This value cannot be `null`.
`volumes` | `float`: an array of float values representing the amplitude of the volume curve. This value cannot be `null`.

Returns
`VolumeShaper.Configuration.Builder` | the same `Builder` instance. This value cannot be `null`.

Throws
`IllegalArgumentException` | if `times` or `volumes` is invalid.

### setDuration

    public VolumeShaper.Configuration.Builder setDuration (long durationMillis)

Sets the `VolumeShaper` duration in milliseconds. If omitted, the default duration is 1 second.

Returns
`VolumeShaper.Configuration.Builder` | the same `Builder` instance. This value cannot be `null`.

Throws
`IllegalArgumentException` | if `durationMillis` is not strictly positive.

### setInterpolatorType

    public VolumeShaper.Configuration.Builder setInterpolatorType (int interpolatorType)

Sets the interpolator type. If omitted the default interpolator type is `VolumeShaper.Configuration.INTERPOLATOR_TYPE_CUBIC`.

Parameters
`interpolatorType` | `int`: method of interpolation used for the volume curve. One of `VolumeShaper.Configuration.INTERPOLATOR_TYPE_STEP`, `VolumeShaper.Configuration.INTERPOLATOR_TYPE_LINEAR`, `VolumeShaper.Configuration.INTERPOLATOR_TYPE_CUBIC`, `VolumeShaper.Configuration.INTERPOLATOR_TYPE_CUBIC_MONOTONIC`. Value is `VolumeShaper.Configuration.INTERPOLATOR_TYPE_STEP`, `VolumeShaper.Configuration.INTERPOLATOR_TYPE_LINEAR`, `VolumeShaper.Configuration.INTERPOLATOR_TYPE_CUBIC`, or `VolumeShaper.Configuration.INTERPOLATOR_TYPE_CUBIC_MONOTONIC`

Returns
`VolumeShaper.Configuration.Builder` | the same `Builder` instance. This value cannot be `null`.

Throws
`IllegalArgumentException` | if `interpolatorType` is not valid.

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*