summaryrefslogtreecommitdiff
path: root/src/portaudio-devices.ads
diff options
context:
space:
mode:
authorJedidiah Barber <contact@jedbarber.id.au>2023-07-17 00:59:56 +1200
committerJedidiah Barber <contact@jedbarber.id.au>2023-07-17 00:59:56 +1200
commit17ed86acaee20590b3ef4d1eea10f2fd27bd3350 (patch)
tree4a0578bacc4dad1cd548b7bbc63e35c38a1d2c84 /src/portaudio-devices.ads
parent543cd19ab514ec632d965acd5177c5bf6695520f (diff)
Split binding into a minimal hierarchy, improved documentation slightly
Diffstat (limited to 'src/portaudio-devices.ads')
-rw-r--r--src/portaudio-devices.ads171
1 files changed, 171 insertions, 0 deletions
diff --git a/src/portaudio-devices.ads b/src/portaudio-devices.ads
new file mode 100644
index 0000000..aae6674
--- /dev/null
+++ b/src/portaudio-devices.ads
@@ -0,0 +1,171 @@
+
+
+-- Programmed by Jedidiah Barber
+-- Released into the public domain
+
+
+pragma Ada_2012;
+
+
+private with
+
+ Interfaces.C.Strings,
+ System;
+
+
+package Portaudio.Devices is
+
+
+ ---------------------------------
+ -- Data Types and Structures --
+ ---------------------------------
+
+ type Host_API_Info is tagged private;
+
+ function Kind
+ (Info : in Host_API_Info)
+ return Host_API_Kind;
+
+ function Name
+ (Info : in Host_API_Info)
+ return String;
+
+ function Device_Count
+ (Info : in Host_API_Info)
+ return Natural;
+
+ function Default_Input_Device
+ (Info : in Host_API_Info)
+ return Device_Index;
+
+ function Default_Output_Device
+ (Info : in Host_API_Info)
+ return Device_Index;
+
+
+ type Device_Info is tagged private;
+
+ function Name
+ (Info : in Device_Info)
+ return String;
+
+ function Host_API
+ (Info : in Device_Info)
+ return Host_API_Index;
+
+ function Max_Input_Channels
+ (Info : in Device_Info)
+ return Natural;
+
+ function Max_Output_Channels
+ (Info : in Device_Info)
+ return Natural;
+
+ function Default_Low_Input_Latency
+ (Info : in Device_Info)
+ return Time;
+
+ function Default_Low_Output_Latency
+ (Info : in Device_Info)
+ return Time;
+
+ function Default_High_Input_Latency
+ (Info : in Device_Info)
+ return Time;
+
+ function Default_High_Output_Latency
+ (Info : in Device_Info)
+ return Time;
+
+ function Default_Sample_Rate
+ (Info : in Device_Info)
+ return Hertz;
+
+
+
+
+ -----------------------
+ -- API Subprograms --
+ -----------------------
+
+ function Get_Host_API_Count
+ return Natural;
+
+ function Get_Default_Host_API
+ return Host_API_Index
+ with Post => Get_Default_Host_API'Result in
+ Host_API_Index (1) .. Host_API_Index (Get_Host_API_Count);
+
+ function Get_Host_API_Info
+ (Index : in Host_API_Index)
+ return Host_API_Info
+ with Pre => Index in Host_API_Index (1) .. Host_API_Index (Get_Host_API_Count);
+
+ function To_Host_API_Index
+ (Kind : in Host_API_Kind)
+ return Host_API_Index
+ with Post => To_Host_API_Index'Result in
+ Host_API_Index (1) .. Host_API_Index (Get_Host_API_Count);
+
+ function To_Device_Index
+ (Host_API : in Host_API_Index;
+ Host_Device : in Positive)
+ return Device_Index
+ with Pre => Host_API in Host_API_Index (1) .. Host_API_Index (Get_Host_API_Count) and
+ Host_Device in 1 .. Get_Host_API_Info (Host_API).Device_Count,
+ Post => To_Device_Index'Result in
+ Device_Index (1) .. Device_Index (Get_Device_Count);
+
+ function Get_Device_Count
+ return Natural;
+
+ function Get_Default_Input_Device
+ return Device_Index;
+
+ function Get_Default_Output_Device
+ return Device_Index;
+
+ function Get_Device_Info
+ (Index : in Device_Index)
+ return Device_Info
+ with Pre => Index in Device_Index (1) .. Device_Index (Get_Device_Count);
+
+
+private
+
+
+ type C_Host_API_Info is record
+ My_Struct_Version : Interfaces.C.int;
+ My_Host_API_Type : Interfaces.C.int;
+ My_Name : Interfaces.C.Strings.chars_ptr;
+ My_Device_Count : Interfaces.C.int;
+ My_Default_Input : Interfaces.C.int;
+ My_Default_Output : Interfaces.C.int;
+ end record with Convention => C;
+
+ type Host_API_Info is tagged record
+ Ptr : System.Address;
+ end record;
+
+
+ type C_Device_Info is record
+ My_Struct_Version : Interfaces.C.int;
+ My_Name : Interfaces.C.Strings.chars_ptr;
+ My_Host_API_Index : Interfaces.C.int;
+ My_Input_Channels : Interfaces.C.int;
+ My_Output_Channels : Interfaces.C.int;
+ My_Low_Input_Latency : Interfaces.C.double;
+ My_Low_Output_Latency : Interfaces.C.double;
+ My_High_Input_Latency : Interfaces.C.double;
+ My_High_Output_Latency : Interfaces.C.double;
+ My_Sample_Rate : Interfaces.C.double;
+ end record with Convention => C;
+
+ type Device_Info is tagged record
+ Ptr : System.Address;
+ end record;
+
+
+end Portaudio.Devices;
+
+