Ada 2012 bindings for libcanberra.
A minimal example to synchronously play an event sound:
with Canberra;
procedure Example is
Context : Canberra.Context := Canberra.Create;
begin
Context.Play ("bell");
end Example;
An example that shows how to play sounds asynchronously and cancel or wait for them to finish playing:
with Canberra;
procedure Example is
Context : Canberra.Context := Canberra.Create
(Name => "Ada",
ID => "ada.lovelace",
Icon => "utilities-terminal");
S1, S2 : Canberra.Sound;
begin
Context.Set_Property ("canberra.xdg-theme.name", "ubuntu");
Context.Play ("phone-outgoing-busy", S1);
Context.Play ("desktop-login", S2, Canberra.Music, "Login");
-- Stop playing the music sound
delay 1.5;
Context.Cancel (S2);
-- But wait for the event sound to finish playing
S1.Await_Finish_Playing;
end Example;
In order to build the bindings for libcanberra, you need to have:
-
An Ada 2012 compiler
To use libcanberra, you need to have some backend installed:
libcanberra-pulse
for the PulseAudio backend
Please read the contributing guidelines before opening issues or pull requests.
These bindings are licensed under the Apache License 2.0. The first line of each Ada file should contain an SPDX license identifier tag that refers to this license:
SPDX-License-Identifier: Apache-2.0