diff --git a/assets/voxygen/audio/sfx.ron b/assets/voxygen/audio/sfx.ron index 374d65584e..bbd864282e 100644 --- a/assets/voxygen/audio/sfx.ron +++ b/assets/voxygen/audio/sfx.ron @@ -19,7 +19,6 @@ files: [ "voxygen.audio.sfx.ambient.birdcall_1", "voxygen.audio.sfx.ambient.birdcall_2", - "voxygen.audio.sfx.ambient.birdcall_3", ], threshold: 10.0, ), diff --git a/assets/voxygen/audio/sfx/ambient/birdcall_3.wav b/assets/voxygen/audio/sfx/ambient/birdcall_3.wav deleted file mode 100644 index 615d6ba075..0000000000 --- a/assets/voxygen/audio/sfx/ambient/birdcall_3.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f5494c1f8e30c0b3fd686ae2c93ece3c145a83bff221801bc3de3eb37ac2d034 -size 1162164 diff --git a/assets/voxygen/audio/soundtrack.ron b/assets/voxygen/audio/soundtrack.ron index e3e8349e2c..90dc6d5232 100644 --- a/assets/voxygen/audio/soundtrack.ron +++ b/assets/voxygen/audio/soundtrack.ron @@ -8,18 +8,10 @@ path: "voxygen.audio.soundtrack.a_solemn_quest", length: 206.0, timing: Some(Day), - biomes: ( - void: 1, - lake: 1, - grassland: 1, - ocean: 1, - mountain: 1, - snowland: 1, - desert: 1, - swamp: 1, - jungle: 1, - forest: 0, - ), + biomes: [ + (Lake, 1), + (Grassland, 1), + ], site: None, artist: "Eden", ), @@ -28,30 +20,22 @@ path: "voxygen.audio.soundtrack.into_the_dark_forest", length: 184.0, timing: Some(Day), - biomes: ( - void: 1, - lake: 1, - grassland: 1, - ocean: 1, - mountain: 1, - snowland: 1, - desert: 1, - swamp: 1, - jungle: 1, - forest: 0, - ), + biomes: [ + (Forest, 1), + (Jungle, 1), + ], + site: None, + artist: "Aeronic", + ), + ( + title: "Field Grazing", + path: "voxygen.audio.soundtrack.field_grazing", + length: 154.0, + timing: Some(Day), + biomes: [], site: None, artist: "Aeronic", ), - //( - // title: "Field Grazing", - // path: "voxygen.audio.soundtrack.field_grazing", - // length: 154.0, - // timing: Some(Day), - // biome: Some(Snowland), - // site: None, - // artist: "Aeronic", - //), //( // title: "Wandering Voices", // path: "voxygen.audio.soundtrack.wandering_voices", @@ -124,54 +108,32 @@ // site: None, // artist: "badbbad", //), - //( - // title: "Limits", - // path: "voxygen.audio.soundtrack.limits", - // length: 203.0, - // timing: Some(Night), - // biome: Some(Desert), - // site: None, - // artist: "badbbad", - //), + ( + title: "Limits", + path: "voxygen.audio.soundtrack.limits", + length: 203.0, + timing: Some(Night), + biomes: [], + site: Some(Dungeon), + artist: "badbbad", + ), ( // Dungeon title: "Down The Rabbit Hole", path: "voxygen.audio.soundtrack.down_the_rabbit_hole", length: 244.0, timing: None, - biomes: ( - void: 1, - lake: 1, - grassland: 1, - ocean: 1, - mountain: 1, - snowland: 1, - desert: 1, - swamp: 1, - jungle: 1, - forest: 1, - ), + biomes: [], site: Some(Cave), artist: "badbbad", ), - ( - title: "Between The Fairies", - path: "voxygen.audio.soundtrack.between_the_fairies", - length: 175.0, - timing: None, - biomes: ( - void: 1, - lake: 1, - grassland: 1, - ocean: 1, - mountain: 1, - snowland: 1, - desert: 1, - swamp: 1, - jungle: 1, - forest: 1, - ), - site: Some(Dungeon), - artist: "badbbad", - ), + //( + // title: "Between The Fairies", + // path: "voxygen.audio.soundtrack.between_the_fairies", + // length: 175.0, + // timing: None, + // biomes: [], + // site: Some(Cave), + // artist: "badbbad", + //), ] ) diff --git a/voxygen/src/audio/music.rs b/voxygen/src/audio/music.rs index d8c0a2cdd4..2434904bf3 100644 --- a/voxygen/src/audio/music.rs +++ b/voxygen/src/audio/music.rs @@ -67,24 +67,10 @@ pub struct SoundtrackItem { length: f64, /// Whether this track should play during day or night timing: Option, - biomes: BiomeProbability, + biomes: Vec<(BiomeKind, u8)>, site: Option, } -#[derive(Debug, Deserialize)] -pub struct BiomeProbability { - void: u8, - lake: u8, - grassland: u8, - ocean: u8, - mountain: u8, - snowland: u8, - desert: u8, - swamp: u8, - jungle: u8, - forest: u8, -} - /// Allows control over when a track should play based on in-game time of day #[derive(Debug, Deserialize, PartialEq)] enum DayPeriod { @@ -107,13 +93,13 @@ enum PlayState { pub struct MusicMgr { soundtrack: SoundtrackCollection, began_playing: Instant, - began_fading: Instant, + //began_fading: Instant, next_track_change: f64, /// The title of the last track played. Used to prevent a track /// being played twice in a row last_track: String, - last_biome: BiomeKind, - playing: PlayState, + /*last_biome: BiomeKind, + *playing: PlayState, */ } impl MusicMgr { @@ -122,11 +108,11 @@ impl MusicMgr { Self { soundtrack: Self::load_soundtrack_items(), began_playing: Instant::now(), - began_fading: Instant::now(), + //began_fading: Instant::now(), next_track_change: 0.0, last_track: String::from("None"), - last_biome: BiomeKind::Void, - playing: PlayState::Stopped, + /*last_biome: BiomeKind::Void, + *playing: PlayState::Stopped, */ } } @@ -139,18 +125,19 @@ impl MusicMgr { // _ => self.last_biome, //}; - if let Some(current_chunk) = client.current_chunk() { - println!("biome: {:?}", current_chunk.meta().biome()); - println!("chaos: {}", current_chunk.meta().chaos()); - println!("alt: {}", current_chunk.meta().alt()); - println!("temp: {}", current_chunk.meta().temp()); - println!("tree_density: {}", current_chunk.meta().tree_density()); - println!("humidity: {}", current_chunk.meta().humidity()); - println!("cave_alt: {}", current_chunk.meta().cave_alt()); - if let Some(position) = client.current_position() { - println!("player_alt: {}", position[2]); - } - } + //if let Some(current_chunk) = client.current_chunk() { + // println!("biome: {:?}", current_chunk.meta().biome()); + // println!("chaos: {}", current_chunk.meta().chaos()); + // println!("alt: {}", current_chunk.meta().alt()); + // println!("temp: {}", current_chunk.meta().temp()); + // println!("tree_density: {}", + // current_chunk.meta().tree_density()); + // println!("humidity: {}", current_chunk.meta().humidity()); + // println!("cave_alt: {}", current_chunk.meta().cave_alt()); + // if let Some(position) = client.current_position() { + // println!("player_alt: {}", position[2]); + // } + //} if audio.music_enabled() && !self.soundtrack.tracks.is_empty() @@ -198,35 +185,33 @@ impl MusicMgr { Some(site) => site == ¤t_site, None => true, }) - .filter(|track| match current_biome { - BiomeKind::Void => false, - BiomeKind::Lake => track.biomes.lake > 0, - BiomeKind::Grassland => track.biomes.grassland > 0, - BiomeKind::Ocean => track.biomes.ocean > 0, - BiomeKind::Mountain => track.biomes.mountain > 0, - BiomeKind::Snowland => track.biomes.snowland > 0, - BiomeKind::Desert => track.biomes.desert > 0, - BiomeKind::Swamp => track.biomes.swamp > 0, - BiomeKind::Jungle => track.biomes.jungle > 0, - BiomeKind::Forest => track.biomes.forest > 0, + .filter(|track| { + let mut result = false; + if track.biomes.len() > 0 { + for biome in track.biomes.iter() { + if biome.0 == current_biome { + result = true; + } + } + } else { + result = true; + } + result }) .collect::>(); - //let new_maybe_track = maybe_track - // .choose_weighted(&mut rng, |track| - // track.biomes.unwrap().entry(current_biome)); - - let new_maybe_track = maybe_track.choose_weighted(&mut rng, |track| match current_biome { - BiomeKind::Void => track.biomes.void, - BiomeKind::Lake => track.biomes.lake, - BiomeKind::Grassland => track.biomes.grassland, - BiomeKind::Ocean => track.biomes.ocean, - BiomeKind::Mountain => track.biomes.mountain, - BiomeKind::Snowland => track.biomes.snowland, - BiomeKind::Desert => track.biomes.desert, - BiomeKind::Swamp => track.biomes.swamp, - BiomeKind::Jungle => track.biomes.jungle, - BiomeKind::Forest => track.biomes.forest, + let new_maybe_track = maybe_track.choose_weighted(&mut rng, |track| { + let mut chance = 0; + if track.biomes.len() > 0 { + for biome in track.biomes.iter() { + if biome.0 == current_biome { + chance = biome.1; + } + } + } else { + chance = 1; + } + chance }); if let Ok(track) = new_maybe_track { @@ -264,9 +249,9 @@ impl MusicMgr { alt = chunk.meta().alt(); cave_alt = chunk.meta().cave_alt(); } - if player_alt < cave_alt && cave_alt != 0.0 { + if player_alt < (alt - 20.0) && cave_alt != 0.0 { SitesKind::Cave - } else if player_alt < (alt - 30.0) { + } else if player_alt < (alt - 20.0) { SitesKind::Dungeon } else { SitesKind::None diff --git a/voxygen/src/audio/sfx/event_mapper/block/mod.rs b/voxygen/src/audio/sfx/event_mapper/block/mod.rs index f10360799a..f0004df1b8 100644 --- a/voxygen/src/audio/sfx/event_mapper/block/mod.rs +++ b/voxygen/src/audio/sfx/event_mapper/block/mod.rs @@ -86,15 +86,15 @@ impl EventMapper for BlockEventMapper { volume: 1.0, cond: |st| st.get_day_period().is_dark(), }, - BlockSounds { - blocks: |boi| &boi.embers, - range: 1, - sfx: SfxEvent::Embers, - volume: 0.15, - //volume: 0.05, - cond: |_| true, - //cond: |st| st.get_day_period().is_dark(), - }, + //BlockSounds { + // blocks: |boi| &boi.embers, + // range: 1, + // sfx: SfxEvent::Embers, + // volume: 0.15, + // //volume: 0.05, + // cond: |_| true, + // //cond: |st| st.get_day_period().is_dark(), + //}, BlockSounds { blocks: |boi| &boi.reeds, range: 1, @@ -131,7 +131,7 @@ impl EventMapper for BlockEventMapper { for sounds in sounds.iter() { if !(sounds.cond)(state) { continue; - } else if sounds.sfx == SfxEvent::Birdcall && thread_rng().gen_bool(0.99) { + } else if sounds.sfx == SfxEvent::Birdcall && thread_rng().gen_bool(0.995) { continue; }