MUSX Document Model
Loading...
Searching...
No Matches
Fretboard.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 <optional>
25#include <vector>
26
27#include "musx/dom/Details.h"
28#include "musx/dom/Others.h"
29
30namespace musx::util {
31
33enum class UnplayedStringDisplay {
34 None,
35 Blank,
36 Muted
37};
38
44{
46 struct Cell
47 {
48 int string{};
49 int fret{};
51 int finger{};
52 };
53
55 struct Barre
56 {
57 int fret{};
59 int endString{};
60 };
61
63 int fretCount{};
66 UnplayedStringDisplay unplayedStringDisplay{UnplayedStringDisplay::None};
67 std::vector<Cell> cells;
68 std::vector<Barre> barres;
69};
70
86[[nodiscard]] std::optional<FretboardDisplayData> calcFretboardDisplayData(
88 const dom::MusxInstance<dom::KeySignature>& keySignature,
90
91} // namespace musx::util
KeyContext
Indicates whether to compute key signature values in concert or written pitch.
Definition CommonClasses.h:273
Shape
Shape type for a fretboard cell.
Definition Details.h:1067
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)
@ Blank
Blank clef (invisible, no symbol).
A barre spanning a range of strings.
Definition Fretboard.h:56
int fret
Absolute display fret number using the same coordinate as Cell::fret.
Definition Fretboard.h:57
int endString
1-based last string in the barre.
Definition Fretboard.h:59
int startString
1-based first string in the barre.
Definition Fretboard.h:58
One marker or fretted position in the diagram.
Definition Fretboard.h:47
int fret
Absolute display fret number; zero is the open-string/marker position.
Definition Fretboard.h:49
dom::details::FretboardDiagram::Shape shape
Source marker or dot shape.
Definition Fretboard.h:50
int finger
Finger number; zero means no fingering is specified.
Definition Fretboard.h:51
Format-neutral display data for one Finale fretboard diagram.
Definition Fretboard.h:44
UnplayedStringDisplay unplayedStringDisplay
Display state for strings without frame notes.
Definition Fretboard.h:66
bool showFretboardNumber
Whether Finale displays fretboardNumber.
Definition Fretboard.h:65
std::vector< Cell > cells
Diagram cells in Finale source order.
Definition Fretboard.h:67
int stringCount
Number of strings in the associated fret instrument.
Definition Fretboard.h:62
std::vector< Barre > barres
Diagram barres in Finale source order.
Definition Fretboard.h:68
int fretboardNumber
Starting fret number stored by Finale.
Definition Fretboard.h:64
int fretCount
Number of frets displayed by the diagram.
Definition Fretboard.h:63