-- $Date: 2004/03/08 10:57:30 $
-- $Revision: 1.10 $
-- $Author: jcrocholl $
-- $Hash: f1ee2658021aee8bcc6a2c0e499acf45 $

-- This file was automatically created with ado.php.
-- Manual changes will be lost when it is updated.

package body Music.Notes is

   -- Constructor for instances.
   function Create
     return Note_Access -- The newly created note.
   is
      Result : Note_Access := new Note;
   begin
      Result.Notations := Notation_Lists.Create;
      return Result;
   end Create;

   -- Mutator to update the note head of a note.
   procedure Set_Note_Head
     (This      : access Note;                    -- The note to be updated.
      Note_Head : in Note_Head_Enum := Normal) is -- The new note head of that note.
   begin
      This.Note_Head := Note_Head;
   end Set_Note_Head;

   -- Accessor to read the note head of a note.
   function Get_Note_Head
     (This : access Note)     -- The note to read from.
     return Note_Head_Enum is -- The note head of that note.
   begin
      return This.Note_Head;
   end Get_Note_Head;

   -- Mutator to update the filled of a note.
   procedure Set_Filled
     (This   : access Note;               -- The note to be updated.
      Filled : in Filled_Enum := Auto) is -- The new filled of that note.
   begin
      This.Filled := Filled;
   end Set_Filled;

   -- Mutator to update the grace of a note.
   procedure Set_Grace
     (This  : access Note;            -- The note to be updated.
      Grace : in Boolean := False) is -- The new grace of that note.
   begin
      This.Grace := Grace;
   end Set_Grace;

   -- Accessor to read the grace of a note.
   function Get_Grace
     (This : access Note-- The note to read from.
     return Boolean is    -- The grace of that note.
   begin
      return This.Grace;
   end Get_Grace;

   -- Mutator to update the chord of a note.
   procedure Set_Chord
     (This  : access Note;            -- The note to be updated.
      Chord : in Boolean := False) is -- The new chord of that note.
   begin
      This.Chord := Chord;
   end Set_Chord;

   -- Accessor to read the chord of a note.
   function Get_Chord
     (This : access Note-- The note to read from.
     return Boolean is    -- The chord of that note.
   begin
      return This.Chord;
   end Get_Chord;

   -- Mutator to update the pitch of a note.
   procedure Set_Pitch
     (This  : access Note;        -- The note to be updated.
      Pitch : in Pitch_Access) is -- The new pitch of that note.
   begin
      This.Pitch := Pitch;
   end Set_Pitch;

   -- Accessor to read the pitch of a note.
   function Get_Pitch
     (This : access Note)   -- The note to read from.
     return Pitch_Access is -- The pitch of that note.
   begin
      return This.Pitch;
   end Get_Pitch;

   -- Mutator to update the duration of a note.
   procedure Set_Duration
     (This     : access Note;         -- The note to be updated.
      Duration : in Positive := 1) is -- The new duration of that note.
   begin
      This.Duration := Duration;
   end Set_Duration;

   -- Accessor to read the duration of a note.
   function Get_Duration
     (This : access Note-- The note to read from.
     return Positive is   -- The duration of that note.
   begin
      return This.Duration;
   end Get_Duration;

   -- Mutator to update the voice of a note.
   procedure Set_Voice
     (This  : access Note;        -- The note to be updated.
      Voice : in Natural := 0) is -- The new voice of that note.
   begin
      This.Voice := Voice;
   end Set_Voice;

   -- Accessor to read the voice of a note.
   function Get_Voice
     (This : access Note-- The note to read from.
     return Natural is    -- The voice of that note.
   begin
      return This.Voice;
   end Get_Voice;

   -- Mutator to update the note type of a note.
   procedure Set_Note_Type
     (This      : access Note;                   -- The note to be updated.
      Note_Type : in Note_Type_Enum := Whole) is -- The new note type of that note.
   begin
      This.Note_Type := Note_Type;
   end Set_Note_Type;

   -- Accessor to read the note type of a note.
   function Get_Note_Type
     (This : access Note)     -- The note to read from.
     return Note_Type_Enum is -- The note type of that note.
   begin
      return This.Note_Type;
   end Get_Note_Type;

   -- Accessor to read the dots of a note.
   function Get_Dots
     (This : access Note-- The note to read from.
     return Natural is    -- The dots of that note.
   begin
      return This.Dots;
   end Get_Dots;

   -- Mutator to update the stem of a note.
   procedure Set_Stem
     (This : access Note;             -- The note to be updated.
      Stem : in Stem_Enum := Auto) is -- The new stem of that note.
   begin
      This.Stem := Stem;
   end Set_Stem;

   -- Accessor to read the stem of a note.
   function Get_Stem
     (This : access Note-- The note to read from.
     return Stem_Enum is  -- The stem of that note.
   begin
      return This.Stem;
   end Get_Stem;

   -- Mutator to update the staff of a note.
   procedure Set_Staff
     (This  : access Note;        -- The note to be updated.
      Staff : in Natural := 0) is -- The new staff of that note.
   begin
      This.Staff := Staff;
   end Set_Staff;

   -- Accessor to read the staff of a note.
   function Get_Staff
     (This : access Note-- The note to read from.
     return Natural is    -- The staff of that note.
   begin
      return This.Staff;
   end Get_Staff;

   -- Accessor to read the beams of a note.
   function Get_Beams
     (This : access Note-- The note to read from.
     return Beam_Array is -- The beams of that note.
   begin
      return This.Beams;
   end Get_Beams;

   -- Accessor to read the notations of a note.
   function Get_Notations
     (This : access Note)           -- The note to read from.
     return Notation_List_Access is -- The notations of that note.
   begin
      return This.Notations;
   end Get_Notations;

   -- Mutator to update the lyric of a note.
   procedure Set_Lyric
     (This  : access Note;        -- The note to be updated.
      Lyric : in Lyric_Access) is -- The new lyric of that note.
   begin
      This.Lyric := Lyric;
   end Set_Lyric;

   -- Accessor to read the lyric of a note.
   function Get_Lyric
     (This : access Note)   -- The note to read from.
     return Lyric_Access is -- The lyric of that note.
   begin
      return This.Lyric;
   end Get_Lyric;

   function Get_Filled
     (This : access Note-- The note object instance.
     return Boolean is    -- The note head fill.
   begin
      case This.Filled is
      when Yes => return True;
      when No => return False;
      when Auto =>
         case This.Note_Type is
         when Whole | Half => return False;
         when others => return True;
         end case;
      end case;
   end Get_Filled;

   -- Add another dot.
   procedure Add_Dot
     (This : access Note) is -- The note object instance.
   begin
      This.Dots := This.Dots + 1;
   end Add_Dot;

   -- Set a beam to start, stop, continue.
   procedure Set_Beam_State
     (This  : access Note;           -- The note object instance.
      Index : in Beam_Range;         -- Set this beam.
      State : in Beam_State_Enum) is -- Set beam to this state.
   begin
      This.Beams(Index) := State;
   end Set_Beam_State;

   -- Get a beam state.
   function Get_Beam_State
     (This  : access Note;     -- The note object instance.
      Index : in Beam_Range)   -- Get this beam.
     return Beam_State_Enum is -- The beam's state.
   begin
      return This.Beams(Index);
   end Get_Beam_State;

   -- Add a notation element to a note.
   procedure Add_Notation
     (This : access Note;                             -- The note object instance.
      Add  : access Notations.Notation'Class) is -- Add this notation.
   begin
      Notation_Lists.Push(This.Notations, Notations.Notation_Access(Add));
   end Add_Notation;

   -- Return the pitch position relative to middle C.
   function Get_Position
     (This : access Note-- The note object instance.
     return Integer is    -- Up or down from middle C.
   begin
      return Get_Position(This.Pitch);
   end Get_Position;

end Music.Notes;