musicxml/elements/mordent.rs
1use crate::datatypes::{
2 AboveBelow, Color, FontFamily, FontSize, FontStyle, FontWeight, Percent, StartNote, Tenths, TrillBeats, TrillStep,
3 TwoNoteTurn, YesNo,
4};
5use alloc::{string::String, vec::Vec};
6use musicxml_internal::*;
7use musicxml_macros::*;
8
9/// Attributes pertaining to the [Mordent] element.
10#[derive(Debug, Default, PartialEq, Eq, AttributeDeserialize, AttributeSerialize)]
11pub struct MordentAttributes {
12 /// If yes, the trill accelerates during playback. It is no if not specified.
13 pub accelerate: Option<YesNo>,
14 /// Used for compound ornaments, indicating how the beginning of the ornament look relative to the main part of the mordent.
15 pub approach: Option<AboveBelow>,
16 /// The number of distinct notes during playback, counting the starting note but not the two-note turn. It is 3 if not specified.
17 pub beats: Option<TrillBeats>,
18 /// Indicates the color of an element.
19 pub color: Option<Color>,
20 /// Changes the computation of the default horizontal position.
21 /// The origin is changed relative to the left-hand side of the note or the musical position within the bar.
22 /// Positive x is right and negative x is left.
23 ///
24 /// This attribute provides higher-resolution positioning data than the [Offset][super::Offset] element.
25 /// Applications reading a MusicXML file that can understand both features should generally rely on this attribute for its greater accuracy.
26 pub default_x: Option<Tenths>,
27 /// Changes the computation of the default vertical position.
28 /// The origin is changed relative to the top line of the staff. Positive y is up and negative y is down.
29 ///
30 /// This attribute provides higher-resolution positioning data than the `placement` attribute.
31 /// Applications reading a MusicXML file that can understand both attributes should generally rely on this attribute for its greater accuracy.
32 pub default_y: Option<Tenths>,
33 /// Used for compound ornaments, indicating how the ending of the ornament look relative to the main part of the mordent.
34 pub departure: Option<AboveBelow>,
35 /// A comma-separated list of font names.
36 pub font_family: Option<FontFamily>,
37 /// One of the CSS sizes or a numeric point size.
38 pub font_size: Option<FontSize>,
39 /// Normal or italic style.
40 pub font_style: Option<FontStyle>,
41 /// Normal or bold weight.
42 pub font_weight: Option<FontWeight>,
43 /// The percentage of the way through the duration for landing on the last beat. It is 24 if not specified.
44 pub last_beat: Option<Percent>,
45 /// Specifies if the ornament is longer than usual. The value is no if not specified.
46 pub long: Option<YesNo>,
47 /// Indicates whether something is above or below another element, such as a note or a notation.
48 pub placement: Option<AboveBelow>,
49 /// Changes the horizontal position relative to the default position, either as computed by the individual program, or as overridden by the `default_x` attribute.
50 /// Positive x is right and negative x is left. It should be interpreted in the context of the [Offset][super::Offset] element or directive attribute if those are present.
51 pub relative_x: Option<Tenths>,
52 /// Changes the vertical position relative to the default position, either as computed by the individual program, or as overridden by the `default_y` attribute.
53 /// Positive y is up and negative y is down. It should be interpreted in the context of the `placement` attribute if that is present.
54 pub relative_y: Option<Tenths>,
55 /// The percentage of the way through the duration for landing on the second beat. It is 12 if not specified.
56 pub second_beat: Option<Percent>,
57 /// The starting note for playback, relative to the current note. It is main if not specified.
58 pub start_note: Option<StartNote>,
59 /// The alternating note for playback, relative to the current note. It is whole if not specified.
60 pub trill_step: Option<TrillStep>,
61 /// Specifies the two-note turn included at the end of the trill, if any. It is none if not specified.
62 pub two_note_turn: Option<TwoNoteTurn>,
63}
64
65/// The [Mordent] element represents the sign with the vertical line.
66///
67/// 
68///
69/// The choice of which mordent sign is inverted differs between MusicXML and the Standard Music Font Layout (SMuFL).
70#[derive(Debug, PartialEq, Eq, ElementDeserialize, ElementSerialize)]
71pub struct Mordent {
72 /// Element-specific attributes
73 pub attributes: MordentAttributes,
74 /// Element-specific content
75 pub content: (),
76}