[vlc-commits] macosx: reimplement audio filter setter for new playlist
Felix Paul Kühne
git at videolan.org
Fri Mar 22 10:48:02 CET 2019
vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Fri Mar 22 10:47:28 2019 +0100| [0cacc33c6d660201ea17b804f64a1622a3730ca0] | committer: Felix Paul Kühne
macosx: reimplement audio filter setter for new playlist
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0cacc33c6d660201ea17b804f64a1622a3730ca0
---
.../panels/VLCAudioEffectsWindowController.m | 24 ++++++++++------------
modules/gui/macosx/playlist/VLCPlayerController.h | 2 ++
modules/gui/macosx/playlist/VLCPlayerController.m | 9 ++++++++
3 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/modules/gui/macosx/panels/VLCAudioEffectsWindowController.m b/modules/gui/macosx/panels/VLCAudioEffectsWindowController.m
index 30db852927..8dd78e2518 100644
--- a/modules/gui/macosx/panels/VLCAudioEffectsWindowController.m
+++ b/modules/gui/macosx/panels/VLCAudioEffectsWindowController.m
@@ -322,11 +322,6 @@
return [names copy];
}
-- (void)setAudioFilter: (char *)psz_name on:(BOOL)b_on
-{
- playlist_EnableAudioFilter(pl_Get(getIntf()), psz_name, b_on);
-}
-
- (void)resetProfileSelector
{
[_profilePopup removeAllItems];
@@ -763,7 +758,7 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
- (IBAction)equalizerEnable:(id)sender
{
[_equalizerView enableSubviews:[sender state]];
- [self setAudioFilter: "equalizer" on:[sender state]];
+ [_playerController enableAudioFilterWithName:@"equalizer" state:[sender state]];
}
- (IBAction)equalizerBandSliderUpdated:(id)sender
@@ -970,7 +965,7 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
- (IBAction)compressorEnable:(id)sender
{
[_compressorView enableSubviews:[sender state]];
- [self setAudioFilter:"compressor" on:[sender state]];
+ [_playerController enableAudioFilterWithName:@"compressor" state:[sender state]];
}
- (IBAction)compressorSliderUpdated:(id)sender
@@ -1050,6 +1045,7 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
- (IBAction)resetSpatializerValues:(id)sender
{
+ // FIXME: this no longer works and a fix depends on a future libvlc improvement
playlist_t *p_playlist = pl_Get(getIntf());
var_SetFloat(p_playlist, "spatializer-roomsize", .85);
var_SetFloat(p_playlist, "spatializer-width", 1.);
@@ -1072,7 +1068,7 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
- (IBAction)spatializerEnable:(id)sender
{
[_spatializerView enableSubviews:[sender state]];
- [self setAudioFilter:"spatializer" on:[sender state]];
+ [_playerController enableAudioFilterWithName:@"spatializer" state:[sender state]];
}
- (IBAction)spatializerSliderUpdated:(id)sender
@@ -1119,6 +1115,7 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
playlist_t *p_playlist = pl_Get(getIntf());
BOOL bEnable_normvol = NO;
char *psz_afilters;
+ // FIXME: this no longer works and a fix depends on a future libvlc improvement
psz_afilters = var_InheritString(p_playlist, "audio-filter");
if (psz_afilters) {
[_filterHeadPhoneCheckbox setState: (NSInteger)strstr(psz_afilters, "headphone") ];
@@ -1143,14 +1140,14 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
- (IBAction)filterEnableHeadPhoneVirt:(id)sender
{
- [self setAudioFilter:"headphone" on:[sender state]];
+ [_playerController enableAudioFilterWithName:@"headphone" state:[sender state]];
}
- (IBAction)filterEnableVolumeNorm:(id)sender
{
[_filterNormLevelSlider setEnabled:[sender state]];
[_filterNormLevelLabel setEnabled:[sender state]];
- [self setAudioFilter:"normvol" on:[sender state]];
+ [_playerController enableAudioFilterWithName:@"normvol" state:[sender state]];
}
- (IBAction)filterVolumeNormSliderUpdated:(id)sender
@@ -1163,22 +1160,23 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
aout_Release(p_aout);
}
+ // FIXME: this no longer works and a fix depends on a future libvlc improvement
var_SetFloat(pl_Get(getIntf()), "norm-max-level", f_value);
}
- (IBAction)filterEnableKaraoke:(id)sender
{
- [self setAudioFilter:"karaoke" on:[sender state]];
+ [_playerController enableAudioFilterWithName:@"karaoke" state:[sender state]];
}
- (IBAction)filterEnableScaleTempo:(id)sender
{
- [self setAudioFilter:"scaletempo" on:[sender state]];
+ [_playerController enableAudioFilterWithName:@"scaletempo" state:[sender state]];
}
- (IBAction)filterEnableStereoEnhancer:(id)sender
{
- [self setAudioFilter:"stereo_widen" on:[sender state]];
+ [_playerController enableAudioFilterWithName:@"stereo_widen" state:[sender state]];
}
@end
diff --git a/modules/gui/macosx/playlist/VLCPlayerController.h b/modules/gui/macosx/playlist/VLCPlayerController.h
index df3507d871..06b5d65a33 100644
--- a/modules/gui/macosx/playlist/VLCPlayerController.h
+++ b/modules/gui/macosx/playlist/VLCPlayerController.h
@@ -593,6 +593,8 @@ extern NSString *VLCPlayerMuteChanged;
*/
@property (readonly, nullable) audio_output_t *mainAudioOutput;
+- (int)enableAudioFilterWithName:(NSString *)name state:(BOOL)state;
+
@end
@interface VLCInputStats : NSObject
diff --git a/modules/gui/macosx/playlist/VLCPlayerController.m b/modules/gui/macosx/playlist/VLCPlayerController.m
index f7c0aaf6b2..8931ffa645 100644
--- a/modules/gui/macosx/playlist/VLCPlayerController.m
+++ b/modules/gui/macosx/playlist/VLCPlayerController.m
@@ -1239,6 +1239,15 @@ static const struct vlc_player_aout_cbs player_aout_callbacks = {
return vlc_player_aout_Hold(_p_player);
}
+- (int)enableAudioFilterWithName:(NSString *)name state:(BOOL)state
+{
+ if (name == nil || name.length == 0) {
+ return VLC_EBADVAR;
+ }
+
+ return vlc_player_aout_EnableFilter(_p_player, [name UTF8String], state);
+}
+
@end
@implementation VLCInputStats
More information about the vlc-commits
mailing list