48 lines
1.5 KiB
Swift
48 lines
1.5 KiB
Swift
// GlissandoKind.swift
|
|
// Lyrebird
|
|
//
|
|
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
/// The kind of glissando notation span.
|
|
///
|
|
/// MusicXML provides two distinct glissando elements, both placed inside
|
|
/// `<notations>` with `type="start"` on the first note and `type="stop"` on
|
|
/// the second:
|
|
///
|
|
/// | `GlissandoKind` | MusicXML element |
|
|
/// |---|---|
|
|
/// | `.glissando` | `<glissando>` — wavy or curved, unmeasured portamento |
|
|
/// | `.slide` | `<slide>` — straight line, measured (portamento) |
|
|
///
|
|
/// Choose `.glissando` for an approximate or unmeasured pitch sweep (typically
|
|
/// drawn with a wavy or curved line). Choose `.slide` for a precisely measured
|
|
/// portamento (typically drawn with a straight line).
|
|
///
|
|
/// ## Decode note
|
|
///
|
|
/// `<glissando>` and `<slide>` elements from an imported MusicXML file are
|
|
/// **not** currently parsed back into ``Glissando`` spanners. This is an
|
|
/// emit-only feature.
|
|
public enum GlissandoKind: Sendable, Hashable {
|
|
/// A wavy or curved, unmeasured pitch sweep between two notes.
|
|
///
|
|
/// Maps to `<glissando>` in MusicXML.
|
|
case glissando
|
|
|
|
/// A straight-line, measured portamento between two notes.
|
|
///
|
|
/// Maps to `<slide>` in MusicXML.
|
|
case slide
|
|
|
|
/// The MusicXML element name for this glissando kind.
|
|
///
|
|
/// `"glissando"` for `.glissando`; `"slide"` for `.slide`.
|
|
public var musicXMLElementName: String {
|
|
switch self {
|
|
case .glissando: return "glissando"
|
|
case .slide: return "slide"
|
|
}
|
|
}
|
|
}
|