blob: d0691b9299afade0d3dbb860adb64dd586543187 (
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
-- Programmed by Jedidiah Barber
-- Released into the public domain
pragma Ada_2012;
private with
Interfaces;
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'Class;
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 Storage.Integer_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 Storage.Integer_Address)
return Interfaces.Integer_64;
pragma Export (C, Ada_Seek_Hook, "ada_seek_hook");
function Ada_Read_Hook
(Ptr : in Storage.Integer_Address;
Count : in Interfaces.Integer_64;
Data : in Storage.Integer_Address)
return Interfaces.Integer_64;
pragma Export (C, Ada_Read_Hook, "ada_read_hook");
function Ada_Write_Hook
(Ptr : in Storage.Integer_Address;
Count : in Interfaces.Integer_64;
Data : in Storage.Integer_Address)
return Interfaces.Integer_64;
pragma Export (C, Ada_Write_Hook, "ada_write_hook");
function Ada_Tell_Hook
(Data : in Storage.Integer_Address)
return Interfaces.Integer_64;
pragma Export (C, Ada_Tell_Hook, "ada_tell_hook");
end Libsndfile.Virtual;
|