Accidental

public enum Accidental: Codable, Equatable, Hashable, RawRepresentable, ExpressibleByIntegerLiteral, ExpressibleByStringLiteral, CustomStringConvertible

The enum used for calculating values of the Keys and Pitches.

  • No accidental.

    Declaration

    Swift

    case natural
  • Reduces the Key or Pitch value amount of halfsteps.

    Declaration

    Swift

    case flats(amount: Int)
  • Reduces the Key or Pitch value one halfstep below.

    Declaration

    Swift

    public static let flat: Accidental = .flats(amount: 1)
  • Increases the Key or Pitch value one halfstep above.

    Declaration

    Swift

    public static let sharp: Accidental = .sharps(amount: 1)
  • Reduces the Key or Pitch value amount two halfsteps below.

    Declaration

    Swift

    public static let doubleFlat: Accidental = .flats(amount: 2)
  • Increases the Key or Pitch value two halfsteps above.

    Declaration

    Swift

    public static let doubleSharp: Accidental = .sharps(amount: 2)
  • A flag for description function that determines if it should use double sharp and double flat symbols. It’s useful to set it false where the fonts do not support that symbols. Defaults true.

    Declaration

    Swift

    public static var shouldUseDoubleFlatAndDoubleSharpNotation = true
  • Declaration

    Swift

    public typealias RawValue = Int
  • Value of the accidental in terms of halfsteps.

    Declaration

    Swift

    public var rawValue: Int
  • Initilizes the accidental with an integer that represents the halfstep amount.

    Declaration

    Swift

    public init?(rawValue: Accidental.RawValue)

    Parameters

    rawValue

    Halfstep value of the accidental. Zero if natural, above zero if sharp, below zero if flat.

  • Declaration

    Swift

    public typealias IntegerLiteralType = Int
  • Initilizes the accidental with an integer literal value.

    Declaration

    Swift

    public init(integerLiteral value: Accidental.IntegerLiteralType)

    Parameters

    value

    Halfstep value of the accidental. Zero if natural, above zero if sharp, below zero if flat.

  • Returns the notation string of the accidental.

    Declaration

    Swift

    public var notation: String
  • Returns the notation string of the accidental. Returns empty string if accidental is natural.

    Declaration

    Swift

    public var description: String