Commit d53743bf authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx/audio effects: remove object instance from xib file and further reduce the exposed class API

parent 5ef7a61e
/*****************************************************************************
* AudioEffects.h: MacOS X interface module
*****************************************************************************
* Copyright (C) 2004-2012 VLC authors and VideoLAN
* Copyright (C) 2004-2015 VLC authors and VideoLAN
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
......@@ -24,122 +24,114 @@
#import <Cocoa/Cocoa.h>
@interface VLCAudioEffects : NSObject {
/* generic */
IBOutlet id o_tableView;
IBOutlet id o_window;
IBOutlet id o_profile_pop;
@interface VLCAudioEffects : NSObject
/* Equalizer */
IBOutlet id o_eq_view;
IBOutlet id o_eq_enable_ckb;
IBOutlet id o_eq_twopass_ckb;
IBOutlet id o_eq_preamp_lbl;
IBOutlet id o_eq_presets_popup;
IBOutlet id o_eq_band1_sld;
IBOutlet id o_eq_band2_sld;
IBOutlet id o_eq_band3_sld;
IBOutlet id o_eq_band4_sld;
IBOutlet id o_eq_band5_sld;
IBOutlet id o_eq_band6_sld;
IBOutlet id o_eq_band7_sld;
IBOutlet id o_eq_band8_sld;
IBOutlet id o_eq_band9_sld;
IBOutlet id o_eq_band10_sld;
IBOutlet id o_eq_preamp_sld;
/* generic */
@property (readwrite, weak) IBOutlet NSWindow *window;
@property (readwrite, weak) IBOutlet NSTabView *tabView;
@property (readwrite, weak) IBOutlet NSPopUpButton *profilePopup;
/* Equalizer */
@property (readwrite, weak) IBOutlet NSView *equalizerView;
@property (readwrite, weak) IBOutlet NSButton *equalizerEnableCheckbox;
@property (readwrite, weak) IBOutlet NSButton *equalizerTwoPassCheckbox;
@property (readwrite, weak) IBOutlet NSTextField *equalizerPreampLabel;
@property (readwrite, weak) IBOutlet NSPopUpButton *equalizerPresetsPopup;
@property (readwrite, weak) IBOutlet NSSlider *equalizerBand1Slider;
@property (readwrite, weak) IBOutlet NSSlider *equalizerBand2Slider;
@property (readwrite, weak) IBOutlet NSSlider *equalizerBand3Slider;
@property (readwrite, weak) IBOutlet NSSlider *equalizerBand4Slider;
@property (readwrite, weak) IBOutlet NSSlider *equalizerBand5Slider;
@property (readwrite, weak) IBOutlet NSSlider *equalizerBand6Slider;
@property (readwrite, weak) IBOutlet NSSlider *equalizerBand7Slider;
@property (readwrite, weak) IBOutlet NSSlider *equalizerBand8Slider;
@property (readwrite, weak) IBOutlet NSSlider *equalizerBand9Slider;
@property (readwrite, weak) IBOutlet NSSlider *equalizerBand10Slider;
@property (readwrite, weak) IBOutlet NSSlider *equalizerPreampSlider;
/* Compressor */
IBOutlet id o_comp_view;
IBOutlet id o_comp_enable_ckb;
IBOutlet id o_comp_reset_btn;
IBOutlet id o_comp_band1_sld;
IBOutlet id o_comp_band1_fld;
IBOutlet id o_comp_band1_lbl;
IBOutlet id o_comp_band2_sld;
IBOutlet id o_comp_band2_fld;
IBOutlet id o_comp_band2_lbl;
IBOutlet id o_comp_band3_sld;
IBOutlet id o_comp_band3_fld;
IBOutlet id o_comp_band3_lbl;
IBOutlet id o_comp_band4_sld;
IBOutlet id o_comp_band4_fld;
IBOutlet id o_comp_band4_lbl;
IBOutlet id o_comp_band5_sld;
IBOutlet id o_comp_band5_fld;
IBOutlet id o_comp_band5_lbl;
IBOutlet id o_comp_band6_sld;
IBOutlet id o_comp_band6_fld;
IBOutlet id o_comp_band6_lbl;
IBOutlet id o_comp_band7_sld;
IBOutlet id o_comp_band7_fld;
IBOutlet id o_comp_band7_lbl;
/* Compressor */
@property (readwrite, weak) IBOutlet NSView *compressorView;
@property (readwrite, weak) IBOutlet NSButton *compressorEnableCheckbox;
@property (readwrite, weak) IBOutlet NSButton *compressorResetButton;
@property (readwrite, weak) IBOutlet NSSlider *compressorBand1Slider;
@property (readwrite, weak) IBOutlet NSTextField *compressorBand1TextField;
@property (readwrite, weak) IBOutlet NSTextField *compressorBand1Label;
@property (readwrite, weak) IBOutlet NSSlider *compressorBand2Slider;
@property (readwrite, weak) IBOutlet NSTextField *compressorBand2TextField;
@property (readwrite, weak) IBOutlet NSTextField *compressorBand2Label;
@property (readwrite, weak) IBOutlet NSSlider *compressorBand3Slider;
@property (readwrite, weak) IBOutlet NSTextField *compressorBand3TextField;
@property (readwrite, weak) IBOutlet NSTextField *compressorBand3Label;
@property (readwrite, weak) IBOutlet NSSlider *compressorBand4Slider;
@property (readwrite, weak) IBOutlet NSTextField *compressorBand4TextField;
@property (readwrite, weak) IBOutlet NSTextField *compressorBand4Label;
@property (readwrite, weak) IBOutlet NSSlider *compressorBand5Slider;
@property (readwrite, weak) IBOutlet NSTextField *compressorBand5TextField;
@property (readwrite, weak) IBOutlet NSTextField *compressorBand5Label;
@property (readwrite, weak) IBOutlet NSSlider *compressorBand6Slider;
@property (readwrite, weak) IBOutlet NSTextField *compressorBand6TextField;
@property (readwrite, weak) IBOutlet NSTextField *compressorBand6Label;
@property (readwrite, weak) IBOutlet NSSlider *compressorBand7Slider;
@property (readwrite, weak) IBOutlet NSTextField *compressorBand7TextField;
@property (readwrite, weak) IBOutlet NSTextField *compressorBand7Label;
/* Spatializer */
IBOutlet id o_spat_view;
IBOutlet id o_spat_enable_ckb;
IBOutlet id o_spat_reset_btn;
IBOutlet id o_spat_band1_sld;
IBOutlet id o_spat_band1_fld;
IBOutlet id o_spat_band1_lbl;
IBOutlet id o_spat_band2_sld;
IBOutlet id o_spat_band2_fld;
IBOutlet id o_spat_band2_lbl;
IBOutlet id o_spat_band3_sld;
IBOutlet id o_spat_band3_fld;
IBOutlet id o_spat_band3_lbl;
IBOutlet id o_spat_band4_sld;
IBOutlet id o_spat_band4_fld;
IBOutlet id o_spat_band4_lbl;
IBOutlet id o_spat_band5_sld;
IBOutlet id o_spat_band5_fld;
IBOutlet id o_spat_band5_lbl;
/* Spatializer */
@property (readwrite, weak) IBOutlet NSView *spatializerView;
@property (readwrite, weak) IBOutlet NSButton *spatializerEnableCheckbox;
@property (readwrite, weak) IBOutlet NSButton *spatializerResetButton;
@property (readwrite, weak) IBOutlet NSSlider *spatializerBand1Slider;
@property (readwrite, weak) IBOutlet NSTextField *spatializerBand1TextField;
@property (readwrite, weak) IBOutlet NSTextField *spatializerBand1Label;
@property (readwrite, weak) IBOutlet NSSlider *spatializerBand2Slider;
@property (readwrite, weak) IBOutlet NSTextField *spatializerBand2TextField;
@property (readwrite, weak) IBOutlet NSTextField *spatializerBand2Label;
@property (readwrite, weak) IBOutlet NSSlider *spatializerBand3Slider;
@property (readwrite, weak) IBOutlet NSTextField *spatializerBand3TextField;
@property (readwrite, weak) IBOutlet NSTextField *spatializerBand3Label;
@property (readwrite, weak) IBOutlet NSSlider *spatializerBand4Slider;
@property (readwrite, weak) IBOutlet NSTextField *spatializerBand4TextField;
@property (readwrite, weak) IBOutlet NSTextField *spatializerBand4Label;
@property (readwrite, weak) IBOutlet NSSlider *spatializerBand5Slider;
@property (readwrite, weak) IBOutlet NSTextField *spatializerBand5TextField;
@property (readwrite, weak) IBOutlet NSTextField *spatializerBand5Label;
/* Filter */
IBOutlet id o_filter_headPhone_ckb;
IBOutlet id o_filter_normLevel_ckb;
IBOutlet id o_filter_normLevel_sld;
IBOutlet id o_filter_normLevel_lbl;
IBOutlet id o_filter_karaoke_ckb;
}
/* Filter */
@property (readwrite, weak) IBOutlet NSButton *filterHeadPhoneCheckbox;
@property (readwrite, weak) IBOutlet NSButton *filterNormLevelCheckbox;
@property (readwrite, weak) IBOutlet NSSlider *filterNormLevelSlider;
@property (readwrite, weak) IBOutlet NSTextField *filterNormLevelLabel;
@property (readwrite, weak) IBOutlet NSButton *filterKaraokeCheckbox;
/* generic */
+ (VLCAudioEffects *)sharedInstance;
- (void)updateCocoaWindowLevel:(NSInteger)i_level;
- (IBAction)toggleWindow:(id)sender;
- (void)setAudioFilter: (char *)psz_name on:(BOOL)b_on;
- (IBAction)profileSelectorAction:(id)sender;
- (IBAction)addAudioEffectsProfile:(id)sender;
- (IBAction)removeAudioEffectsProfile:(id)sender;
- (void)toggleWindow:(id)sender;
- (void)updateCocoaWindowLevel:(NSInteger)i_level;
- (void)saveCurrentProfile;
/* Equalizer */
- (void)equalizerUpdated;
- (void)setValue:(float)value forSlider:(int)index;
- (IBAction)eq_bandSliderUpdated:(id)sender;
- (IBAction)eq_changePreset:(id)sender;
- (IBAction)eq_enable:(id)sender;
- (IBAction)eq_preampSliderUpdated:(id)sender;
- (IBAction)eq_twopass:(id)sender;
- (IBAction)equalizerBandSliderUpdated:(id)sender;
- (IBAction)equalizerChangePreset:(id)sender;
- (IBAction)equalizerEnable:(id)sender;
- (IBAction)equalizerPreAmpSliderUpdated:(id)sender;
- (IBAction)equalizerTwoPass:(id)sender;
/* Compressor */
- (void)resetCompressor;
- (IBAction)resetCompressorValues:(id)sender;
- (IBAction)comp_enable:(id)sender;
- (IBAction)comp_sliderUpdated:(id)sender;
- (IBAction)compressorEnable:(id)sender;
- (IBAction)compressorSliderUpdated:(id)sender;
/* Spatializer */
- (void)resetSpatializer;
- (IBAction)resetSpatializerValues:(id)sender;
- (IBAction)spat_enable:(id)sender;
- (IBAction)spat_sliderUpdated:(id)sender;
- (IBAction)spatializerEnable:(id)sender;
- (IBAction)spatializerSliderUpdated:(id)sender;
/* Filter */
- (void)resetAudioFilters;
- (IBAction)filter_enableHeadPhoneVirt:(id)sender;
- (IBAction)filter_enableVolumeNorm:(id)sender;
- (IBAction)filter_volNormSliderUpdated:(id)sender;
- (IBAction)filter_enableKaraoke:(id)sender;
- (IBAction)filterEnableHeadPhoneVirt:(id)sender;
- (IBAction)filterEnableVolumeNorm:(id)sender;
- (IBAction)filterVolumeNormSliderUpdated:(id)sender;
- (IBAction)filterEnableKaraoke:(id)sender;
@end
/*****************************************************************************
* AudioEffects.m: MacOS X interface module
*****************************************************************************
* Copyright (C) 2004-2012 VLC authors and VideoLAN
* Copyright (C) 2004-2015 VLC authors and VideoLAN
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
......@@ -38,7 +38,6 @@
@interface VLCAudioEffects ()
{
intf_thread_t *p_intf;
BOOL b_genericAudioProfileInInteraction;
NSInteger i_old_profile_index;
}
......@@ -101,7 +100,6 @@
- (id)init
{
self = [super init];
p_intf = VLCIntf;
i_old_profile_index = -1;
return self;
}
......@@ -110,44 +108,45 @@
{
/* setup the user's language */
/* Equalizer */
[o_eq_enable_ckb setTitle:_NS("Enable")];
[o_eq_twopass_ckb setTitle:_NS("2 Pass")];
[o_eq_preamp_lbl setStringValue:_NS("Preamp")];
[_equalizerEnableCheckbox setTitle:_NS("Enable")];
[_equalizerTwoPassCheckbox setTitle:_NS("2 Pass")];
[_equalizerPreampLabel setStringValue:_NS("Preamp")];
/* Compressor */
[o_comp_enable_ckb setTitle:_NS("Enable dynamic range compressor")];
[o_comp_reset_btn setTitle:_NS("Reset")];
[o_comp_band1_lbl setStringValue:_NS("RMS/peak")];;
[o_comp_band2_lbl setStringValue:_NS("Attack")];
[o_comp_band3_lbl setStringValue:_NS("Release")];
[o_comp_band4_lbl setStringValue:_NS("Threshold")];
[o_comp_band5_lbl setStringValue:_NS("Ratio")];
[o_comp_band6_lbl setStringValue:_NS("Knee radius")];
[o_comp_band7_lbl setStringValue:_NS("Makeup gain")];
[_compressorEnableCheckbox setTitle:_NS("Enable dynamic range compressor")];
[_compressorResetButton setTitle:_NS("Reset")];
[_compressorBand1Label setStringValue:_NS("RMS/peak")];;
[_compressorBand2Label setStringValue:_NS("Attack")];
[_compressorBand3Label setStringValue:_NS("Release")];
[_compressorBand4Label setStringValue:_NS("Threshold")];
[_compressorBand5Label setStringValue:_NS("Ratio")];
[_compressorBand6Label setStringValue:_NS("Knee radius")];
[_compressorBand7Label setStringValue:_NS("Makeup gain")];
/* Spatializer */
[o_spat_enable_ckb setTitle:_NS("Enable Spatializer")];
[o_spat_reset_btn setTitle:_NS("Reset")];
[o_spat_band1_lbl setStringValue:_NS("Size")];
[o_spat_band2_lbl setStringValue:_NS("Width")];
[o_spat_band3_lbl setStringValue:_NS("Wet")];
[o_spat_band4_lbl setStringValue:_NS("Dry")];
[o_spat_band5_lbl setStringValue:_NS("Damp")];
[_spatializerEnableCheckbox setTitle:_NS("Enable Spatializer")];
[_spatializerResetButton setTitle:_NS("Reset")];
[_spatializerBand1Label setStringValue:_NS("Size")];
[_spatializerBand2Label setStringValue:_NS("Width")];
[_spatializerBand3Label setStringValue:_NS("Wet")];
[_spatializerBand4Label setStringValue:_NS("Dry")];
[_spatializerBand5Label setStringValue:_NS("Damp")];
/* Filter */
[o_filter_headPhone_ckb setTitle:_NS("Headphone virtualization")];
[o_filter_normLevel_ckb setTitle:_NS("Volume normalization")];
[o_filter_normLevel_lbl setStringValue:_NS("Maximum level")];
[o_filter_karaoke_ckb setTitle:_NS("Karaoke")];
[_filterHeadPhoneCheckbox setTitle:_NS("Headphone virtualization")];
[_filterNormLevelCheckbox setTitle:_NS("Volume normalization")];
[_filterNormLevelLabel setStringValue:_NS("Maximum level")];
[_filterKaraokeCheckbox setTitle:_NS("Karaoke")];
/* generic */
[[o_tableView tabViewItemAtIndex:[o_tableView indexOfTabViewItemWithIdentifier:@"equalizer"]] setLabel:_NS("Equalizer")];
[[o_tableView tabViewItemAtIndex:[o_tableView indexOfTabViewItemWithIdentifier:@"compressor"]] setLabel:_NS("Compressor")];
[[o_tableView tabViewItemAtIndex:[o_tableView indexOfTabViewItemWithIdentifier:@"spatializer"]] setLabel:_NS("Spatializer")];
[[o_tableView tabViewItemAtIndex:[o_tableView indexOfTabViewItemWithIdentifier:@"filter"]] setLabel:_NS("Filter")];
[o_window setTitle:_NS("Audio Effects")];
[o_window setExcludedFromWindowsMenu:YES];
[o_window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
[[_tabView tabViewItemAtIndex:[_tabView indexOfTabViewItemWithIdentifier:@"equalizer"]] setLabel:_NS("Equalizer")];
[[_tabView tabViewItemAtIndex:[_tabView indexOfTabViewItemWithIdentifier:@"compressor"]] setLabel:_NS("Compressor")];
[[_tabView tabViewItemAtIndex:[_tabView indexOfTabViewItemWithIdentifier:@"spatializer"]] setLabel:_NS("Spatializer")];
[[_tabView tabViewItemAtIndex:[_tabView indexOfTabViewItemWithIdentifier:@"filter"]] setLabel:_NS("Filter")];
[_window setTitle:_NS("Audio Effects")];
[_window setExcludedFromWindowsMenu:YES];
[_window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
[self equalizerUpdated];
[self resetCompressor];
......@@ -162,6 +161,7 @@
- (void)setAudioFilter: (char *)psz_name on:(BOOL)b_on
{
audio_output_t *p_aout = getAout();
intf_thread_t *p_intf = VLCIntf;
playlist_EnableAudioFilter(pl_Get(p_intf), psz_name, b_on);
if (p_aout) {
......@@ -176,23 +176,23 @@
- (void)resetProfileSelector
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[o_profile_pop removeAllItems];
[_profilePopup removeAllItems];
NSArray *profileNames = [defaults objectForKey:@"AudioEffectProfileNames"];
[o_profile_pop addItemsWithTitles:profileNames];
[_profilePopup addItemsWithTitles:profileNames];
[[o_profile_pop menu] addItem:[NSMenuItem separatorItem]];
[o_profile_pop addItemWithTitle:_NS("Duplicate current profile...")];
[[o_profile_pop lastItem] setTarget: self];
[[o_profile_pop lastItem] setAction: @selector(addAudioEffectsProfile:)];
[[_profilePopup menu] addItem:[NSMenuItem separatorItem]];
[_profilePopup addItemWithTitle:_NS("Duplicate current profile...")];
[[_profilePopup lastItem] setTarget: self];
[[_profilePopup lastItem] setAction: @selector(addAudioEffectsProfile:)];
if ([profileNames count] > 1) {
[o_profile_pop addItemWithTitle:_NS("Organize Profiles...")];
[[o_profile_pop lastItem] setTarget: self];
[[o_profile_pop lastItem] setAction: @selector(removeAudioEffectsProfile:)];
[_profilePopup addItemWithTitle:_NS("Organize Profiles...")];
[[_profilePopup lastItem] setTarget: self];
[[_profilePopup lastItem] setAction: @selector(removeAudioEffectsProfile:)];
}
[o_profile_pop selectItemAtIndex:[defaults integerForKey:@"AudioEffectSelectedProfile"]];
[_profilePopup selectItemAtIndex:[defaults integerForKey:@"AudioEffectSelectedProfile"]];
[self profileSelectorAction:self];
}
......@@ -200,22 +200,23 @@
#pragma mark generic code
- (void)updateCocoaWindowLevel:(NSInteger)i_level
{
if (o_window && [o_window isVisible] && [o_window level] != i_level)
[o_window setLevel: i_level];
if (_window && [_window isVisible] && [_window level] != i_level)
[_window setLevel: i_level];
}
- (IBAction)toggleWindow:(id)sender
{
if ([o_window isKeyWindow])
[o_window orderOut:sender];
if ([_window isKeyWindow])
[_window orderOut:sender];
else {
[o_window setLevel: [[[VLCMain sharedInstance] voutController] currentStatusWindowLevel]];
[o_window makeKeyAndOrderFront:sender];
[_window setLevel: [[[VLCMain sharedInstance] voutController] currentStatusWindowLevel]];
[_window makeKeyAndOrderFront:sender];
}
}
- (NSString *)generateProfileString
{
intf_thread_t *p_intf = VLCIntf;
vlc_object_t *p_object = VLC_OBJECT(getAout());
if (p_object == NULL)
p_object = vlc_object_hold(pl_Get(p_intf));
......@@ -262,11 +263,12 @@
- (IBAction)profileSelectorAction:(id)sender
{
intf_thread_t *p_intf = VLCIntf;
[self saveCurrentProfile];
i_old_profile_index = [o_profile_pop indexOfSelectedItem];
i_old_profile_index = [_profilePopup indexOfSelectedItem];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSInteger selectedProfile = [o_profile_pop indexOfSelectedItem];
NSInteger selectedProfile = [_profilePopup indexOfSelectedItem];
if (selectedProfile < 0)
return;
......@@ -344,11 +346,11 @@
}
/* update UI */
BOOL b_eq_enabled = [tempString rangeOfString:@"equalizer"].location != NSNotFound;
[o_eq_view enableSubviews:b_eq_enabled];
[o_eq_enable_ckb setState:(b_eq_enabled ? NSOnState : NSOffState)];
BOOL b_equalizerEnabled = [tempString rangeOfString:@"equalizer"].location != NSNotFound;
[_equalizerView enableSubviews:b_equalizerEnabled];
[_equalizerEnableCheckbox setState:(b_equalizerEnabled ? NSOnState : NSOffState)];
[o_eq_twopass_ckb setState:[[items objectAtIndex:15] intValue]];
[_equalizerTwoPassCheckbox setState:[[items objectAtIndex:15] intValue]];
[self resetCompressor];
[self resetSpatializer];
[self resetAudioFilters];
......@@ -362,7 +364,7 @@
vlc_object_release(p_aout);
}
- (IBAction)addAudioEffectsProfile:(id)sender
- (void)addAudioEffectsProfile:(id)sender
{
/* show panel */
VLCEnterTextPanel *panel = [VLCEnterTextPanel sharedInstance];
......@@ -373,10 +375,10 @@
[panel setTarget:self];
b_genericAudioProfileInInteraction = YES;
[panel runModalForWindow:o_window];
[panel runModalForWindow:_window];
}
- (IBAction)removeAudioEffectsProfile:(id)sender
- (void)removeAudioEffectsProfile:(id)sender
{
/* show panel */
VLCSelectItemInPopupPanel *panel = [VLCSelectItemInPopupPanel sharedInstance];
......@@ -388,7 +390,7 @@
[panel setTarget:self];
b_genericAudioProfileInInteraction = YES;
[panel runModalForWindow:o_window];
[panel runModalForWindow:_window];
}
#pragma mark -
......@@ -426,17 +428,17 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSArray *presets = [defaults objectForKey:@"EQNames"];
[o_eq_presets_popup removeAllItems];
[o_eq_presets_popup addItemsWithTitles:[[NSUserDefaults standardUserDefaults] objectForKey:@"EQTitles"]];
[[o_eq_presets_popup menu] addItem:[NSMenuItem separatorItem]];
[o_eq_presets_popup addItemWithTitle:_NS("Add new Preset...")];
[[o_eq_presets_popup lastItem] setTarget: self];
[[o_eq_presets_popup lastItem] setAction: @selector(addPresetAction:)];
[_equalizerPresetsPopup removeAllItems];
[_equalizerPresetsPopup addItemsWithTitles:[[NSUserDefaults standardUserDefaults] objectForKey:@"EQTitles"]];
[[_equalizerPresetsPopup menu] addItem:[NSMenuItem separatorItem]];
[_equalizerPresetsPopup addItemWithTitle:_NS("Add new Preset...")];
[[_equalizerPresetsPopup lastItem] setTarget: self];
[[_equalizerPresetsPopup lastItem] setAction: @selector(addPresetAction:)];
if ([presets count] > 1) {
[o_eq_presets_popup addItemWithTitle:_NS("Organize Presets...")];
[[o_eq_presets_popup lastItem] setTarget: self];
[[o_eq_presets_popup lastItem] setAction: @selector(deletePresetAction:)];
[_equalizerPresetsPopup addItemWithTitle:_NS("Organize Presets...")];
[[_equalizerPresetsPopup lastItem] setTarget: self];
[[_equalizerPresetsPopup lastItem] setAction: @selector(deletePresetAction:)];
}
audio_output_t *p_aout = getAout();
......@@ -457,42 +459,43 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
currentPresetIndex = [presets count] - 1;
}
[o_eq_presets_popup selectItemAtIndex:currentPresetIndex];
[self eq_changePreset: o_eq_presets_popup];
[_equalizerPresetsPopup selectItemAtIndex:currentPresetIndex];
[self equalizerChangePreset:_equalizerPresetsPopup];
[o_eq_preamp_sld setFloatValue:[[[defaults objectForKey:@"EQPreampValues"] objectAtIndex:currentPresetIndex] floatValue]];
[_equalizerPreampSlider setFloatValue:[[[defaults objectForKey:@"EQPreampValues"] objectAtIndex:currentPresetIndex] floatValue]];
[self setBandSliderValuesForPreset:currentPresetIndex];
}
- (void)equalizerUpdated
{
float f_preamp = config_GetFloat(p_intf, "equalizer-preamp");
intf_thread_t *p_intf = VLCIntf;
float fPreamp = config_GetFloat(p_intf, "equalizer-preamp");
bool b_2p = (BOOL)config_GetInt(p_intf, "equalizer-2pass");
bool b_enabled = GetEqualizerStatus(p_intf, (char *)"equalizer");
bool bEnabled = GetEqualizerStatus(p_intf, (char *)"equalizer");
/* Setup sliders */
[self updatePresetSelector];
/* Set the the checkboxes */
[o_eq_view enableSubviews: b_enabled];
[o_eq_enable_ckb setState: b_enabled];
[o_eq_twopass_ckb setState: b_2p];
[_equalizerView enableSubviews: bEnabled];
[_equalizerEnableCheckbox setState: bEnabled];
[_equalizerTwoPassCheckbox setState: b_2p];
}
- (id)sliderByIndex:(int)index
{
switch(index) {
case 0 : return o_eq_band1_sld;
case 1 : return o_eq_band2_sld;
case 2 : return o_eq_band3_sld;
case 3 : return o_eq_band4_sld;
case 4 : return o_eq_band5_sld;
case 5 : return o_eq_band6_sld;
case 6 : return o_eq_band7_sld;
case 7 : return o_eq_band8_sld;
case 8 : return o_eq_band9_sld;
case 9 : return o_eq_band10_sld;
case 0 : return _equalizerBand1Slider;
case 1 : return _equalizerBand2Slider;
case 2 : return _equalizerBand3Slider;
case 3 : return _equalizerBand4Slider;
case 4 : return _equalizerBand5Slider;
case 5 : return _equalizerBand6Slider;
case 6 : return _equalizerBand7Slider;
case 7 : return _equalizerBand8Slider;
case 8 : return _equalizerBand9Slider;
case 9 : return _equalizerBand10Slider;
default : return nil;
}
}
......@@ -509,16 +512,16 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
- (NSString *)generatePresetString
{
return [NSString stringWithFormat:@"%.1f %.1f %.1f %.1f %.1f %.1f %.1f %.1f %.1f %.1f",
[o_eq_band1_sld floatValue],
[o_eq_band2_sld floatValue],
[o_eq_band3_sld floatValue],
[o_eq_band4_sld floatValue],
[o_eq_band5_sld floatValue],
[o_eq_band6_sld floatValue],
[o_eq_band7_sld floatValue],
[o_eq_band8_sld floatValue],
[o_eq_band9_sld floatValue],
[o_eq_band10_sld floatValue]];
[_equalizerBand1Slider floatValue],
[_equalizerBand2Slider floatValue],
[_equalizerBand3Slider floatValue],
[_equalizerBand4Slider floatValue],
[_equalizerBand5Slider floatValue],
[_equalizerBand6Slider floatValue],
[_equalizerBand7Slider floatValue],
[_equalizerBand8Slider floatValue],
[_equalizerBand9Slider floatValue],
[_equalizerBand10Slider floatValue]];
}
- (void)setValue:(float)value forSlider:(int)index
......@@ -529,13 +532,13 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
[slider setFloatValue:value];
}
- (IBAction)eq_enable:(id)sender
- (IBAction)equalizerEnable:(id)sender
{
[o_eq_view enableSubviews:[sender state]];
[_equalizerView enableSubviews:[sender state]];
[self setAudioFilter: "equalizer" on:[sender state]];
}
- (IBAction)eq_bandSliderUpdated:(id)sender
- (IBAction)equalizerBandSliderUpdated:(id)sender
{
audio_output_t *p_aout = getAout();
if (p_aout) {
......@@ -544,12 +547,13 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
}
/* save changed to config */
config_PutPsz(p_intf, "equalizer-bands", [[self generatePresetString] UTF8String]);
config_PutPsz(VLCIntf, "equalizer-bands", [[self generatePresetString] UTF8String]);
}
- (IBAction)eq_changePreset:(id)sender
- (IBAction)equalizerChangePreset:(id)sender
{
intf_thread_t *p_intf = VLCIntf;
NSInteger numberOfChosenPreset = [sender indexOfSelectedItem];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
......@@ -564,31 +568,30 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
vlc_object_release(p_aout);
}
[o_eq_preamp_sld setFloatValue: [preamp floatValue]];
[_equalizerPreampSlider setFloatValue: [preamp floatValue]];
[self setBandSliderValuesForPreset:numberOfChosenPreset];
/* save changed to config */
config_PutPsz(p_intf, "equalizer-bands", [preset UTF8String]);
config_PutFloat(p_intf, "equalizer-preamp", [preamp floatValue]);
config_PutPsz(p_intf, "equalizer-preset", [[[defaults objectForKey:@"EQNames"] objectAtIndex:numberOfChosenPreset] UTF8String]);
}
- (IBAction)eq_preampSliderUpdated:(id)sender
- (IBAction)equalizerPreAmpSliderUpdated:(id)sender
{
float f_preamp = [sender floatValue] ;
float fPreamp = [sender floatValue] ;
audio_output_t *p_aout = getAout();
if (p_aout) {
var_SetFloat(p_aout, "equalizer-preamp", f_preamp);
var_SetFloat(p_aout, "equalizer-preamp", fPreamp);
vlc_object_release(p_aout);
}
/* save changed to config */
config_PutFloat(p_intf, "equalizer-preamp", f_preamp);
config_PutFloat(VLCIntf, "equalizer-preamp", fPreamp);
}
- (IBAction)eq_twopass:(id)sender
- (IBAction)equalizerTwoPass:(id)sender
{
bool b_2p = [sender state] ? true : false;
......@@ -599,8 +602,7 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
}
/* save changed to config */
config_PutInt(p_intf, "equalizer-2pass", (int)b_2p);
config_PutInt(VLCIntf, "equalizer-2pass", (int)b_2p);
}
- (IBAction)addPresetAction:(id)sender
......@@ -614,7 +616,7 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
[panel setTarget:self];
b_genericAudioProfileInInteraction = NO;
[panel runModalForWindow:o_window];
[panel runModalForWindow:_window];
}
- (void)panel:(VLCEnterTextPanel *)panel returnValue:(NSUInteger)value text:(NSString *)text
......@@ -632,7 +634,7 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
[workArray addObject:text];
[defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQTitles"];
workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQPreampValues"]];
[workArray addObject:[NSString stringWithFormat:@"%.1f", [o_eq_preamp_sld floatValue]]];
[workArray addObject:[NSString stringWithFormat:@"%.1f", [_equalizerPreampSlider floatValue]]];
[defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQPreampValues"];
workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQNames"]];
[workArray addObject:[text decomposedStringWithCanonicalMapping]];
......@@ -646,8 +648,7 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
vlc_object_release(p_aout);
}
config_PutPsz(p_intf, "equalizer-preset", [[text decomposedStringWithCanonicalMapping] UTF8String]);
config_PutPsz(VLCIntf, "equalizer-preset", [[text decomposedStringWithCanonicalMapping] UTF8String]);
/* update UI */
[self updatePresetSelector];
......@@ -656,7 +657,7 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
// profile settings
} else {
if (value != NSOKButton) {
[o_profile_pop selectItemAtIndex:[defaults integerForKey:@"AudioEffectSelectedProfile"]];
[_profilePopup selectItemAtIndex:[defaults integerForKey:@"AudioEffectSelectedProfile"]];
return;
}
......@@ -664,14 +665,14 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
// duplicate names are not allowed in the popup control
if ([text length] == 0 || [profileNames containsObject:text]) {