Commit 87b64a6b authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx/MainWindow: fixed mute toggle and removed some minor code duplication

parent fe17d440
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
- (void)volumeUp; - (void)volumeUp;
- (void)volumeDown; - (void)volumeDown;
- (void)toggleMute;
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender; - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender;
......
...@@ -446,6 +446,15 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -446,6 +446,15 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
aout_VolumeDown( pl_Get( p_intf ), 1, NULL ); aout_VolumeDown( pl_Get( p_intf ), 1, NULL );
} }
- (void)toggleMute
{
intf_thread_t *p_intf = VLCIntf;
if( !p_intf )
return;
aout_MuteToggle( pl_Get( p_intf ) );
}
- (void)setMute:(BOOL)b_value - (void)setMute:(BOOL)b_value
{ {
intf_thread_t *p_intf = VLCIntf; intf_thread_t *p_intf = VLCIntf;
......
...@@ -1204,9 +1204,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1204,9 +1204,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
if (sender == o_volume_sld) if (sender == o_volume_sld)
[[VLCCoreInteraction sharedInstance] setVolume: [sender intValue]]; [[VLCCoreInteraction sharedInstance] setVolume: [sender intValue]];
else if (sender == o_volume_down_btn) else if (sender == o_volume_down_btn)
{ [[VLCCoreInteraction sharedInstance] toggleMute];
[[VLCCoreInteraction sharedInstance] setMute: YES];
}
else else
[[VLCCoreInteraction sharedInstance] setVolume: AOUT_VOLUME_MAX]; [[VLCCoreInteraction sharedInstance] setVolume: AOUT_VOLUME_MAX];
} }
...@@ -1568,8 +1566,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1568,8 +1566,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (void)updateVolumeSlider - (void)updateVolumeSlider
{ {
playlist_t * p_playlist = pl_Get( VLCIntf ); int i_volume = [[VLCCoreInteraction sharedInstance] volume];
int i_volume = lroundf(aout_VolumeGet( p_playlist ) * AOUT_VOLUME_DEFAULT);
BOOL b_muted = [[VLCCoreInteraction sharedInstance] mute]; BOOL b_muted = [[VLCCoreInteraction sharedInstance] mute];
if( !b_muted ) if( !b_muted )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment