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
27#include "musx/dom/Details.h"
28#include "musx/dom/Entries.h"
29#include "musx/dom/Others.h"
30
31namespace musx::util {
32
34enum class ArpeggioDirection
35{
36 Auto,
37 Up,
38 Down
39};
40
42enum class ArpeggioArrow
43{
44 Auto,
45 None,
46 Up,
47 Down
48};
49
51enum class ArpeggioSpanType
52{
53 Normal,
54 Bracket
55};
56
59{
60 ArpeggioSpanType type{ArpeggioSpanType::Normal};
64 ArpeggioDirection direction{ArpeggioDirection::Auto};
65 ArpeggioArrow arrow{ArpeggioArrow::Auto};
66};
67
75
77[[nodiscard]]
78std::optional<ArpeggioSpanCandidate> calcArpeggioSpanForAssignment(
79 const dom::EntryInfoPtr& sourceEntry,
81 const ArpeggioSpanOptions& options = {},
82 std::function<bool(const dom::details::ArticulationAssign::SelectedSymbolContext&)> symbolContextFilter = {});
83
84[[nodiscard]]
85std::optional<ArpeggioSpanCandidate> calcNonArpeggioSpanForAssignment(
86 const dom::EntryInfoPtr& sourceEntry,
87 const dom::MusxInstance<dom::details::ArticulationAssign>& assign,
88 const ArpeggioSpanOptions& options = {});
89
90[[nodiscard]]
91std::optional<ArpeggioSpanCandidate> calcNonArpeggioSpanForAssignment(
92 const dom::MusxInstance<dom::others::MeasureExprAssign>& assign,
93 const ArpeggioSpanOptions& options = {});
94
95[[nodiscard]]
96std::optional<ArpeggioSpanCandidate> calcNonArpeggioSpanForSmartShape(
97 const dom::MusxInstance<dom::others::SmartShape>& smartShape,
98 const ArpeggioSpanOptions& options = {});
99
100} // 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:513
@ 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)
Resolved arpeggio span for one articulation assignment.
Definition Arpeggio.h:59
ArpeggioSpanType type
Connector type for the resolved span.
Definition Arpeggio.h:60
dom::EntryInfoPtr bottomEntry
Chosen bottom entry for the arpeggio span.
Definition Arpeggio.h:63
ArpeggioDirection direction
Roll direction when known.
Definition Arpeggio.h:64
ArpeggioArrow arrow
Arrowhead state when known.
Definition Arpeggio.h:65
dom::EntryInfoPtr topEntry
Chosen top entry for the arpeggio span.
Definition Arpeggio.h:62
dom::EntryInfoPtr sourceEntry
Entry that owns the articulation assignment.
Definition Arpeggio.h:61
Options controlling arpeggio span resolution.
Definition Arpeggio.h:70
bool constrainToSourceStaffOnly
Restrict matching to entries on the source staff only.
Definition Arpeggio.h:73
bool skipGraceEntries
Skip grace-note source entries and grace-note candidates.
Definition Arpeggio.h:72
bool includeHiddenEntries
Include hidden entries in candidate matching.
Definition Arpeggio.h:71