AKADSRView

@IBDesignable open class AKADSRView: UIView

A click and draggable view of an ADSR Envelope (Atttack, Decay, Sustain, Release)

  • Attack time in seconds, Default: 0.1

    Declaration

    Swift

    @IBInspectable open var attackDuration: Double = 0.100
  • Type of function to call when values of the ADSR have changed

    Declaration

    Swift

    public typealias ADSRCallback = (Double, Double, Double, Double) -> Void
  • Decay time in seconds, Default: 0.1

    Declaration

    Swift

    @IBInspectable open var decayDuration: Double = 0.100
  • Sustain Level (0-1), Default: 0.5

    Declaration

    Swift

    @IBInspectable open var sustainLevel: Double = 0.50
  • Release time in seconds, Default: 0.1

    Declaration

    Swift

    @IBInspectable open var releaseDuration: Double = 0.100
  • Function to call when the values of the ADSR changes

    Declaration

    Swift

    open var callback: ADSRCallback?
  • / Color Declarations Color in the attack portion of the UI element

    Declaration

    Swift

    @IBInspectable open var attackColor: UIColor = #colorLiteral(red: 0.767, green: 0.000, blue: 0.000, alpha: 1.000)
  • Color in the decay portion of the UI element

    Declaration

    Swift

    @IBInspectable open var decayColor: UIColor = #colorLiteral(red: 0.942, green: 0.648, blue: 0.000, alpha: 1.000)
  • Color in the sustain portion of the UI element

    Declaration

    Swift

    @IBInspectable open var sustainColor: UIColor = #colorLiteral(red: 0.320, green: 0.800, blue: 0.616, alpha: 1.000)
  • Color in the release portion of the UI element

    Declaration

    Swift

    @IBInspectable open var releaseColor: UIColor = #colorLiteral(red: 0.720, green: 0.519, blue: 0.888, alpha: 1.000)
  • Background color

    Declaration

    Swift

    @IBInspectable open var bgColor = #colorLiteral(red: 1.000, green: 1.000, blue: 1.000, alpha: 1.000)
  • Width of the envelope curve

    Declaration

    Swift

    @IBInspectable open var curveStrokeWidth: CGFloat = 1
  • Color of the envelope curve

    Declaration

    Swift

    @IBInspectable open var curveColor: UIColor = .black
  • Initialize the view, usually with a callback

    Declaration

    Swift

    public init(callback: ADSRCallback? = nil)
  • Initialization of the view from within interface builder

    Declaration

    Swift

    required public init?(coder aDecoder: NSCoder)
  • Perform necessary operation to allow the view to be rendered in interface builder

    Declaration

    Swift

    override open func prepareForInterfaceBuilder()
  • Size of the view

    Declaration

    Swift

    override open var intrinsicContentSize: CGSize
  • Requeire a constraint based layout with interface builder

    Declaration

    Swift

    open class override var requiresConstraintBasedLayout: Bool
  • Handle new touches

    Declaration

    Swift

    override open func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?)
  • Handle moving touches

    Declaration

    Swift

    override open func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?)
  • Draw the view

    Declaration

    Swift

    override open func draw(_ rect: CGRect)