summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJedidiah Barber <contact@jedbarber.id.au>2023-07-20 23:11:17 +1200
committerJedidiah Barber <contact@jedbarber.id.au>2023-07-20 23:11:17 +1200
commit59a2fd979cfb79e9f6cd0699b0ad05814279e2a7 (patch)
tree65c088e4347ceea5d9439005dbca4cae38f79441
parent623d5a88343a90c7b0d3aa02fe8b06b09b537928 (diff)
Changed array datatypes for better interop
-rw-r--r--example/virtual_io_example.adb7
-rw-r--r--src/libsndfile.ads14
2 files changed, 13 insertions, 8 deletions
diff --git a/example/virtual_io_example.adb b/example/virtual_io_example.adb
index 8953c07..add9b56 100644
--- a/example/virtual_io_example.adb
+++ b/example/virtual_io_example.adb
@@ -15,6 +15,7 @@ with
Ada.Directories,
Ada.Direct_IO,
Ada.Text_IO,
+ Interfaces,
Libsndfile.Virtual;
use type
@@ -27,7 +28,7 @@ procedure Virtual_IO_Example is
package ACom renames Ada.Command_Line;
package ADir renames Ada.Directories;
- package DIO is new Ada.Direct_IO (Element_Type => Character);
+ package DIO is new Ada.Direct_IO (Element_Type => Interfaces.Unsigned_8);
package TIO renames Ada.Text_IO;
@@ -69,7 +70,7 @@ procedure Virtual_IO_Example is
Bytes : in Libsndfile.Count_Type)
return Libsndfile.Count_Type
is
- Item : Character;
+ Item : Interfaces.Unsigned_8;
Data_Position : Integer := 1;
begin
while Current_Offset <= Libsndfile.Count_Type (DIO.Size (Virtual_File)) and
@@ -88,7 +89,7 @@ procedure Virtual_IO_Example is
Bytes : in Libsndfile.Count_Type)
return Libsndfile.Count_Type
is
- Item : Character;
+ Item : Interfaces.Unsigned_8;
Data_Position : Integer := 1;
begin
while Current_Offset <= Libsndfile.Count_Type (DIO.Size (Virtual_File)) and
diff --git a/src/libsndfile.ads b/src/libsndfile.ads
index 2c0866c..d88c06d 100644
--- a/src/libsndfile.ads
+++ b/src/libsndfile.ads
@@ -7,6 +7,10 @@
pragma Ada_2012;
+with
+
+ Interfaces;
+
private with
Interfaces.C,
@@ -28,12 +32,12 @@ package Libsndfile is
type Seek_From is (From_Start, From_Current, From_End);
- type Short_Data is array (Positive range <>) of Short_Integer;
- type Integer_Data is array (Positive range <>) of Integer;
- type Float_Data is array (Positive range <>) of Float;
- type Double_Data is array (Positive range <>) of Long_Float;
+ type Short_Data is array (Positive range <>) of Interfaces.Integer_16;
+ type Integer_Data is array (Positive range <>) of Interfaces.Integer_32;
+ type Float_Data is array (Positive range <>) of Interfaces.IEEE_Float_32;
+ type Double_Data is array (Positive range <>) of Interfaces.IEEE_Float_64;
- type Raw_Data is new String;
+ type Raw_Data is array (Positive range <>) of Interfaces.Unsigned_8;
type Metadata is
(Title_String,