diff options
-rw-r--r-- | example/sine_block.adb | 3 | ||||
-rw-r--r-- | src/portaudio-streams.ads | 30 |
2 files changed, 20 insertions, 13 deletions
diff --git a/example/sine_block.adb b/example/sine_block.adb index 5ff5be5..b28b7cd 100644 --- a/example/sine_block.adb +++ b/example/sine_block.adb @@ -27,7 +27,8 @@ procedure Sine_Block is Channels : constant Natural := 2; Per_Buffer : constant Pstm.Frame_Amount := 1024; - Sample_Array : Pstm.Float_32_Array (1 .. Natural (Per_Buffer) * Channels) := (others => 0.0); + Sample_Array : aliased Pstm.Float_32_Array (1 .. Natural (Per_Buffer) * Channels) := + (others => 0.0); Sample_Buffer : Pstm.Buffer := Pstm.Wrap (Sample_Array, Per_Buffer, Channels); type Table_Index is mod 200; diff --git a/src/portaudio-streams.ads b/src/portaudio-streams.ads index 6eb22bd..1f14733 100644 --- a/src/portaudio-streams.ads +++ b/src/portaudio-streams.ads @@ -37,12 +37,12 @@ package Portaudio.Streams is type Integer_24 is range -2 ** 23 .. 2 ** 23 - 1; for Integer_24'Size use 24; - 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 Float_32_Array is array (Positive range <>) of aliased Interfaces.IEEE_Float_32; + type Int_32_Array is array (Positive range <>) of aliased Interfaces.Integer_32; + type Int_24_Array is array (Positive range <>) of aliased Integer_24; + type Int_16_Array is array (Positive range <>) of aliased Interfaces.Integer_16; + type Int_8_Array is array (Positive range <>) of aliased Interfaces.Integer_8; + type UInt_8_Array is array (Positive range <>) of aliased Interfaces.Unsigned_8; type Frame_Amount is new Interfaces.Unsigned_32; @@ -152,47 +152,53 @@ package Portaudio.Streams is Value : in Interfaces.Unsigned_8) with Pre => Store.Kind = UInt_8_Format; + -- !!! ENSURE STORE IS ALIASED !!! -- function Wrap (Store : in Float_32_Array; Frames : in Frame_Amount; Channels : in Natural) return Buffer - with Pre => Store'Length = Frames * Frame_Amount (Channels); + with Pre => Store'Length > 0 and Store'Length = Frames * Frame_Amount (Channels); + -- !!! ENSURE STORE IS ALIASED !!! -- function Wrap (Store : in Int_32_Array; Frames : in Frame_Amount; Channels : in Natural) return Buffer - with Pre => Store'Length = Frames * Frame_Amount (Channels); + with Pre => Store'Length > 0 and Store'Length = Frames * Frame_Amount (Channels); + -- !!! ENSURE STORE IS ALIASED !!! -- function Wrap (Store : in Int_24_Array; Frames : in Frame_Amount; Channels : in Natural) return Buffer - with Pre => Store'Length = Frames * Frame_Amount (Channels); + with Pre => Store'Length > 0 and Store'Length = Frames * Frame_Amount (Channels); + -- !!! ENSURE STORE IS ALIASED !!! -- function Wrap (Store : in Int_16_Array; Frames : in Frame_Amount; Channels : in Natural) return Buffer - with Pre => Store'Length = Frames * Frame_Amount (Channels); + with Pre => Store'Length > 0 and Store'Length = Frames * Frame_Amount (Channels); + -- !!! ENSURE STORE IS ALIASED !!! -- function Wrap (Store : in Int_8_Array; Frames : in Frame_Amount; Channels : in Natural) return Buffer - with Pre => Store'Length = Frames * Frame_Amount (Channels); + with Pre => Store'Length > 0 and Store'Length = Frames * Frame_Amount (Channels); + -- !!! ENSURE STORE IS ALIASED !!! -- function Wrap (Store : in UInt_8_Array; Frames : in Frame_Amount; Channels : in Natural) return Buffer - with Pre => Store'Length = Frames * Frame_Amount (Channels); + with Pre => Store'Length > 0 and Store'Length = Frames * Frame_Amount (Channels); type Parameters is private; |