pub struct AudioCue {
pub asset_id: AssetId,
pub screen: Option<AssetId>,
pub clip: Option<AudioClipHandle>,
pub kind: CueKind,
pub volume: f32,
pub bus: Option<AudioBus>,
pub priority: i32,
}Expand description
Plays audio when a Screen is shown.
A cue links a Screen to an AudioClip: whenever UI
navigation makes the screen active (a screen:show or screen:toggle action, a
KeyBinding, dismissing an overlay back to it, or being the
world’s initial screen), the clip plays. Cues play flat on the main mix with
no 3D position; use an AudioEmitter for positional sound.
The kind decides the playback behavior:
music: loops until replaced. Showing a screen whose music cue is already playing leaves the track running, so navigating between screens that share a cue is seamless. A screen with a different music cue replaces the track; a screen with no music cue leaves the current music playing.sound: a one-shot effect, played every time the screen is shown.
Fields§
§asset_id: AssetIdAsset identity; injected via inject_name. Not part of args.
screen: Option<AssetId>The Screen whose activation triggers this cue.
clip: Option<AudioClipHandle>The AudioClip to play.
kind: CueKindPlayback behavior: a looping music track or a one-shot sound.
volume: f32Linear gain applied to the clip (1.0 leaves it unchanged).
bus: Option<AudioBus>Mix bus the cue routes through. Defaults to music for a music cue
and sfx for a sound cue; set voice for dialogue.
priority: i32Voice priority for a sound cue. When all voice slots are busy, a new
sound silences the oldest lowest-priority voice; a sound outranked by
everything playing is skipped. Higher wins; the default is 0.
Trait Implementations§
Source§impl Component for AudioCue
impl Component for AudioCue
Source§fn from_baked(bytes: &[u8]) -> Result<AudioCue, CnResult>
fn from_baked(bytes: &[u8]) -> Result<AudioCue, CnResult>
Source§fn inject_locator(&mut self, _locator: PayloadLocator)
fn inject_locator(&mut self, _locator: PayloadLocator)
Source§fn inject_name(&mut self, _id: AssetId)
fn inject_name(&mut self, _id: AssetId)
Source§impl ComponentSlot for AudioCue
impl ComponentSlot for AudioCue
Source§const DISCRIMINANT: u8
const DISCRIMINANT: u8
ComponentId.Source§impl<'de> Deserialize<'de> for AudioCue
impl<'de> Deserialize<'de> for AudioCue
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<AudioCue, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<AudioCue, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<AudioCue> for ComponentAsset
impl From<AudioCue> for ComponentAsset
Source§fn from(c: AudioCue) -> ComponentAsset
fn from(c: AudioCue) -> ComponentAsset
impl RuntimeComponent for AudioCue
Source§impl Serialize for AudioCue
impl Serialize for AudioCue
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for AudioCue
impl RefUnwindSafe for AudioCue
impl Send for AudioCue
impl Sync for AudioCue
impl Unpin for AudioCue
impl UnsafeUnpin for AudioCue
impl UnwindSafe for AudioCue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().