text
stringlengths
0
234
begin
Wave_Format := Init (Bit_Depth => Test_Bits,
Sample_Rate => Sample_Rate_44100,
Number_Of_Channels => 2,
Use_Float => False);
WF_Out.Set_Format_Of_Wavefile (Wave_Format);
WF_Out.Create (Out_File, Wav_File_Name);
Write_PCM_Vals (WF_Out, PCM_Ref);
WF_Out.Close;
end Write_Wavefile;
-------------------
-- Read_Wavefile --
-------------------
procedure Read_Wavefile
(Wav_File_Name : String;
PCM_DUT : out PCM_Buffer)
is
WF_In : Wavefile;
-- Wave_Format : Wave_Format_Extensible;
EOF : Boolean;
Samples : Integer := 0;
begin
WF_In.Open (In_File, Wav_File_Name);
-- Wave_Format := WF_In.Format_Of_Wavefile;
if Verbose then
Display_Info (WF_In, "Input File:");
end if;
Samples := 0;
PCM_DUT := (others => 0.0);
loop
Samples := Samples + 1;
-- Put ("[" & Integer'Image (Samples) & "]");
declare
PCM_Buf : constant PCM_Buffer := Get (WF_In);
begin
PCM_DUT (Samples) := PCM_Buf (PCM_Buf'First);
Function Definition: procedure Gif2ada is
Function Body: use Interfaces;
Image : GID.Image_descriptor;
begin
if Ada.Command_Line.Argument_Count /= 2 then
Ada.Text_IO.Put_Line (Ada.Text_IO.Standard_Error,
"Usage: gif2ada <package-name> <file>");
Ada.Text_IO.Put_Line (Ada.Text_IO.Standard_Error,
"Generate an Ada package that contains an GIF image");
Ada.Command_Line.Set_Exit_Status (2);
return;
end if;
declare
subtype Primary_color_range is Unsigned_8;
procedure Get_Color (Red, Green, Blue : Interfaces.Unsigned_8);
procedure Set_X_Y (X, Y : in Natural) is null;
procedure Put_Pixel (Red, Green, Blue : Primary_color_range;
Alpha : Primary_color_range) is null;
procedure Feedback (Percents : Natural) is null;
procedure Raw_Byte (B : in Interfaces.Unsigned_8);
Name : constant String := Ada.Command_Line.Argument (1);
Path : constant String := Ada.Command_Line.Argument (2);
File : Ada.Streams.Stream_IO.File_Type;
Color_Count : Natural := 0;
Need_Sep : Boolean := False;
Need_Line : Boolean := False;
Count : Natural := 0;
procedure Raw_Byte (B : in Interfaces.Unsigned_8) is
begin
if Need_Sep then
Ada.Text_IO.Put (",");
end if;
if Need_Line then
Need_Line := False;
Ada.Text_IO.New_Line;
Ada.Text_IO.Set_Col (8);
end if;
Need_Sep := True;
Ada.Text_IO.Put (Natural'Image (Natural (B)));
Count := Count + 1;
Need_Line := (Count mod 8) = 0;
end Raw_Byte;
procedure Load_Image is
new GID.Load_image_contents (Primary_color_range, Set_X_Y,
Put_Pixel, Raw_Byte, Feedback, GID.fast);
procedure Get_Color (Red, Green, Blue : Interfaces.Unsigned_8) is
Red_Image : constant String := Unsigned_8'Image (Red);
begin