Duration
public struct Duration
A unit of hierarchically-divided symbolic time.
Example Usage
You can create a Duration value with an amount of beats at a given subdivision level.
let _ = Duration(1,4) // => one quarter note
let _ = Duration(3,32) // => three thirty-second notes
You can also create a Duration value with an infix operator:
let _ = 3/>32
let _ = 31/>4
The subdivision value must be a power-of-two, otherwise your program will crash!
let _ = Duration(3,13) // boom
-
Numerator.
Declaration
Swift
public let beats: Beats -
Denominator.
Declaration
Swift
public let subdivision: Subdivision
-
Create a
Durationwith abeatsandsubdivision.Declaration
Swift
public init(_ numerator: Beats, _ denominator: Subdivision)
-
A
Durationwith zero length.Declaration
Swift
public static let zero: Duration
-
Declaration
Swift
public var numerator: Int { get }Return Value
The
beatsvalue forRationalarithmetic. -
Declaration
Swift
public var denominator: Int { get }Return Value
The
subdivisionvalue forRationalarithmetic.
-
Creates a
Durationwith the given amount ofbeatsat the quarter-note level.Declaration
Swift
public init(integerLiteral beats: Int)
View on GitHub
Install in Dash
Duration Structure Reference