# VolumeShaper.Configuration

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Configuration

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/media/VolumeShaper.Configuration "View this page in Java")  

```
class Configuration : Parcelable
```

|---|--------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                       ||
| ↳ | [android.media.VolumeShaper.Configuration](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#) |

The`VolumeShaper.Configuration`class contains curve and duration information. It is constructed by the[VolumeShaper.Configuration.Builder](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration.Builder).

A`VolumeShaper.Configuration`is used by[VolumeAutomation.createVolumeShaper(Configuration)](https://developer.android.com/reference/kotlin/android/media/VolumeAutomation#createVolumeShaper(android.media.VolumeShaper.Configuration))to create a`VolumeShaper`and by[VolumeShaper.replace(Configuration, Operation, boolean)](https://developer.android.com/reference/kotlin/android/media/VolumeShaper#replace(android.media.VolumeShaper.Configuration,%20android.media.VolumeShaper.Operation,%20kotlin.Boolean))to replace an existing`configuration`.

The[AudioTrack](https://developer.android.com/reference/kotlin/android/media/AudioTrack)and[MediaPlayer](https://developer.android.com/reference/kotlin/android/media/MediaPlayer)classes implement the[VolumeAutomation](https://developer.android.com/reference/kotlin/android/media/VolumeAutomation)interface.

## Summary

|                                                                                                                         Nested classes                                                                                                                         ||
|---|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|   | [Builder](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration.Builder) Builder class for a[VolumeShaper.Configuration](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#)object. |

|                                                                                                                                                           Constants                                                                                                                                                            ||
|----------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [INTERPOLATOR_TYPE_CUBIC](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#INTERPOLATOR_TYPE_CUBIC:kotlin.Int) Cubic interpolated volume curve.                                                       |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [INTERPOLATOR_TYPE_CUBIC_MONOTONIC](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#INTERPOLATOR_TYPE_CUBIC_MONOTONIC:kotlin.Int) Cubic interpolated volume curve that preserves local monotonicity. |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [INTERPOLATOR_TYPE_LINEAR](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#INTERPOLATOR_TYPE_LINEAR:kotlin.Int) Linear interpolated volume curve.                                                    |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [INTERPOLATOR_TYPE_STEP](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#INTERPOLATOR_TYPE_STEP:kotlin.Int) Stepwise volume curve.                                                                   |

| Inherited constants ||
|---|---|
| From class[Parcelable](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#) |----------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [CONTENTS_FILE_DESCRIPTOR](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR:kotlin.Int) <br /> Descriptor bit used with[describeContents()](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#describeContents()): indicates that the Parcelable object's flattened representation includes a file descriptor. <br />                                                                                                                                                                                                        | | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int) <br /> Flag for use with[writeToParcel](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#writeToParcel(android.os.Parcel,%20kotlin.Int)): the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`". Some implementations may want to release resources at this point. <br /> | ||

|                                                                                                                                                                                                                 Public methods                                                                                                                                                                                                                  ||
|--------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                 | [describeContents](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#describeContents())`()` <br />                                                                                                                                                                                                           |
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)         | [equals](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#equals(kotlin.Any))`(`other:` `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?`)` <br />                                                                                                                               |
| [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)               | [getDuration](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#getDuration())`()` Returns the duration of the volume shape in milliseconds.                                                                                                                                                                  |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                 | [getInterpolatorType](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#getInterpolatorType())`()` Returns the interpolator type.                                                                                                                                                                             |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)           | [getMaximumCurvePoints](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#getMaximumCurvePoints())`()` Returns the maximum number of curve points allowed for VolumeShaper.                                                                                                                                   |
| [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)! | [getTimes](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#getTimes())`()` Returns the times (x) coordinate array of the volume curve points.                                                                                                                                                               |
| [FloatArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float-array/index.html)! | [getVolumes](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#getVolumes())`()` Returns the volumes (y) coordinate array of the volume curve points.                                                                                                                                                         |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                 | [hashCode](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#hashCode())`()` <br />                                                                                                                                                                                                                           |
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)           | [toString](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#toString())`()` <br />                                                                                                                                                                                                                           |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)               | [writeToParcel](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#writeToParcel(android.os.Parcel,%20kotlin.Int))`(`dest:` `[Parcel](https://developer.android.com/reference/kotlin/android/os/Parcel.html#)`, `flags:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` <br /> |

|                                                                                                                                                                                                                                        Properties                                                                                                                                                                                                                                         ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| static[Parcelable.Creator](https://developer.android.com/reference/kotlin/android/os/Parcelable.Creator.html#)\<[VolumeShaper.Configuration](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#)!\> | [CREATOR](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#CREATOR:android.os.Parcelable.Creator) <br />                                                                                                |
| static[VolumeShaper.Configuration](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#)!                                                                                                             | [CUBIC_RAMP](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#CUBIC_RAMP:android.media.VolumeShaper.Configuration) A one second cubic ramp from silence to full volume.                                 |
| static[VolumeShaper.Configuration](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#)!                                                                                                             | [LINEAR_RAMP](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#LINEAR_RAMP:android.media.VolumeShaper.Configuration) A one second linear ramp from silence to full volume.                              |
| static[VolumeShaper.Configuration](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#)!                                                                                                             | [SCURVE_RAMP](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#SCURVE_RAMP:android.media.VolumeShaper.Configuration) A one second sine-squared s-curve ramp from silence to full volume.                |
| static[VolumeShaper.Configuration](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#)!                                                                                                             | [SINE_RAMP](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#SINE_RAMP:android.media.VolumeShaper.Configuration) A one second sine curve from silence to full volume for energy preserving cross fades. |

## Constants

### INTERPOLATOR_TYPE_CUBIC

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val INTERPOLATOR_TYPE_CUBIC: Int
```

Cubic interpolated volume curve. This is default if unspecified.  

    Value: 2

### INTERPOLATOR_TYPE_CUBIC_MONOTONIC

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val INTERPOLATOR_TYPE_CUBIC_MONOTONIC: Int
```

Cubic interpolated volume curve that preserves local monotonicity. So long as the control points are locally monotonic, the curve interpolation between those points are monotonic. This is useful for cubic spline interpolated volume ramps and ducks.  

    Value: 3

### INTERPOLATOR_TYPE_LINEAR

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val INTERPOLATOR_TYPE_LINEAR: Int
```

Linear interpolated volume curve.  

    Value: 1

### INTERPOLATOR_TYPE_STEP

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val INTERPOLATOR_TYPE_STEP: Int
```

Stepwise volume curve.  

    Value: 0

## Public methods

### describeContents

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun describeContents(): Int
```

|                                                                                                                                                                               Return                                                                                                                                                                               ||
|----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either`0`or[android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR:kotlin.Int) |

### equals

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun equals(other: Any?): Boolean
```

|                     Parameters                     ||
|-------|---------------------------------------------|
| `obj` | the reference object with which to compare. |

|                                                                           Return                                                                           ||
|------------------------------------------------------------------------------------|------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `true`if this object is the same as the obj argument;`false`otherwise. |

### getDuration

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getDuration(): Long
```

Returns the duration of the volume shape in milliseconds.  

### getInterpolatorType

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getInterpolatorType(): Int
```

Returns the interpolator type.

|                                                                                                                                                                                                                                                                                                                                                                                                                                                 Return                                                                                                                                                                                                                                                                                                                                                                                                                                                 ||
|----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | Value is[android.media.VolumeShaper.Configuration#INTERPOLATOR_TYPE_STEP](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#INTERPOLATOR_TYPE_STEP:kotlin.Int),[android.media.VolumeShaper.Configuration#INTERPOLATOR_TYPE_LINEAR](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#INTERPOLATOR_TYPE_LINEAR:kotlin.Int),[android.media.VolumeShaper.Configuration#INTERPOLATOR_TYPE_CUBIC](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#INTERPOLATOR_TYPE_CUBIC:kotlin.Int), or[android.media.VolumeShaper.Configuration#INTERPOLATOR_TYPE_CUBIC_MONOTONIC](https://developer.android.com/reference/kotlin/android/media/VolumeShaper.Configuration#INTERPOLATOR_TYPE_CUBIC_MONOTONIC:kotlin.Int) |

### getMaximumCurvePoints

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static fun getMaximumCurvePoints(): Int
```

Returns the maximum number of curve points allowed for VolumeShaper.Builder#setCurve(float\[\], float\[\]).  

### getTimes

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getTimes(): FloatArray!
```

Returns the times (x) coordinate array of the volume curve points.  

### getVolumes

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getVolumes(): FloatArray!
```

Returns the volumes (y) coordinate array of the volume curve points.  

### hashCode

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun hashCode(): Int
```

|                                                     Return                                                     ||
|----------------------------------------------------------------------------|------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | a hash code value for this object. |

### toString

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun toString(): String
```

|                                                          Return                                                          ||
|----------------------------------------------------------------------------------|----------------------------------------|
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | a string representation of the object. |

### writeToParcel

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun writeToParcel(
    dest: Parcel, 
    flags: Int
): Unit
```

|                                                                                                                                                                                                                                                                                     Parameters                                                                                                                                                                                                                                                                                     ||
|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `dest`  | [Parcel](https://developer.android.com/reference/kotlin/android/os/Parcel.html#):The Parcel in which the object should be written. This value cannot be`null`.                                                                                                                                                                                                                                                                                                                                                                                                            |
| `flags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Additional flags about how the object should be written. May be 0 or[PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int). Value is either`0`or a combination of[android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int), and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |

## Properties

### CREATOR

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val CREATOR: Parcelable.Creator<VolumeShaper.Configuration!>
```  

### CUBIC_RAMP

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val CUBIC_RAMP: VolumeShaper.Configuration!
```

A one second cubic ramp from silence to full volume. Use VolumeShaper.Builder#reflectTimes() or VolumeShaper.Builder#invertVolumes() to generate the matching cubic duck.  

### LINEAR_RAMP

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val LINEAR_RAMP: VolumeShaper.Configuration!
```

A one second linear ramp from silence to full volume. Use VolumeShaper.Builder#reflectTimes() or VolumeShaper.Builder#invertVolumes() to generate the matching linear duck.  

### SCURVE_RAMP

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val SCURVE_RAMP: VolumeShaper.Configuration!
```

A one second sine-squared s-curve ramp from silence to full volume. Use VolumeShaper.Builder#reflectTimes() or VolumeShaper.Builder#invertVolumes() to generate the matching sine-squared s-curve duck.  

### SINE_RAMP

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val SINE_RAMP: VolumeShaper.Configuration!
```

A one second sine curve from silence to full volume for energy preserving cross fades. Use VolumeShaper.Builder#reflectTimes() to generate the matching cosine duck.