blob: a147de6fc6148fbca17f3833e2e41420441fa193 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
-- Programmed by Jedidiah Barber
-- Released into the public domain
-- This program opens the file supplied as a command line argument, outputs the
-- file info from it, then closes the file. No modifications are made.
with
Ada.Command_Line,
Ada.Directories,
Ada.Text_IO,
Libsndfile;
procedure File_Info_Example is
package ACom renames Ada.Command_Line;
package ADir renames Ada.Directories;
package TIO renames Ada.Text_IO;
My_Info : Libsndfile.File_Info := Libsndfile.Blank_Info;
My_Sound_File : Libsndfile.Sound_File;
begin
if ACom.Argument_Count < 1 then
TIO.Put_Line ("No filename provided");
ACom.Set_Exit_Status (ACom.Failure);
return;
end if;
if not ADir.Exists (ACom.Argument (1)) then
TIO.Put_Line ("File does not exist");
ACom.Set_Exit_Status (ACom.Failure);
return;
end if;
TIO.Put_Line ("Load file " & ACom.Argument (1));
My_Sound_File.Open (ACom.Argument (1), Libsndfile.Read_Only, My_Info);
TIO.New_Line;
TIO.Put_Line ("Open frame count:" & Libsndfile.Count_Type'Image (My_Info.Frames));
TIO.Put_Line ("Open sample rate:" & Natural'Image (My_Info.Rate));
TIO.Put_Line ("Open channel count:" & Natural'Image (My_Info.Channels));
TIO.Put_Line ("Open major format: " & Libsndfile.Major_Format'Image (My_Info.Major));
TIO.Put_Line ("Open minor format: " & Libsndfile.Minor_Format'Image (My_Info.Minor));
TIO.Put_Line ("Open endianness: " & Libsndfile.Endianness'Image (My_Info.Endian));
TIO.Put_Line ("Open section count:" & Natural'Image (My_Info.Sections));
TIO.Put_Line ("Open seekable: " & Boolean'Image (My_Info.Seekable));
TIO.New_Line;
My_Sound_File.Close;
TIO.Put_Line ("File closed");
end File_Info_Example;
|