-- un iterateur pour calculer global pour supprimer des ligne dans une vue Gtk_Tree_View.
Parent : Gtk_Tree_Iter := Null_Iter;
-- un paquetage de génération aléatoire pour un type discret
-- de type value_type pouvant prendre une valeur de 0 à 127.
use MIDI_Value_Rand;
-- La fonction de test plugin qui envoie envoie un note on et un note off vers un périphérique MIDI.
function Test_Plugin_Action (Ultrason : Ultrason_Access) return Boolean is
Note : Note_Type;
Message : Message_Type;
Iter : Gtk_Tree_Iter := Null_Iter;
Seq : Seq_Access;
Verax : Boolean := False;
begin
for Aux_Id in Ultrason.Theory.Aux.Set'Range loop
if Ultrason.Theory.Aux.Set(Aux_Id) /= null then
if Ultrason.Theory.Aux.Set(Aux_Id).all in Test_Plugin_Record then
Note := (Key => Random(Test_Plugin_Record(Ultrason.Theory.Aux.Set(Aux_Id).all).Value_Gen.all),
Sens => Random(Test_Plugin_Record(Ultrason.Theory.Aux.Set(Aux_Id).all).Value_Gen.all),
On_Hour => 0.0,
Off_Hour => 0.0);
Message := Note_On(0,
Note.Key,
Note.Sens);
Seq :=
new Seq_Type '
(new Step_Record ' ((Ultrason.Theory.Options.Tempo,
((Clock - Ultrason.Theory.Options.Timers.Date) + Quantum(Ultrason.Theory.Options.Signature,
Ultrason.Theory.Options.Tempo)),
Step_Vectors."&"(Step_Vectors.Empty_Vector, To_Long(Message)))),
null, null);
Insert_Steps_Before(Ultrason.Buffered_Partition, Left => seq, Right => seq,
Steps => Seq,
Device_Id => Plugin_Record(Ultrason.Theory.Aux.Set(Aux_Id).all).Device_Id);
while Gtk.Main.Events_Pending loop
Verax := Gtk.Main.Main_Iteration(False);
end loop;
if Plugin_Record(Ultrason.Theory.Aux.Set(Aux_Id).all).Printed then
Iter := Add_Line
(Ultrason.Flow_Model,
Natural'Image(Aux_Id),
Natural'Image(Plugin_Record(Ultrason.Theory.Aux.Set(Aux_Id).all).Device_Id),
Control_Type'Image(Control_Of(To_Long(Message))),
Channel_Type'Image(Channel_Of(To_Long(Message))),
Interfaces.C.Long'Image(Portmidi.Data1(To_Long(Message))),
Interfaces.C.Long'Image(Portmidi.Data2(To_Long(Message))),
Formatting.Image(Seq.Step.Hour, True), Parent => parent);
while Gtk.Main.Events_Pending loop
Verax := Gtk.Main.Main_Iteration(False);
end loop;
Iter := Get_Iter_First(Ultrason.Flow_Model);
if Line_Counter > 50 then
for I in 1..Line_Counter/2 loop
Parent := Iter;
Next(Ultrason.Flow_Model, iter);
Remove(Ultrason.Flow_Model, parent);
Line_Counter := Line_Counter - 1;
end loop;
end if;
while Gtk.Main.Events_Pending loop
Verax := Gtk.Main.Main_Iteration(False);
end loop;
end if;
Message := Note_Off(0, Note.Key);
Seq :=
new Seq_Type '
(new Step_Record ' ((Ultrason.Theory.Options.Tempo,
((Clock - Ultrason.Theory.Options.Timers.Date) + ((Quantum(Ultrason.Theory.Options.Signature,
Ultrason.Theory.Options.Tempo) * 2\
.0))),
Step_Vectors."&"(Step_Vectors.Empty_Vector, To_Long(Message)))),
null,
null);
Insert_Steps_Before(Ultrason.Buffered_Partition, Left => seq, Right => seq,
Steps => Seq,
Device_Id => Plugin_Record(Ultrason.Theory.Aux.Set(Aux_Id).all).Device_Id);
while Gtk.Main.Events_Pending loop
Verax := Gtk.Main.Main_Iteration(False);
end loop;
if Plugin_Record(Ultrason.Theory.Aux.Set(Aux_Id).all).Printed then
Iter := Add_Line
(Ultrason.Flow_Model,
Natural'Image(Aux_Id),
Natural'Image(Plugin_Record(Ultrason.Theory.Aux.Set(Aux_Id).all).Device_Id),
Control_Type'Image(Control_Of(To_Long(Message))),
Channel_Type'Image(Channel_of(To_Long(Message))),
Interfaces.C.Long'Image(Portmidi.Data1(To_Long(Message))),
Interfaces.C.Long'Image(Portmidi.Data2(To_Long(Message))),
Formatting.Image(Seq.Step.Hour, True), Parent => parent);
while Gtk.Main.Events_Pending loop
Verax := Gtk.Main.Main_Iteration(False);
end loop;
Iter := Get_Iter_First(Ultrason.Flow_Model);
if Line_Counter > 50 then
for I in 1..Line_Counter/2 loop
Parent := Iter;
Next(Ultrason.Flow_Model, iter);
Remove(Ultrason.Flow_Model, parent);
Line_Counter := Line_Counter - 1;
end loop;
end if;
while Gtk.Main.Events_Pending loop
Verax := Gtk.Main.Main_Iteration(False);
end loop;
end if;
end if;
end if;
end loop;
return True;
end Test_Plugin_Action;