text
stringlengths
0
234
Function Definition: function From_Sample is new To_Int (Int_T);
Function Body: begin
for Elt of Buffer loop
Elt := From_Sample (This.Next_Sample);
end loop;
end Next_Samples_Int;
-----------------------
-- Next_Samples_UInt --
-----------------------
procedure Next_Samples_UInt (This : in out Instance;
Buffer : out Buffer_T)
is
function From_Sample is new To_UInt (UInt_T);
begin
for Elt of Buffer loop
Elt := From_Sample (This.Next_Sample);
end loop;
end Next_Samples_UInt;
-----------------
-- Process_Seq --
-----------------
procedure Process_Seq (This : in out Instance;
Chan_Id : Channel_ID)
is
Chan : Channel renames This.Channels (Chan_Id);
begin
if Chan.Seq_Remaining_Ticks /= 0 then
Chan.Seq_Remaining_Ticks := Chan.Seq_Remaining_Ticks - 1;
end if;
if Chan.Seq_Remaining_Ticks = 0 then
while Chan.Seq_Index in Chan.Seq'Range loop
declare
Cmd : Command renames Chan.Seq (Chan.Seq_Index);
begin
case Cmd.Kind is
when Wait_Ticks =>
Chan.Seq_Remaining_Ticks := Cmd.Ticks;
when Wait_Note =>
Chan.Seq_Remaining_Ticks :=
Tick_Count ((60.0 / Float (Chan.BPM)) *
Float (Chan.Ticks_Per_Second) *
(case Cmd.Note is
when Large => 8.0,
when Long => 4.0,
when Double => 2.0,
when Whole => 1.0,
when Half => 0.5,
when Quarter => 0.25,
when N_8th => 0.125,
when N_16th => 0.0625,
when N_32nd => 0.0312,
when N_64th => 0.015625,
when N_128th => 0.0078125,
when N_256th => 0.0039062));
when Note_On =>
Note_On (This, Chan_Id, Cmd.Freq);
when Note_Off =>
Note_Off (This, Chan_Id);
when Set_Decay =>
Set_Decay (This, Chan_Id, Cmd.Decay_Ticks);
when Set_Sweep =>
Set_Sweep (This, Chan_Id,
Cmd.Sweep,
Cmd.Sweep_Len,
Cmd.Sweep_Ticks);
when Set_Volume =>
Set_Volume (This, Chan_Id, Cmd.Vol);
when Set_Mode =>
Set_Mode (This, Chan_Id, Cmd.Mode);
when Set_Width =>
Set_Width (This, Chan_Id, Cmd.Width);
end case;
Function Definition: procedure tsp is
Function Body: package random_num is new ada.numerics.discrete_random (integer);
use random_num;
g : generator;
--total number of population
population_size : integer := 1000;
--length of gene = number of node
gene_length : integer := 15;
max_dist:integer := 40;
min_dist:integer := 10;
mutation_rate:integer:=100;