1pub mod model;
6
7pub use model::arrange::{
8 AccordionAnalysis, ArrangeResult, PartCandidate, analyze_for_accordion, arrange_for_accordion,
9};
10pub use model::change_hint::{ChangeHint, ChangeScope};
11pub use model::commands::{
12 AddHairpinCmd, AddMeasureCmd, AddNoteCmd, AddPartCmd, AddPedalCmd, AddPitchCmd, AddSpannerCmd,
13 AddStaffCmd, BatchCmd, Command, CommandStack, DeleteMeasureCmd, DeleteNoteCmd, DeletePartCmd,
14 DeleteStaffCmd, NewScoreCmd, PasteRangeCmd, PasteVoiceCmd, RemoveSpannerCmd, RespellScoreCmd,
15 RespellScoreToKeyCmd, SetArpeggioCmd, SetBarlineCmd, SetChordSymbolCmd, SetClefCmd,
16 SetCrossStaffCmd, SetCueCmd, SetDurationCmd, SetDynamicCmd, SetExpressionTextCmd,
17 SetFiguredBassCmd, SetFingeringCmd, SetFingeringsCmd, SetGlissandoCmd, SetGraceCmd,
18 SetGuitarBendAlterCmd, SetGuitarTechniqueCmd, SetHarmonyRangeCmd, SetInstrumentIdCmd,
19 SetKeySignatureCmd, SetLyricCmd, SetMeasureTextCmd, SetMetadataCmd, SetMidiInstrumentCmd,
20 SetMultiRestCmd, SetNavigationMarkCmd, SetNoteHeadCmd, SetNotePlacementCmd, SetOttavaCmd,
21 SetPageBreakCmd, SetPartGroupCmd, SetPartNameCmd, SetRehearsalMarkCmd, SetScoreTextCmd,
22 SetStemCmd, SetStringNumberCmd, SetSystemBreakCmd, SetTabPositionCmd, SetTablatureConfigCmd,
23 SetTechniqueTextCmd, SetTempoAtMeasureCmd, SetTempoCmd, SetTimeSignatureCmd, SetTransposeCmd,
24 SetTupletCmd, SetUnpitchedCmd, SetVoltaCmd, ToggleArticulationCmd, ToggleSlurCmd, ToggleTieCmd,
25 ToggleTrillLineCmd, UpdateSpannerCmd, command_key, command_label,
26};
27pub use model::duration::Duration;
28pub use model::engine::{EngineHistory, HistoryConflict, HistoryRelation, ScoreEngine};
29pub use model::gm::{drum_name, program_name};
30pub use model::harmony::{detect_chord, roman_numeral};
31pub use model::interval::{Interval, IntervalQuality};
32pub use model::notation::{
33 Articulation, Barline, BeamState, ChordBarre, ChordDefinition, ChordDefinitionMember,
34 ChordDegree, ChordSymbol, Clef, CrossStaff, Dynamic, FiguredBassFigure,
35 FingeringSelectionPolicy, GuitarTechnique, HairpinKind, KeySignature, Lyric, NoteHead,
36 OttavaKind, StyledText, TabPosition, TablatureConfig, TextStyle, TimeSignature, TupletInfo,
37};
38pub use model::pitch::{Pitch, Step};
39pub use model::playback::{
40 MAX_PLAYBACK_COMPARISON_EVENTS, MAX_TAB_PERFORMANCE_EVENTS, MetronomeConfig,
41 PLAYBACK_COMPARISON_CONTRACT_VERSION, PlaybackEvent, PlaybackOptions, PlaybackPosition,
42 PlaybackTimingMismatch, PlaybackTimingReport, PlaybackTimingTolerance,
43 TAB_PERFORMANCE_CONTRACT_VERSION, TAB_ROUND_TRIP_CONTRACT_VERSION,
44 TablaturePerformanceDiagnostic, TablaturePerformanceEvent, TablaturePerformanceReport,
45 TablatureRoundTripDiagnostic, TablatureRoundTripReport, compare_playback_timing,
46 compute_playback_position, project_tablature_performance, tablature_round_trip_report,
47 to_playback_events, to_playback_events_bounded,
48};
49pub use model::repeat::measure_sequence;
50pub use model::scale::{Scale, ScaleKind};
51pub use model::score::{
52 Measure, MidiAftertouch, MidiControlChange, MidiPitchBend, MidiProgramChange, NotationSpanner,
53 NotationSpannerKind, Note, NoteAddr, Part, PartGroup, PartGroupSymbol, PercussionInstrument,
54 Score, ScoreChange, ScoreMetadata, ScorePatch, ScoreSettings, ScoreStats, ScoreTemplate, Staff,
55 StaffGroup, VoltaBracket, apply_patch, assign_tablature_positions, compute_beams, diff,
56 measure_beats_remaining, optimize_tablature_positions, respell_score, respell_score_to_key,
57 score_duration_secs, score_duration_secs_region, score_patch, suggested_stem_up, transpose,
58 transpose_checked,
59};
60pub use model::validate::{
61 SpannerEndpoint, TablatureValidationReason, ValidationError, ValidationReport,
62 ValidationWarning, validate,
63};
64
65pub const SCORE_SCHEMA_VERSION: u32 = 1;
67
68#[derive(Debug, thiserror::Error)]
69pub enum Error {
70 #[error("part index {0} out of range")]
71 PartNotFound(usize),
72 #[error("staff index {0} out of range")]
73 StaffNotFound(usize),
74 #[error("measure index {0} out of range")]
75 MeasureNotFound(usize),
76 #[error("note index {0} out of range")]
77 NoteNotFound(usize),
78 #[error("voice index {0} out of range")]
79 VoiceOutOfRange(usize),
80 #[error("{0}")]
81 InvalidCommand(String),
82 #[error("nothing to undo")]
83 NothingToUndo,
84 #[error("nothing to redo")]
85 NothingToRedo,
86 #[error("clipboard is empty")]
87 ClipboardEmpty,
88 #[error("cannot delete the last staff of a part")]
89 CannotDeleteLastStaff,
90 #[error("invalid patch: {0}")]
91 InvalidPatch(String),
92 #[error("score failed structural validation")]
93 InvalidScore,
94 #[error("engine history base score does not match the supplied score")]
95 HistoryBaseMismatch,
96 #[error("engine history is not a safe append-only extension")]
97 HistoryNotAppendable,
98 #[error("invalid playback comparison tolerance")]
99 InvalidPlaybackComparison,
100 #[error("playback comparison contains too many events ({0})")]
101 PlaybackComparisonTooLarge(usize),
102 #[error("tablature performance projection contains too many events ({0})")]
103 TabPerformanceTooLarge(usize),
104 #[error("tablature round-trip serialization failed: {0}")]
105 TabRoundTripSerialization(String),
106}