From ed02634895209b9a937297838c1ae04f072f9c79 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Mon, 9 Oct 2023 12:14:14 +1300 Subject: Figured out and fixed up array aliasing issue --- example/sine_block.adb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'example/sine_block.adb') diff --git a/example/sine_block.adb b/example/sine_block.adb index b28b7cd..538d1d9 100644 --- a/example/sine_block.adb +++ b/example/sine_block.adb @@ -27,8 +27,9 @@ procedure Sine_Block is Channels : constant Natural := 2; Per_Buffer : constant Pstm.Frame_Amount := 1024; - Sample_Array : aliased Pstm.Float_32_Array (1 .. Natural (Per_Buffer) * Channels) := - (others => 0.0); + -- Note how this array specifies the bounds in the initial value rather than the type. + -- This is important because otherwise the aliasing would cause subtype mismatch errors. + Sample_Array : aliased Pstm.Float_32_Array := (1 .. Natural (Per_Buffer) * Channels => 0.0); Sample_Buffer : Pstm.Buffer := Pstm.Wrap (Sample_Array, Per_Buffer, Channels); type Table_Index is mod 200; -- cgit