diff options
author | Jedidiah Barber <contact@jedbarber.id.au> | 2023-07-17 00:59:56 +1200 |
---|---|---|
committer | Jedidiah Barber <contact@jedbarber.id.au> | 2023-07-17 00:59:56 +1200 |
commit | 17ed86acaee20590b3ef4d1eea10f2fd27bd3350 (patch) | |
tree | 4a0578bacc4dad1cd548b7bbc63e35c38a1d2c84 /example | |
parent | 543cd19ab514ec632d965acd5177c5bf6695520f (diff) |
Split binding into a minimal hierarchy, improved documentation slightly
Diffstat (limited to 'example')
-rw-r--r-- | example/device_list.adb | 35 | ||||
-rw-r--r-- | example/saw_back.adb | 24 |
2 files changed, 30 insertions, 29 deletions
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"); diff --git a/example/saw_back.adb b/example/saw_back.adb index c266964..680a7a2 100644 --- a/example/saw_back.adb +++ b/example/saw_back.adb @@ -7,26 +7,26 @@ with Ada.Text_IO, - Portaudio; + Portaudio.Streams; use type - Portaudio.Float_32; + Portaudio.Streams.Float_32; procedure Saw_Back is - Left_Phase, Right_Phase : Portaudio.Float_32 := 0.0; + Left_Phase, Right_Phase : Portaudio.Streams.Float_32 := 0.0; function Saw_Callback - (Input : in Portaudio.Sample_Buffer; - Output : in Portaudio.Sample_Buffer; - Frames : in Portaudio.Frame_Amount; - Timing : in Portaudio.Callback_Time_Info; - Flags : in Portaudio.Callback_Flags) - return Portaudio.Callback_Result is + (Input : in Portaudio.Streams.Buffer; + Output : in Portaudio.Streams.Buffer; + Frames : in Portaudio.Streams.Frame_Amount; + Timing : in Portaudio.Streams.Time_Info; + Flags : in Portaudio.Streams.Callback_Flags) + return Portaudio.Streams.Callback_Result is begin for Frame in 1 .. Frames loop @@ -44,12 +44,12 @@ procedure Saw_Back is end if; end loop; - return Portaudio.Continue; + return Portaudio.Streams.Continue; end Saw_Callback; - Saw_Stream : Portaudio.Audio_Stream; + Saw_Stream : Portaudio.Streams.Audio_Stream; begin @@ -60,7 +60,7 @@ begin Saw_Stream.Open_Default (Input_Channels => 0, Output_Channels => 2, - Format => Portaudio.Float_32_Sample, + Format => Portaudio.Streams.Float_32_Format, Sample_Rate => 44100.0, Buffer_Frames => 256, Callback => Saw_Callback'Unrestricted_Access); |