MUSX Document Model
Loading...
Searching...
No Matches
Arpeggio.h
1/*
2 * Copyright (C) 2025, Robert Patterson
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 */
22#pragma once
23
24#include <functional>
25#include <optional>
26#include <string>
27
28#include "musx/dom/Details.h"
29#include "musx/dom/Entries.h"
30#include "musx/dom/Others.h"
31#include "musx/util/Layout.h"
32
33namespace musx::util {
34
36enum class ArpeggioDirection
37{
38 Auto,
39 Up,
40 Down
41};
42
44enum class ArpeggioArrow
45{
46 Auto,
47 None,
48 Up,
49 Down
50};
51
53enum class ArpeggioSpanType
54{
55 Normal,
56 Bracket
57};
58
61{
62 ArpeggioSpanType type{ArpeggioSpanType::Normal};
66 ArpeggioDirection direction{ArpeggioDirection::Auto};
67 ArpeggioArrow arrow{ArpeggioArrow::Auto};
68
69 [[nodiscard]] std::string key() const;
71};
72
75{
77 bool skipGraceEntries{false};
79 StaffOriginOffsetResolver staffOriginOffsetResolver;
81};
82
84[[nodiscard]]
85std::optional<ArpeggioSpanCandidate> calcArpeggioSpanForAssignment(
86 const dom::EntryInfoPtr& sourceEntry,
88 const ArpeggioSpanOptions& options = {},
89 std::function<bool(const dom::details::ArticulationAssign::SelectedSymbolContext&)> symbolContextFilter = {});
90
91[[nodiscard]]
92std::optional<ArpeggioSpanCandidate> calcNonArpeggioSpanForAssignment(
93 const dom::EntryInfoPtr& sourceEntry,
94 const dom::MusxInstance<dom::details::ArticulationAssign>& assign,
95 const ArpeggioSpanOptions& options = {});
96
97[[nodiscard]]
98std::optional<ArpeggioSpanCandidate> calcNonArpeggioSpanForAssignment(
99 const dom::MusxInstance<dom::others::MeasureExprAssign>& assign,
100 const ArpeggioSpanOptions& options = {});
101
102[[nodiscard]]
103std::optional<ArpeggioSpanCandidate> calcNonArpeggioSpanForSmartShape(
104 const dom::MusxInstance<dom::others::SmartShape>& smartShape,
105 const ArpeggioSpanOptions& options = {});
106
107} // namespace musx::util
Wraps a frame of shared_ptr<const EntryInfo> and an index for per entry access. This class manages ow...
Definition Entries.h:553
@ Down
contour is curved downward (tips face up)
@ Up
contour is curved upward (tips face down)
std::shared_ptr< const T > MusxInstance
Defines the type of a musx instance stored in a pool.
Definition MusxInstance.h:40
@ None
Do not override the existing enharmonic state. (Default)
Provides information about the best analysis as to which articulation symbol in being used on this as...
Definition Details.h:118
Resolved arpeggio span for one articulation assignment.
Definition Arpeggio.h:61
ArpeggioSpanType type
Connector type for the resolved span.
Definition Arpeggio.h:62
dom::EntryInfoPtr bottomEntry
Chosen bottom entry for the arpeggio span.
Definition Arpeggio.h:65
ArpeggioDirection direction
Roll direction when known.
Definition Arpeggio.h:66
ArpeggioArrow arrow
Arrowhead state when known.
Definition Arpeggio.h:67
dom::EntryInfoPtr topEntry
Chosen top entry for the arpeggio span.
Definition Arpeggio.h:64
std::string key() const
Stable identity key for deduplicating equivalent span candidates.
Definition Arpeggio.cpp:33
dom::EntryInfoPtr sourceEntry
Entry that owns the articulation assignment.
Definition Arpeggio.h:63
Options controlling arpeggio span resolution.
Definition Arpeggio.h:75
bool constrainToSourceStaffOnly
Restrict matching to entries on the source staff only.
Definition Arpeggio.h:78
bool skipGraceEntries
Skip grace-note source entries and grace-note candidates.
Definition Arpeggio.h:77
bool includeHiddenEntries
Include hidden entries in candidate matching.
Definition Arpeggio.h:76
StaffOriginOffsetResolver staffOriginOffsetResolver
Optional caller-provided staff origin offset resolver. If unhandled, the system-staff proxy is used.
Definition Arpeggio.h:79