-- 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;