Skip to content

API Overview

Hangman edited this page May 22, 2024 · 10 revisions

TuningFork tries to be a thin wrapper around OpenAL Soft while providing some high-level and convenience features that reduce developer effort. Here is a rough overview of its components.

Core

Class Description
Audio The main class needed for initialization. It provides general settings like setting the attenuation model, master volume and provides access to the used AudioDevice and the SoundListener.
AudioDevice Provides access to hardware specific settings like HRTF.
SoundListener Represents the listener in the audio world (there's only one at a time). You can set the position, orientation and some more attributes to adjust the audio output.
SoundBuffer Holds a buffer with audio data that can be played directly or used by a BufferedSoundSource.
BufferedSoundSource An audio source that can play fully loaded audio (not streaming).
StreamedSoundSource An audio source that streams audio data from disk.
SoundLoader Used to load sound files. Returns a SoundBuffer or a ReadableSoundBuffer.
SoundEffect Can be attached to a SoundSource to change the sound output of the source based on one of the various effects available.

Music Player

Class Description
JukeBox This is the music player, it needs to be updated every frame and offers methods to play Songs from PlayLists.
PlayList A PlayList is a collection of any number of Songs that should be grouped together. The JukeBox plays them in order.
PlayListProvider Provides the JukeBox with PlayLists. This is just an interface, available implementations are listed on the Music Player wiki page.
Song A Song groups a SoundSource, SongSettings and SongMeta.
SongSettings Defines volume and fading settings for a Song.
SongMeta An optional data class to provide custom meta-data for a Song (like title, artist, etc.).

Audio Capture

Class Description
CaptureDevice Used to record audio from capture devices like microphones.

Low-level API

Class Description
AudioStream An interface you can implement to plug-in custom decoders or other sources of audio. SoundLoader and StreamedSoundSources accept AudioStreams as sources. You can also extend one of the built-in implementations below.
WavInputStream An AudioStream that decodes wav files.
AiffInputStream An AudioStream that decodes aiff files.
FlacInputStream An AudioStream that decodes flac files.
Mp3InputStream An AudioStream that decodes mp3 files.
OggInputStream An AudioStream that decodes ogg vorbis files.
QoaInputStream An AudioStream that decodes qoa files.
PcmSoundSource An audio source that can be fed with raw pcm data.
PcmUtil Provides utility functions to analyze or modify PCM samples.