mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'DaforLynx/ambience-loop-fix' into 'master'
Fixing ambience looping issues See merge request veloren/veloren!3463
This commit is contained in:
commit
7bd4686187
@ -2,22 +2,22 @@
|
|||||||
tracks: [
|
tracks: [
|
||||||
(
|
(
|
||||||
path: "voxygen.audio.ambience.wind",
|
path: "voxygen.audio.ambience.wind",
|
||||||
length: 14.203,
|
length: 14.17,
|
||||||
tag: Wind,
|
tag: Wind,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
path: "voxygen.audio.ambience.rain",
|
path: "voxygen.audio.ambience.rain",
|
||||||
length: 17.0,
|
length: 16.97,
|
||||||
tag: Rain,
|
tag: Rain,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
path:"voxygen.audio.ambience.thunder",
|
path:"voxygen.audio.ambience.thunder",
|
||||||
length: 32.0,
|
length: 31.97,
|
||||||
tag: Thunder,
|
tag: Thunder,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
path:"voxygen.audio.ambience.leaves",
|
path:"voxygen.audio.ambience.leaves",
|
||||||
length: 26.0,
|
length: 25.97,
|
||||||
tag: Leaves,
|
tag: Leaves,
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
@ -641,8 +641,8 @@
|
|||||||
biomes: [],
|
biomes: [],
|
||||||
site: Some(Dungeon),
|
site: Some(Dungeon),
|
||||||
segments: [
|
segments: [
|
||||||
("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-start", 56.0, Transition(Explore, Combat(High)), Some(Combat(High))),
|
("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-start", 55.97, Transition(Explore, Combat(High)), Some(Combat(High))),
|
||||||
("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-loop", 54.0, Activity(Combat(High)), None),
|
("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-loop", 53.97, Activity(Combat(High)), None),
|
||||||
("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-end", 6.0, Transition(Combat(High), Explore), None),
|
("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-end", 6.0, Transition(Combat(High), Explore), None),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -653,8 +653,8 @@
|
|||||||
biomes: [],
|
biomes: [],
|
||||||
site: Some(Dungeon),
|
site: Some(Dungeon),
|
||||||
segments: [
|
segments: [
|
||||||
("voxygen.audio.soundtrack.combat.reversal.reversal-start", 60.0, Transition(Explore, Combat(High)), Some(Combat(High))),
|
("voxygen.audio.soundtrack.combat.reversal.reversal-start", 59.97, Transition(Explore, Combat(High)), Some(Combat(High))),
|
||||||
("voxygen.audio.soundtrack.combat.reversal.reversal-loop", 60.0, Activity(Combat(High)), None),
|
("voxygen.audio.soundtrack.combat.reversal.reversal-loop", 59.97, Activity(Combat(High)), None),
|
||||||
("voxygen.audio.soundtrack.combat.reversal.reversal-end", 4.0, Transition(Combat(High), Explore), None),
|
("voxygen.audio.soundtrack.combat.reversal.reversal-end", 4.0, Transition(Combat(High), Explore), None),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -79,20 +79,17 @@ impl AmbientMgr {
|
|||||||
// Update with sfx volume
|
// Update with sfx volume
|
||||||
channel.set_volume(ambience_volume);
|
channel.set_volume(ambience_volume);
|
||||||
|
|
||||||
// Set the duration of the loop to whatever the current value is (0.0 by
|
|
||||||
// default)
|
|
||||||
|
|
||||||
// If the sound should loop at this point:
|
// If the sound should loop at this point:
|
||||||
if channel.began_playing.elapsed().as_secs_f32() > channel.next_track_change {
|
if channel.began_playing.elapsed().as_secs_f32() > channel.next_track_change {
|
||||||
let track = ambience.tracks.iter().find(|track| track.tag == tag);
|
let track = ambience.tracks.iter().find(|track| track.tag == tag);
|
||||||
// Set the channel's start point at this instant
|
// Set the channel's start point to this instant
|
||||||
channel.began_playing = Instant::now();
|
channel.began_playing = Instant::now();
|
||||||
if let Some(track) = track {
|
if let Some(track) = track {
|
||||||
// Set loop duration to the one specified in the ron
|
// Set loop duration to the one specified in the ron
|
||||||
channel.next_track_change = track.length;
|
channel.next_track_change = track.length;
|
||||||
// Play the file of the current tag at the current multiplier;
|
// Play the file of the current tag at the current multiplier;
|
||||||
let current_multiplier = channel.multiplier;
|
let current_multiplier = channel.multiplier;
|
||||||
audio.play_ambient(tag, &track.path, current_multiplier);
|
audio.play_ambient(tag, &track.path, current_multiplier * ambience_volume);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -308,15 +308,10 @@ impl AudioFrontend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Plays a file at a given volume in the channel with a given tag
|
/// Plays a file at a given volume in the channel with a given tag
|
||||||
fn play_ambient(
|
fn play_ambient(&mut self, channel_tag: AmbientChannelTag, sound: &str, volume: f32) {
|
||||||
&mut self,
|
|
||||||
channel_tag: AmbientChannelTag,
|
|
||||||
sound: &str,
|
|
||||||
volume_multiplier: f32,
|
|
||||||
) {
|
|
||||||
if self.audio_stream.is_some() {
|
if self.audio_stream.is_some() {
|
||||||
if let Some(channel) = self.get_ambient_channel(channel_tag) {
|
if let Some(channel) = self.get_ambient_channel(channel_tag) {
|
||||||
channel.set_volume(volume_multiplier);
|
channel.set_volume(volume);
|
||||||
channel.play(load_ogg(sound));
|
channel.play(load_ogg(sound));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user