From 6a4fd86a07ebe97c8067e0e732efc2f708a2c6a8 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Wed, 26 Jul 2023 19:51:33 +1200 Subject: Changed data buffer types for easier interop with other libraries --- src/portaudio-streams.ads | 51 +++++++++++++++++++---------------------------- 1 file changed, 21 insertions(+), 30 deletions(-) (limited to 'src/portaudio-streams.ads') diff --git a/src/portaudio-streams.ads b/src/portaudio-streams.ads index 8acf758..6eb22bd 100644 --- a/src/portaudio-streams.ads +++ b/src/portaudio-streams.ads @@ -33,25 +33,16 @@ package Portaudio.Streams is UInt_8_Format); - type Float_32 is new Float; - for Float_32'Size use 32; - type Float_32_Array is array (Positive range <>) of Float_32; + -- This type isn't usually available in Interfaces + type Integer_24 is range -2 ** 23 .. 2 ** 23 - 1; + for Integer_24'Size use 24; - type Int_32 is new Interfaces.Integer_32; - type Int_32_Array is array (Positive range <>) of Int_32; - - type Int_24 is range -2 ** 23 .. 2 ** 23 - 1; - for Int_24'Size use 24; - type Int_24_Array is array (Positive range <>) of Int_24; - - type Int_16 is new Interfaces.Integer_16; - type Int_16_Array is array (Positive range <>) of Int_16; - - type Int_8 is new Interfaces.Integer_8; - type Int_8_Array is array (Positive range <>) of Int_8; - - type UInt_8 is new Interfaces.Unsigned_8; - type UInt_8_Array is array (Positive range <>) of UInt_8; + type Float_32_Array is array (Positive range <>) of Interfaces.IEEE_Float_32; + type Int_32_Array is array (Positive range <>) of Interfaces.Integer_32; + type Int_24_Array is array (Positive range <>) of Integer_24; + type Int_16_Array is array (Positive range <>) of Interfaces.Integer_16; + type Int_8_Array is array (Positive range <>) of Interfaces.Integer_8; + type UInt_8_Array is array (Positive range <>) of Interfaces.Unsigned_8; type Frame_Amount is new Interfaces.Unsigned_32; @@ -81,84 +72,84 @@ package Portaudio.Streams is (Store : in Buffer; Frame : in Frame_Amount; Channel : in Positive) - return Float_32 + return Interfaces.IEEE_Float_32 with Pre => Store.Kind = Float_32_Format; function Get (Store : in Buffer; Frame : in Frame_Amount; Channel : in Positive) - return Int_32 + return Interfaces.Integer_32 with Pre => Store.Kind = Int_32_Format; function Get (Store : in Buffer; Frame : in Frame_Amount; Channel : in Positive) - return Int_24 + return Integer_24 with Pre => Store.Kind = Int_24_Format; function Get (Store : in Buffer; Frame : in Frame_Amount; Channel : in Positive) - return Int_16 + return Interfaces.Integer_16 with Pre => Store.Kind = Int_16_Format; function Get (Store : in Buffer; Frame : in Frame_Amount; Channel : in Positive) - return Int_8 + return Interfaces.Integer_8 with Pre => Store.Kind = Int_8_Format; function Get (Store : in Buffer; Frame : in Frame_Amount; Channel : in Positive) - return UInt_8 + return Interfaces.Unsigned_8 with Pre => Store.Kind = UInt_8_Format; procedure Put (Store : in Buffer; Frame : in Frame_Amount; Channel : in Positive; - Value : in Float_32) + Value : in Interfaces.IEEE_Float_32) with Pre => Store.Kind = Float_32_Format; procedure Put (Store : in Buffer; Frame : in Frame_Amount; Channel : in Positive; - Value : in Int_32) + Value : in Interfaces.Integer_32) with Pre => Store.Kind = Int_32_Format; procedure Put (Store : in Buffer; Frame : in Frame_Amount; Channel : in Positive; - Value : in Int_24) + Value : in Integer_24) with Pre => Store.Kind = Int_24_Format; procedure Put (Store : in Buffer; Frame : in Frame_Amount; Channel : in Positive; - Value : in Int_16) + Value : in Interfaces.Integer_16) with Pre => Store.Kind = Int_16_Format; procedure Put (Store : in Buffer; Frame : in Frame_Amount; Channel : in Positive; - Value : in Int_8) + Value : in Interfaces.Integer_8) with Pre => Store.Kind = Int_8_Format; procedure Put (Store : in Buffer; Frame : in Frame_Amount; Channel : in Positive; - Value : in UInt_8) + Value : in Interfaces.Unsigned_8) with Pre => Store.Kind = UInt_8_Format; function Wrap -- cgit