flutter3d_audio library
Positional audio for flutter3d.
The spatialisation — attenuation, panning, occlusion and voice limiting — is here; making noise is a backend's job. See AudioScene for why the geometry is computed in Dart rather than handed to the audio engine.
Classes
- Attenuation
- How a sound gets quieter with distance.
- AudioBackend
- What actually makes noise.
- AudioBus
- A group of sounds that a player can turn down as one.
- AudioIssue
- Plays through SoLoud, flat.
- AudioListener
- Where the ears are.
- AudioScene
- Decides what is heard, and how loudly.
- BlendedLoop
- Several loops, crossfaded by one number.
- ExponentialRolloff
-
(d / reference) ^ -factor. Steep near the source, long tail after. - Heard
- One sound, and where it happened.
- InverseRolloff
-
Falls off as
1 / distance, which is what sound actually does. - LinearRolloff
- Straight line from full to silent. Predictable, and wrong.
- LoopBand
- One recording in a set that covers a range of some value.
- Mixer
- What each bus is turned to, and the one place a volume setting lives.
- NoAttenuation
- Never gets quieter and never pans. Music, narration, the wind.
- SilentBackend
- A backend that makes no sound and records everything.
- SilentVoice
- One recorded voice. Public because a test reads it, and a type a test has to reach for is part of the interface whether or not it looks like one.
- SoLoudBackend
- SoundBank
- Everything one game can make a noise about, as one list.
- SoundDef
- A sound the game can ask for, by name and behaviour rather than by file.
- SoundEmitter
- One sound, somewhere, possibly moving.
- Speakers
- What openSpeakers hands back: the device, and the scene playing through it.
Functions
-
gainToDecibels(
double gain) → double - Turns a distance into the decibel figure a mixing desk would show.
-
openSpeakers(
{required SoundBank bank, Mixer? mixer, int maxVoices = 24, double occlusion(Vector3 from, Vector3 to)?, AudioIssueSink? onIssue}) → Future< Speakers?> - The device a game plays through, opened, or nothing and a game that is silent.
Typedefs
- AudioIssueSink = void Function(AudioIssue issue)
-
Named apart from
flutter3d_game's on purpose. This package depends on nothing of ours — not the engine, not the simulation — so that a program can take the sound without the rest, and there is nowhere to put a shared type that would not give that up. Two identicaltypedefs were interchangeable and cost nothing; two identical classes are not, and a program importing both would have to prefix one of them at every use. So this one carries its own name and its own vocabulary, which is what the packages being uncoupled actually means. - VoiceId = Object
- A live voice, as the backend sees it.