pub struct UiSounds {
pub open: Option<String>,
pub close: Option<String>,
pub navigate: Option<String>,
pub wrap: Option<String>,
pub activate: Option<String>,
pub edge: Option<String>,
pub change: Option<String>,
pub typing: Option<String>,
}Expand description
Which sound to play for each UiSound. Each entry is a sound name as accepted by
Audio::play; None means silence.
The default is UiSounds::builtin: small generated clicks that work without any files.
use audio_code::ui::{UiSound, UiSounds};
// Built-in sounds, but your own file for moving through menus and no "edge" sound.
let sounds = UiSounds::builtin()
.with(UiSound::Navigate, "ui/my_click")
.without(UiSound::Edge);To design a click in code instead of using a file, see
Ui::set_sound_data.
Fields§
§open: Option<String>Played when a widget opens.
close: Option<String>Played when the player closes a widget.
Played when moving between items.
wrap: Option<String>Played when wrapping around in a menu (falls back to navigate).
activate: Option<String>Played when a button is pressed.
edge: Option<String>Played at the first or last item.
change: Option<String>Played when a value changes.
typing: Option<String>Played for each typed or deleted character.
Implementations§
Source§impl UiSounds
impl UiSounds
Sourcepub fn from_folder(folder: &str) -> Self
pub fn from_folder(folder: &str) -> Self
Loads sounds by convention from a folder: open, close, navigate, wrap,
activate, edge, change and typing (any supported extension) inside folder.
Missing files fall back to silence with a warning on first use; use
UiSounds::without for slots you do not have a file for.
Sourcepub fn with(self, kind: UiSound, name: impl Into<String>) -> Self
pub fn with(self, kind: UiSound, name: impl Into<String>) -> Self
Returns a copy that plays sound name for kind.
Trait Implementations§
impl Eq for UiSounds
impl StructuralPartialEq for UiSounds
Auto Trait Implementations§
impl Freeze for UiSounds
impl RefUnwindSafe for UiSounds
impl Send for UiSounds
impl Sync for UiSounds
impl Unpin for UiSounds
impl UnsafeUnpin for UiSounds
impl UnwindSafe for UiSounds
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,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.