SoLoudBackend class final
Plays through SoLoud, flat.
Flat on purpose. SoLoud has a 3D layer, and it is not usable from here:
applying a moved source or a turned listener requires update3dAudio(),
which flutter_soloud exposes neither directly nor by way of any call that
makes it — its set3dSourcePosition passes straight through to a SoLoud
method that only marks the source dirty. A source set once at play3d
therefore never moves again, which in a first-person game means the whole
feature. So AudioScene does the geometry and this asks for a voice with a
volume and a pan, both of which take effect immediately.
If a later flutter_soloud exposes the call, the right change is a second backend rather than an edit here — the base class exists for exactly that.
What it could not do it says through onIssue, in the engine's one
Issue type, which flutter3d_app reports through as well.
- Inheritance
-
- Object
- AudioBackend
- SoLoudBackend
Constructors
- SoLoudBackend({IssueSink? onIssue})
-
A backend over
SoLoud.instance, reporting throughonIssue, or todebugPrintwhen null. Nothing opens untilopen. A game that holds a SoLoud engine of its own hands it over with adoptSoLoud, frompackage:flutter3d_audio/soloud.dart.
Properties
-
failedAssets
→ List<
String> -
Assets preload was asked for and could not decode.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isPaused → bool
-
Whether pause holds the voices: set by pause, cleared by resume.
no setter
- onIssue → IssueSink
-
Where this says what it could not play.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
close(
) → Future< void> -
Frees the sources and shuts the engine down.
override
-
isAlive(
VoiceId voice) → bool -
False once a one-shot has run out, so the mixer can forget it.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
open(
) → Future< void> -
Boots the audio engine. Safe to call twice.
override
-
pause(
) → void -
Pauses every voice this backend started and has not stopped, and holds
every voice started before resume.
override
-
preload(
String asset) → Future< void> -
Reads an asset so that start does not have to wait.
override
-
resume(
) → void -
Lets the voices pause held go on, and the ones started since.
override
-
start(
VoiceStart voice) → VoiceId? -
Begins the voice VoiceStart describes, or null when the backend
refused.
override
-
stop(
VoiceId voice) → void -
Silences
voicefor good; the scene does not hand it back after this.override -
toString(
) → String -
A string representation of this object.
inherited
-
update(
VoiceUpdate update) → void -
The three below run per audible voice per frame, and were the three
with no guard. Only start was wrapped, which is backwards: a throw
there costs one sound, and a throw here comes out of the render loop and
takes the frame with it. A
SoundHandlegoes stale for reasons this side does not control — a device change, an engine torn down underneath a voice — and the right answer to a stale handle is to stop using it, not to stop the game.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited