River sounds and more

This commit is contained in:
DaforLynx 2022-01-03 22:40:31 +00:00 committed by Samuel Keiffer
parent 58b41bb2bb
commit 13e87375d6
44 changed files with 200 additions and 36 deletions

View File

@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- New outfit for merchants
- Nightly linux Aarch64 builds are now produced (distribution via airshipper will follow soon)
- Worldgen wildlife density modifier in features.ron
- Rivers now make ambient sounds (again)
### Changed

BIN
assets/voxygen/audio/ambient/wind.ogg (Stored with Git LFS)

Binary file not shown.

View File

@ -55,7 +55,33 @@
),
RunningWater: (
files: [
"voxygen.audio.sfx.ambient.running_water_1",
"voxygen.audio.sfx.ambient.river_sounds.running_water-001",
"voxygen.audio.sfx.ambient.river_sounds.running_water-002",
"voxygen.audio.sfx.ambient.river_sounds.running_water-003",
"voxygen.audio.sfx.ambient.river_sounds.running_water-004",
"voxygen.audio.sfx.ambient.river_sounds.running_water-005",
"voxygen.audio.sfx.ambient.river_sounds.running_water-006",
"voxygen.audio.sfx.ambient.river_sounds.running_water-007",
"voxygen.audio.sfx.ambient.river_sounds.running_water-008",
"voxygen.audio.sfx.ambient.river_sounds.running_water-009",
"voxygen.audio.sfx.ambient.river_sounds.running_water-010",
"voxygen.audio.sfx.ambient.river_sounds.running_water-011",
"voxygen.audio.sfx.ambient.river_sounds.running_water-012",
"voxygen.audio.sfx.ambient.river_sounds.running_water-013",
"voxygen.audio.sfx.ambient.river_sounds.running_water-014",
"voxygen.audio.sfx.ambient.river_sounds.running_water-015",
"voxygen.audio.sfx.ambient.river_sounds.running_water-016",
"voxygen.audio.sfx.ambient.river_sounds.running_water-017",
"voxygen.audio.sfx.ambient.river_sounds.running_water-018",
"voxygen.audio.sfx.ambient.river_sounds.running_water-019",
"voxygen.audio.sfx.ambient.river_sounds.running_water-020",
"voxygen.audio.sfx.ambient.river_sounds.running_water-021",
"voxygen.audio.sfx.ambient.river_sounds.running_water-022",
"voxygen.audio.sfx.ambient.river_sounds.running_water-023",
"voxygen.audio.sfx.ambient.river_sounds.running_water-024",
"voxygen.audio.sfx.ambient.river_sounds.running_water-025",
"voxygen.audio.sfx.ambient.river_sounds.running_water-026",
"voxygen.audio.sfx.ambient.river_sounds.running_water-027",
],
threshold: 7.0,
),
@ -69,7 +95,7 @@
"voxygen.audio.sfx.footsteps.water_splash_3",
"voxygen.audio.sfx.footsteps.water_splash_4",
],
threshold: 0.25,
threshold: 0.5,
),
Run(Earth): (
files: [
@ -113,6 +139,27 @@
],
threshold: 0.8,
),
// For when sand 1) exists and 2) has unique sounds
// Run(Sand): (
// files: [
// "voxygen.audio.sfx.footsteps.stepdirt_1",
// "voxygen.audio.sfx.footsteps.stepdirt_2",
// "voxygen.audio.sfx.footsteps.stepdirt_3",
// "voxygen.audio.sfx.footsteps.stepdirt_4",
// "voxygen.audio.sfx.footsteps.stepdirt_5",
// ],
// threshold: 1.6,
// ),
// QuadRun(Sand): (
// files: [
// "voxygen.audio.sfx.footsteps.stepdirt_1",
// "voxygen.audio.sfx.footsteps.stepdirt_2",
// "voxygen.audio.sfx.footsteps.stepdirt_3",
// "voxygen.audio.sfx.footsteps.stepdirt_4",
// "voxygen.audio.sfx.footsteps.stepdirt_5",
// ],
// threshold: 0.8,
// ),
Run(Snow): (
files: [
"voxygen.audio.sfx.footsteps.snow_step_1",

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.

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.

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.

Binary file not shown.

View File

@ -9,6 +9,26 @@
(
tracks: [
Individual((
title: "The Quiet After the Battle",
path: "voxygen.audio.soundtrack.town.the_quiet_after_the_battle",
length: 240.0,
timing: Some(Night),
biomes: [],
site: Some(Settlement),
music_state: Activity(Explore),
artist: "Tobias Thy - (Thy SFX)",
)),
Individual((
title: "A Rest Under the Sunset",
path: "voxygen.audio.soundtrack.town.a_rest_under_the_sunset",
length: 83.0,
timing: Some(Day),
biomes: [],
site: Some(Settlement),
music_state: Activity(Explore),
artist: "phoenix13032005",
)),
Individual((
title: "Raising Below Like Thunder",
path: "voxygen.audio.soundtrack.town.raising_below_like_thunder",
@ -101,7 +121,7 @@
biomes: [
(Desert, 1)
],
site: Some(Void),
site: Some(Settlement),
music_state: Activity(Explore),
artist: "Aeronic; mixed by Robotnik",
)),

Binary file not shown.

Binary file not shown.

View File

@ -6,7 +6,7 @@
//!
//! When constructing a new [`AudioFrontend`](../struct.AudioFrontend.html), two
//! music channels are created internally (to achieve crossover fades) while the
//! number of sfx channels are determined by the `max_sfx_channels` value
//! number of sfx channels are determined by the `num_sfx_channels` value
//! defined in the client
//! [`AudioSettings`](../../settings/struct.AudioSettings.html)
//!

View File

@ -53,7 +53,7 @@ pub struct AudioFrontend {
impl AudioFrontend {
/// Construct with given device
pub fn new(/* dev: String, */ max_sfx_channels: usize) -> Self {
pub fn new(/* dev: String, */ num_sfx_channels: usize) -> Self {
// Commented out until audio device switcher works
//let audio_device = get_device_raw(&dev);
@ -76,9 +76,9 @@ impl AudioFrontend {
},
};
let mut sfx_channels = Vec::with_capacity(max_sfx_channels);
let mut sfx_channels = Vec::with_capacity(num_sfx_channels);
if let Some(audio_stream) = &audio_stream {
sfx_channels.resize_with(max_sfx_channels, || SfxChannel::new(audio_stream));
sfx_channels.resize_with(num_sfx_channels, || SfxChannel::new(audio_stream));
};
Self {

View File

@ -16,7 +16,7 @@ use common::{
};
use common_state::State;
use hashbrown::HashMap;
use rand::{thread_rng, Rng};
use rand::{seq::SliceRandom, thread_rng, Rng};
use std::time::{Duration, Instant};
use vek::*;
@ -97,13 +97,13 @@ impl EventMapper for BlockEventMapper {
volume: 1.0,
cond: |st| st.get_day_period().is_dark(),
},
// BlockSounds {
// blocks: |boi| &boi.river,
// range: 1,
// sfx: SfxEvent::RunningWater,
// volume: 1.0,
// cond: |_| true,
// },
BlockSounds {
blocks: |boi| &boi.river,
range: 1,
sfx: SfxEvent::RunningWater,
volume: 1.5,
cond: |_| true,
},
//BlockSounds {
// blocks: |boi| &boi.embers,
// range: 1,
@ -187,14 +187,25 @@ impl EventMapper for BlockEventMapper {
let absolute_pos: Vec3<i32> =
Vec3::from(chunk_pos * TerrainChunk::RECT_SIZE.map(|e| e as i32));
// Replace all RunningWater blocks with just one random one per tick
let blocks = if sounds.sfx == SfxEvent::RunningWater {
blocks
.choose(&mut thread_rng())
.map(std::slice::from_ref)
.unwrap_or(&[])
} else {
blocks
};
// Iterate through each individual block
for block in blocks {
// TODO Address this hack properly, potentially by making a new
// block of interest type which picks fewer leaf blocks
// Hack to reduce the number of bird sounds (too many leaf blocks)
// Hack to reduce the number of bird, frog, and water sounds
if ((sounds.sfx == SfxEvent::Birdcall || sounds.sfx == SfxEvent::Owl)
&& thread_rng().gen_bool(0.999))
|| (sounds.sfx == SfxEvent::Frog && thread_rng().gen_bool(0.75))
|| (sounds.sfx == SfxEvent::RunningWater && thread_rng().gen_bool(0.5))
{
continue;
}

View File

@ -192,7 +192,7 @@ impl MovementEventMapper {
underfoot_block_kind: BlockKind,
) -> SfxEvent {
// Match run / roll / swim state
if physics_state.in_liquid().is_some() && vel.magnitude() > 0.1
if physics_state.in_liquid().is_some() && vel.magnitude() > 2.0
|| !previous_state.in_water && physics_state.in_liquid().is_some()
{
return SfxEvent::Swim;
@ -209,6 +209,7 @@ impl MovementEventMapper {
BlockKind::Rock | BlockKind::WeakRock | BlockKind::Ice => {
SfxEvent::Run(BlockKind::Rock)
},
BlockKind::Earth => SfxEvent::Run(BlockKind::Earth),
BlockKind::Sand => SfxEvent::Run(BlockKind::Sand),
BlockKind::Air => SfxEvent::Idle,
_ => SfxEvent::Run(BlockKind::Grass),
@ -237,13 +238,14 @@ impl MovementEventMapper {
vel: Vec3<f32>,
underfoot_block_kind: BlockKind,
) -> SfxEvent {
if physics_state.in_liquid().is_some() && vel.magnitude() > 0.1 {
if physics_state.in_liquid().is_some() && vel.magnitude() > 2.0 {
SfxEvent::Swim
} 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::Sand => SfxEvent::Run(BlockKind::Sand),
BlockKind::Earth => SfxEvent::Run(BlockKind::Earth),
BlockKind::Air => SfxEvent::Idle,
_ => SfxEvent::Run(BlockKind::Grass),
}
@ -258,13 +260,14 @@ impl MovementEventMapper {
vel: Vec3<f32>,
underfoot_block_kind: BlockKind,
) -> SfxEvent {
if physics_state.in_liquid().is_some() && vel.magnitude() > 0.1 {
if physics_state.in_liquid().is_some() && vel.magnitude() > 2.0 {
SfxEvent::Swim
} 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::Sand => SfxEvent::QuadRun(BlockKind::Sand),
BlockKind::Earth => SfxEvent::QuadRun(BlockKind::Earth),
BlockKind::Air => SfxEvent::Idle,
_ => SfxEvent::QuadRun(BlockKind::Grass),
}

View File

@ -211,7 +211,7 @@ fn main() {
// Setup audio
let mut audio = match settings.audio.output {
AudioOutput::Off => AudioFrontend::no_audio(),
AudioOutput::Automatic => AudioFrontend::new(settings.audio.max_sfx_channels),
AudioOutput::Automatic => AudioFrontend::new(settings.audio.num_sfx_channels),
// AudioOutput::Device(ref dev) => Some(dev.clone()),
};

View File

@ -75,9 +75,7 @@ impl BlocksOfInterest {
_ => {},
}
},
BlockKind::Water if chunk.meta().contains_river() && rng.gen_range(0..16) == 0 => {
river.push(pos)
},
BlockKind::Water if chunk.meta().contains_river() => river.push(pos),
BlockKind::Snow if rng.gen_range(0..16) == 0 => snow.push(pos),
BlockKind::Lava if rng.gen_range(0..5) == 0 => fires.push(pos + Vec3::unit_z()),
BlockKind::Snow | BlockKind::Ice if rng.gen_range(0..16) == 0 => snow.push(pos),

View File

@ -25,7 +25,7 @@ pub struct AudioSettings {
pub inactive_master_volume_perc: f32,
pub music_volume: f32,
pub sfx_volume: f32,
pub max_sfx_channels: usize,
pub num_sfx_channels: usize,
/// Audio Device that Voxygen will use to play audio.
pub output: AudioOutput,
@ -38,7 +38,7 @@ impl Default for AudioSettings {
inactive_master_volume_perc: 0.5,
music_volume: 0.4,
sfx_volume: 0.6,
max_sfx_channels: 30,
num_sfx_channels: 60,
output: AudioOutput::Automatic,
}
}