public static final class VolumeShaper.Configuration implements android.os.Parcelable {
method public int describeContents();
- method public double getDurationMillis();
+ method public long getDuration();
method public int getInterpolatorType();
method public static int getMaximumCurvePoints();
method public float[] getTimes();
method public android.media.VolumeShaper.Configuration.Builder scaleToEndVolume(float);
method public android.media.VolumeShaper.Configuration.Builder scaleToStartVolume(float);
method public android.media.VolumeShaper.Configuration.Builder setCurve(float[], float[]);
- method public android.media.VolumeShaper.Configuration.Builder setDurationMillis(double);
+ method public android.media.VolumeShaper.Configuration.Builder setDuration(long);
method public android.media.VolumeShaper.Configuration.Builder setInterpolatorType(int);
}
public static final class VolumeShaper.Configuration implements android.os.Parcelable {
method public int describeContents();
- method public double getDurationMillis();
+ method public long getDuration();
method public int getInterpolatorType();
method public static int getMaximumCurvePoints();
method public float[] getTimes();
method public android.media.VolumeShaper.Configuration.Builder scaleToEndVolume(float);
method public android.media.VolumeShaper.Configuration.Builder scaleToStartVolume(float);
method public android.media.VolumeShaper.Configuration.Builder setCurve(float[], float[]);
- method public android.media.VolumeShaper.Configuration.Builder setDurationMillis(double);
+ method public android.media.VolumeShaper.Configuration.Builder setDuration(long);
method public android.media.VolumeShaper.Configuration.Builder setInterpolatorType(int);
}
public static final class VolumeShaper.Configuration implements android.os.Parcelable {
method public int describeContents();
- method public double getDurationMillis();
+ method public long getDuration();
method public int getInterpolatorType();
method public static int getMaximumCurvePoints();
method public float[] getTimes();
method public android.media.VolumeShaper.Configuration.Builder scaleToEndVolume(float);
method public android.media.VolumeShaper.Configuration.Builder scaleToStartVolume(float);
method public android.media.VolumeShaper.Configuration.Builder setCurve(float[], float[]);
- method public android.media.VolumeShaper.Configuration.Builder setDurationMillis(double);
+ method public android.media.VolumeShaper.Configuration.Builder setDuration(long);
method public android.media.VolumeShaper.Configuration.Builder setInterpolatorType(int);
}
.setInterpolatorType(INTERPOLATOR_TYPE_LINEAR)
.setCurve(new float[] {0.f, 1.f} /* times */,
new float[] {0.f, 1.f} /* volumes */)
- .setDurationMillis(1000.)
+ .setDuration(1000)
.build();
/**
.setInterpolatorType(INTERPOLATOR_TYPE_CUBIC)
.setCurve(new float[] {0.f, 1.f} /* times */,
new float[] {0.f, 1.f} /* volumes */)
- .setDurationMillis(1000.)
+ .setDuration(1000)
.build();
/**
SINE_RAMP = new VolumeShaper.Configuration.Builder()
.setInterpolatorType(INTERPOLATOR_TYPE_CUBIC)
.setCurve(times, sines)
- .setDurationMillis(1000.)
+ .setDuration(1000)
.build();
SCURVE_RAMP = new VolumeShaper.Configuration.Builder()
.setInterpolatorType(INTERPOLATOR_TYPE_CUBIC)
.setCurve(times, scurve)
- .setDurationMillis(1000.)
+ .setDuration(1000)
.build();
}
/**
* Returns the duration of the volume shape in milliseconds.
*/
- public double getDurationMillis() {
- return mDurationMs;
+ public long getDuration() {
+ // casting is safe here as the duration was set as a long in the Builder
+ return (long) mDurationMs;
}
/**
* .setInterpolatorType(VolumeShaper.Configuration.INTERPOLATOR_TYPE_LINEAR)
* .setCurve(new float[] { 0.f, 1.f }, // times
* new float[] { 0.f, 1.f }) // volumes
- * .setDurationMillis(1000.)
+ * .setDuration(1000)
* .build();
* </pre>
* <p>
mId = configuration.getId();
mOptionFlags = configuration.getAllOptionFlags();
mInterpolatorType = configuration.getInterpolatorType();
- mDurationMs = configuration.getDurationMillis();
+ mDurationMs = configuration.getDuration();
mTimes = configuration.getTimes().clone();
mVolumes = configuration.getVolumes().clone();
}
* @throws IllegalArgumentException if {@code durationMillis}
* is not strictly positive.
*/
- public @NonNull Builder setDurationMillis(double durationMillis) {
- if (durationMillis <= 0.) {
+ public @NonNull Builder setDuration(long durationMillis) {
+ if (durationMillis <= 0) {
throw new IllegalArgumentException(
"duration: " + durationMillis + " not positive");
}
- mDurationMs = durationMillis;
+ mDurationMs = (double) durationMillis;
return this;
}
* time (x) coordinates should be monotonically increasing, from 0.f to 1.f;
* volume (y) coordinates must be within 0.f to 1.f.
* <p>
- * The time scale is set by {@link #setDurationMillis}.
+ * The time scale is set by {@link #setDuration}.
* <p>
* @param times an array of float values representing
* the time line of the volume curve.