diff --git a/LICENSE.md b/LICENSE.md index 1a6e251..e220177 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -41,7 +41,11 @@ - https://pixabay.com/sound-effects/whoosh-blow-flutter-shortwav-14678/ - https://pixabay.com/sound-effects/dslr-camera-sounds-26117/ - https://pixabay.com/sound-effects/beep-6-96243 -- Music: [Cinematic Cello](https://pixabay.com/music/build-up-scenes-cinematic-cello-115667) by [Aleksey Chistilin](https://pixabay.com/users/lexin_music-28841948/), [Pixabay Content License](https://pixabay.com/service/license-summary) +- Music: + - JupiterRecording.ogg is an [actual Jupiter recording by NASA](https://archive.org/download/voyager-1-and-2-1990-jupiter-nasa-voyager-space-sounds-electronic), public domain. + - Processed by cutting out min 1:47-3:47 and applying a 10s linear crossfade at the end. Exported as ogg with quality=3, see [.kdenlive file](src/audio/JupiterRecording.kdenlive). + - The source file has been taken down, and generally, I can't find information on how exactly this was produced. Hoping it's not a hoax. + - [Cinematic Cello](https://pixabay.com/music/build-up-scenes-cinematic-cello-115667) by [Aleksey Chistilin](https://pixabay.com/users/lexin_music-28841948/), [Pixabay Content License](https://pixabay.com/service/license-summary) - Star chart based on the [HYG Stellar database](https://github.com/astronexus/HYG-Database) - Font Yupiter-Regular.ttf is placed under the SIL OPEN FONT LICENSE Version 1.1 and is based on: - Noto Sans Symbols 2, Copyright 2022 The Noto Project Authors (https://github.com/notofonts/symbols) diff --git a/assets/music/JupiterRecording.ogg b/assets/music/JupiterRecording.ogg new file mode 100644 index 0000000..6b82963 Binary files /dev/null and b/assets/music/JupiterRecording.ogg differ diff --git a/src/audio.rs b/src/audio.rs index 393e122..b03cea7 100644 --- a/src/audio.rs +++ b/src/audio.rs @@ -21,12 +21,19 @@ impl Plugin for AudioPlugin { app.add_systems(Startup, setup); app.add_systems( Update, - respawn_sinks.run_if(on_event::()), + ( + play_zoom_sfx, + respawn_sinks.run_if(on_event::()), + pause_all.run_if(on_event::()), + ), + ); + app.add_systems( + PostUpdate, + ( + play_sfx, + toggle_music.run_if(on_event::()), + ), ); - app.add_systems(Update, play_zoom_sfx); - app.add_systems(Update, pause_all.run_if(on_event::())); - app.add_systems(PostUpdate, play_sfx); - app.add_systems(PostUpdate, update_music); app.add_event::(); app.add_event::(); app.add_event::(); @@ -44,6 +51,11 @@ const PATHS: &[(SfxType, Sfx, &str)] = &[ Sfx::BGM, "music/Aleksey Chistilin - Cinematic Cello.ogg", ), + ( + SfxType::BGMNoAR, + Sfx::BGMActualJupiterRecording, + "music/JupiterRecording.ogg", + ), ( SfxType::LoopSfx, Sfx::ElectricMotor, @@ -81,6 +93,7 @@ const PATHS: &[(SfxType, Sfx, &str)] = &[ pub enum Sfx { Achieve, BGM, + BGMActualJupiterRecording, Click, Connect, Crash, @@ -115,6 +128,7 @@ pub fn str2sfx(sfx_label: &str) -> Sfx { pub enum SfxType { BGM, + BGMNoAR, LoopSfx, OneOff, } @@ -163,7 +177,20 @@ pub fn respawn_sinks( source, settings: PlaybackSettings { mode: PlaybackMode::Loop, - paused: settings.mute_music, + paused: settings.mute_music || !settings.hud_active, + ..default() + }, + }, + )); + } + SfxType::BGMNoAR => { + commands.spawn(( + *sfx, + AudioBundle { + source, + settings: PlaybackSettings { + mode: PlaybackMode::Loop, + paused: settings.mute_music || settings.hud_active, ..default() }, }, @@ -207,22 +234,19 @@ pub fn play_sfx( } } -pub fn update_music( - mut events: EventReader, - q_audiosinks: Query<(&AudioSink, &Sfx)>, - settings: Res, -) { - if !events.is_empty() { - events.clear(); - for (bgm_sink, sfx) in &q_audiosinks { - if *sfx != Sfx::BGM { +pub fn toggle_music(q_audiosinks: Query<(&AudioSink, &Sfx)>, settings: Res) { + for (bgm_sink, sfx) in &q_audiosinks { + let play = match *sfx { + Sfx::BGM => settings.hud_active, + Sfx::BGMActualJupiterRecording => !settings.hud_active, + _ => { continue; } - if settings.mute_music { - bgm_sink.pause(); - } else { - bgm_sink.play(); - } + }; + if settings.mute_music || !play { + bgm_sink.pause(); + } else { + bgm_sink.play(); } } }