#[non_exhaustive]pub enum AudioRequest<V> {
Show 14 variants
PlaySound {
cue: String,
volume: f32,
},
StartSound {
id: SoundId,
cue: String,
volume: f32,
},
StopSound {
id: SoundId,
},
SoundVolume {
id: SoundId,
volume: f32,
},
PauseSounds,
ResumeSounds,
#[non_exhaustive] PlayMusic {
cue: String,
switch: Option<MusicSwitch>,
},
StopMusic,
#[non_exhaustive] StopMusicWith {
fade_ms: u32,
},
PlayVoice {
line: LineId,
variant: V,
},
StopVoice,
PreloadVoices {
lines: Vec<(LineId, V)>,
},
#[non_exhaustive] AddSound {
cue: String,
samples: SharedSamples,
},
RemoveSound {
cue: String,
},
}Expand description
Something a screen wants heard. Cue ids are the ones in the game’s
audio manifest (AudioManifest).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
PlaySound
Play a sound cue once, at volume (0–1) times the cue’s own volume.
StartSound
Play a sound cue until StopSound of its id
(looped if the cue says so, else once), at volume (0–1) times the
cue’s own volume.
Fields
StopSound
Stop the sound started as id, at once.
SoundVolume
Set the volume of the sound started as id.
PauseSounds
Pause every sound started with a handle that is playing now
(AudioQueue::pause_sounds); one started after it plays. Sound
cues played once, the music and the voice go on.
ResumeSounds
Resume the sounds PauseSounds paused.
#[non_exhaustive]PlayMusic
Switch to a music cue. Asking for the track already playing does
nothing. Build it with AudioRequest::play_music (ADR-0039).
Fields
This variant is marked as non-exhaustive
switch: Option<MusicSwitch>How the track playing gives way to it; None for the audio
manifest’s default (AudioManifest::music_switch).
StopMusic
Fade the music out over the audio manifest’s default fade-out
(MusicSwitch’s out_ms).
#[non_exhaustive]StopMusicWith
Fade the music out over fade_ms, for this stop only: the time
from full gain to silence, so a track at half gain takes half of
it; 0 stops at once. Build it with
AudioRequest::stop_music_with (ADR-0039).
Fields
This variant is marked as non-exhaustive
PlayVoice
Say a dialogue line: play its voice clip once, stopping the voice that is playing (one voice at a time).
StopVoice
Stop the voice that is playing, if any.
PreloadVoices
The clips a scene will ask for, in script order, so the platform can load
the next few ahead of each PlayVoice. Replaces
the list sent before.
#[non_exhaustive]AddSound
Make samples the sound cue cue from now on, as a cue of the manifest
is: PlaySound and
StartSound play it at its own volume, full, once.
A cue added before is replaced. Only AudioQueue::add_sound makes
one, within its limits.
Fields
This variant is marked as non-exhaustive
samples: SharedSamplesIts samples, shared with whatever plays them.
RemoveSound
Forget the sound cue cue that AddSound made,
stopping what plays it.
Implementations§
Source§impl<V> AudioRequest<V>
impl<V> AudioRequest<V>
Sourcepub fn play_music(cue: impl Into<String>, switch: Option<MusicSwitch>) -> Self
pub fn play_music(cue: impl Into<String>, switch: Option<MusicSwitch>) -> Self
A PlayMusic of cue, switching with switch
(None: the manifest’s default).
Sourcepub fn stop_music_with(fade_ms: u32) -> Self
pub fn stop_music_with(fade_ms: u32) -> Self
A StopMusicWith: the music fades out over
fade_ms (0: at once), whatever the manifest’s default.
Trait Implementations§
Source§impl<V: Clone> Clone for AudioRequest<V>
impl<V: Clone> Clone for AudioRequest<V>
Source§fn clone(&self) -> AudioRequest<V>
fn clone(&self) -> AudioRequest<V>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more