change sounds away from mario, replace their use sites (#974)

This commit is contained in:
Keagan McClelland
2021-12-20 11:23:36 -07:00
committed by Aiden McClelland
parent fb8c5edc13
commit c814fbe4cb
5 changed files with 82 additions and 40 deletions

View File

@@ -10,7 +10,7 @@ use embassy::middleware::encrypt::encrypt;
#[cfg(feature = "avahi")]
use embassy::net::mdns::MdnsController;
use embassy::shutdown::Shutdown;
use embassy::sound::MARIO_COIN;
use embassy::sound::CHIME;
use embassy::util::logger::EmbassyLogger;
use embassy::util::Invoke;
use embassy::{Error, ResultExt};
@@ -51,7 +51,7 @@ async fn setup_or_init(cfg_path: Option<&str>) -> Result<(), Error> {
async move { ctx.product_key().await }
};
let encrypt = encrypt(keysource);
MARIO_COIN.play().await?;
CHIME.play().await?;
rpc_server!({
command: embassy::setup_api,
context: ctx.clone(),

View File

@@ -219,7 +219,7 @@ async fn inner_main(cfg_path: Option<&str>) -> Result<Option<Shutdown>, Error> {
rpc_ctx.shutdown.subscribe(),
);
embassy::sound::MARIO_COIN.play().await?;
embassy::sound::CHARGE.play().await?;
futures::try_join!(
server

View File

@@ -6,7 +6,7 @@ use rpc_toolkit::command;
use crate::context::RpcContext;
use crate::disk::main::export;
use crate::sound::MARIO_DEATH;
use crate::sound::SHUTDOWN;
use crate::util::{display_none, Invoke};
use crate::Error;
@@ -53,7 +53,7 @@ impl Shutdown {
tracing::debug!("{:?}", e);
}
}
if let Err(e) = MARIO_DEATH.play().await {
if let Err(e) = SHUTDOWN.play().await {
tracing::error!("Error Playing Shutdown Song: {}", e);
tracing::debug!("{:?}", e);
}

View File

@@ -336,44 +336,65 @@ macro_rules! song {
pub const BEP: Song<[(Option<Note>, TimeSlice); 1]> = song!(150, [note(A, 4, Sixteenth);]);
pub const MARIO_DEATH: Song<[(Option<Note>, TimeSlice); 12]> = song!(400, [
note(B, 4, Quarter);
note(F, 5, Quarter);
rest(Quarter);
note(F, 5, Quarter);
note(F, 5, Triplet(&Half));
note(E, 5, Triplet(&Half));
note(D, 5, Triplet(&Half));
note(C, 5, Quarter);
note(E, 4, Quarter);
rest(Quarter);
note(E, 4, Quarter);
note(C, 4, Half);
]);
pub const MARIO_POWER_UP: Song<[(Option<Note>, TimeSlice); 15]> = song!(400, [
note(G,4,Triplet(&Eighth));
note(B,4,Triplet(&Eighth));
note(D,5,Triplet(&Eighth));
note(G,5,Triplet(&Eighth));
note(B,5,Triplet(&Eighth));
note(Ab,4,Triplet(&Eighth));
note(C,5,Triplet(&Eighth));
note(Eb,5,Triplet(&Eighth));
note(Ab,5,Triplet(&Eighth));
note(C,5,Triplet(&Eighth));
note(Bb,4,Triplet(&Eighth));
note(D,5,Triplet(&Eighth));
note(F,5,Triplet(&Eighth));
note(Bb,5,Triplet(&Eighth));
note(D,6,Triplet(&Eighth));
]);
pub const MARIO_COIN: Song<[(Option<Note>, TimeSlice); 2]> = song!(400, [
pub const CHIME: Song<[(Option<Note>, TimeSlice); 2]> = song!(400, [
note(B, 5, Eighth);
note(E, 6, Tie(&Dot(&Quarter), &Half));
]);
pub const CHARGE: Song<[(Option<Note>, TimeSlice); 7]> = song!(120, [
note(G, 3, Triplet(&Eighth));
note(C, 4, Triplet(&Eighth));
note(E, 4, Triplet(&Eighth));
note(G, 4, Triplet(&Eighth));
rest(Triplet(&Eighth));
note(E, 4, Triplet(&Eighth));
note(G, 4, Whole);
]);
pub const SHUTDOWN: Song<[(Option<Note>, TimeSlice); 12]> = song!(120, [
note(C, 5, Eighth);
rest(Eighth);
note(G, 4, Triplet(&Eighth));
note(Gb, 4, Triplet(&Eighth));
note(G, 4, Triplet(&Eighth));
note(Ab, 4, Quarter);
note(G, 4, Eighth);
rest(Eighth);
rest(Quarter);
note(B, 4, Eighth);
rest(Eighth);
note(C, 5, Eighth);
]);
pub const UPDATE_FAILED_1: Song<[(Option<Note>, TimeSlice); 5]> = song!(120, [
note(C, 4, Triplet(&Sixteenth));
note(Eb, 4, Triplet(&Sixteenth));
note(Gb, 4, Triplet(&Sixteenth));
note(A, 4, Quarter);
rest(Eighth);
]);
pub const UPDATE_FAILED_2: Song<[(Option<Note>, TimeSlice); 5]> = song!(110, [
note(B, 3, Triplet(&Sixteenth));
note(D, 4, Triplet(&Sixteenth));
note(F, 4, Triplet(&Sixteenth));
note(Ab, 4, Quarter);
rest(Eighth);
]);
pub const UPDATE_FAILED_3: Song<[(Option<Note>, TimeSlice); 5]> = song!(100, [
note(Bb, 3, Triplet(&Sixteenth));
note(Db, 4, Triplet(&Sixteenth));
note(E, 4, Triplet(&Sixteenth));
note(G, 4, Quarter);
rest(Eighth);
]);
pub const UPDATE_FAILED_4: Song<[(Option<Note>, TimeSlice); 5]> = song!(90, [
note(A, 3, Triplet(&Sixteenth));
note(C, 4, Triplet(&Sixteenth));
note(Eb, 4, Triplet(&Sixteenth));
note(Gb, 4, Tie(&Dot(&Quarter), &Quarter));
rest(Quarter);
]);
pub const BEETHOVEN: Song<[(Option<Note>, TimeSlice); 9]> = song!(216, [
note(G, 4, Eighth);
note(G, 4, Eighth);

View File

@@ -30,6 +30,7 @@ use crate::disk::mount::filesystem::FileSystem;
use crate::disk::mount::guard::TmpMountGuard;
use crate::disk::BOOT_RW_PATH;
use crate::notifications::NotificationLevel;
use crate::sound::{BEP, UPDATE_FAILED_1, UPDATE_FAILED_2, UPDATE_FAILED_3, UPDATE_FAILED_4};
use crate::update::latest_information::LatestInformation;
use crate::util::Invoke;
use crate::version::{Current, VersionT};
@@ -194,6 +195,9 @@ async fn maybe_do_update(ctx: RpcContext) -> Result<Option<Arc<Revision>>, Error
Ok(()) => {
info.status = ServerStatus::Updated;
info.save(&mut db).await.expect("could not save status");
BEP.play().await.expect("could not bep");
BEP.play().await.expect("could not bep");
BEP.play().await.expect("could not bep");
}
Err(e) => {
info.status = ServerStatus::Running;
@@ -209,7 +213,24 @@ async fn maybe_do_update(ctx: RpcContext) -> Result<Option<Arc<Revision>>, Error
None,
)
.await
.expect("")
.expect("");
// TODO: refactor sound lib to make compound tempos easier to deal with
UPDATE_FAILED_1
.play()
.await
.expect("could not play song: update failed 1");
UPDATE_FAILED_2
.play()
.await
.expect("could not play song: update failed 2");
UPDATE_FAILED_3
.play()
.await
.expect("could not play song: update failed 3");
UPDATE_FAILED_4
.play()
.await
.expect("could not play song: update failed 4");
}
}
});