Watch
2
0
Fork
You've already forked jarabica
0
Type-safe OpenAL wrapper
  • Java 99.2%
  • Shell 0.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Mark Raynsford 5596d42aa8
Some checks are pending
main-RHEL10-x86_64-jdk25 / Build (push) Waiting to run
main-RHEL10-x86_64-jdk26 / Build (push) Waiting to run
main-RHEL9-x86_64-jdk25 / Build (push) Waiting to run
main-RHEL9-x86_64-jdk26 / Build (push) Waiting to run
Update workflows.
2026-07-31 18:42:53 +01:00
.forgejo Update workflows. 2026-07-31 18:42:53 +01:00
com.io7m.jarabica.api Update to latest checkstyle. 2025-04-26 20:14:03 +00:00
com.io7m.jarabica.demo Upgrade to jwheatsheaf 4.0.0. 2024-09-19 10:09:30 +00:00
com.io7m.jarabica.extensions.efx Update to latest checkstyle. 2025-04-26 20:14:03 +00:00
com.io7m.jarabica.lwjgl Begin next development iteration. 2024-06-01 18:44:30 +00:00
com.io7m.jarabica.tests Begin next development iteration. 2024-06-01 18:44:30 +00:00
src/site/resources Update site metadata. 2025-08-09 15:06:49 +00:00
.gitignore Update .gitignore. 2024-05-07 16:01:42 +00:00
.gitmodules Move to new organization. 2024-05-02 20:55:02 +00:00
alsoft.conf Use a single test config file. 2024-05-02 21:27:26 +00:00
checkstyle-filter.xml Initial version 2022-02-02 20:25:10 +00:00
checkstyle-suppressions-1.0.dtd Initial version 2022-02-02 20:25:10 +00:00
doc7m-books.json Add doc7m-books.json 2026-07-31 18:36:44 +01:00
pom.xml Migrate project. 2026-06-27 10:08:07 +01:00
README-CHANGES.xml Mark release 1.0.0 2024-06-01 18:44:18 +00:00
README-LICENSE.txt Update LICENSE 2023-08-13 21:16:12 +00:00
README.in Migrate project. 2026-06-27 10:08:07 +01:00
README.md Migrate project. 2026-06-27 10:08:07 +01:00

jarabica

Maven Central Maven Central (snapshot) Java Version

com.io7m.jarabica

jarabica

The jarabica package attempts to provide a type-safe, mildly object-oriented frontend to the OpenAL API. Currently, it uses the high-quality LWJGL bindings internally, and wraps them with a thin layer of short-lived immutable types for safety and efficiency. It strongly separates the API and implementation to allow for easy unit testing and mocking of code that calls OpenAL.

Features

  • Type-safe OpenAL frontend.
  • Strong separation of API and implementation to allow for switching to different bindings at compile-time.
  • Strongly-typed interfaces with a heavy emphasis on immutable value types.
  • Fully documented (JavaDoc).
  • Example code included.
  • High coverage test suite.
  • OSGi-ready
  • JPMS-ready
  • ISC license.

Usage

The jarabica package works in the same manner as the OpenAL API, but with adjustments to make the API feel more like a Java API. Create a device factory from which to create devices. The device factory implementation chosen essentially decides which underlying OpenAL bindings will be used; currently, the only real implementation is based on LWJGL.

val devices = new JALWDeviceFactory();

Enumerate the available audio devices:

List<JADeviceDescription> deviceDescriptions = devices.enumerateDevices();

Inspect the list of returned devices, and select the one that is most appropriate to your application. Use the description of the device to open the device:

try (JADeviceType device = devices.openDevice(deviceDescriptions.get(0))) {
  ...
}

With the open device, it's necessary to create a context.

JAContextType context = device.createContext();

The context value follows the usual OpenAL thread-safety rules; a context must be made current on the current thread before any operations can be performed using it. Creating a context automatically makes it current on the calling thread.

The context value can then be used to create OpenAL sources and buffers in a manner familiar to anyone experienced with OpenAL.

try (var source = context.createSource()) {
  try (var buffer = context.createBuffer()) {
    ...
  }
}

Example Application

A demo application is included that demonstrates how to use the API correctly, and also demonstrates numerous extensions such as the ubiquitous EFX extension.