Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/level-element-explained.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The XSD wording (`docs/musicxml-4.0-ed15c23.xsd:2645`):

The second sentence was added in 4.0 to clarify the meaning (w3c-cg/musicxml#146).

Good's own example comes from his paper *Using MusicXML 2.0 for Editorial Applications* (Listing
Good's example comes from his paper *Using MusicXML 2.0 for Editorial Applications* (Listing
19). Two slurs in a Brahms edition come from different sources:

```xml
Expand Down Expand Up @@ -280,7 +280,7 @@ std::optional<LevelData> level;
parentheses around a rest the editor added") and say that a rest's parentheses go here, not on the
notehead.

Scope recommendation, unchanged: note only. The XSD's own `reference` example is on `<attributes>`
Scope recommendation, unchanged: note only. The XSD's `reference` example is on `<attributes>`
(original clef/key/time). That's the strongest case for another element, but `mx::api` doesn't model
`<attributes>` as an object, so it stays out unless someone designs one.

Expand Down
13 changes: 12 additions & 1 deletion src/include/mx/api/BarlineData.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
#pragma once

#include "mx/api/ApiCommon.h"
#include "mx/api/FootnoteData.h"
#include "mx/api/Id.h"
#include "mx/api/LevelData.h"
#include "mx/api/PositionData.h"

#include <optional>
Expand Down Expand Up @@ -150,13 +152,20 @@ class BarlineData
RepeatWinged repeatWinged;
HorizontalAlignment location;

// The editorial status of this barline (see LevelData), for example a repeat sign the editor
// added.
std::optional<LevelData> level;

// Editorial commentary about this barline, printed as a footnote (see FootnoteData).
std::optional<FootnoteData> footnote;

// The <barline> element's id attribute (see Id.h).
std::optional<Id> id;

BarlineData()
: tickTimePosition{0}, barlineType{BarlineType::normal}, ending{}, repeat{false}, repeatTimes{0},
repeatDirection{RepeatDirection::unspecified}, repeatAfterJump{Bool::unspecified},
repeatWinged{RepeatWinged::unspecified}, location{HorizontalAlignment::unspecified}, id{}
repeatWinged{RepeatWinged::unspecified}, location{HorizontalAlignment::unspecified}, level{}, footnote{}, id{}
{
}
};
Expand All @@ -171,6 +180,8 @@ MXAPI_EQUALS_MEMBER(repeatDirection)
MXAPI_EQUALS_MEMBER(repeatAfterJump)
MXAPI_EQUALS_MEMBER(repeatWinged)
MXAPI_EQUALS_MEMBER(location)
MXAPI_EQUALS_MEMBER(level)
MXAPI_EQUALS_MEMBER(footnote)
MXAPI_EQUALS_MEMBER(id)
MXAPI_EQUALS_END;
MXAPI_NOT_EQUALS_AND_VECTORS(BarlineData);
Expand Down
13 changes: 13 additions & 0 deletions src/include/mx/api/ChordData.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#pragma once

#include "mx/api/ApiCommon.h"
#include "mx/api/FootnoteData.h"
#include "mx/api/LevelData.h"
#include "mx/api/MiscData.h"
#include "mx/api/PitchData.h"
#include "mx/api/PositionData.h"
Expand Down Expand Up @@ -323,6 +325,15 @@ class ChordData
// value; when they differ, the first chord that is not unspecified is used.
Bool printFrame;
PositionData positionData;

// The editorial status of the chord symbol (see LevelData), for example a chord the editor
// supplied. The chords of one direction share a single level, so give them all the same
// value; when they differ, the first chord that has one is used.
std::optional<LevelData> level;

// Editorial commentary about the chord symbol, printed as a footnote (see FootnoteData). The
// chords of one direction share a single footnote, the same way they share level.
std::optional<FootnoteData> footnote;
};

MXAPI_EQUALS_BEGIN(ChordData)
Expand Down Expand Up @@ -356,6 +367,8 @@ MXAPI_EQUALS_MEMBER(hasFrameData)
MXAPI_EQUALS_MEMBER(frameData)
MXAPI_EQUALS_MEMBER(printFrame)
MXAPI_EQUALS_MEMBER(positionData)
MXAPI_EQUALS_MEMBER(level)
MXAPI_EQUALS_MEMBER(footnote)
MXAPI_EQUALS_END;
MXAPI_NOT_EQUALS_AND_VECTORS(ChordData);

Expand Down
16 changes: 15 additions & 1 deletion src/include/mx/api/DirectionData.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
#include "mx/api/ChordData.h"
#include "mx/api/DirectionChoice.h"
#include "mx/api/FiguredBassData.h"
#include "mx/api/FootnoteData.h"
#include "mx/api/Id.h"
#include "mx/api/LevelData.h"
#include "mx/api/SoundData.h"

#include <optional>
Expand Down Expand Up @@ -102,14 +104,24 @@ struct DirectionData
// serialize as their own <figured-bass> elements, not as direction-type content.
std::vector<FiguredBassData> figuredBasses;

// The editorial status of the direction's content (see LevelData), for example a dynamic the
// editor added, drawn in brackets. MusicXML keeps it on the <direction> element, which needs at
// least one direction type, so give the direction something in directionTypes. The chords and
// figured bass held here carry their own.
std::optional<LevelData> level;

// Editorial commentary about the direction's content, printed as a footnote (see FootnoteData).
// Like level, it is kept on the <direction> element, which needs at least one direction type.
std::optional<FootnoteData> footnote;

// The <direction> element's id attribute (see Id.h).
std::optional<Id> id;

DirectionData()
: tickTimePosition{0}, placement{Placement::unspecified}, systemRelation{SystemRelation::unspecified},
directive{Bool::unspecified}, offset{}, offsetSound{Bool::unspecified}, voice{VALUE_UNSPECIFIED},
isStaffValueSpecified{true}, isSoundDataSpecified{false}, soundData{}, directionTypes{}, chords{},
figuredBasses{}, id{}
figuredBasses{}, level{}, footnote{}, id{}
{
}
};
Expand All @@ -134,6 +146,8 @@ MXAPI_EQUALS_MEMBER(soundData)
MXAPI_EQUALS_MEMBER(directionTypes)
MXAPI_EQUALS_MEMBER(chords)
MXAPI_EQUALS_MEMBER(figuredBasses)
MXAPI_EQUALS_MEMBER(level)
MXAPI_EQUALS_MEMBER(footnote)
MXAPI_EQUALS_MEMBER(id)
MXAPI_EQUALS_END;
MXAPI_NOT_EQUALS_AND_VECTORS(DirectionData);
Expand Down
24 changes: 22 additions & 2 deletions src/include/mx/api/FiguredBassData.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
#pragma once

#include "mx/api/ApiCommon.h"
#include "mx/api/FootnoteData.h"
#include "mx/api/Id.h"
#include "mx/api/LevelData.h"
#include "mx/api/PositionData.h"
#include "mx/api/PrintData.h"

Expand Down Expand Up @@ -55,7 +57,14 @@ class FigureData
// The figure's continuation line. Absent when the figure does not have one.
std::optional<FigureExtend> extend;

FigureData() : prefix{}, figureNumber{}, suffix{}, extend{}
// The editorial status of this one figure (see LevelData), for example a figure the editor
// added, drawn in brackets.
std::optional<LevelData> level;

// Editorial commentary about this one figure, printed as a footnote (see FootnoteData).
std::optional<FootnoteData> footnote;

FigureData() : prefix{}, figureNumber{}, suffix{}, extend{}, level{}, footnote{}
{
}
};
Expand All @@ -65,6 +74,8 @@ MXAPI_EQUALS_MEMBER(prefix)
MXAPI_EQUALS_MEMBER(figureNumber)
MXAPI_EQUALS_MEMBER(suffix)
MXAPI_EQUALS_MEMBER(extend)
MXAPI_EQUALS_MEMBER(level)
MXAPI_EQUALS_MEMBER(footnote)
MXAPI_EQUALS_END;
MXAPI_NOT_EQUALS_AND_VECTORS(FigureData);

Expand Down Expand Up @@ -97,9 +108,16 @@ class FiguredBassData
// appearance.
PrintData printData;

// The editorial status of the whole figured bass (see LevelData), for example figures the
// editor supplied where the source does not have any.
std::optional<LevelData> level;

// Editorial commentary about the whole figured bass, printed as a footnote (see FootnoteData).
std::optional<FootnoteData> footnote;

FiguredBassData()
: figures{}, parentheses{Bool::unspecified}, durationTimeTicks{VALUE_UNSPECIFIED}, id{}, positionData{},
printData{}
printData{}, level{}, footnote{}
{
}
};
Expand All @@ -111,6 +129,8 @@ MXAPI_EQUALS_MEMBER(durationTimeTicks)
MXAPI_EQUALS_MEMBER(id)
MXAPI_EQUALS_MEMBER(positionData)
MXAPI_EQUALS_MEMBER(printData)
MXAPI_EQUALS_MEMBER(level)
MXAPI_EQUALS_MEMBER(footnote)
MXAPI_EQUALS_END;
MXAPI_NOT_EQUALS_AND_VECTORS(FiguredBassData);

Expand Down
60 changes: 60 additions & 0 deletions src/include/mx/api/FootnoteData.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// MusicXML Class Library
// Copyright (c) by Matthew James Briggs
// Distributed under the MIT License

#pragma once

#include "mx/api/ApiCommon.h"
#include "mx/api/ColorData.h"
#include "mx/api/FontData.h"
#include "mx/api/PositionData.h"

#include <optional>
#include <string>

namespace mx
{
namespace api
{
// The MusicXML <footnote> element: editorial commentary about a symbol, printed as a footnote in
// the score, such as "m. 12: slur absent in the autograph". A footnote explains in prose, while a
// level (see LevelData) classifies the symbol and says how to draw it. One symbol may carry both.
struct FootnoteData
{
// The words of the footnote.
std::string text;

// Where the footnote text is drawn, in tenths of a staff space, and how it aligns against that
// point. placement is ignored. Leave this alone to let the application place it.
PositionData positionData;

// The font of the footnote text.
FontData fontData;

// The color of the footnote text. Leave it empty to draw it in the score's usual color.
std::optional<ColorData> color;

// How the lines of the footnote line up with each other when it spans more than one line.
// Leave it unspecified to let the application decide.
HorizontalAlignment justify = HorizontalAlignment::unspecified;

// A shape drawn around the footnote text. Enclosure::unspecified does not draw an enclosure;
// Enclosure::none states explicitly that there is no enclosure.
Enclosure enclosure = Enclosure::unspecified;

// Whether the spaces at the start and end of text are part of it (see XmlSpace).
XmlSpace xmlSpace = XmlSpace::unspecified;
};

MXAPI_EQUALS_BEGIN(FootnoteData)
MXAPI_EQUALS_MEMBER(text)
MXAPI_EQUALS_MEMBER(positionData)
MXAPI_EQUALS_MEMBER(fontData)
MXAPI_EQUALS_MEMBER(color)
MXAPI_EQUALS_MEMBER(justify)
MXAPI_EQUALS_MEMBER(enclosure)
MXAPI_EQUALS_MEMBER(xmlSpace)
MXAPI_EQUALS_END;
MXAPI_NOT_EQUALS_AND_VECTORS(FootnoteData);
} // namespace api
} // namespace mx
Loading
Loading