560724d116
- Fixed: SynthesizerBase subclasses' release/free now dispatch correctly (gated synths were hard-freed instead of released). - New: quickstart project template + LyrebirdQuickstartDemo. - Docs: every example typechecked or provably illustrative (426->542); ~20 wrong-API examples fixed; root docs brought under the compile guard. - Fixed: NRT/Score demo Package.swift build from terminal again. See RELEASES.md for details.
43 lines
1.5 KiB
Swift
43 lines
1.5 KiB
Swift
// NoteSize.swift
|
|
// Lyrebird
|
|
//
|
|
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
import Foundation
|
|
|
|
/// The visual size scale of a note in MusicXML output.
|
|
///
|
|
/// Expressed as the `size` attribute on the MusicXML `<type>` element
|
|
/// (`<type size="cue">eighth</type>`). Scales the entire note (head, stem,
|
|
/// flag/beam, and ledger lines) — MusicXML has no per-notehead percentage
|
|
/// scaling separate from the note-type size attribute.
|
|
///
|
|
/// Set via ``NoteDisplay/size`` and applied through the `display:` parameter
|
|
/// of ``Note(_:dur:dyn:art:voice:tie:spanners:display:marks:dynamicCurve:)`` or
|
|
/// `Chord`.
|
|
///
|
|
/// > Note: Note size is **emit-only** — ``Score/fromMusicXML(data:)`` does not
|
|
/// > parse the `size` attribute back into `NoteDisplay`.
|
|
public enum NoteSize: Sendable, Hashable {
|
|
/// Small cue-note size — the `size="cue"` attribute on `<type>`.
|
|
case cue
|
|
/// Normal (default) size — no `size` attribute is emitted on `<type>`.
|
|
case normal
|
|
/// Large note size — the `size="large"` attribute on `<type>`.
|
|
case large
|
|
|
|
/// The MusicXML `size` attribute value for the `<type>` element.
|
|
///
|
|
/// Returns `nil` for `.normal` (no attribute is written, keeping output
|
|
/// byte-identical to the default). Returns `"cue"` or `"large"` for the
|
|
/// named sizes.
|
|
public var musicXMLTypeSize: String? {
|
|
switch self {
|
|
case .cue: return "cue"
|
|
case .normal: return nil
|
|
case .large: return "large"
|
|
}
|
|
}
|
|
}
|