pub struct AudioBell { /* private fields */ }Expand description
Audio bell manager for playing terminal bell sounds.
When the audio feature is enabled this uses rodio for real audio
playback. When disabled, all methods are no-ops so callers never need
conditional code.
Implementations§
Source§impl AudioBell
impl AudioBell
Sourcepub fn play(&self, volume: u8)
pub fn play(&self, volume: u8)
Play a bell sound with the specified volume (0-100)
§Arguments
volume- Volume level from 0 to 100. A value of 0 disables the bell sound.
Sourcepub fn play_tone(&self, volume: u8, frequency: f32, duration_ms: u64)
pub fn play_tone(&self, volume: u8, frequency: f32, duration_ms: u64)
Play a tone with configurable frequency and duration
§Arguments
volume- Volume level from 0 to 100. A value of 0 disables the sound.frequency- Frequency in Hz (e.g. 800.0 for standard bell)duration_ms- Duration in milliseconds
Sourcepub fn play_file(&self, volume: u8, path: &Path)
pub fn play_file(&self, volume: u8, path: &Path)
Play a sound file (WAV/MP3/OGG/FLAC) at the specified volume
§Arguments
volume- Volume level from 0 to 100path- Path to the sound file
Sourcepub fn play_alert(&self, config: &AlertSoundConfig)
pub fn play_alert(&self, config: &AlertSoundConfig)
Play an alert sound using the given configuration
Trait Implementations§
Source§impl Default for AudioBell
Available on crate feature audio only.
impl Default for AudioBell
audio only.Source§fn default() -> Self
fn default() -> Self
A silent bell that owns no output device.
This deliberately does not open a device. shared is the only
sanctioned way to obtain a working bell, because opening a second device
from another thread faults inside WASAPI on Windows. A Default that
quietly opened its own device re-introduced exactly that crash, and had
no callers outside tests. Matches the no-audio build’s behaviour.
Auto Trait Implementations§
impl !RefUnwindSafe for AudioBell
impl !UnwindSafe for AudioBell
impl Freeze for AudioBell
impl Send for AudioBell
impl Sync for AudioBell
impl Unpin for AudioBell
impl UnsafeUnpin for AudioBell
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> 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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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().