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
67 changes: 67 additions & 0 deletions src/include/mx/api/DampData.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// 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
{
// A harp damping mark, MusicXML's <damp> element: the player silences one or more ringing
// strings with the hand. positionData captures default/relative x-y plus the horizontal and
// vertical alignment; its placement member is unused here because <damp> has no placement
// attribute (placement lives on the parent <direction>).
class DampData
{
public:
PositionData positionData;
FontData fontData;
std::optional<ColorData> color;
std::optional<std::string> id;

DampData() : positionData{}, fontData{}, color{}, id{}
{
}
};

MXAPI_EQUALS_BEGIN(DampData)
MXAPI_EQUALS_MEMBER(positionData)
MXAPI_EQUALS_MEMBER(fontData)
MXAPI_EQUALS_MEMBER(color)
MXAPI_EQUALS_MEMBER(id)
MXAPI_EQUALS_END;
MXAPI_NOT_EQUALS_AND_VECTORS(DampData);

// A harp damping mark, MusicXML's <damp-all> element: the player silences all of the ringing
// strings at once, notated as an X inside a circle. Formatting works the same way as DampData.
class DampAllData
{
public:
PositionData positionData;
FontData fontData;
std::optional<ColorData> color;
std::optional<std::string> id;

DampAllData() : positionData{}, fontData{}, color{}, id{}
{
}
};

MXAPI_EQUALS_BEGIN(DampAllData)
MXAPI_EQUALS_MEMBER(positionData)
MXAPI_EQUALS_MEMBER(fontData)
MXAPI_EQUALS_MEMBER(color)
MXAPI_EQUALS_MEMBER(id)
MXAPI_EQUALS_END;
MXAPI_NOT_EQUALS_AND_VECTORS(DampAllData);
} // namespace api
} // namespace mx
25 changes: 24 additions & 1 deletion src/include/mx/api/DirectionData.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@
#include "mx/api/ApiCommon.h"
#include "mx/api/ChordData.h"
#include "mx/api/CodaData.h"
#include "mx/api/DampData.h"
#include "mx/api/EyeglassesData.h"
#include "mx/api/FiguredBassData.h"
#include "mx/api/MarkData.h"
#include "mx/api/OttavaData.h"
#include "mx/api/RehearsalData.h"
#include "mx/api/SegnoData.h"
#include "mx/api/SoundData.h"
#include "mx/api/StaffDivideData.h"
#include "mx/api/StringMuteData.h"
#include "mx/api/TempoData.h"
#include "mx/api/WedgeData.h"
#include "mx/api/WordsData.h"
Expand All @@ -39,7 +43,12 @@ enum class DirectionComponentKind
chord,
segno,
coda,
rehearsal
rehearsal,
damp,
dampAll,
eyeglasses,
stringMute,
staffDivide
};

struct DirectionComponent
Expand Down Expand Up @@ -120,6 +129,11 @@ struct DirectionData
std::vector<SegnoData> segnos;
std::vector<CodaData> codas;
std::vector<RehearsalData> rehearsals;
std::vector<DampData> damps;
std::vector<DampAllData> dampAlls;
std::vector<EyeglassesData> eyeglasses;
std::vector<StringMuteData> stringMutes;
std::vector<StaffDivideData> staffDivides;
// Preserves the original order of direction-type children from parsed XML
// for round-trip fidelity. Do NOT populate this when constructing
// DirectionData programmatically. If empty, the writer uses a default
Expand All @@ -146,6 +160,9 @@ inline bool isDirectionDataEmpty(const DirectionData &directionData)
directionData.tempos.size() == 0 && directionData.ottavaStarts.size() == 0 &&
directionData.ottavaStops.size() == 0 && directionData.words.size() == 0 &&
directionData.segnos.size() == 0 && directionData.codas.size() == 0 &&
directionData.rehearsals.size() == 0 && directionData.damps.size() == 0 &&
directionData.dampAlls.size() == 0 && directionData.eyeglasses.size() == 0 &&
directionData.stringMutes.size() == 0 && directionData.staffDivides.size() == 0 &&
directionData.figuredBasses.size() == 0 && !directionData.isSoundDataSpecified &&
directionData.orderedComponents.size() == 0;
}
Expand Down Expand Up @@ -174,6 +191,12 @@ MXAPI_EQUALS_MEMBER(chords)
MXAPI_EQUALS_MEMBER(figuredBasses)
MXAPI_EQUALS_MEMBER(segnos)
MXAPI_EQUALS_MEMBER(codas)
MXAPI_EQUALS_MEMBER(rehearsals)
MXAPI_EQUALS_MEMBER(damps)
MXAPI_EQUALS_MEMBER(dampAlls)
MXAPI_EQUALS_MEMBER(eyeglasses)
MXAPI_EQUALS_MEMBER(stringMutes)
MXAPI_EQUALS_MEMBER(staffDivides)
MXAPI_EQUALS_MEMBER(orderedComponents)
MXAPI_EQUALS_END;
MXAPI_NOT_EQUALS_AND_VECTORS(DirectionData);
Expand Down
45 changes: 45 additions & 0 deletions src/include/mx/api/EyeglassesData.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// 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 eyeglasses symbol, MusicXML's <eyeglasses> element: a cue common in commercial music
// telling the player to watch the conductor (or another player) closely at this spot.
// positionData captures default/relative x-y plus the horizontal and vertical alignment; its
// placement member is unused here because <eyeglasses> has no placement attribute (placement
// lives on the parent <direction>).
class EyeglassesData
{
public:
PositionData positionData;
FontData fontData;
std::optional<ColorData> color;
std::optional<std::string> id;

EyeglassesData() : positionData{}, fontData{}, color{}, id{}
{
}
};

MXAPI_EQUALS_BEGIN(EyeglassesData)
MXAPI_EQUALS_MEMBER(positionData)
MXAPI_EQUALS_MEMBER(fontData)
MXAPI_EQUALS_MEMBER(color)
MXAPI_EQUALS_MEMBER(id)
MXAPI_EQUALS_END;
MXAPI_NOT_EQUALS_AND_VECTORS(EyeglassesData);
} // namespace api
} // namespace mx
56 changes: 56 additions & 0 deletions src/include/mx/api/StaffDivideData.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// 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
{
// Which staff-divide arrow a StaffDivideData shows: an arrow pointing down, up, or both.
enum class StaffDivideType
{
down,
up,
upDown
};

// A staff-divide arrow, MusicXML's <staff-divide> element (MusicXML 3.1): the arrow symbol used
// in condensed conductor scores where one staff carries two players, showing whether the music
// continues on the staff below (down), above (up), or both (up-down). positionData captures
// default/relative x-y plus the horizontal and vertical alignment; its placement member is
// unused here because <staff-divide> has no placement attribute (placement lives on the parent
// <direction>).
class StaffDivideData
{
public:
StaffDivideType type;
PositionData positionData;
FontData fontData;
std::optional<ColorData> color;
std::optional<std::string> id;

StaffDivideData() : type{StaffDivideType::down}, positionData{}, fontData{}, color{}, id{}
{
}
};

MXAPI_EQUALS_BEGIN(StaffDivideData)
MXAPI_EQUALS_MEMBER(type)
MXAPI_EQUALS_MEMBER(positionData)
MXAPI_EQUALS_MEMBER(fontData)
MXAPI_EQUALS_MEMBER(color)
MXAPI_EQUALS_MEMBER(id)
MXAPI_EQUALS_END;
MXAPI_NOT_EQUALS_AND_VECTORS(StaffDivideData);
} // namespace api
} // namespace mx
53 changes: 53 additions & 0 deletions src/include/mx/api/StringMuteData.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// 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
{
// Whether a StringMuteData turns muting on or off.
enum class StringMuteType
{
on,
off
};

// A string mute change, MusicXML's <string-mute> element: the "mute on" or "mute off" symbol
// telling string players to apply or remove their mutes. positionData captures default/relative
// x-y plus the horizontal and vertical alignment; its placement member is unused here because
// <string-mute> has no placement attribute (placement lives on the parent <direction>).
class StringMuteData
{
public:
StringMuteType type;
PositionData positionData;
FontData fontData;
std::optional<ColorData> color;
std::optional<std::string> id;

StringMuteData() : type{StringMuteType::on}, positionData{}, fontData{}, color{}, id{}
{
}
};

MXAPI_EQUALS_BEGIN(StringMuteData)
MXAPI_EQUALS_MEMBER(type)
MXAPI_EQUALS_MEMBER(positionData)
MXAPI_EQUALS_MEMBER(fontData)
MXAPI_EQUALS_MEMBER(color)
MXAPI_EQUALS_MEMBER(id)
MXAPI_EQUALS_END;
MXAPI_NOT_EQUALS_AND_VECTORS(StringMuteData);
} // namespace api
} // namespace mx
Loading
Loading