Skip to Content
Audio

Audio

The audio solution of the Hiber3D engine is based on the C++ audio library SoLoud .

Audio components

Audio, similar to much of the rest of Hiber3D, is interfaced through ECS, meaning that the way to set-up audio in your project is done by creating components.

AudioSource

To add play an audio asset in your scene, either through the editor or code, first add an AudioSource component to an entity in the scene.

This can be done either through the editor:

The AudioSource component can be added to an entity using the editor.

Or in scripting:

const audioEntity = hiber3d.createEntity(); hiber3d.addComponent(audioEntity, "Hiber3D::AudioSource"); hiber3d.setComponent(audioEntity, "Hiber3D::AudioSource", "asset", "my_audio_asset.mp3"); ...

Or in C++:

const auto audioEntity = registry.create(); auto& audioSource = registry.emplace<Hiber3D::AudioSource>(audioEntity, {}) ...
Last updated on