diff options
author | Jedidiah Barber <contact@jedbarber.id.au> | 2023-07-18 01:47:26 +1200 |
---|---|---|
committer | Jedidiah Barber <contact@jedbarber.id.au> | 2023-07-18 01:47:26 +1200 |
commit | baac81253b3cc2e3addbbe6e90ec2a7abb5d56fd (patch) | |
tree | 88cb63624bcae8f944d670640094873a55610823 /src/libao.ads | |
parent | c36d37880986f734a69086b28ac6f0e9df7babab (diff) |
Code cleanup, slight API improvement
Diffstat (limited to 'src/libao.ads')
-rw-r--r-- | src/libao.ads | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/src/libao.ads b/src/libao.ads index 9e1cde1..33ec49c 100644 --- a/src/libao.ads +++ b/src/libao.ads @@ -4,6 +4,10 @@ -- Released into the public domain +with + + Interfaces; + private with Ada.Finalization, @@ -25,7 +29,7 @@ package Libao is type Data_Buffer is new String; - type Device is private; + type Device is tagged private; type Info is tagged private; @@ -72,7 +76,7 @@ package Libao is Empty_Options : constant Option_List; - type Sample_Format is private; + type Sample_Format is tagged private; type Channel_Mnemonic is (L, R, C, M, CL, CR, BL, BR, BC, SL, SR, LFE, A1, A2, A3, A4, X); type Mnemonic_Array is array (Positive range <>) of Channel_Mnemonic; @@ -144,26 +148,26 @@ package Libao is (Key : in String; Value : in String); - function Open_Live - (Driver_ID : in Driver_ID_Number; - Format : in Sample_Format; - Options : in Option_List'Class) - return Device; + procedure Open_Live + (Output : in out Device; + Driver_ID : in Driver_ID_Number; + Format : in Sample_Format'Class; + Options : in Option_List'Class); - function Open_File - (Driver_ID : in Driver_ID_Number; - Filename : in String; - Format : in Sample_Format; - Options : in Option_List'Class; - Overwrite : in Boolean := False) - return Device; + procedure Open_File + (Output : in out Device; + Driver_ID : in Driver_ID_Number; + Filename : in String; + Format : in Sample_Format'Class; + Options : in Option_List'Class; + Overwrite : in Boolean := False); procedure Play - (Output_Device : in Device; - Samples : in Data_Buffer); + (Output : in Device; + Samples : in Data_Buffer); procedure Close - (Output_Device : in out Device); + (Output : in out Device); @@ -216,13 +220,13 @@ private (Ptr : in System.Address); - type Device is record - Ptr : System.Address; + type Device is tagged record + Ptr : System.Address := System.Null_Address; end record; type Info is tagged record - Ptr : System.Address; + Ptr : System.Address := System.Null_Address; end record; @@ -259,7 +263,7 @@ private (This : in out Sample_Format); - -- Keep track of + -- Keep track of open devices package Address_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => System.Address, |