generated from PlexSheep/rs-base
refactor(notify): remove rodio because it doesn't work
cargo devel CI / cargo CI (push) Successful in 1m34s
Details
cargo devel CI / cargo CI (push) Successful in 1m34s
Details
This commit is contained in:
parent
5e2621e828
commit
f9e544391e
|
@ -15,7 +15,7 @@ categories = ["date-and-time"]
|
|||
[features]
|
||||
default = ["desktop", "sound"]
|
||||
desktop = ["dep:notify-rust"]
|
||||
sound = ["dep:rodio", "desktop"]
|
||||
sound = ["desktop"]
|
||||
|
||||
|
||||
[dependencies]
|
||||
|
@ -25,5 +25,4 @@ humantime = "2.1.0"
|
|||
libpt = { version = "0.6.0", features = ["cli"] }
|
||||
notify-rust = { version = "4.11.0", optional = true }
|
||||
ratatui = "0.27.0"
|
||||
rodio = { version = "0.19.0", optional = true }
|
||||
tui-big-text = "0.4.5"
|
||||
|
|
|
@ -408,16 +408,11 @@ impl Clock {
|
|||
#[cfg(feature = "sound")]
|
||||
{
|
||||
trace!("playing bundled sound");
|
||||
use rodio::{source::Source, Decoder, OutputStream};
|
||||
|
||||
// only 30 KiB, so let's just include it in the binary and not worry about reading it
|
||||
// from the fs and somehow making the file be there
|
||||
let sound: Cursor<_> = std::io::Cursor::new(include_bytes!("../data/media/alarm.mp3"));
|
||||
|
||||
// Get an output stream handle to the default physical sound device
|
||||
let (_stream, stream_handle) = OutputStream::try_default().unwrap();
|
||||
let source = Decoder::new(sound).expect("could not load the included sound");
|
||||
stream_handle.play_raw(source.convert_samples())?; // the sound plays in another thread
|
||||
// TODO: add something to make a sound
|
||||
debug!("played bundled sound");
|
||||
}
|
||||
#[cfg(feature = "desktop")]
|
||||
|
|
Reference in New Issue