Tightened the source code and README documentations in the library.
This commit is contained in:
@@ -22,33 +22,32 @@ extension Sound {
|
||||
LFO.api.pointee.setType.unsafelyUnwrapped(pointer, shape.cValue)
|
||||
}
|
||||
|
||||
/// The LFO rate, in cycles per second.
|
||||
/// In cycles per second.
|
||||
public func setRate(_ rate: Float) {
|
||||
LFO.api.pointee.setRate.unsafelyUnwrapped(pointer, rate)
|
||||
}
|
||||
|
||||
/// The current phase, 0...1.
|
||||
/// 0...1.
|
||||
public func setPhase(_ phase: Float) {
|
||||
LFO.api.pointee.setPhase.unsafelyUnwrapped(pointer, phase)
|
||||
}
|
||||
|
||||
/// The phase the LFO starts at when a note starts, 0...1.
|
||||
/// 0...1; used when the LFO is retriggered.
|
||||
public func setStartPhase(_ phase: Float) {
|
||||
LFO.api.pointee.setStartPhase.unsafelyUnwrapped(pointer, phase)
|
||||
}
|
||||
|
||||
/// The center value of the LFO output.
|
||||
public func setCenter(_ center: Float) {
|
||||
LFO.api.pointee.setCenter.unsafelyUnwrapped(pointer, center)
|
||||
}
|
||||
|
||||
/// The amplitude of the LFO around its center.
|
||||
/// The output's amplitude around its center.
|
||||
public func setDepth(_ depth: Float) {
|
||||
LFO.api.pointee.setDepth.unsafelyUnwrapped(pointer, depth)
|
||||
}
|
||||
|
||||
/// For `.arpeggiator` LFOs: the sequence of values (in half-steps)
|
||||
/// to step through.
|
||||
/// Switches to `.arpeggiator` over `steps`, in half-steps from the center note
|
||||
/// (e.g. `[0, 4, 7, 12]` for a major chord).
|
||||
public func setArpeggiation(_ steps: [Float]) {
|
||||
var steps = steps
|
||||
steps.withUnsafeMutableBufferPointer { buffer in
|
||||
@@ -57,8 +56,7 @@ extension Sound {
|
||||
}
|
||||
}
|
||||
|
||||
/// For `.function` LFOs: the Swift function providing the value. If
|
||||
/// `interpolate` is `true`, values are interpolated between calls.
|
||||
/// For `.function` LFOs; `interpolate` smooths between calls. Keeps `function` alive.
|
||||
public func setFunction(interpolate: Bool = false, _ function: @escaping (LFO) -> Float) {
|
||||
self.function = function
|
||||
LFO.api.pointee.setFunction.unsafelyUnwrapped(pointer, { _, userdata in
|
||||
@@ -68,28 +66,27 @@ extension Sound {
|
||||
}, Unmanaged.passUnretained(self).toOpaque(), interpolate ? 1 : 0)
|
||||
}
|
||||
|
||||
/// Waits `holdoff` seconds after a note starts, then ramps the LFO
|
||||
/// depth up over `rampTime` seconds.
|
||||
/// Holds at center `holdoff` seconds after a note starts, then ramps linearly to
|
||||
/// full depth over `rampTime` seconds.
|
||||
public func setDelay(holdoff: Float, rampTime: Float) {
|
||||
LFO.api.pointee.setDelay.unsafelyUnwrapped(pointer, holdoff, rampTime)
|
||||
}
|
||||
|
||||
/// Whether the LFO phase restarts on every new note.
|
||||
/// If `true`, notes on a synth using the LFO reset its phase to the start phase.
|
||||
public func setRetrigger(_ flag: Bool) {
|
||||
LFO.api.pointee.setRetrigger.unsafelyUnwrapped(pointer, flag ? 1 : 0)
|
||||
}
|
||||
|
||||
/// When `true`, the LFO runs globally instead of per-note.
|
||||
/// If `true`, updates continuously, even when not in use.
|
||||
public func setGlobal(_ global: Bool) {
|
||||
LFO.api.pointee.setGlobal.unsafelyUnwrapped(pointer, global ? 1 : 0)
|
||||
}
|
||||
|
||||
/// Seeds the random number generator used by `.sampleAndHold` LFOs.
|
||||
/// Seeds the random generator, for reproducible `.sampleAndHold` output.
|
||||
public func setRandomSeed(_ seed: UInt16) {
|
||||
LFO.api.pointee.setRandomSeed.unsafelyUnwrapped(pointer, seed)
|
||||
}
|
||||
|
||||
/// The LFO's current value.
|
||||
public var value: Float {
|
||||
LFO.api.pointee.getValue.unsafelyUnwrapped(pointer)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user