Skip to main content

acorde_core/
lib.rs

1pub mod model;
2
3pub use model::arrange::{analyze_for_accordion, arrange_for_accordion, AccordionAnalysis, ArrangeResult, PartCandidate};
4pub use model::score::{
5    Measure, Note, NoteAddr, Part, PartGroup, PartGroupSymbol, Score, ScoreChange, ScoreMetadata, ScoreSettings, ScoreStats,
6    ScoreTemplate, Staff, VoltaBracket, ScorePatch,
7    diff, score_patch, apply_patch,
8    transpose, respell_score, respell_score_to_key,
9    score_duration_secs, score_duration_secs_region, measure_beats_remaining,
10    suggested_stem_up, compute_beams,
11};
12pub use model::pitch::{Pitch, Step};
13pub use model::duration::Duration;
14pub use model::notation::{
15    Articulation, Barline, BeamState, ChordSymbol, Clef, Dynamic, GuitarTechnique,
16    HairpinKind, KeySignature, Lyric, NoteHead, OttavaKind, TimeSignature, TupletInfo,
17};
18pub use model::commands::{
19    AddHairpinCmd, AddMeasureCmd, AddNoteCmd, AddPartCmd, AddPedalCmd, AddPitchCmd,
20    AddStaffCmd, BatchCmd, Command, CommandStack, DeleteMeasureCmd, DeleteNoteCmd,
21    DeletePartCmd, DeleteStaffCmd, NewScoreCmd,
22    RespellScoreCmd, RespellScoreToKeyCmd, SetArpeggioCmd, SetBarlineCmd, SetChordSymbolCmd, SetClefCmd, SetDynamicCmd, SetGraceCmd,
23    SetKeySignatureCmd, SetLyricCmd, SetMetadataCmd, SetMidiInstrumentCmd, SetMultiRestCmd,
24    SetNavigationMarkCmd, SetOttavaCmd, SetPageBreakCmd, SetPartNameCmd, SetRehearsalMarkCmd,
25    SetSystemBreakCmd, SetStemCmd, SetTempoCmd, SetTempoAtMeasureCmd, SetTimeSignatureCmd, SetTransposeCmd,
26    SetTupletCmd, SetVoltaCmd, ToggleArticulationCmd, ToggleSlurCmd, ToggleTieCmd,
27    PasteVoiceCmd, PasteRangeCmd, command_key, command_label,
28    SetTechniqueTextCmd, SetFingeringCmd, SetStringNumberCmd, SetNoteHeadCmd, SetCueCmd,
29    SetGuitarTechniqueCmd,
30    SetExpressionTextCmd, ToggleTrillLineCmd, SetPartGroupCmd,
31};
32pub use model::change_hint::{ChangeHint, ChangeScope};
33pub use model::engine::{EngineHistory, ScoreEngine};
34pub use model::gm::{drum_name, program_name};
35pub use model::harmony::{detect_chord, roman_numeral};
36pub use model::interval::{Interval, IntervalQuality};
37pub use model::playback::{
38    MetronomeConfig, PlaybackEvent, PlaybackOptions, PlaybackPosition,
39    compute_playback_position, to_playback_events,
40};
41pub use model::repeat::measure_sequence;
42pub use model::scale::{Scale, ScaleKind};
43pub use model::validate::{ValidationError, ValidationWarning, ValidationReport, validate};
44
45/// Current Score JSON schema version produced by this crate.
46pub const SCORE_SCHEMA_VERSION: u32 = 1;
47
48#[derive(Debug, thiserror::Error)]
49pub enum Error {
50    #[error("part index {0} out of range")]
51    PartNotFound(usize),
52    #[error("staff index {0} out of range")]
53    StaffNotFound(usize),
54    #[error("measure index {0} out of range")]
55    MeasureNotFound(usize),
56    #[error("note index {0} out of range")]
57    NoteNotFound(usize),
58    #[error("voice index {0} out of range")]
59    VoiceOutOfRange(usize),
60    #[error("{0}")]
61    InvalidCommand(String),
62    #[error("nothing to undo")]
63    NothingToUndo,
64    #[error("nothing to redo")]
65    NothingToRedo,
66    #[error("clipboard is empty")]
67    ClipboardEmpty,
68    #[error("cannot delete the last staff of a part")]
69    CannotDeleteLastStaff,
70    #[error("invalid patch: {0}")]
71    InvalidPatch(String),
72}