Contents

fade(to:duration:)

Transitions the gain to the given value over a time interval using a linear curve.

Declaration

@MainActor @preconcurrency func fade(to newValue: AudioPlaybackController.Decibel, duration: TimeInterval)

Parameters

  • newValue:

    The target decibel level.

  • duration:

    How long in seconds the fade should last.

Discussion

The target gain must be zero or negative, where zero is nominal loudness and negative infinity is silent. If the gain is positive, it will be reset to zero.

See Also

Setting the volume