From a9a297e8f7282bcc9b3ffb14862160bb1abad511 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Wed, 26 Jul 2023 22:32:42 +1200 Subject: Changed data buffer type for better interop with other libraries --- example/aao_example.adb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'example/aao_example.adb') diff --git a/example/aao_example.adb b/example/aao_example.adb index 6851f54..51466f8 100644 --- a/example/aao_example.adb +++ b/example/aao_example.adb @@ -11,6 +11,7 @@ with Ada.Command_Line, Ada.Numerics.Elementary_Functions, Ada.Text_IO, + Interfaces, Libao; @@ -74,10 +75,10 @@ begin Math.Sin (2.0 * Ada.Numerics.Pi * 440.0 * Float (I) / 44100.0)) mod 65536); -- Put the same stuff in left and right channel - Buffer (4 * I + 1) := Character'Val (Sample and 16#FF#); - Buffer (4 * I + 2) := Character'Val ((Sample / 256) and 16#FF#); - Buffer (4 * I + 3) := Character'Val (Sample and 16#FF#); - Buffer (4 * I + 4) := Character'Val ((Sample / 256) and 16#FF#); + Buffer (4 * I + 1) := Interfaces.Unsigned_8 (Sample and 16#FF#); + Buffer (4 * I + 2) := Interfaces.Unsigned_8 ((Sample / 256) and 16#FF#); + Buffer (4 * I + 3) := Interfaces.Unsigned_8 (Sample and 16#FF#); + Buffer (4 * I + 4) := Interfaces.Unsigned_8 ((Sample / 256) and 16#FF#); end loop; My_Device.Play (Buffer); -- cgit