Hosted by
|
with Ada.Tags; use Ada.Tags;
with Music; use Music;
with Pitches; use Pitches;
with Lyrics; use Lyrics;
with Lists;
with Notations;
with Notations.Slurs; use Notations.Slurs;
with Enum_Strings; use Enum_Strings;
package Music.Notes is
type Filled_Enum is (Auto, Yes, No);
function To_Filled_Enum is new To_Enum(Filled_Enum);
type Note_Type_Enum is (Long, Breve, Whole, Half, Quarter, Eighth,
N_16th, N_32nd, N_64th, N_128th, N_256th);
function To_Note_Type_Enum is new To_Enum(Note_Type_Enum);
type Natural_Array is array(Note_Type_Enum) of Natural;
Note_Numbers : constant Natural_Array := (0, 0, 1, 2, 4, 8, 16, 32, 64, 128, 256);
Flag_Counts : constant Natural_Array := (0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6);
type Stem_Enum is (Auto, Down, Up, None, Double);
function To_Stem_Enum is new To_Enum(Stem_Enum);
package Notation_Lists is new Lists(Notations.Notation_Access);
subtype Notation_List is Notation_Lists.List;
subtype Notation_List_Access is Notation_Lists.List_Access;
type Note_Head_Enum is (Slash, Triangle, Diamond, Square, Cross, X,
Circle_X, Normal, None);
type Beam_State_Enum is (None, N_Begin, N_End, Continue);
function To_Beam_State_Enum is new To_Enum(Beam_State_Enum);
subtype Beam_Range is Positive range 1 .. 6;
type Beam_Array is Array(Beam_Range) of Beam_State_Enum;
type Note is new Music_Data with private;
Note_Tag : constant String;
type Note_Access is access all Note;
function Create
return Note_Access;
procedure Set_Note_Head
(This : access Note;
Note_Head : in Note_Head_Enum := Normal);
function Get_Note_Head
(This : access Note)
return Note_Head_Enum;
procedure Set_Filled
(This : access Note;
Filled : in Filled_Enum := Auto);
procedure Set_Grace
(This : access Note;
Grace : in Boolean := False);
function Get_Grace
(This : access Note)
return Boolean;
procedure Set_Chord
(This : access Note;
Chord : in Boolean := False);
function Get_Chord
(This : access Note)
return Boolean;
procedure Set_Pitch
(This : access Note;
Pitch : in Pitch_Access);
function Get_Pitch
(This : access Note)
return Pitch_Access;
procedure Set_Duration
(This : access Note;
Duration : in Positive := 1);
function Get_Duration
(This : access Note)
return Positive;
procedure Set_Voice
(This : access Note;
Voice : in Natural := 0);
function Get_Voice
(This : access Note)
return Natural;
procedure Set_Note_Type
(This : access Note;
Note_Type : in Note_Type_Enum := Whole);
function Get_Note_Type
(This : access Note)
return Note_Type_Enum;
function Get_Dots
(This : access Note)
return Natural;
procedure Set_Stem
(This : access Note;
Stem : in Stem_Enum := Auto);
function Get_Stem
(This : access Note)
return Stem_Enum;
procedure Set_Staff
(This : access Note;
Staff : in Natural := 0);
function Get_Staff
(This : access Note)
return Natural;
function Get_Beams
(This : access Note)
return Beam_Array;
function Get_Notations
(This : access Note)
return Notation_List_Access;
procedure Set_Lyric
(This : access Note;
Lyric : in Lyric_Access);
function Get_Lyric
(This : access Note)
return Lyric_Access;
function Get_Filled
(This : access Note)
return Boolean;
procedure Add_Dot
(This : access Note);
procedure Set_Beam_State
(This : access Note;
Index : in Beam_Range;
State : in Beam_State_Enum);
function Get_Beam_State
(This : access Note;
Index : in Beam_Range)
return Beam_State_Enum;
procedure Add_Notation
(This : access Note;
Add : access Notations.Notation'Class);
function Get_Position
(This : access Note)
return Integer;
private
type Note is
new Music_Data with
record
Note_Head : Note_Head_Enum := Normal;
Filled : Filled_Enum := Auto;
Grace : Boolean := False;
Chord : Boolean := False;
Pitch : Pitch_Access;
Duration : Positive := 1;
Voice : Natural := 0;
Note_Type : Note_Type_Enum := Whole;
Dots : Natural := 0;
Stem : Stem_Enum := Auto;
Staff : Natural := 0;
Beams : Beam_Array := (others => none);
Notations : Notation_List_Access;
Lyric : Lyric_Access;
end record;
Note_Tag : constant String := "music.notes.note";
end Music.Notes;
|