Hosted by
|
package body Clefs is
function Create
(Number : in Natural;
Sign : in Sign_Enum;
Line : in Integer)
return Clef_Access
is
Result : Clef_Access := new Clef;
begin
Result.Number := Number;
Result.Sign := Sign;
Result.Line := Line;
return Result;
end Create;
function Get_Number
(This : access Clef)
return Natural is
begin
return This.Number;
end Get_Number;
function Get_Sign
(This : access Clef)
return Sign_Enum is
begin
return This.Sign;
end Get_Sign;
function Get_Middle_C
(This : access Clef)
return Integer is
begin
case This.Sign is
when G => return (Get_Line(This) - 3) * 2 - 4;
when F => return (Get_Line(This) - 3) * 2 + 4;
when C => return (Get_Line(This) - 3) * 2;
end case;
end Get_Middle_C;
function Get_Line
(This : access Clef)
return Integer is
begin
if This.Line = Auto then
case This.Sign is
when G => return 2;
when F => return 4;
when C => return 3;
end case;
end if;
return This.Line;
end Get_Line;
end Clefs;
|