From 07e7b817c59c3dce263bfb89b51248316c343f0e Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Mon, 7 Oct 2024 19:51:28 +1300 Subject: Now using Integer_Address for C interface --- src/portaudio-streams.adb | 132 +++++++++++++++++++++++----------------------- 1 file changed, 66 insertions(+), 66 deletions(-) (limited to 'src/portaudio-streams.adb') diff --git a/src/portaudio-streams.adb b/src/portaudio-streams.adb index ed837b9..070da8b 100644 --- a/src/portaudio-streams.adb +++ b/src/portaudio-streams.adb @@ -84,108 +84,108 @@ package body Portaudio.Streams is ------------------------ function pa_is_format_supported - (Input : in System.Address; - Output : in System.Address; + (Input : in Storage.Integer_Address; + Output : in Storage.Integer_Address; Rate : in Interfaces.C.double) return Interfaces.C.int; pragma Import (C, pa_is_format_supported, "Pa_IsFormatSupported"); function pa_open_stream - (Stream : in out System.Address; - In_Params : in System.Address; - Out_Params : in System.Address; + (Stream : in out Storage.Integer_Address; + In_Params : in Storage.Integer_Address; + Out_Params : in Storage.Integer_Address; Rate : in Interfaces.C.double; Frames : in Interfaces.C.unsigned_long; Flags : in Interfaces.C.unsigned_long; - Callback : in System.Address; - Userdata : in System.Address) + Callback : in Storage.Integer_Address; + Userdata : in Storage.Integer_Address) return Interfaces.C.int; pragma Import (C, pa_open_stream, "Pa_OpenStream"); function pa_open_default_stream - (Stream : in out System.Address; + (Stream : in out Storage.Integer_Address; In_Chans : in Interfaces.C.int; Out_Chans : in Interfaces.C.int; Format : in Interfaces.C.unsigned_long; Rate : in Interfaces.C.double; Frames : in Interfaces.C.unsigned_long; - Callback : in System.Address; - Userdata : in System.Address) + Callback : in Storage.Integer_Address; + Userdata : in Storage.Integer_Address) return Interfaces.C.int; pragma Import (C, pa_open_default_stream, "Pa_OpenDefaultStream"); function pa_close_stream - (Stream : in System.Address) + (Stream : in Storage.Integer_Address) return Interfaces.C.int; pragma Import (C, pa_close_stream, "Pa_CloseStream"); function pa_set_stream_finished_callback - (Stream : in System.Address; - Callback : in System.Address) + (Stream : in Storage.Integer_Address; + Callback : in Storage.Integer_Address) return Interfaces.C.int; pragma Import (C, pa_set_stream_finished_callback, "Pa_SetStreamFinishedCallback"); function pa_start_stream - (Stream : in System.Address) + (Stream : in Storage.Integer_Address) return Interfaces.C.int; pragma Import (C, pa_start_stream, "Pa_StartStream"); function pa_stop_stream - (Stream : in System.Address) + (Stream : in Storage.Integer_Address) return Interfaces.C.int; pragma Import (C, pa_stop_stream, "Pa_StopStream"); function pa_abort_stream - (Stream : in System.Address) + (Stream : in Storage.Integer_Address) return Interfaces.C.int; pragma Import (C, pa_abort_stream, "Pa_AbortStream"); function pa_is_stream_stopped - (Stream : in System.Address) + (Stream : in Storage.Integer_Address) return Interfaces.C.int; pragma Import (C, pa_is_stream_stopped, "Pa_IsStreamStopped"); function pa_is_stream_active - (Stream : in System.Address) + (Stream : in Storage.Integer_Address) return Interfaces.C.int; pragma Import (C, pa_is_stream_active, "Pa_IsStreamActive"); function pa_get_stream_info - (Stream : in System.Address) - return System.Address; + (Stream : in Storage.Integer_Address) + return Storage.Integer_Address; pragma Import (C, pa_get_stream_info, "Pa_GetStreamInfo"); function pa_get_stream_time - (Stream : in System.Address) + (Stream : in Storage.Integer_Address) return Interfaces.C.double; pragma Import (C, pa_get_stream_time, "Pa_GetStreamTime"); function pa_get_stream_cpu_load - (Stream : in System.Address) + (Stream : in Storage.Integer_Address) return Interfaces.C.double; pragma Import (C, pa_get_stream_cpu_load, "Pa_GetStreamCpuLoad"); function pa_read_stream - (Stream : in System.Address; - Buffer : in System.Address; + (Stream : in Storage.Integer_Address; + Buffer : in Storage.Integer_Address; Frames : in Interfaces.C.unsigned_long) return Interfaces.C.int; pragma Import (C, pa_read_stream, "Pa_ReadStream"); function pa_write_stream - (Stream : in System.Address; - Buffer : in System.Address; + (Stream : in Storage.Integer_Address; + Buffer : in Storage.Integer_Address; Frames : in Interfaces.C.unsigned_long) return Interfaces.C.int; pragma Import (C, pa_write_stream, "Pa_WriteStream"); function pa_get_stream_read_available - (Stream : in System.Address) + (Stream : in Storage.Integer_Address) return Interfaces.C.long; pragma Import (C, pa_get_stream_read_available, "Pa_GetStreamReadAvailable"); function pa_get_stream_write_available - (Stream : in System.Address) + (Stream : in Storage.Integer_Address) return Interfaces.C.long; pragma Import (C, pa_get_stream_write_available, "Pa_GetStreamWriteAvailable"); @@ -584,7 +584,7 @@ package body Portaudio.Streams is My_Channels => Interfaces.C.int (Channels), My_Samples => To_Cnum (Format), My_Latency => Interfaces.C.double (Latency), - My_Specific => System.Null_Address); + My_Specific => Null_Pointer); end Create; @@ -630,8 +630,8 @@ package body Portaudio.Streams is Param_Conversions.To_Address (Param_Conversions.Object_Pointer (Output)); begin Code := pa_is_format_supported - (Input_Address, - Output_Address, + (Storage.To_Integer (Input_Address), + Storage.To_Integer (Output_Address), Interfaces.C.double (Rate)); return Code = pa_format_is_supported; end Is_Format_Supported; @@ -648,13 +648,13 @@ package body Portaudio.Streams is begin Code := pa_open_stream (Stream.Ptr, - Input_Params'Address, - System.Null_Address, + Storage.To_Integer (Input_Params'Address), + Null_Pointer, Interfaces.C.double (Sample_Rate), Interfaces.C.unsigned_long (Buffer_Frames), Interfaces.C.unsigned_long (Bunting), - Stream_Callback_Hook'Address, - Stream'Address); + Storage.To_Integer (Stream_Callback_Hook'Address), + Storage.To_Integer (Stream'Address)); if Code /= pa_no_error then Raise_Error (Code); raise Program_Error; @@ -678,13 +678,13 @@ package body Portaudio.Streams is begin Code := pa_open_stream (Stream.Ptr, - System.Null_Address, - Output_Params'Address, + Null_Pointer, + Storage.To_Integer (Output_Params'Address), Interfaces.C.double (Sample_Rate), Interfaces.C.unsigned_long (Buffer_Frames), Interfaces.C.unsigned_long (Bunting), - Stream_Callback_Hook'Address, - Stream'Address); + Storage.To_Integer (Stream_Callback_Hook'Address), + Storage.To_Integer (Stream'Address)); if Code /= pa_no_error then Raise_Error (Code); raise Program_Error; @@ -709,13 +709,13 @@ package body Portaudio.Streams is begin Code := pa_open_stream (Stream.Ptr, - Input_Params'Address, - Output_Params'Address, + Storage.To_Integer (Input_Params'Address), + Storage.To_Integer (Output_Params'Address), Interfaces.C.double (Sample_Rate), Interfaces.C.unsigned_long (Buffer_Frames), Interfaces.C.unsigned_long (Bunting), - Stream_Callback_Hook'Address, - Stream'Address); + Storage.To_Integer (Stream_Callback_Hook'Address), + Storage.To_Integer (Stream'Address)); if Code /= pa_no_error then Raise_Error (Code); raise Program_Error; @@ -740,13 +740,13 @@ package body Portaudio.Streams is begin Code := pa_open_stream (Stream.Ptr, - Input_Params'Address, - System.Null_Address, + Storage.To_Integer (Input_Params'Address), + Null_Pointer, Interfaces.C.double (Sample_Rate), Interfaces.C.unsigned_long (Buffer_Frames), Interfaces.C.unsigned_long (Bunting), - System.Null_Address, - System.Null_Address); + Null_Pointer, + Null_Pointer); if Code /= pa_no_error then Raise_Error (Code); raise Program_Error; @@ -766,13 +766,13 @@ package body Portaudio.Streams is begin Code := pa_open_stream (Stream.Ptr, - System.Null_Address, - Output_Params'Address, + Null_Pointer, + Storage.To_Integer (Output_Params'Address), Interfaces.C.double (Sample_Rate), Interfaces.C.unsigned_long (Buffer_Frames), Interfaces.C.unsigned_long (Bunting), - System.Null_Address, - System.Null_Address); + Null_Pointer, + Null_Pointer); if Code /= pa_no_error then Raise_Error (Code); raise Program_Error; @@ -793,13 +793,13 @@ package body Portaudio.Streams is begin Code := pa_open_stream (Stream.Ptr, - Input_Params'Address, - Output_Params'Address, + Storage.To_Integer (Input_Params'Address), + Storage.To_Integer (Output_Params'Address), Interfaces.C.double (Sample_Rate), Interfaces.C.unsigned_long (Buffer_Frames), Interfaces.C.unsigned_long (Bunting), - System.Null_Address, - System.Null_Address); + Null_Pointer, + Null_Pointer); if Code /= pa_no_error then Raise_Error (Code); raise Program_Error; @@ -826,8 +826,8 @@ package body Portaudio.Streams is To_Cnum (Format), Interfaces.C.double (Sample_Rate), Interfaces.C.unsigned_long (Buffer_Frames), - Stream_Callback_Hook'Address, - Stream'Address); + Storage.To_Integer (Stream_Callback_Hook'Address), + Storage.To_Integer (Stream'Address)); if Code /= pa_no_error then Raise_Error (Code); raise Program_Error; @@ -858,8 +858,8 @@ package body Portaudio.Streams is To_Cnum (Format), Interfaces.C.double (Sample_Rate), Interfaces.C.unsigned_long (Buffer_Frames), - System.Null_Address, - System.Null_Address); + Null_Pointer, + Null_Pointer); if Code /= pa_no_error then Raise_Error (Code); raise Program_Error; @@ -895,7 +895,7 @@ package body Portaudio.Streams is Stream.Finfun := Callback; Code := pa_set_stream_finished_callback (Stream.Ptr, - Stream_Finished_Callback_Hook'Address); + Storage.To_Integer (Stream_Finished_Callback_Hook'Address)); if Code /= pa_no_error then Raise_Error (Code); raise Program_Error; @@ -909,7 +909,7 @@ package body Portaudio.Streams is begin Code := pa_set_stream_finished_callback (Stream.Ptr, - System.Null_Address); + Null_Pointer); if Code /= pa_no_error then Raise_Error (Code); raise Program_Error; @@ -990,15 +990,15 @@ package body Portaudio.Streams is (Stream : in Audio_Stream) return Stream_Info is - Result : System.Address; + Result : Storage.Integer_Address; begin Result := pa_get_stream_info (Stream.Ptr); - if Result = System.Null_Address then + if Result = Null_Pointer then raise General_Failure; else declare C_Data : C_Stream_Info; - for C_Data'Address use Result; + for C_Data'Address use Storage.To_Address (Result); pragma Import (Ada, C_Data); begin return @@ -1039,7 +1039,7 @@ package body Portaudio.Streams is begin Code := pa_read_stream (Stream.Ptr, - Store.My_Array, + Storage.To_Integer (Store.My_Array), Interfaces.C.unsigned_long (Frames)); if Code /= pa_no_error then Raise_Error (Code); @@ -1056,7 +1056,7 @@ package body Portaudio.Streams is begin Code := pa_write_stream (Stream.Ptr, - Store.My_Array, + Storage.To_Integer (Store.My_Array), Interfaces.C.unsigned_long (Frames)); if Code /= pa_no_error then Raise_Error (Code); -- cgit