mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
sound feature flag
This commit is contained in:
committed by
Aiden McClelland
parent
6b6dc404ab
commit
0cf1a45da7
@@ -38,9 +38,8 @@ path = "src/bin/embassy-cli.rs"
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
avahi = ["avahi-sys"]
|
avahi = ["avahi-sys"]
|
||||||
default = ["avahi"]
|
default = ["avahi", "sound"]
|
||||||
portable = []
|
sound = []
|
||||||
production = []
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
aes = { version = "0.7.5", features = ["ctr"] }
|
aes = { version = "0.7.5", features = ["ctr"] }
|
||||||
|
|||||||
@@ -50,18 +50,22 @@ impl Shutdown {
|
|||||||
|
|
||||||
#[command(display(display_none))]
|
#[command(display(display_none))]
|
||||||
pub async fn shutdown(#[context] ctx: RpcContext) -> Result<(), Error> {
|
pub async fn shutdown(#[context] ctx: RpcContext) -> Result<(), Error> {
|
||||||
ctx.shutdown.send(Some(Shutdown {
|
ctx.shutdown
|
||||||
zfs_pool: ctx.zfs_pool_name.clone(),
|
.send(Some(Shutdown {
|
||||||
restart: false,
|
zfs_pool: ctx.zfs_pool_name.clone(),
|
||||||
}));
|
restart: false,
|
||||||
|
}))
|
||||||
|
.expect("receiver dropped");
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[command(display(display_none))]
|
#[command(display(display_none))]
|
||||||
pub async fn restart(#[context] ctx: RpcContext) -> Result<(), Error> {
|
pub async fn restart(#[context] ctx: RpcContext) -> Result<(), Error> {
|
||||||
ctx.shutdown.send(Some(Shutdown {
|
ctx.shutdown
|
||||||
zfs_pool: ctx.zfs_pool_name.clone(),
|
.send(Some(Shutdown {
|
||||||
restart: true,
|
zfs_pool: ctx.zfs_pool_name.clone(),
|
||||||
}));
|
restart: true,
|
||||||
|
}))
|
||||||
|
.expect("receiver dropped");
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,12 +113,15 @@ where
|
|||||||
&'a T: IntoIterator<Item = &'a (Option<Note>, TimeSlice)>,
|
&'a T: IntoIterator<Item = &'a (Option<Note>, TimeSlice)>,
|
||||||
{
|
{
|
||||||
pub async fn play(&'a self) -> Result<(), Error> {
|
pub async fn play(&'a self) -> Result<(), Error> {
|
||||||
let mut sound = SoundInterface::lease().await?;
|
#[cfg(feature = "sound")]
|
||||||
for (note, slice) in &self.note_sequence {
|
{
|
||||||
match note {
|
let mut sound = SoundInterface::lease().await?;
|
||||||
None => tokio::time::sleep(slice.to_duration(self.tempo_qpm)).await,
|
for (note, slice) in &self.note_sequence {
|
||||||
Some(n) => sound.play_for_time_slice(self.tempo_qpm, n, slice).await?,
|
match note {
|
||||||
};
|
None => tokio::time::sleep(slice.to_duration(self.tempo_qpm)).await,
|
||||||
|
Some(n) => sound.play_for_time_slice(self.tempo_qpm, n, slice).await?,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user