mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Voxygen: Stop ambient sounds on logout
This commit is contained in:
parent
1892ec571d
commit
26c2738dc2
@ -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() }
|
||||
|
@ -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) {
|
||||
|
@ -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 => {
|
||||
|
Loading…
Reference in New Issue
Block a user