From 8463ca926a038bab28772c56bf5b32b0a7403853 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Mon, 17 Jul 2023 21:03:46 +1200 Subject: Sine wave blocking example added, fixed Buffer wrapping bug --- src/portaudio-streams.ads | 54 ++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 24 deletions(-) (limited to 'src/portaudio-streams.ads') diff --git a/src/portaudio-streams.ads b/src/portaudio-streams.ads index bdd6247..8acf758 100644 --- a/src/portaudio-streams.ads +++ b/src/portaudio-streams.ads @@ -57,6 +57,12 @@ package Portaudio.Streams is type Frame_Amount is new Interfaces.Unsigned_32; + -- Acts as a wrapper around the arrays given above. + -- This both avoids the use of void pointers, and also + -- allows for easier reference to arrays by frame/channel. + -- Since it is only a pointer wrapper, please ensure that + -- every Buffer lives at least as long as any array used + -- to make it. type Buffer is tagged private; function Kind @@ -156,46 +162,46 @@ package Portaudio.Streams is with Pre => Store.Kind = UInt_8_Format; function Wrap - (Store : access Float_32_Array; - Frames : in Frame_Amount; - Channels : in Natural) + (Store : in Float_32_Array; + Frames : in Frame_Amount; + Channels : in Natural) return Buffer - with Pre => Store.all'Length = Frames * Frame_Amount (Channels); + with Pre => Store'Length = Frames * Frame_Amount (Channels); function Wrap - (Store : access Int_32_Array; - Frames : in Frame_Amount; - Channels : in Natural) + (Store : in Int_32_Array; + Frames : in Frame_Amount; + Channels : in Natural) return Buffer - with Pre => Store.all'Length = Frames * Frame_Amount (Channels); + with Pre => Store'Length = Frames * Frame_Amount (Channels); function Wrap - (Store : access Int_24_Array; - Frames : in Frame_Amount; - Channels : in Natural) + (Store : in Int_24_Array; + Frames : in Frame_Amount; + Channels : in Natural) return Buffer - with Pre => Store.all'Length = Frames * Frame_Amount (Channels); + with Pre => Store'Length = Frames * Frame_Amount (Channels); function Wrap - (Store : access Int_16_Array; - Frames : in Frame_Amount; - Channels : in Natural) + (Store : in Int_16_Array; + Frames : in Frame_Amount; + Channels : in Natural) return Buffer - with Pre => Store.all'Length = Frames * Frame_Amount (Channels); + with Pre => Store'Length = Frames * Frame_Amount (Channels); function Wrap - (Store : access Int_8_Array; - Frames : in Frame_Amount; - Channels : in Natural) + (Store : in Int_8_Array; + Frames : in Frame_Amount; + Channels : in Natural) return Buffer - with Pre => Store.all'Length = Frames * Frame_Amount (Channels); + with Pre => Store'Length = Frames * Frame_Amount (Channels); function Wrap - (Store : access UInt_8_Array; - Frames : in Frame_Amount; - Channels : in Natural) + (Store : in UInt_8_Array; + Frames : in Frame_Amount; + Channels : in Natural) return Buffer - with Pre => Store.all'Length = Frames * Frame_Amount (Channels); + with Pre => Store'Length = Frames * Frame_Amount (Channels); type Parameters is private; -- cgit