From 088d1cfe9decaefc61c519c2579123d2a8eddd73 Mon Sep 17 00:00:00 2001 From: DaforLynx Date: Tue, 22 Mar 2022 21:42:51 -0700 Subject: [PATCH] Remove debug lines, re-mix some sfx, add crafting sfx, separate inv event sfx into spatial and nonspatial --- assets/voxygen/audio/ambience/leaves.ogg | 4 ++-- assets/voxygen/audio/sfx.ron | 20 ++++++++++------ assets/voxygen/audio/sfx/ambient/bees_1.ogg | 4 ++-- .../voxygen/audio/sfx/ambient/birdcall_1.ogg | 4 ++-- .../voxygen/audio/sfx/ambient/birdcall_2.ogg | 4 ++-- .../audio/sfx/ambient/frog_croak_1.ogg | 4 ++-- .../audio/sfx/character/dive_roll_1.ogg | 4 ++-- .../audio/sfx/character/dive_roll_2.ogg | 4 ++-- assets/voxygen/audio/sfx/crafting/hammer.ogg | 4 ++-- .../audio/sfx/footsteps/snow_step_1.ogg | 4 ++-- .../audio/sfx/footsteps/snow_step_2.ogg | 4 ++-- .../audio/sfx/footsteps/snow_step_3.ogg | 4 ++-- voxygen/src/audio/ambient.rs | 24 +++++-------------- voxygen/src/audio/sfx/mod.rs | 2 ++ voxygen/src/session/mod.rs | 22 ++++++++++++++--- 15 files changed, 62 insertions(+), 50 deletions(-) diff --git a/assets/voxygen/audio/ambience/leaves.ogg b/assets/voxygen/audio/ambience/leaves.ogg index 5b2515be42..ee07a5c77a 100644 --- a/assets/voxygen/audio/ambience/leaves.ogg +++ b/assets/voxygen/audio/ambience/leaves.ogg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6e89ea4467addefe98cd3ec9d9e8895a25900804c71212be657a61d4aa57e5f2 -size 453813 +oid sha256:04fc161500a4ea9bdbc280c1f88df95baeb06d77c2ee3beb5feddcec25274ff5 +size 449134 diff --git a/assets/voxygen/audio/sfx.ron b/assets/voxygen/audio/sfx.ron index 8ea7093d23..ecff170504 100644 --- a/assets/voxygen/audio/sfx.ron +++ b/assets/voxygen/audio/sfx.ron @@ -155,7 +155,7 @@ "voxygen.audio.sfx.footsteps.stepgrass_5", "voxygen.audio.sfx.footsteps.stepgrass_6", ], - threshold: 1.6, + threshold: 1.8, ), QuadRun(Grass): ( files: [ @@ -166,7 +166,7 @@ "voxygen.audio.sfx.footsteps.stepgrass_5", "voxygen.audio.sfx.footsteps.stepgrass_6", ], - threshold: 0.8, + threshold: 0.9, ), // For when sand 1) exists and 2) has unique sounds // Run(Sand): ( @@ -195,7 +195,7 @@ "voxygen.audio.sfx.footsteps.snow_step_2", "voxygen.audio.sfx.footsteps.snow_step_3", ], - threshold: 1.6, + threshold: 1.8, ), QuadRun(Snow): ( files: [ @@ -203,7 +203,7 @@ "voxygen.audio.sfx.footsteps.snow_step_2", "voxygen.audio.sfx.footsteps.snow_step_3", ], - threshold: 0.8, + threshold: 0.9, ), Run(Rock): ( files: [ @@ -220,7 +220,7 @@ "voxygen.audio.sfx.footsteps.stone_step_11", "voxygen.audio.sfx.footsteps.stone_step_12", ], - threshold: 1.6, + threshold: 1.8, ), QuadRun(Rock): ( files: [ @@ -237,14 +237,14 @@ "voxygen.audio.sfx.footsteps.stone_step_11", "voxygen.audio.sfx.footsteps.stone_step_12", ], - threshold: 0.8, + threshold: 0.9, ), Roll: ( files: [ "voxygen.audio.sfx.character.dive_roll_1", "voxygen.audio.sfx.character.dive_roll_2", ], - threshold: 0.25, + threshold: 0.3, ), Climb: ( files: [ @@ -620,6 +620,12 @@ ], threshold: 0.3, ), + Inventory(Craft): ( + files: [ + "voxygen.audio.sfx.crafting.hammer", + ], + threshold: 0.05, + ), // // Consumables diff --git a/assets/voxygen/audio/sfx/ambient/bees_1.ogg b/assets/voxygen/audio/sfx/ambient/bees_1.ogg index 57738d6ca8..00511a8725 100644 --- a/assets/voxygen/audio/sfx/ambient/bees_1.ogg +++ b/assets/voxygen/audio/sfx/ambient/bees_1.ogg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1eee9c850c3fba96e607284abac60c52ec7703a31fc42e0f97c367df1a12d168 -size 174456 +oid sha256:51e3b36a0ddded060a009ae2c0e0f282d1bcc3826019573de5d68a10847f2335 +size 137186 diff --git a/assets/voxygen/audio/sfx/ambient/birdcall_1.ogg b/assets/voxygen/audio/sfx/ambient/birdcall_1.ogg index 2d8abedaf2..06ceea2840 100644 --- a/assets/voxygen/audio/sfx/ambient/birdcall_1.ogg +++ b/assets/voxygen/audio/sfx/ambient/birdcall_1.ogg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:673504d4e6e1ccf272782b8159baedabf7fde73d7c006cccaf0beaedc5d314fa -size 84946 +oid sha256:b8e7061dca633f53c30cc91d18b266d46c53504926ad3168ace1c673de444cef +size 66488 diff --git a/assets/voxygen/audio/sfx/ambient/birdcall_2.ogg b/assets/voxygen/audio/sfx/ambient/birdcall_2.ogg index a9a5a7f47b..e1e6cbfb50 100644 --- a/assets/voxygen/audio/sfx/ambient/birdcall_2.ogg +++ b/assets/voxygen/audio/sfx/ambient/birdcall_2.ogg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cedcdff91a632c439467420293b2f22f18399268f7ec08b76f81c34fdddaab29 -size 137561 +oid sha256:9a305641f3eaa45b8fadd4160e6a677bfd9bf0a5950c79e62bbc0d4bb72b4fa6 +size 107298 diff --git a/assets/voxygen/audio/sfx/ambient/frog_croak_1.ogg b/assets/voxygen/audio/sfx/ambient/frog_croak_1.ogg index e6fb9f3650..cdb7fee5d8 100644 --- a/assets/voxygen/audio/sfx/ambient/frog_croak_1.ogg +++ b/assets/voxygen/audio/sfx/ambient/frog_croak_1.ogg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cfc457273f6a969f064ee8a149ea2b1ca5f2cd80c4747bb4a65a2b1b6cb7c439 -size 9212 +oid sha256:1f77f03cfdde09602f6cfe676c7e9a12ae42feff41fc548d4ac7ac880312ca75 +size 7409 diff --git a/assets/voxygen/audio/sfx/character/dive_roll_1.ogg b/assets/voxygen/audio/sfx/character/dive_roll_1.ogg index ccf1cec114..6295dcdb16 100644 --- a/assets/voxygen/audio/sfx/character/dive_roll_1.ogg +++ b/assets/voxygen/audio/sfx/character/dive_roll_1.ogg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3a3f7f26a385ede32dc79744078967caf3449b8623785729c1f186f78d9399d3 -size 16489 +oid sha256:3b0a80cfe9688a00b5690ffc79746fe6b47de1cadf053b8af509ed6e28ba82ee +size 8989 diff --git a/assets/voxygen/audio/sfx/character/dive_roll_2.ogg b/assets/voxygen/audio/sfx/character/dive_roll_2.ogg index 3b05cabb0e..356487fb28 100644 --- a/assets/voxygen/audio/sfx/character/dive_roll_2.ogg +++ b/assets/voxygen/audio/sfx/character/dive_roll_2.ogg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7638f3a2053e3cadc7551bbe105eb1fb9afb934e4d71d551064e5d740c411df2 -size 20611 +oid sha256:b3107b18d513c69bb794bad320b36e02f8dcf80b2f4eec1704de553861a38cce +size 9105 diff --git a/assets/voxygen/audio/sfx/crafting/hammer.ogg b/assets/voxygen/audio/sfx/crafting/hammer.ogg index 231793d411..0000a6454b 100644 --- a/assets/voxygen/audio/sfx/crafting/hammer.ogg +++ b/assets/voxygen/audio/sfx/crafting/hammer.ogg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ad18acbbf98dcb1f6b0dcbb37c5bb97331d1eec6f0ea3e1b68c6aacf3a629afb -size 11280 +oid sha256:4f3936067b4e070911420ff038f6784177c1682c0f0d4da29ddf6b734a3b7a14 +size 8707 diff --git a/assets/voxygen/audio/sfx/footsteps/snow_step_1.ogg b/assets/voxygen/audio/sfx/footsteps/snow_step_1.ogg index 3eb0d491ac..625097be82 100644 --- a/assets/voxygen/audio/sfx/footsteps/snow_step_1.ogg +++ b/assets/voxygen/audio/sfx/footsteps/snow_step_1.ogg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c6aeabd16949b87a43d194d08f6aedd173103ce8535cd930029f280d6b00c841 -size 12849 +oid sha256:7586e83188dbb014be78922eec4c3418d59924516bde0c67a8b3031a6740b320 +size 13332 diff --git a/assets/voxygen/audio/sfx/footsteps/snow_step_2.ogg b/assets/voxygen/audio/sfx/footsteps/snow_step_2.ogg index ab72e4cb88..85474aaaf6 100644 --- a/assets/voxygen/audio/sfx/footsteps/snow_step_2.ogg +++ b/assets/voxygen/audio/sfx/footsteps/snow_step_2.ogg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9810dca5425173b196a794f46ed2f8a0e707c636290ef6cc84ca7686761cd924 -size 12297 +oid sha256:33ef3179c67c9c2f27f9b509fcfe21ad8586d9f0eb4b9a29e3046daf0940448c +size 12950 diff --git a/assets/voxygen/audio/sfx/footsteps/snow_step_3.ogg b/assets/voxygen/audio/sfx/footsteps/snow_step_3.ogg index 9e63e16562..cd7182040e 100644 --- a/assets/voxygen/audio/sfx/footsteps/snow_step_3.ogg +++ b/assets/voxygen/audio/sfx/footsteps/snow_step_3.ogg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:07d11684646b9942e6fceb342a6b26e66b704a9072c2ca127dd2f896ff196fd3 -size 10593 +oid sha256:26e6212bb82f1a7f5795944a55ba71e317c8bd0124bdec99ed11d466612b4da4 +size 11012 diff --git a/voxygen/src/audio/ambient.rs b/voxygen/src/audio/ambient.rs index 6be97876dc..3cdfaa5bfd 100644 --- a/voxygen/src/audio/ambient.rs +++ b/voxygen/src/audio/ambient.rs @@ -57,14 +57,11 @@ impl AmbientMgr { }; // if the conditions warrant creating a channel of that tag if should_create && audio.get_ambient_channel(tag).is_none() { - println!("No audio channel with this tag: {:?}", tag); // iterate through the supposed number of channels - one for each tag for index in 0..AmbientChannelTag::iter().len() { - println!("Iter on channel index {:?}", index); // if index would exceed current number of channels, create a new one with // current tag if index >= audio.ambient_channels.len() { - println!("Creating audio channel with this tag: {:?}", tag); audio.new_ambient_channel(tag); break; } @@ -73,10 +70,6 @@ impl AmbientMgr { // channel with that tag, but a channel with // that tag remains nonetheless, run the code } else if audio.get_ambient_channel(tag).is_some() { - println!( - "Channel for {:?} is actually present, performing volume code", - tag - ); for index in 0..AmbientChannelTag::iter().len() { // update with sfx volume audio.ambient_channels[index].set_volume(sfx_volume); @@ -124,11 +117,6 @@ impl AmbientMgr { // remove channel if not playing if audio.ambient_channels[index].get_multiplier() == 0.0 { - println!( - "Removing channel {:?} with tag {:?}", - index, - audio.ambient_channels[index].get_tag() - ); audio.ambient_channels[index].stop(); audio.ambient_channels.remove(index); }; @@ -189,10 +177,10 @@ impl AmbientMgr { // Tree density factors into wind volume. The more trees, // the lower wind volume. The trees make more of an impact // the closer the camera is to the ground. - let tree_multiplier = 1.0 - - (((1.0 - tree_density) + ((cam_pos.z - terrain_alt).abs() / 150.0).powi(2)).min(1.0)); + let tree_multiplier = + 1.0 - (((1.0 - tree_density) + ((cam_pos.z - terrain_alt + 20.0).abs() / 150.0).powi(2)).min(1.0)); - return tree_multiplier > 0.05; + return tree_multiplier > 0.1; } } @@ -311,10 +299,10 @@ impl AmbientChannel { // Tree density factors into wind volume. The more trees, // the lower wind volume. The trees make more of an impact // the closer the camera is to the ground. - let tree_multiplier = 1.0 - - (((1.0 - tree_density) + ((cam_pos.z - terrain_alt).abs() / 150.0).powi(2)).min(1.0)); + let tree_multiplier = + 1.0 - (((1.0 - tree_density) + ((cam_pos.z - terrain_alt + 20.0).abs() / 150.0).powi(2)).min(1.0)); - if tree_multiplier > 0.05 { + if tree_multiplier > 0.1 { tree_multiplier } else { 0.0 diff --git a/voxygen/src/audio/sfx/mod.rs b/voxygen/src/audio/sfx/mod.rs index d33eb68263..86378f46bf 100644 --- a/voxygen/src/audio/sfx/mod.rs +++ b/voxygen/src/audio/sfx/mod.rs @@ -296,6 +296,7 @@ pub enum SfxInventoryEvent { Dropped, Given, Swapped, + Craft, } // TODO Move to a separate event mapper? @@ -328,6 +329,7 @@ impl From<&InventoryUpdateEvent> for SfxEvent { InventoryUpdateEvent::Dropped => SfxEvent::Inventory(SfxInventoryEvent::Dropped), InventoryUpdateEvent::Given => SfxEvent::Inventory(SfxInventoryEvent::Given), InventoryUpdateEvent::Swapped => SfxEvent::Inventory(SfxInventoryEvent::Swapped), + InventoryUpdateEvent::Craft => SfxEvent::Inventory(SfxInventoryEvent::Craft), _ => SfxEvent::Inventory(SfxInventoryEvent::Swapped), } } diff --git a/voxygen/src/session/mod.rs b/voxygen/src/session/mod.rs index f4087ef206..ec440ca71a 100644 --- a/voxygen/src/session/mod.rs +++ b/voxygen/src/session/mod.rs @@ -245,9 +245,25 @@ impl SessionState { let sfx_triggers = self.scene.sfx_mgr.triggers.read(); let sfx_trigger_item = sfx_triggers.get_key_value(&SfxEvent::from(&inv_event)); - global_state - .audio - .emit_sfx_item(sfx_trigger_item, Some(1.0)); + + match inv_event { + InventoryUpdateEvent::Dropped + | InventoryUpdateEvent::Swapped + | InventoryUpdateEvent::Given + | InventoryUpdateEvent::Collected(_) + | InventoryUpdateEvent::EntityCollectFailed(_) + | InventoryUpdateEvent::BlockCollectFailed(_) + | InventoryUpdateEvent::Craft => { + global_state + .audio + .emit_sfx_item(sfx_trigger_item, Some(1.0)); + + } + _ => global_state + .audio + .emit_sfx(sfx_trigger_item, client.position().unwrap_or_default(), Some(1.0), false) + } + match inv_event { InventoryUpdateEvent::BlockCollectFailed { pos, reason } => {