SoundtrackPlugin class final

A CueSheet heard from the engine's bus, on the frame channel, and played.

A view plugin. Once a frame, after the frame's steps, every event is handed to the sheet and what it makes of them is played through the scene scene answers — asked each time, because a game swaps its silent scene for the speakers' once they open. Nothing reaches the simulation.

A rollback does not play a sound twice. An event the frame channel hands out again as Delivered.resimulated is a correction to something already heard; this skips it unless playCorrections is set.

final loop = EngineLoop(
  input: input,
  plugins: [genre, SoundtrackPlugin(cues, scene: () => audio.scene)],
);

Constructors

SoundtrackPlugin(CueSheet cues, {required AudioScene scene(), String id = 'flutter3d_game_kit.soundtrack', bool playCorrections = false, AudioBus? bus})
A plugin playing cues into the audio scene scene returns, under id, on bus when one is given; rolled-back events are skipped unless playCorrections is set.

Properties

bus → AudioBus?
The bus every cue plays on, or null for each sound's own — which is what a sheet heard before there were buses to choose did. Each cue is an AudioEmitter in scene, so the mixer's snapshots and ducking reach it either way.
final
cues → CueSheet
What each event sounds like: the game's own sheet.
final
hashCode → int
The hash code for this object.
no setterinherited
id → String
The plugin's id. Two sheets in one engine need two.
final
manifest → PluginManifest
What the plugin is and needs, read before it is installed: its id, the API it was written against, its dependencies and what it touches.
no setter
playCorrections → bool
Whether an event a rollback changed is played when it arrives again.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scene → AudioScene Function()
The scene to play through, asked once a frame.
final

Methods

install(PluginHost host) → void
Registers this plugin's phases, systems, subscriptions and the rest.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
ready(PluginHost host) → Future<void>
Loads what the plugin needs before it is whole — a shader library its lighting model draws with, a table its system reads — after install has registered everything, and completes when it has. Completes at once unless overridden.
inherited
toString() → String
A string representation of this object.
inherited
uninstall(PluginHost host) → void
Releases what install took that is not a registration. The registrations themselves are cancelled by the host after this returns.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited