Expand description
Player: the rules of playing a frame’s audio, shared by every backend
(game ADR-0026, ADR-0063), behind the small Backend trait a backend
writes: the sound and voice requests and the music commands
App hands the sound device (AudioFrame).
The player keeps the cues’ volumes, picks a variant, plays at most two
tracks in a crossfade, their gains moving opposite ways (ADR-0054), and
plays the voice clips (game ADR-0046). PlayerDevice is the whole of a
backend’s Audio over it.
A sound started with a handle (SoundRequest::Start) is one playback
the player keeps by its id, so that one copy stops alone and its volume
follows the requests and the player’s sound volume.
Holding a sound (ADR-0056). A sound paused under a menu
(SoundRequest::PauseSounds), and everything sounding while the system
suspends the game (Player::suspend: the sounds started with a handle,
the voice and the music), is held with Backend::pause. A backend that
can’t pause says Unsupported, and the player mutes instead: the sound
runs on silently, so a track’s clock runs too, and comes back at the
volume it would have had. A paused track’s clock holds.
It also knows when each track really started (Player::music_playing,
game ADR-0037): a track asked for only sounds once its file has loaded, and
screens that keep time with the music need the real moment.
Structs§
- Player
- The audio player: owns the decoded sounds and the music tracks.
- Player
Device - The
Audioof a backend that writes onlyBackend: its backend and, once the game has loaded, thePlayerover it. Before that there is nothing to play. - Unsupported
- What a
Backend’s provided method says on a backend without the feature: the player then carries on with the feature’s fallback.
Constants§
- RATE_
ONE - A playback rate of 1.0, as
Backend::set_ratetakes it: 16.16 fixed point, so a sound plays as recorded.
Traits§
- Backend
- What playing audio needs from the platform: all a backend writes for the sound of a game (ADR-0063).