diff options
author | Jedidiah Barber <contact@jedbarber.id.au> | 2023-10-09 12:14:14 +1300 |
---|---|---|
committer | Jedidiah Barber <contact@jedbarber.id.au> | 2023-10-09 12:14:14 +1300 |
commit | ed02634895209b9a937297838c1ae04f072f9c79 (patch) | |
tree | ba06b13d2fbab9b4d7fa7ff2b32b1ec0acc4a232 /example | |
parent | f654fd430eae581fb524bb16dc3e3eb0bfb10aef (diff) |
Figured out and fixed up array aliasing issue
Diffstat (limited to 'example')
-rw-r--r-- | example/sine_block.adb | 5 |
1 files changed, 3 insertions, 2 deletions
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; |