N7SD logo

HOME      INDEX

OpenAL_GtkAda_GUI_Doppler_Effect_Plane_1


Referenced
https://www.openal.org/documentation/OpenAL_Programmers_Guide.pdf
https://www.openal.org/documentation/openal-1.1-specification.pdf
https://github.com/io7m/coreland-openal-ada/blob/master/openal-context-capture.adb
https://github.com/io7m/coreland-openal-ada-dist/tree/master/doc/openal-ada-doc-1.1.1/single.html
 (openal-ada 1.1.1 documentation…This is OpenAL-Ada command reference)

Development and confirmed environment
Released 8/30/2025

Tested environment:
Ubuntu: 24.04.2 LTS, Gnat: 14.2.1, Gtkada:25.0.1
OpenAL-Ada(Coreland) 1.1.1, Alire 2.0.2
PC: OMEN 17-ck2095cl, i9-13900HX, RTX-4080

Audio source file: Mono, 44.1kHz, 16bit, 5sec, testsound.wav repeating

 

Doppler effect sample movie

 

File Structures

Directory: ada/oal/gui_doppler_plane_1/   — gnatstudio project files to control build options


Directory: ada/oal/gui_doppler_plane_1/src/ — source files


Directory: ada/oal/gui_doppler_plane_1/bin/ 
(File “gui_doppler_plane_1” is the executable file.
  A picture and a sound files are located here.



GitHub Download:

https://github.com/moriyasum/OpenAL_GtkAda_GUI_Doppler_Effect_Plane_1

GtkAda_Build_Setting_File

with "config/gui_doppler_plane_1_config.gpr";

project Gui_Doppler_Plane_1 is

   --   for Library_Name use "Gui_Doppler_Plane_1";
   --   for Library_Version use Project'Library_Name & ".so." & Gui_Doppler_Plane_1_Config.Crate_Version;

   for Source_Dirs use ("src", "config", "../../../../../usr/local/include/coreland/openal-ada");
   for Object_Dir use "obj/" & Gui_Doppler_Plane_1_Config.Build_Profile;
   for Create_Missing_Dirs use "True";
   for Library_Dir use "lib";
   for Exec_Dir use "bin";
   for Source_List_File use "sourcefiles.txt";
   for Main use ("gui_doppler_plane_1.adb");

   --   type Library_Type_Type is ("relocatable", "static", "static-pic");
   --   Library_Type : Library_Type_Type :=
   --     external ("GUI_DOPPLER_PLANE_1_LIBRARY_TYPE", external ("LIBRARY_TYPE", "static"));
   --   for Library_Kind use Library_Type;

   package Compiler is
      for Default_Switches ("ada") use Gui_Doppler_Plane_1_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;

   package Linker is
      for Switches ("ada") use ("-lopenal", "-lalut");
   end Linker;

end Gui_Doppler_Plane_1;

 

gui_doppler_plane_1.adb
tintr.ads
tintr.adb
gui.ads
gui.adb
gval.ads
audio.ads
audio.adb
common.ads
common.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



Picture_of_Listener_140x140pix

Listener image
140 x 140 pixel

1kHz_Sound_File

1kHz Tone

Format: PCM, Duration:5sec, Bitrate:705.6kbps, 1channel, Sampling rate:44.1kHz, 16bit, Size:441kB

 

Build Project

 

Setup Alire Environment

~$ cd ada/oal
~/ada/oal$ alr init gui_doppler_plane_1 –bin (dash dash 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'

Select the kind of crate you want to create:
  1. LIBRARY
  2. BINARY
Enter your choice index (first is default): 
> Enter
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: ''
✓ gui_doppler_plane_1 initialized successfully.

Setup GtkAda Environment

~/ada/oal$ cd gui_doppler_plane_1/
~/ada/oal/gui_doppler_plane_1$ alr with gtkada

◴ Updating index... remote: Enumerating objects: 36, done.
remote: Counting objects: 100% (31/31), done.
remote: Compressing objects: 100% (22/22), done.
remote: Total 36 (delta 17), reused 20 (delta 9), pack-reused 5 (from 1)
Unpacking objects: 100% (36/36), 21.23 KiB | 905.00 KiB/s, done.
From https://github.com/alire-project/alire-index
   f5b1032..327f9e4  stable-1.4.0 -> origin/stable-1.4.0
Already up to date.
                                                                                ◵ Solving dependencies: 0/0/0/6 (complete/partial/dupes/states)... Looking for e                                                                                ◵ Solving dependencies: 0/0/0/6 (complete/partial/dupes/states)... Looking for e                                                                                ◵ Solving dependencies: 0/0/0/6 (complete/partial/dupes/states)... Looking for e                                                                                                                                                                ◵ Solving dependencies: 0/0/0/6 (complete/partial/dupes/states)... Looking for e                                                                                ◵ Solving dependencies: 0/0/0/6 (complete/partial/dupes/states)... Looking for e                                                                                ◵ Solving dependencies: 0/0/0/6 (complete/partial/dupes/states)... Looking for e                                                                                Requested changes:                                                   

   ✓ gtkada ^25.0.1 (add)
                            
Changes to dependency solution:

   +   gtkada     25.0.1  (new)
   +📦 libgtk3    3.24.41 (new,indirect,system package)
   +📦 make       4.3.0   (new,indirect,system package)
   +📦 pkg_config 1.8.1   (new,indirect,system package)

Do you want to proceed?
[Y] Yes  [N] No  (default is Yes) Yes


Build

~/ada/oal/gui_doppler_plane_1$ alr build

ⓘ Building gui_doppler_plane_1=0.1.0-dev/gui_doppler_plane_1.gpr...      
Setup
   [mkdir]        object directory for project Gui_Doppler_Plane_1
   [mkdir]        library directory for project Gui_Doppler_Plane_1
Compile
   [C]            misc_generated.c
   [C]            misc.c
   [Ada]          gui_doppler_plane_1_config.ads
   [Ada]          gui_doppler_plane_1.ads
/home/mm/.local/share/alire/builds/gtkada_25.0.1_d3787772/05561da954afaee17128f59bba699db2f2e4a4215317b2b818a8016192c82334/src/misc.c: In function 'ada_g_module_build_path':
/home/mm/.local/share/alire/builds/gtkada_25.0.1_d3787772/05561da954afaee17128f59bba699db2f2e4a4215317b2b818a8016192c82334/src/misc.c:161:3: warning: 'g_module_build_path' is deprecated [-Wdeprecated-declarations]
  161 |   return g_module_build_path (directory, module_name);
      |   ^~~~~~
In file included from /usr/include/glib-2.0/gio/giomodule.h:31,
                 from /usr/include/glib-2.0/gio/gio.h:102,
                 from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:28,
                 from /usr/include/gtk-3.0/gdk/gdk.h:32,
                 from /home/mm/.local/share/alire/builds/gtkada_25.0.1_d3787772/05561da954afaee17128f59bba699db2f2e4a4215317b2b818a8016192c82334/src/misc.c:38:
/usr/include/glib-2.0/gmodule.h:142:23: note: declared here
  142 | gchar*                g_module_build_path    (const gchar  *directory,
      |                       ^~~~~~~~~~~~~~~~~~~
Build Libraries
   [gprlib]       gtkada.lexch
   [gprlib]       Gui_Doppler_Plane_1.lexch
   [archive]      libgtkada.a
   [index]        libgtkada.a
   [archive]      libGui_Doppler_Plane_1.a
   [index]        libGui_Doppler_Plane_1.a
✓ Build finished successfully in 1.30 seconds.


~/ada/oal/gui_doppler_plane_1$ ls -al

total 44
drwxrwxr-x  8 mm mm 4096 Aug 26 21:19 .
drwxrwxr-x 12 mm mm 4096 Aug 26 21:13 ..
drwxrwxr-x  3 mm mm 4096 Aug 26 21:19 alire
-rw-rw-r--  1 mm mm  275 Aug 26 21:16 alire.toml
drwxrwxr-x  2 mm mm 4096 Aug 26 21:13 config
-rw-rw-r--  1 mm mm   29 Aug 26 21:13 .gitignore
-rw-rw-r--  1 mm mm  986 Aug 26 21:13 gui_doppler_plane_1.gpr
drwxrwxr-x  2 mm mm 4096 Aug 26 21:19 lib
drwxrwxr-x  3 mm mm 4096 Aug 26 21:19 obj
drwxrwxr-x  3 mm mm 4096 Aug 26 21:13 share
drwxrwxr-x  2 mm mm 4096 Aug 26 21:13 src


Setup Source Files

Download files from GitHub and copy these directories:

2 file to the current directory ./

gui_doppler_plane_1.gpr — Available from GitHub or you can generate with GnatStudio.

sourcefiles.txt

10 files to the src directory src/

  audio.ads

  audio.adb

  common.ads

  common.adb

  gui.ads

  gui.adb

  gui_doppler_plane_1.adb

  gval.ads

  tintr.ads

  tintr.adb

Startup GnatStudio to create the project gpr file

~/ada/oal/gui_doppler_plane_1$ alr edit

GnatStudio window

GnatStudio window

Press “Edit” – ”Project Properties”
Setup OpenAL source files directory
“Directories” – “+” – navigate “Computer” — “usr” – “local” – “include” – “coreland” – “openal-ada” – “OK”

Source directory



Press “Files” – “source list file” Radio button
“Browse” – choose “sourcefiles.txt” which you created – “OK”

NOTE: This file setting remembers the previous directory configuration, so when setting up a new project, be careful not to confuse it with the previous settings.

Source files list


Press “Main” – “+” – “ – check “gui_doppler_plane_1.adb” – OK

Main file


“Build”—”Switches”—”Ada Linker” tab: Enter this line into the bottom rectangular box.

Ada Linker option

-lopenal -lalut

Save” to close the properties window.
Press “Reload”.
New project file: ./cli_doppler_1.gpr was created:

Copy 2 sound and image files for execution

2 files to bin/ directory
testsound.wav (1kHz tone sound)
BackShot140140.png  (Listner image)

Build all

Build message

Although many warnings are displayed as shown above, none of them are fatal errors.
If the last line ends with “[Link]”, the build was successful.



Execution

The application can only be executed from the console. It cannot be launched from GnatStudio.

The following 2 files are also required in the same directory as the executable:

  • BackShot140140.png: Listener image file (140×140 pixels)
  • testsound.wav: Audio file

~/ada/oal/gui_doppler_plane_1/bin$ ./gui_doppler_plane_1

Executing screen


Console messages

Console