diff --git a/CHANGELOG.md b/CHANGELOG.md index e5ac281570..cc76dc8f78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Experience bar below the hotbar - Bridges. - Tool for exporting PNG images of all in-game models (`cargo img-export`) +- Calendar event soundtracks. ### Changed diff --git a/voxygen/src/audio/mod.rs b/voxygen/src/audio/mod.rs index 6bfcb04266..08e44dcca1 100644 --- a/voxygen/src/audio/mod.rs +++ b/voxygen/src/audio/mod.rs @@ -15,17 +15,12 @@ use music::MusicTransitionManifest; use sfx::{SfxEvent, SfxTriggerItem}; use soundcache::load_ogg; use std::time::Duration; -use tracing::{debug, error, warn}; +use tracing::{debug, error}; use common::assets::{AssetExt, AssetHandle}; use rodio::{source::Source, OutputStream, OutputStreamHandle, StreamError}; use vek::*; -/// Prevents sounds that are too low in volume from playing. This may marginally -/// improve performance in certain situations since less audio channels will be -/// used on average. -const MIN_HEARABLE_VOLUME: f32 = 0.003; - #[derive(Default, Clone)] pub struct Listener { pos: Vec3, @@ -116,15 +111,6 @@ impl AudioFrontend { /// Construct in `no-audio` mode for debugging pub fn no_audio() -> Self { - let audio_manifest = "voxygen.audio.music_transition_manifest"; - let mtm = MusicTransitionManifest::load_or_insert_with(audio_manifest, |err| { - warn!( - "Error loading MusicTransitionManifest {:?}: {:?}", - audio_manifest, err - ); - MusicTransitionManifest::default() - }); - Self { // The following is for the disabled device switcher //device: "".to_string(), @@ -142,7 +128,7 @@ impl AudioFrontend { master_volume: 1.0, music_spacing: 1.0, listener: Listener::default(), - mtm, + mtm: AssetExt::load_expect("voxygen.audio.music_transition_manifest"), } } @@ -268,7 +254,7 @@ impl AudioFrontend { ) { if let Some(sfx_file) = Self::get_sfx_file(trigger_item) { // Play sound in empty channel at given position - if self.audio_stream.is_some() && volume.map_or(true, |v| v > MIN_HEARABLE_VOLUME) { + if self.audio_stream.is_some() { let sound = load_ogg(sfx_file).amplify(volume.unwrap_or(1.0)); let listener = self.listener.clone(); @@ -302,7 +288,7 @@ impl AudioFrontend { ) { if let Some(sfx_file) = Self::get_sfx_file(trigger_item) { // Play sound in empty channel at given position - if self.audio_stream.is_some() && volume.map_or(true, |v| v > MIN_HEARABLE_VOLUME) { + if self.audio_stream.is_some() { let sound = load_ogg(sfx_file).amplify(volume.unwrap_or(1.0)); let listener = self.listener.clone(); @@ -337,7 +323,7 @@ impl AudioFrontend { ) { if let Some(sfx_file) = Self::get_sfx_file(trigger_item) { // Play sound in empty channel - if self.audio_stream.is_some() && volume.map_or(true, |v| v > MIN_HEARABLE_VOLUME) { + if self.audio_stream.is_some() { let sound = load_ogg(sfx_file).amplify(volume.unwrap_or(1.0)); if let Some(channel) = self.get_ui_channel() { diff --git a/voxygen/src/audio/sfx/event_mapper/movement/mod.rs b/voxygen/src/audio/sfx/event_mapper/movement/mod.rs index 9c613200f8..dada4b3a4b 100644 --- a/voxygen/src/audio/sfx/event_mapper/movement/mod.rs +++ b/voxygen/src/audio/sfx/event_mapper/movement/mod.rs @@ -207,9 +207,11 @@ impl MovementEventMapper { } else { match underfoot_block_kind { BlockKind::Snow => SfxEvent::Run(BlockKind::Snow), - BlockKind::Rock | BlockKind::WeakRock | BlockKind::Ice => { - SfxEvent::Run(BlockKind::Rock) - }, + BlockKind::Rock + | BlockKind::WeakRock + | BlockKind::GlowingRock + | BlockKind::GlowingWeakRock + | BlockKind::Ice => SfxEvent::Run(BlockKind::Rock), BlockKind::Earth => SfxEvent::Run(BlockKind::Earth), // BlockKind::Sand => SfxEvent::Run(BlockKind::Sand), BlockKind::Air => SfxEvent::Idle, @@ -237,7 +239,11 @@ impl MovementEventMapper { } else if physics_state.on_ground.is_some() && vel.magnitude() > 0.1 { match underfoot_block_kind { BlockKind::Snow => SfxEvent::Run(BlockKind::Snow), - BlockKind::Rock | BlockKind::WeakRock => SfxEvent::Run(BlockKind::Rock), + BlockKind::Rock + | BlockKind::WeakRock + | BlockKind::GlowingRock + | BlockKind::GlowingWeakRock + | BlockKind::Ice => SfxEvent::Run(BlockKind::Rock), // BlockKind::Sand => SfxEvent::Run(BlockKind::Sand), BlockKind::Earth => SfxEvent::Run(BlockKind::Earth), BlockKind::Air => SfxEvent::Idle, @@ -259,7 +265,11 @@ impl MovementEventMapper { } else if physics_state.on_ground.is_some() && vel.magnitude() > 0.1 { match underfoot_block_kind { BlockKind::Snow => SfxEvent::QuadRun(BlockKind::Snow), - BlockKind::Rock | BlockKind::WeakRock => SfxEvent::QuadRun(BlockKind::Rock), + BlockKind::Rock + | BlockKind::WeakRock + | BlockKind::GlowingRock + | BlockKind::GlowingWeakRock + | BlockKind::Ice => SfxEvent::QuadRun(BlockKind::Rock), // BlockKind::Sand => SfxEvent::QuadRun(BlockKind::Sand), BlockKind::Earth => SfxEvent::QuadRun(BlockKind::Earth), BlockKind::Air => SfxEvent::Idle, diff --git a/voxygen/src/audio/sfx/mod.rs b/voxygen/src/audio/sfx/mod.rs index afe6660b92..b1781dcf6a 100644 --- a/voxygen/src/audio/sfx/mod.rs +++ b/voxygen/src/audio/sfx/mod.rs @@ -120,29 +120,6 @@ use vek::*; /// player. const SFX_DIST_LIMIT_SQR: f32 = 20000.0; -pub struct SfxEventItem { - /// The SFX event that triggers this sound - pub sfx: SfxEvent, - /// The position at which the sound should play - pub pos: Option>, - /// The volume to play the sound at - pub vol: Option, -} - -impl SfxEventItem { - pub fn new(sfx: SfxEvent, pos: Option>, vol: Option) -> Self { - Self { sfx, pos, vol } - } - - pub fn at_player_position(sfx: SfxEvent) -> Self { - Self { - sfx, - pos: None, - vol: None, - } - } -} - #[derive(Clone, Debug, PartialEq, Deserialize, Hash, Eq)] pub enum SfxEvent { Campfire, @@ -169,8 +146,6 @@ pub enum SfxEvent { CatchAir, Jump, Fall, - ExperienceGained, - LevelUp, Attack(CharacterAbilityType, ToolKind), Wield(ToolKind), Unwield(ToolKind), diff --git a/voxygen/src/ecs/mod.rs b/voxygen/src/ecs/mod.rs index 8b7b647b38..c312c4ab26 100644 --- a/voxygen/src/ecs/mod.rs +++ b/voxygen/src/ecs/mod.rs @@ -1,8 +1,7 @@ pub mod comp; pub mod sys; -use crate::audio::sfx::SfxEventItem; -use common::{event::EventBus, slowjob::SlowJobPool}; +use common::slowjob::SlowJobPool; use specs::{World, WorldExt}; pub fn init(world: &mut World) { @@ -15,7 +14,4 @@ pub fn init(world: &mut World) { pool.configure("FIGURE_MESHING", |n| n / 2); pool.configure("TERRAIN_MESHING", |n| n / 2); } - - // Voxygen event buses - world.insert(EventBus::::default()); }