From 17ed86acaee20590b3ef4d1eea10f2fd27bd3350 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Mon, 17 Jul 2023 00:59:56 +1200 Subject: Split binding into a minimal hierarchy, improved documentation slightly --- example/device_list.adb | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'example/device_list.adb') diff --git a/example/device_list.adb b/example/device_list.adb index f9f6e65..d92d2c4 100644 --- a/example/device_list.adb +++ b/example/device_list.adb @@ -8,7 +8,8 @@ with Ada.Characters.Latin_1, Ada.Text_IO, - Portaudio; + Portaudio.Devices, + Portaudio.Streams; use type @@ -59,8 +60,8 @@ procedure Device_List is procedure Put_Supported_Standard_Sample_Rates - (In_Params : access Paud.Stream_Parameters; - Out_Params : access Paud.Stream_Parameters) + (In_Params : access Paud.Streams.Parameters; + Out_Params : access Paud.Streams.Parameters) is Standard_Sample_Rates : array (Positive range <>) of Paud.Hertz := (8000.0, 9600.0, 11025.0, 12000.0, 16000.0, 22050.0, 24000.0, @@ -68,7 +69,7 @@ procedure Device_List is Put_Counter : Natural := 0; begin for Rate of Standard_Sample_Rates loop - if Paud.Is_Format_Supported (In_Params, Out_Params, Rate) then + if Paud.Streams.Is_Format_Supported (In_Params, Out_Params, Rate) then case Put_Counter is when 0 => TIO.Put (Latin.HT & Image (Rate)); @@ -92,12 +93,12 @@ procedure Device_List is Num_Devices : Natural; - Current_Device : Paud.Device_Info; - Current_Host_API : Paud.Host_API_Info; + Current_Device : Paud.Devices.Device_Info; + Current_Host_API : Paud.Devices.Host_API_Info; Displayed_Default : Boolean; - Input_Params : aliased Paud.Stream_Parameters; - Output_Params : aliased Paud.Stream_Parameters; + Input_Params : aliased Paud.Streams.Parameters; + Output_Params : aliased Paud.Streams.Parameters; begin @@ -106,19 +107,19 @@ begin TIO.Put_Line ("PortAudio version: " & Paud.Image (Paud.Get_Version)); TIO.Put_Line ("Version text: " & Paud.Get_Version_Info.Text); - Num_Devices := Paud.Get_Device_Count; + Num_Devices := Paud.Devices.Get_Device_Count; TIO.Put_Line ("Number of devices = " & Image (Num_Devices)); for Index in Paud.Device_Index (1) .. Paud.Device_Index (Num_Devices) loop - Current_Device := Paud.Get_Device_Info (Index); - Current_Host_API := Paud.Get_Host_API_Info (Current_Device.Host_API); + Current_Device := Paud.Devices.Get_Device_Info (Index); + Current_Host_API := Paud.Devices.Get_Host_API_Info (Current_Device.Host_API); Displayed_Default := False; TIO.New_Line; TIO.Put_Line ("--------------------------------------- device #" & Image (Integer (Index))); - if Index = Paud.Get_Default_Input_Device then + if Index = Paud.Devices.Get_Default_Input_Device then TIO.Put ("[ Default Input"); Displayed_Default := True; elsif Index = Current_Host_API.Default_Input_Device then @@ -126,7 +127,7 @@ begin Displayed_Default := True; end if; - if Index = Paud.Get_Default_Output_Device then + if Index = Paud.Devices.Get_Default_Output_Device then if Displayed_Default then TIO.Put (","); else @@ -165,10 +166,10 @@ begin TIO.Put_Line ("Default sample rate = " & Image (Current_Device.Default_Sample_Rate)); - Input_Params := Paud.Create - (Index, Current_Device.Max_Input_Channels, Paud.Int_16_Sample, 0.0); - Output_Params := Paud.Create - (Index, Current_Device.Max_Output_Channels, Paud.Int_16_Sample, 0.0); + Input_Params := Paud.Streams.Create + (Index, Current_Device.Max_Input_Channels, Paud.Streams.Int_16_Format, 0.0); + Output_Params := Paud.Streams.Create + (Index, Current_Device.Max_Output_Channels, Paud.Streams.Int_16_Format, 0.0); if Current_Device.Max_Input_Channels > 0 then TIO.Put_Line ("Supported standard sample rates"); -- cgit