summaryrefslogtreecommitdiff
path: root/src/libsndfile-virtual.ads
diff options
context:
space:
mode:
authorJedidiah Barber <contact@jedbarber.id.au>2023-07-02 21:36:34 +1200
committerJedidiah Barber <contact@jedbarber.id.au>2023-07-02 21:36:34 +1200
commit049d2a9a337331295b4a2d4ad13061bc73536236 (patch)
treec360b2ce05f91d070c14dad7a3691c1435df7df7 /src/libsndfile-virtual.ads
Initial commit
Diffstat (limited to 'src/libsndfile-virtual.ads')
-rw-r--r--src/libsndfile-virtual.ads116
1 files changed, 116 insertions, 0 deletions
diff --git a/src/libsndfile-virtual.ads b/src/libsndfile-virtual.ads
new file mode 100644
index 0000000..4ce27e6
--- /dev/null
+++ b/src/libsndfile-virtual.ads
@@ -0,0 +1,116 @@
+
+
+-- Programmed by Jedidiah Barber
+-- Released into the public domain
+
+
+private with
+
+ Interfaces,
+ System;
+
+
+package Libsndfile.Virtual is
+
+
+ ---------------------------------
+ -- Data Types and Structures --
+ ---------------------------------
+
+ type Virtual_Sound_File is new Sound_File with private;
+
+ type File_Length_Function is access function
+ return Count_Type;
+
+ type Seek_Function is access function
+ (Offset : in Count_Type;
+ Whence : in Seek_From)
+ return Count_Type;
+
+ type Read_Function is access function
+ (Data : out Raw_Data;
+ Bytes : in Count_Type)
+ return Count_Type;
+
+ type Write_Function is access function
+ (Data : in Raw_Data;
+ Bytes : in Count_Type)
+ return Count_Type;
+
+ type Tell_Function is access function
+ return Count_Type;
+
+
+
+
+ ---------------------
+ -- API Interface --
+ ---------------------
+
+ procedure Open
+ (File : in out Virtual_Sound_File;
+ Mode : in File_Mode;
+ Info : in out File_Info;
+ Length : in File_Length_Function;
+ Seek : in Seek_Function;
+ Read : in Read_Function;
+ Write : in Write_Function;
+ Tell : in Tell_Function)
+ with Pre => not Is_Open (File),
+ Post => Is_Open (File);
+
+
+private
+
+
+ type Virtual_Data is limited record
+ My_Length : File_Length_Function;
+ My_Seek : Seek_Function;
+ My_Read : Read_Function;
+ My_Write : Write_Function;
+ My_Tell : Tell_Function;
+ end record with Convention => C;
+
+
+ type Virtual_Sound_File is new Sound_File with record
+ My_Virtual : Virtual_Data;
+ end record;
+
+
+
+
+ function Ada_Filelen_Hook
+ (Data : in System.Address)
+ return Interfaces.Integer_64;
+ pragma Export (C, Ada_Filelen_Hook, "ada_filelen_hook");
+
+ function Ada_Seek_Hook
+ (Offset : in Interfaces.Integer_64;
+ Whence : in Interfaces.C.int;
+ Data : in System.Address)
+ return Interfaces.Integer_64;
+ pragma Export (C, Ada_Seek_Hook, "ada_seek_hook");
+
+ function Ada_Read_Hook
+ (Ptr : in System.Address;
+ Count : in Interfaces.Integer_64;
+ Data : in System.Address)
+ return Interfaces.Integer_64;
+ pragma Export (C, Ada_Read_Hook, "ada_read_hook");
+
+ function Ada_Write_Hook
+ (Ptr : in System.Address;
+ Count : in Interfaces.Integer_64;
+ Data : in System.Address)
+ return Interfaces.Integer_64;
+ pragma Export (C, Ada_Write_Hook, "ada_write_hook");
+
+ function Ada_Tell_Hook
+ (Data : in System.Address)
+ return Interfaces.Integer_64;
+ pragma Export (C, Ada_Tell_Hook, "ada_tell_hook");
+
+
+end Libsndfile.Virtual;
+
+