MUSX Document Model
Loading...
Searching...
No Matches
Cue.h
1/*
2 * Copyright (C) 2026, 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 <memory>
25#include <vector>
26
27#include "musx/dom/Entries.h"
28
29namespace musx::util {
30
32class Cue
33{
34public:
44
47 {
49 enum class Kind
50 {
51 None,
52 PartOnly,
54 };
55
61
63 [[nodiscard]] bool isCue() const noexcept
64 { return kind != Kind::None; }
65 };
66
69 {
70 bool isCueFrame{};
72 std::vector<size_t> cueEntryIndices;
73 };
74
77 {
78 std::vector<dom::LayerIndex> cueLayers;
79 std::vector<dom::LayerIndex> visibleCueLayers;
80 bool isCueOnly{};
81
83 explicit operator bool() const
84 { return isCueOnly; }
85 };
86
90 [[nodiscard]]
91 static EntryVisibility calcVisibility(const dom::EntryInfoPtr& entry, dom::Cmper targetPartId);
92
94 [[nodiscard]]
96
98 [[nodiscard]]
101
103 [[nodiscard]]
104 static EntryAnalysis calcEntryAnalysis(const dom::EntryInfoPtr& entry);
105
108 [[nodiscard]]
109 static FrameAnalysis calcFrameAnalysis(const std::shared_ptr<const dom::EntryFrame>& frame);
110
113 [[nodiscard]]
114 static StaffMeasureAnalysis calcStaffMeasureAnalysis(const dom::details::GFrameHoldContext& context);
115};
116
117} // 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:534
A context wrapper for GFrameHold associated with a specific part and location.
Definition Entries.h:69
Stateless interpretation utilities for cue material and its visibility.
Definition Cue.h:33
static FrameAnalysis calcFrameAnalysis(const std::shared_ptr< const dom::EntryFrame > &frame)
Calculates cue classification and requested-context visibility for frame. Explicitly hidden source en...
Definition Cue.cpp:116
static StaffMeasureAnalysis calcStaffMeasureAnalysis(const dom::details::GFrameHoldContext &context)
Calculates semantic and requested-context-visible cue layers for one staff and measure....
Definition Cue.cpp:138
static EntryVisibility calcVisibility(const dom::EntryInfoPtr &entry, dom::Cmper targetPartId)
Calculates why entry is visible or hidden in targetPartId.
Definition Cue.cpp:49
static EntryAnalysis calcEntryAnalysis(const dom::EntryInfoPtr &entry)
Calculates source-level cue classification separately from visibility in relevant contexts.
Definition Cue.cpp:87
static bool calcIsVisibleInRequestedContext(const dom::EntryInfoPtr &entry)
Returns whether the entry is visible in its requested context.
Definition Cue.h:99
static EntryVisibility calcVisibilityInRequestedContext(const dom::EntryInfoPtr &entry)
Calculates visibility in the entry frame's requested score or linked-part context.
Definition Cue.cpp:82
EntryVisibility
Describes why an entry is or is not visible in a score or linked-part context.
Definition Cue.h:37
@ ExcludedByVoicing
The target part's voicing excludes this layer.
@ HiddenEntry
The stored dom::Entry::isHidden flag is set.
@ HiddenByAlternateNotation
Alternate notation hides entries in this layer.
@ Visible
The entry is visible in the target context.
@ HiddenStaff
The staff is absent from the context or is force-hidden.
uint16_t Cmper
Enigma "comperator" key type.
Definition Fundamentals.h:57
Cue classification and visibility information for an entry.
Definition Cue.h:47
bool visibleInAnyLinkedPart
Whether the entry is visible in at least one linked part.
Definition Cue.h:60
bool visibleInScore
Whether the entry is visible in the score.
Definition Cue.h:59
Kind
Source-level cue classification for a reduced entry.
Definition Cue.h:50
@ None
The entry is not cue material.
@ PartOnly
The reduced entry is hidden in the score and visible in at least one linked part.
@ ScoreVisible
The reduced entry is visible in the score.
int entrySizePercent
Effective entry size in the requested context.
Definition Cue.h:57
Kind kind
Source-level cue classification.
Definition Cue.h:56
bool isCue() const noexcept
Returns whether the entry is classified as cue material.
Definition Cue.h:63
bool visibleInRequestedContext
Whether the entry is visible in its EntryFrame's requested context.
Definition Cue.h:58
Cue classification and requested-context visibility for an entry frame.
Definition Cue.h:69
std::vector< size_t > cueEntryIndices
Indices of entries classified as cue material.
Definition Cue.h:72
bool hasVisibleCueEntries
True if any cue entry is visible in the requested context.
Definition Cue.h:71
bool isCueFrame
True if every applicable source entry is cue material.
Definition Cue.h:70
Cue-layer analysis for one staff in one measure and its requested context.
Definition Cue.h:77
bool isCueOnly
True if all significant layers are cue frames and at least one exists.
Definition Cue.h:80
std::vector< dom::LayerIndex > visibleCueLayers
Cue-frame layers with visible cue entries in this context.
Definition Cue.h:79
std::vector< dom::LayerIndex > cueLayers
Layers whose frames are cue frames.
Definition Cue.h:78