Latest version:
Tramway SDK 0.0.9
Github
Quick links
Home
Get Started

Audio


The audio system provides audio playback services.

Currently it only supports playing back audio from audio files, and from .ogg format audio files in particular.

In the future, the system will be enhanced to allow streaming audio, and possibly to allow for more formats to be used.

If you want to easily play back sounds in your levels, check out the Sound entity. It also has a scripting API option, which is useful for playing back sound effects.

If you want to incorporate audio playback into the entities you are constructing, you will find the Audio Component useful.

Key concepts


Sound

A sound is a Resource. It contains audio data loaded from an .ogg audio file.

Source

A source will play back the audio contained in a Sound. It can be positioned in 3D space.

Listener

A listener is usually attached to the render view. It has a position and an orientation.

It determines how the sources should sound like, relative to it, i.e. if a sound source is next to the listener, it will sound very loud, and if it is moved to be very far from the listener, it will be very quiet.

Programming in C++


// TODO: implement

Scripting in Lua


// TODO: implement

Backends


Just like Physics and Render, the Audio system provides an interface for swapping out the audio system backends. The possible options are:

OpenAL

This is the default Audio backend. It uses the OpenAL library to play back audio.

Spatial

An experimental audio backend. Uses path tracing adapted from the primary sample space metropolis light transport algorithm. Very fancy, but also very slow and broken. Might not even compile without some fixes.

Template

The template for implementing further backends. Implements only stubs of the internal API functions. Can be used if you don't want to use any audio.