Hosted by
|
package body Pitches is
function Create
(Step : in Step_Enum;
Alter : in Integer;
Octave : in Integer)
return Pitch_Access
is
Result : Pitch_Access := new Pitch;
begin
Result.Step := Step;
Result.Alter := Alter;
Result.Octave := Octave;
return Result;
end Create;
function Get_Step
(This : access Pitch)
return Step_Enum is
begin
return This.Step;
end Get_Step;
function Get_Alter
(This : access Pitch)
return Integer is
begin
return This.Alter;
end Get_Alter;
function Get_Octave
(This : access Pitch)
return Integer is
begin
return This.Octave;
end Get_Octave;
function Get_Position
(This : access Pitch)
return Integer is
begin
case This.Step is
when C => return (This.Octave - 4) * 7;
when D => return (This.Octave - 4) * 7 + 1;
when E => return (This.Octave - 4) * 7 + 2;
when F => return (This.Octave - 4) * 7 + 3;
when G => return (This.Octave - 4) * 7 + 4;
when A => return (This.Octave - 4) * 7 + 5;
when B => return (This.Octave - 4) * 7 + 6;
end case;
end Get_Position;
end Pitches;
|