@@ -703,35 +703,48 @@ pub struct AudioSettings {
703
703
}
704
704
705
705
impl AudioSettings {
706
- fn show_ui ( & mut self , ui : & mut Ui , main : bool ) {
706
+ fn show_ui ( & mut self , ui : & mut Ui , main : bool ) -> bool {
707
+ let mut changed = false ;
707
708
ui. label ( "drop off rate of audio from others" ) ;
708
- ui. add ( Slider :: new ( & mut self . dropoff , 0.0 ..=128.0 ) ) ;
709
- /*ui.label("how much walls effect drop off rate of audio from others");
710
- ui.add(Slider::new(&mut self.walls_strength, 0.0..=128.0));
711
- ui.label("highest durability of wall which sound can pass through");
712
- ui.add(Slider::new(&mut self.max_wall_durability, 0..=14));*/
709
+ changed |= ui
710
+ . add ( Slider :: new ( & mut self . dropoff , 0.0 ..=128.0 ) )
711
+ . changed ( ) ;
713
712
ui. label ( "maximal range of audio" ) ;
714
- ui. add ( Slider :: new ( & mut self . range , 0 ..=4096 ) ) ;
713
+ changed |= ui. add ( Slider :: new ( & mut self . range , 0 ..=4096 ) ) . changed ( ) ;
715
714
ui. label ( "global input volume" ) ;
716
- ui. add ( Slider :: new ( & mut self . global_input_volume , 0.0 ..=8.0 ) ) ;
715
+ changed |= ui
716
+ . add ( Slider :: new ( & mut self . global_input_volume , 0.0 ..=8.0 ) )
717
+ . changed ( ) ;
717
718
ui. label ( "global output volume" ) ;
718
- ui. add ( Slider :: new ( & mut self . global_output_volume , 0.0 ..=8.0 ) ) ;
719
- ui. checkbox ( & mut self . loopback , "loopback audio" ) ;
720
- ui. checkbox ( & mut self . global , "have voice always be played" ) ;
721
- ui. checkbox (
722
- & mut self . push_to_talk ,
723
- "push to talk, keybinds in noita, T by default" ,
724
- ) ;
725
- ui. checkbox (
726
- & mut self . player_position ,
727
- "use player position rather then camera position" ,
728
- ) ;
729
- ui. checkbox ( & mut self . mute_in , "mute input" ) ;
730
- ui. checkbox ( & mut self . mute_in_while_polied , "mute input while polied" ) ;
731
- ui. checkbox ( & mut self . mute_in_while_dead , "mute input while dead" ) ;
732
- ui. checkbox ( & mut self . mute_out , "mute output" ) ;
719
+ changed |= ui
720
+ . add ( Slider :: new ( & mut self . global_output_volume , 0.0 ..=8.0 ) )
721
+ . changed ( ) ;
722
+ changed |= ui. checkbox ( & mut self . loopback , "loopback audio" ) . changed ( ) ;
723
+ changed |= ui
724
+ . checkbox ( & mut self . global , "have voice always be played" )
725
+ . changed ( ) ;
726
+ changed |= ui
727
+ . checkbox (
728
+ & mut self . push_to_talk ,
729
+ "push to talk, keybinds in noita, T by default" ,
730
+ )
731
+ . changed ( ) ;
732
+ changed |= ui
733
+ . checkbox (
734
+ & mut self . player_position ,
735
+ "use player position rather than camera position" ,
736
+ )
737
+ . changed ( ) ;
738
+ changed |= ui. checkbox ( & mut self . mute_in , "mute input" ) . changed ( ) ;
739
+ changed |= ui
740
+ . checkbox ( & mut self . mute_in_while_polied , "mute input while polied" )
741
+ . changed ( ) ;
742
+ changed |= ui
743
+ . checkbox ( & mut self . mute_in_while_dead , "mute input while dead" )
744
+ . changed ( ) ;
745
+ changed |= ui. checkbox ( & mut self . mute_out , "mute output" ) . changed ( ) ;
733
746
if main {
734
- ui. checkbox ( & mut self . disabled , "disabled" ) ;
747
+ changed |= ui. checkbox ( & mut self . disabled , "disabled" ) . changed ( ) ;
735
748
if self . input_devices . is_empty ( ) {
736
749
#[ cfg( target_os = "linux" ) ]
737
750
let host = cpal:: available_hosts ( )
@@ -769,6 +782,7 @@ impl AudioSettings {
769
782
. clicked ( )
770
783
{
771
784
self . input_device = Some ( device. clone ( ) ) ;
785
+ changed = true ;
772
786
}
773
787
}
774
788
} ) ;
@@ -785,13 +799,16 @@ impl AudioSettings {
785
799
. clicked ( )
786
800
{
787
801
self . output_device = Some ( device. clone ( ) ) ;
802
+ changed = true ;
788
803
}
789
804
}
790
805
} ) ;
791
806
}
792
807
if ui. button ( "default" ) . clicked ( ) {
793
808
* self = Default :: default ( ) ;
809
+ changed = true ;
794
810
}
811
+ changed
795
812
}
796
813
}
797
814
@@ -1259,7 +1276,7 @@ impl App {
1259
1276
self . show_audio_settings = !self . show_audio_settings
1260
1277
}
1261
1278
if self . show_audio_settings {
1262
- self . audio . show_ui ( ui, true )
1279
+ self . audio . show_ui ( ui, true ) ;
1263
1280
}
1264
1281
if self . running_on_steamdeck && ui. button ( "Close Proxy" ) . clicked ( ) {
1265
1282
exit ( 0 )
@@ -1748,7 +1765,7 @@ impl App {
1748
1765
}
1749
1766
} ,
1750
1767
ConnectedMenu :: VoIP => {
1751
- self . audio . show_ui ( ui, false ) ;
1768
+ let mut save = self . audio . show_ui ( ui, false ) ;
1752
1769
for peer in netman. peer . iter_peer_ids ( ) {
1753
1770
if netman. peer . my_id ( ) != peer {
1754
1771
ui. label ( format ! (
@@ -1760,13 +1777,18 @@ impl App {
1760
1777
. get( & peer)
1761
1778
. unwrap_or( & peer. to_string( ) )
1762
1779
) ) ;
1763
- ui. add ( Slider :: new (
1764
- self . audio . volume . entry ( peer) . or_insert ( 1.0 ) ,
1765
- 0.0 ..=8.0 ,
1766
- ) ) ;
1780
+ if ui
1781
+ . add ( Slider :: new (
1782
+ self . audio . volume . entry ( peer) . or_insert ( 1.0 ) ,
1783
+ 0.0 ..=8.0 ,
1784
+ ) )
1785
+ . changed ( )
1786
+ {
1787
+ save = true ;
1788
+ }
1767
1789
}
1768
1790
}
1769
- if ui . button ( " save" ) . clicked ( ) {
1791
+ if save {
1770
1792
* netman. audio . lock ( ) . unwrap ( ) = self . audio . clone ( )
1771
1793
}
1772
1794
}
0 commit comments