Remove debug lines, re-mix some sfx, add crafting sfx, separate inv event sfx into spatial and nonspatial

This commit is contained in:
DaforLynx 2022-03-22 21:42:51 -07:00 committed by IsseW
parent 234ed5afb2
commit 088d1cfe9d
15 changed files with 62 additions and 50 deletions

BIN
assets/voxygen/audio/ambience/leaves.ogg (Stored with Git LFS)

Binary file not shown.

View File

@ -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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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

View File

@ -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),
}
}

View File

@ -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 } => {