OpenAL Ada App openal_info #1 Using Alire and GnatStudio
A basic application to run first after installing OpenAL.
The Coreland OpenAL package includes openal_info.ads and openal_info.adb with a simple application.
By confirming its operation, you can verify that OpenAL has been installed correctly.
Date: Aug 18 2025
Confirmed versions:
Ubuntu: 24.04.3 LTS, Gnat: 13.3.0
PC: OMEN 17-ck2095cl, i9-13900HX, RTX-4080
Application Output

Make the project with Alire command
~/ada/oal$ alr init al_info –bin
Alire needs some user information to initialize the crate author and maintainer,
for eventual submission to the Alire community index. This information will be
interactively requested now.
You can edit this information at any time with 'alr config'
Enter a short description of the crate: (default: '')
> Enter
Using default: ''
Please enter your email address: (default: 'example@example.com')
> Enter
Using default: 'example@example.com'
Select a software license for the crate?
1. MIT OR Apache-2.0 WITH LLVM-exception
2. MIT
3. Apache-2.0 WITH LLVM-exception
4. Apache-2.0
5. BSD-3-Clause
6. LGPL-3.0-or-later
7. GPL-3.0-or-later WITH GCC-exception-3.1
8. GPL-3.0-or-later
9. Other...
Enter your choice index (first is default):
> Enter
Enter a comma (',') separated list of tags to help people find your crate: (default: '')
> Enter
Using default: ''
Enter an optional Website URL for the crate: (default: '')
> Enter
Using default: ''
✓ al_info initialized successfully.
~/ada/oal$ cd al_info
~/ada/oal/al_info$ alr edit
GnatStudio
Display the default source and update (#1 and #2)
This application is based on openal_info_main.adb in the OpenAL files.
Source code: src/al_info.adb
with OpenAL_Info;
procedure Al_Info is
begin
OpenAL_Info.Run;
end Al_Info;
Note:
When creating applications in GnatStudio, indentation must use 3 spaces. Since OpenAL uses 2 spaces consistently, numerous warnings will be displayed for OpenAL files when building the application for the first time, but these can be ignored. From the second build onward, those warnings will not be displayed.
Also, you must insert 2 spaces after — (dash, dash, space, space which represents comments), otherwise an error will occur.
Create the following text file in the working directory
./sourcefiles.txt
al_info.adb
openal.ads
openal-alc_thin.ads
openal-buffer.adb
openal-buffer.ads
openal-context.adb
openal-context.ads
openal-context-capture.adb
openal-context-capture.ads
openal-context-error.adb
openal-context-error.ads
openal-error.adb
openal-error.ads
openal-extension.ads
openal-extension-efx.adb
openal-extension-efx.ads
openal-extension-efx_thin.adb
openal-extension-efx_thin.ads
openal-extension-float32.adb
openal-extension-float32.ads
openal-extension-float32_thin.ads
openal-global.adb
openal-global.ads
openal_info.adb
openal_info.ads
openal_info_main.adb
openal-list.adb
openal-list.ads
openal-listener.adb
openal-listener.ads
openal-load.adb
openal-load.ads
openal-source.adb
openal-source.ads
openal-thin.ads
openal-types.ads
NOTE: The top line is this application and project file name.
Edit project file: al_info.gpr with GnatStudio Wizard
Press “Edit” – ”Project Properties”
Setup OpenAL source files directory
“Directories” – “+” – “navigate usr” – “local” – “include” – “coreland” – “openal-ada” – “OK”
Press “source list file” Radio button
“Browse” – choose “sourcefiles.txt” which you created – “OK”
“Build”—”Switches”—”Ada Linker” tab: Enter this line into the bottom rectangular box.
-lopenal -lalut
“Save” to close the properties window.
Press “Reload”.
New project file: ./al_info.gpr was created:
with "config/al_info_config.gpr";
project Al_Info is
for Source_Dirs use ("src", "config", "../../../../../usr/local/include/coreland/openal-ada");
for Object_Dir use "obj/" & Al_Info_Config.Build_Profile;
for Create_Missing_Dirs use "True";
for Exec_Dir use "bin";
for Main use ("al_info.adb");
package Compiler is
for Default_Switches ("ada") use Al_Info_Config.Ada_Compiler_Switches;
end Compiler;
package Binder is
for Switches ("Ada") use ("-Es"); -- Symbolic traceback
end Binder;
package Install is
for Artifacts (".") use ("share");
end Install;
for Source_List_File use "../sample1_device_list/sourcefiles.txt";
package Linker is
for Switches ("ada") use ("-lopenal", "-lalut");
end Linker;
end Al_Info;
Build Al_Info project
Build result message:
Many warnings will be displayed, but if [link] al_info.adb appears on the last line as shown below, the build is successful.
Build command just for reference:
gprbuild -d -P/home/mm/ada/oal/al_info/al_info.gpr -XADAFLAGS=
Compile
[Ada] al_info.adb
Bind
[gprbind] al_info.bexch
[Ada] al_info.ali
Link
[link] al_info.adb
[2025-08-17 13:51:21] process terminated successfully, elapsed time: 00.49s
Execution file was created in bin/ directory
Execution
The resulting executable file is created in the bin directory.
Executable file:
~/ada/oal/al_info/bin$ ls -al
total 2184
drwxrwxr-x 2 mm mm 4096 Aug 17 13:51 .
drwxrwxr-x 8 mm mm 4096 Aug 17 13:33 ..
-rwxrwxr-x 1 mm mm 2228144 Aug 17 13:51 al_info
When running, the following messages are displayed in my environment:
/home/mm/ada/oal/al_info/bin/al_info
Playback devices :
OpenAL Soft
Capture devices :
sof-hda-dsp Digital Microphone
sof-hda-dsp Headphones Stereo Microphone
Monitor of HDA NVidia Digital Stereo (HDMI)
Monitor of sof-hda-dsp Speaker + Headphones
Monitor of sof-hda-dsp HDMI / DisplayPort 2 Output
Monitor of sof-hda-dsp HDMI / DisplayPort 1 Output
Monitor of sof-hda-dsp HDMI / DisplayPort 3 Output
Default playback : OpenAL Soft
Default capture : sof-hda-dsp Digital Microphone
ALC major version : 1
ALC minor version : 1
ALC extensions : ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE ALC_EXT_DEDICATED ALC_EXT_disconnect ALC_EXT_EFX ALC_EXT_thread_local_context ALC_SOFT_device_clock ALC_SOFT_HRTF ALC_SOFT_loopback ALC_SOFT_loopback_bformat ALC_SOFT_output_limiter ALC_SOFT_output_mode ALC_SOFT_pause_device ALC_SOFT_reopen_device
AL vendor : OpenAL Community
AL renderer : OpenAL Soft
AL version : 1.1 ALSOFT 1.23.1
AL extensions : AL_EXT_ALAW AL_EXT_BFORMAT AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW AL_EXT_MULAW_BFORMAT AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_EXT_SOURCE_RADIUS AL_EXT_STATIC_BUFFER AL_EXT_STEREO_ANGLES AL_LOKI_quadriphonic AL_SOFT_bformat_ex AL_SOFTX_bformat_hoa AL_SOFT_block_alignment AL_SOFT_buffer_length_query AL_SOFT_callback_buffer AL_SOFTX_convolution_reverb AL_SOFT_deferred_upd
ates AL_SOFT_direct_channels AL_SOFT_direct_channels_remix AL_SOFT_effect_target AL_SOFT_events AL_SOFT_gain_clamp_ex AL_SOFTX_hold_on_disconnect AL_SOFT_loop_points AL_SOFTX_map_buffer AL_SOFT_MSADPCM AL_SOFT_source_latency AL_SOFT_source_length AL_SOFT_source_resampler AL_SOFT_source_spatialize AL_SOFT_source_start_delay AL_SOFT_UHJ AL_SOFT_UHJ_ex
[2025-08-17 14:04:27] process terminated successfully, elapsed time: 00.30s
Note:
This application is based on openal_info_main.adb in the OpenAL files.
The messagea are displayed in the following order based on the results of “Procedure Run” in openal_info.adb.
procedure Run is
begin
Init;
List_Playback_Devices;
List_Capture_Devices;
Defaults;
Open_Device;
Versions;
Finish;
This is the list of openal_info for reference:
https://github.com/io7m/coreland-openal-ada
https://github.com/io7m/coreland-openal-ada/blob/master/openal_info.ads
https://github.com/io7m/coreland-openal-ada/blob/master/openal_info.adb
File: openal_info.adb
with Ada.Command_Line;
with Ada.Exceptions;
with Ada.Text_IO;
with OpenAL.Context;
with OpenAL.Global;
with OpenAL.List;
package body OpenAL_Info is
package AL_Context renames OpenAL.Context;
package AL_Global renames OpenAL.Global;
package AL_String_Vectors renames OpenAL.List.String_Vectors;
package Command_Line renames Ada.Command_Line;
package Exceptions renames Ada.Exceptions;
package Natural_IO is new Ada.Text_IO.Integer_IO (Natural);
package Text_IO renames Ada.Text_IO;
Device : AL_Context.Device_t;
Context : AL_Context.Context_t;
Error : exception;
use type AL_Context.Device_t;
use type AL_Context.Context_t;
procedure Versions;
--
-- Defaults.
--
procedure Defaults is
begin
Text_IO.Put ("Default playback : ");
Text_IO.Put (AL_Context.Get_Default_Device_Specifier);
Text_IO.New_Line;
Text_IO.Put ("Default capture : ");
Text_IO.Put (AL_Context.Get_Default_Capture_Device_Specifier);
Text_IO.New_Line;
end Defaults;
--
-- Finish.
--
procedure Finish is
begin
AL_Context.Destroy_Context (Context);
AL_Context.Close_Device (Device);
end Finish;
--
-- Init.
--
procedure Init is
begin
Natural_IO.Default_Width := 0;
end Init;
--
-- Capture devices.
--
procedure List_Capture_Devices is
Devices : AL_String_Vectors.Vector;
procedure Process_Element (Device : in String) is
begin
Text_IO.Put_Line (" " & Device);
end Process_Element;
begin
Text_IO.Put_Line ("Capture devices :");
Devices := AL_Context.Get_Available_Capture_Devices;
for Index in AL_String_Vectors.First_Index (Devices) .. AL_String_Vectors.Last_Index (Devices) loop
AL_String_Vectors.Query_Element (Devices, Index, Process_Element'Access);
end loop;
end List_Capture_Devices;
--
-- Playback devices.
--
procedure List_Playback_Devices is
Devices : AL_String_Vectors.Vector;
procedure Process_Element (Device : in String) is
begin
Text_IO.Put_Line (" " & Device);
end Process_Element;
begin
Text_IO.Put_Line ("Playback devices :");
Devices := AL_Context.Get_Available_Playback_Devices;
for Index in AL_String_Vectors.First_Index (Devices) .. AL_String_Vectors.Last_Index (Devices) loop
AL_String_Vectors.Query_Element (Devices, Index, Process_Element'Access);
end loop;
end List_Playback_Devices;
--
-- Open_Device.
--
procedure Open_Device is
begin
Command_Line.Set_Exit_Status (Command_Line.Failure);
Device := AL_Context.Open_Default_Device;
if Device /= AL_Context.Invalid_Device then
Context := AL_Context.Create_Context (Device);
if Context /= AL_Context.Invalid_Context then
if AL_Context.Make_Context_Current (Context) = False then
raise Error with "error making context current";
else
Command_Line.Set_Exit_Status (Command_Line.Success);
end if;
else
raise Error with "error creating context";
end if;
else
raise Error with "error opening device";
end if;
end Open_Device;
--
-- Entry point.
--
procedure Run is
begin
Init;
List_Playback_Devices;
List_Capture_Devices;
Defaults;
Open_Device;
Versions;
Finish;
exception
when E : Error =>
Text_IO.Put_Line
(File => Text_IO.Current_Error,
Item => "fatal: " & Exceptions.Exception_Message (E));
end Run;
--
-- Versions.
--
procedure Versions is
begin
Text_IO.Put ("ALC major version : ");
Natural_IO.Put (AL_Context.Get_Major_Version (Device));
Text_IO.New_Line;
Text_IO.Put ("ALC minor version : ");
Natural_IO.Put (AL_Context.Get_Minor_Version (Device));
Text_IO.New_Line;
Text_IO.Put ("ALC extensions : ");
Text_IO.Put (AL_Context.Get_Extensions (Device));
Text_IO.New_Line;
Text_IO.Put ("AL vendor : ");
Text_IO.Put (AL_Global.Vendor);
Text_IO.New_Line;
Text_IO.Put ("AL renderer : ");
Text_IO.Put (AL_Global.Renderer);
Text_IO.New_Line;
Text_IO.Put ("AL version : ");
Text_IO.Put (AL_Global.Version);
Text_IO.New_Line;
Text_IO.Put ("AL extensions : ");
Text_IO.Put (AL_Global.Extensions);
Text_IO.New_Line;
end Versions;
end OpenAL_Info;