Voxygen: Stop ambient sounds on logout

This commit is contained in:
João Capucho 2021-04-18 21:35:43 +01:00
parent 1892ec571d
commit 26c2738dc2
No known key found for this signature in database
GPG Key ID: 1AD5CE7CCAEBDA21
3 changed files with 9 additions and 0 deletions

View File

@ -193,6 +193,8 @@ impl AmbientChannel {
self.sink.append(source);
}
pub fn stop(&mut self) { self.sink.stop(); }
pub fn set_volume(&mut self, volume: f32) { self.sink.set_volume(volume); }
pub fn get_volume(&mut self) -> f32 { self.sink.volume() }

View File

@ -422,6 +422,12 @@ impl AudioFrontend {
}
}
pub fn stop_ambient_sounds(&mut self) {
for channel in self.ambient_channels.iter_mut() {
channel.stop()
}
}
// The following is for the disabled device switcher
//// TODO: figure out how badly this will break things when it is called
//pub fn set_device(&mut self, name: String) {

View File

@ -920,6 +920,7 @@ impl PlayState for SessionState {
},
HudEvent::Logout => {
self.client.borrow_mut().logout();
global_state.audio.stop_ambient_sounds();
return PlayStateResult::Pop;
},
HudEvent::Quit => {