musicxml/elements/instrument_change.rs
1use super::{Ensemble, InstrumentSound, Solo, VirtualInstrument};
2use crate::datatypes::IdRef;
3use alloc::{string::String, vec::Vec};
4use musicxml_internal::*;
5use musicxml_macros::*;
6
7/// Attributes pertaining to the [InstrumentChange] element.
8#[derive(Debug, PartialEq, Eq, AttributeDeserialize, AttributeSerialize)]
9pub struct InstrumentChangeAttributes {
10 /// Specifies an ID that is unique to the entire document.
11 pub id: IdRef,
12}
13
14/// Contents of the [InstrumentChange] element.
15#[derive(Debug, Default, PartialEq, Eq, ContentDeserialize, ContentSerialize)]
16pub struct InstrumentChangeContents {
17 /// The [InstrumentSound] element specifies the virtual instrument sound to use for a given [ScoreInstrument][super::ScoreInstrument].
18 pub instrument_sound: Option<InstrumentSound>,
19 /// The [Solo] element specifies the solo virtual instrument sound to use for a given [ScoreInstrument][super::ScoreInstrument].
20 pub solo: Option<Solo>,
21 /// The [Ensemble] element specifies the ensemble virtual instrument sound to use for a given [ScoreInstrument][super::ScoreInstrument].
22 pub ensemble: Option<Ensemble>,
23 /// The [VirtualInstrument] element specifies the virtual instrument to use for a given [ScoreInstrument][super::ScoreInstrument].
24 pub virtual_instrument: Option<VirtualInstrument>,
25}
26
27/// The [InstrumentChange] element type represents a change to the virtual instrument sound for a given [ScoreInstrument][super::ScoreInstrument].
28///
29/// All [InstrumentChange] child elements can also be initially specified within the [ScoreInstrument][super::ScoreInstrument] element.
30#[derive(Debug, PartialEq, Eq, ElementDeserialize, ElementSerialize)]
31#[rename("instrument-change")]
32pub struct InstrumentChange {
33 /// Element-specific attributes
34 pub attributes: InstrumentChangeAttributes,
35 #[flatten]
36 /// Element-specific content
37 pub content: InstrumentChangeContents,
38}