macosx: rename to VLCAudioEffectsWindowController
authorDavid Fuhrmann <dfuhrmann@videolan.org>
Mon, 8 Aug 2016 15:38:16 +0000 (17:38 +0200)
committerDavid Fuhrmann <dfuhrmann@videolan.org>
Mon, 8 Aug 2016 16:47:29 +0000 (18:47 +0200)
12 files changed:
extras/package/macosx/Resources/English.lproj/AudioEffects.xib
extras/package/macosx/vlc.xcodeproj/project.pbxproj
modules/gui/macosx/AudioEffects.h [deleted file]
modules/gui/macosx/AudioEffects.m [deleted file]
modules/gui/macosx/MainMenu.m
modules/gui/macosx/MainWindow.m
modules/gui/macosx/Makefile.am
modules/gui/macosx/VLCAudioEffectsWindowController.h [new file with mode: 0644]
modules/gui/macosx/VLCAudioEffectsWindowController.m [new file with mode: 0644]
modules/gui/macosx/VLCVoutWindowController.m
modules/gui/macosx/intf.h
modules/gui/macosx/intf.m

index 8b64895..d4e50c8 100644 (file)
@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
     <dependencies>
         <deployment version="1070" identifier="macosx"/>
         <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
         <capability name="box content view" minToolsVersion="7.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="VLCAudioEffects">
+        <customObject id="-2" userLabel="File's Owner" customClass="VLCAudioEffectsWindowController">
             <connections>
                 <outlet property="compressorBand1Label" destination="248" id="qCX-jv-cwZ"/>
                 <outlet property="compressorBand1Slider" destination="221" id="mTW-zO-vyb"/>
                                                 <button verticalHuggingPriority="750" id="621">
                                                     <rect key="frame" x="317" y="159" width="73" height="17"/>
                                                     <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-                                                    <buttonCell key="cell" type="roundRect" title="Reset" bezelStyle="roundedRect" image="CEBD97E7-9B4C-48EE-8F46-A4CFB512B098" imagePosition="overlaps" alignment="center" controlSize="mini" borderStyle="border" inset="2" id="622" customClass="VLCHUDButtonCell">
+                                                    <buttonCell key="cell" type="roundRect" title="Reset" bezelStyle="roundedRect" image="9B33308E-D9B3-480C-BC58-0B776FDB6290" imagePosition="overlaps" alignment="center" controlSize="mini" borderStyle="border" inset="2" id="622" customClass="VLCHUDButtonCell">
                                                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                         <font key="font" metaFont="miniSystem"/>
                                                     </buttonCell>
                                                 <button verticalHuggingPriority="750" id="618">
                                                     <rect key="frame" x="317" y="159" width="73" height="17"/>
                                                     <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-                                                    <buttonCell key="cell" type="roundRect" title="Reset" bezelStyle="roundedRect" image="B012D5B9-9282-4637-9073-EE8929D183CC" imagePosition="overlaps" alignment="center" controlSize="mini" borderStyle="border" inset="2" id="619" customClass="VLCHUDButtonCell">
+                                                    <buttonCell key="cell" type="roundRect" title="Reset" bezelStyle="roundedRect" image="A4069BBB-2117-4542-9BBE-3082B4161FD5" imagePosition="overlaps" alignment="center" controlSize="mini" borderStyle="border" inset="2" id="619" customClass="VLCHUDButtonCell">
                                                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                         <font key="font" metaFont="miniSystem"/>
                                                     </buttonCell>
         <userDefaultsController representsSharedInstance="YES" id="350"/>
     </objects>
     <resources>
-        <image name="B012D5B9-9282-4637-9073-EE8929D183CC" width="1" height="1">
+        <image name="9B33308E-D9B3-480C-BC58-0B776FDB6290" width="1" height="1">
             <mutableData key="keyedArchiveRepresentation">
 YnBsaXN0MDDUAQIDBAUGPT5YJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3ASAAGGoK4HCBMU
 GR4fIyQrLjE3OlUkbnVsbNUJCgsMDQ4PEBESVk5TU2l6ZVYkY2xhc3NcTlNJbWFnZUZsYWdzVk5TUmVw
@@ -938,7 +938,7 @@ B04HVwdcB2QHZwdsB3sHfweGB44HmwegB6IHpAepB7EHtAe5B8EHxAfWB9kH3gAAAAAAAAIBAAAAAAAA
 AEEAAAAAAAAAAAAAAAAAAAfgA
 </mutableData>
         </image>
-        <image name="CEBD97E7-9B4C-48EE-8F46-A4CFB512B098" width="1" height="1">
+        <image name="A4069BBB-2117-4542-9BBE-3082B4161FD5" width="1" height="1">
             <mutableData key="keyedArchiveRepresentation">
 YnBsaXN0MDDUAQIDBAUGPT5YJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3ASAAGGoK4HCBMU
 GR4fIyQrLjE3OlUkbnVsbNUJCgsMDQ4PEBESVk5TU2l6ZVYkY2xhc3NcTlNJbWFnZUZsYWdzVk5TUmVw
index 2dc6981..c6dbc6a 100644 (file)
                1CCB5F561A62A724004C3E90 /* AddonsWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DB65D5318ABD6380053B874 /* AddonsWindowController.m */; };
                1CCB5F571A62A724004C3E90 /* applescript.h in Sources */ = {isa = PBXBuildFile; fileRef = 8E6BC6F6041643860059A3A7 /* applescript.h */; };
                1CCB5F581A62A724004C3E90 /* applescript.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E6BC6F7041643860059A3A7 /* applescript.m */; };
-               1CCB5F591A62A724004C3E90 /* AudioEffects.h in Sources */ = {isa = PBXBuildFile; fileRef = CC5560231365CDC700D54038 /* AudioEffects.h */; };
-               1CCB5F5A1A62A724004C3E90 /* AudioEffects.m in Sources */ = {isa = PBXBuildFile; fileRef = CC5560241365CDC800D54038 /* AudioEffects.m */; };
+               1CCB5F591A62A724004C3E90 /* VLCAudioEffectsWindowController.h in Sources */ = {isa = PBXBuildFile; fileRef = CC5560231365CDC700D54038 /* VLCAudioEffectsWindowController.h */; };
+               1CCB5F5A1A62A724004C3E90 /* VLCAudioEffectsWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = CC5560241365CDC800D54038 /* VLCAudioEffectsWindowController.m */; };
                1CCB5F5B1A62A724004C3E90 /* VLCBookmarksWindowController.h in Sources */ = {isa = PBXBuildFile; fileRef = DCE7BD0708A5724D007B10AE /* VLCBookmarksWindowController.h */; };
                1CCB5F5C1A62A724004C3E90 /* VLCBookmarksWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = DCE7BD0608A5724D007B10AE /* VLCBookmarksWindowController.m */; };
                1CCB5F5D1A62A724004C3E90 /* CompatibilityFixes.h in Sources */ = {isa = PBXBuildFile; fileRef = CCB0BB3013FAC9F40095BD0A /* CompatibilityFixes.h */; };
                CC4A33220F8CB017000FC4A7 /* VLCCoreDialogProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCCoreDialogProvider.h; path = ../../../modules/gui/macosx/VLCCoreDialogProvider.h; sourceTree = SOURCE_ROOT; };
                CC4D67F71348F601003FCC5B /* specific.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = specific.c; path = ../../../src/darwin/specific.c; sourceTree = "<group>"; };
                CC4EFC2C13E96BD00091D19A /* dropzone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = dropzone.png; path = Resources/mainwindow/dropzone.png; sourceTree = "<group>"; };
-               CC5560231365CDC700D54038 /* AudioEffects.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AudioEffects.h; path = ../../../modules/gui/macosx/AudioEffects.h; sourceTree = SOURCE_ROOT; };
-               CC5560241365CDC800D54038 /* AudioEffects.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = AudioEffects.m; path = ../../../modules/gui/macosx/AudioEffects.m; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
+               CC5560231365CDC700D54038 /* VLCAudioEffectsWindowController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = VLCAudioEffectsWindowController.h; path = ../../../modules/gui/macosx/VLCAudioEffectsWindowController.h; sourceTree = SOURCE_ROOT; };
+               CC5560241365CDC800D54038 /* VLCAudioEffectsWindowController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = VLCAudioEffectsWindowController.m; path = ../../../modules/gui/macosx/VLCAudioEffectsWindowController.m; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
                CC68B0321544C1AE00FD9C7F /* vlc-xmas.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "vlc-xmas.png"; path = "Resources/icons/vlc-xmas.png"; sourceTree = "<group>"; };
                CC6C01A90DDF3E9200C7D754 /* intf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = intf.h; path = ../../../modules/gui/minimal_macosx/intf.h; sourceTree = SOURCE_ROOT; };
                CC6C01AA0DDF3E9200C7D754 /* intf.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = intf.m; path = ../../../modules/gui/minimal_macosx/intf.m; sourceTree = SOURCE_ROOT; };
                                7DB65D5318ABD6380053B874 /* AddonsWindowController.m */,
                                8E6BC6F6041643860059A3A7 /* applescript.h */,
                                8E6BC6F7041643860059A3A7 /* applescript.m */,
-                               CC5560231365CDC700D54038 /* AudioEffects.h */,
-                               CC5560241365CDC800D54038 /* AudioEffects.m */,
+                               CC5560231365CDC700D54038 /* VLCAudioEffectsWindowController.h */,
+                               CC5560241365CDC800D54038 /* VLCAudioEffectsWindowController.m */,
                                DCE7BD0708A5724D007B10AE /* VLCBookmarksWindowController.h */,
                                DCE7BD0608A5724D007B10AE /* VLCBookmarksWindowController.m */,
                                CCB0BB3013FAC9F40095BD0A /* CompatibilityFixes.h */,
                                1CCB5F561A62A724004C3E90 /* AddonsWindowController.m in Sources */,
                                1CCB5F571A62A724004C3E90 /* applescript.h in Sources */,
                                1CCB5F581A62A724004C3E90 /* applescript.m in Sources */,
-                               1CCB5F591A62A724004C3E90 /* AudioEffects.h in Sources */,
-                               1CCB5F5A1A62A724004C3E90 /* AudioEffects.m in Sources */,
+                               1CCB5F591A62A724004C3E90 /* VLCAudioEffectsWindowController.h in Sources */,
+                               1CCB5F5A1A62A724004C3E90 /* VLCAudioEffectsWindowController.m in Sources */,
                                7D9516BA1C60B6AB00D14E1A /* VLCStatusBarIcon.m in Sources */,
                                1CCB5F5B1A62A724004C3E90 /* VLCBookmarksWindowController.h in Sources */,
                                1CCB5F5C1A62A724004C3E90 /* VLCBookmarksWindowController.m in Sources */,
diff --git a/modules/gui/macosx/AudioEffects.h b/modules/gui/macosx/AudioEffects.h
deleted file mode 100644 (file)
index c64fffd..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-/*****************************************************************************
- * AudioEffects.h: MacOS X interface module
- *****************************************************************************
- * Copyright (C) 2004-2015 VLC authors and VideoLAN
- * $Id$
- *
- * Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
- *          Jérôme Decoodt <djc@videolan.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#import <Cocoa/Cocoa.h>
-
-@class VLCPopupPanelController;
-@class VLCTextfieldPanelController;
-
-@interface VLCAudioEffects : NSWindowController
-
-/* generic */
-@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 */
-@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 */
-@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 */
-@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;
-
-@property (strong) VLCPopupPanelController *popupPanel;
-@property (strong) VLCTextfieldPanelController *textfieldPanel;
-
-/* generic */
-- (IBAction)profileSelectorAction:(id)sender;
-
-- (void)toggleWindow:(id)sender;
-- (void)updateCocoaWindowLevel:(NSInteger)i_level;
-- (void)saveCurrentProfile;
-
-/* Equalizer */
-- (IBAction)equalizerBandSliderUpdated:(id)sender;
-- (IBAction)equalizerChangePreset:(id)sender;
-- (IBAction)equalizerEnable:(id)sender;
-- (IBAction)equalizerPreAmpSliderUpdated:(id)sender;
-- (IBAction)equalizerTwoPass:(id)sender;
-
-/* Compressor */
-- (IBAction)resetCompressorValues:(id)sender;
-- (IBAction)compressorEnable:(id)sender;
-- (IBAction)compressorSliderUpdated:(id)sender;
-
-/* Spatializer */
-- (IBAction)resetSpatializerValues:(id)sender;
-- (IBAction)spatializerEnable:(id)sender;
-- (IBAction)spatializerSliderUpdated:(id)sender;
-
-/* Filter */
-- (IBAction)filterEnableHeadPhoneVirt:(id)sender;
-- (IBAction)filterEnableVolumeNorm:(id)sender;
-- (IBAction)filterVolumeNormSliderUpdated:(id)sender;
-- (IBAction)filterEnableKaraoke:(id)sender;
-
-@end
diff --git a/modules/gui/macosx/AudioEffects.m b/modules/gui/macosx/AudioEffects.m
deleted file mode 100644 (file)
index 0229655..0000000
+++ /dev/null
@@ -1,989 +0,0 @@
-/*****************************************************************************
- * AudioEffects.m: MacOS X interface module
- *****************************************************************************
- * Copyright (C) 2004-2015 VLC authors and VideoLAN
- * $Id$
- *
- * Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
- *          Jérôme Decoodt <djc@videolan.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-# import "config.h"
-#endif
-
-#import "intf.h"
-#import "AudioEffects.h"
-#import "../../audio_filter/equalizer_presets.h"
-#import "CompatibilityFixes.h"
-#import "SharedDialogs.h"
-
-#import <vlc_common.h>
-
-#import <math.h>
-
-@interface VLCAudioEffects ()
-{
-    NSInteger i_old_profile_index;
-}
-- (void)resetProfileSelector;
-- (void)updatePresetSelector;
-- (void)setBandSliderValuesForPreset:(NSInteger)presetID;
-@end
-
-#pragma mark -
-#pragma mark Initialization
-
-@implementation VLCAudioEffects
-
-+ (void)initialize
-{
-    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-
-    NSString *workString;
-    NSMutableArray *workValues = [[NSMutableArray alloc] initWithCapacity:NB_PRESETS];
-    NSMutableArray *workPreamp = [[NSMutableArray alloc] initWithCapacity:NB_PRESETS];
-    NSMutableArray *workTitles = [[NSMutableArray alloc] initWithCapacity:NB_PRESETS];
-    NSMutableArray *workNames = [[NSMutableArray alloc] initWithCapacity:NB_PRESETS];
-
-    for (int i = 0 ; i < NB_PRESETS ; i++) {
-        workString = [NSString stringWithFormat:@"%.1f %.1f %.1f %.1f %.1f %.1f %.1f %.1f %.1f %.1f",
-                      eqz_preset_10b[i].f_amp[0],
-                      eqz_preset_10b[i].f_amp[1],
-                      eqz_preset_10b[i].f_amp[2],
-                      eqz_preset_10b[i].f_amp[3],
-                      eqz_preset_10b[i].f_amp[4],
-                      eqz_preset_10b[i].f_amp[5],
-                      eqz_preset_10b[i].f_amp[6],
-                      eqz_preset_10b[i].f_amp[7],
-                      eqz_preset_10b[i].f_amp[8],
-                      eqz_preset_10b[i].f_amp[9]];
-        [workValues addObject:workString];
-        [workPreamp addObject:[NSString stringWithFormat:@"%1.f", eqz_preset_10b[i].f_preamp]];
-        [workTitles addObject:toNSStr(preset_list_text[i])];
-        [workNames addObject:toNSStr(preset_list[i])];
-    }
-
-    NSString *defaultProfile = [NSString stringWithFormat:@"ZmxhdA==;;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%i",
-                                .0,25.,100.,-11.,8.,2.5,7.,.85,1.,.4,.5,.5,2.,0];
-
-    NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithArray:workValues], @"EQValues", [NSArray arrayWithArray:workPreamp], @"EQPreampValues", [NSArray arrayWithArray:workTitles], @"EQTitles", [NSArray arrayWithArray:workNames], @"EQNames", [NSArray arrayWithObject:defaultProfile], @"AudioEffectProfiles", [NSArray arrayWithObject:_NS("Default")], @"AudioEffectProfileNames", nil];
-    [defaults registerDefaults:appDefaults];
-}
-
-- (id)init
-{
-    self = [super initWithWindowNibName:@"AudioEffects"];
-    if (self) {
-        i_old_profile_index = -1;
-
-        self.popupPanel = [[VLCPopupPanelController alloc] init];
-        self.textfieldPanel = [[VLCTextfieldPanelController alloc] init];
-    }
-
-    return self;
-}
-
-- (void)windowDidLoad
-{
-    /* setup the user's language */
-    /* Equalizer */
-    [_equalizerEnableCheckbox setTitle:_NS("Enable")];
-    [_equalizerTwoPassCheckbox setTitle:_NS("2 Pass")];
-    [_equalizerPreampLabel setStringValue:_NS("Preamp")];
-
-    /* Compressor */
-    [_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 */
-    [_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 */
-    [_filterHeadPhoneCheckbox setTitle:_NS("Headphone virtualization")];
-    [_filterNormLevelCheckbox setTitle:_NS("Volume normalization")];
-    [_filterNormLevelLabel setStringValue:_NS("Maximum level")];
-    [_filterKaraokeCheckbox setTitle:_NS("Karaoke")];
-
-    /* generic */
-    [[_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")];
-    [self.window setTitle:_NS("Audio Effects")];
-    [self.window setExcludedFromWindowsMenu:YES];
-    [self.window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
-
-    [self equalizerUpdated];
-    [self resetCompressor];
-    [self resetSpatializer];
-    [self resetAudioFilters];
-    [self resetProfileSelector];
-}
-
-#pragma mark -
-#pragma mark internal functions
-
-- (void)setAudioFilter: (char *)psz_name on:(BOOL)b_on
-{
-    audio_output_t *p_aout = getAout();
-    intf_thread_t *p_intf = getIntf();
-    playlist_EnableAudioFilter(pl_Get(p_intf), psz_name, b_on);
-
-    if (p_aout) {
-        char *psz_new = var_GetNonEmptyString(p_aout, "audio-filter");
-        config_PutPsz(p_intf, "audio-filter", psz_new);
-        free(psz_new);
-
-        vlc_object_release(p_aout);
-    }
-}
-
-- (void)resetProfileSelector
-{
-    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-    [_profilePopup removeAllItems];
-
-    NSArray *profileNames = [defaults objectForKey:@"AudioEffectProfileNames"];
-    [_profilePopup addItemsWithTitles:profileNames];
-
-    [[_profilePopup menu] addItem:[NSMenuItem separatorItem]];
-    [_profilePopup addItemWithTitle:_NS("Duplicate current profile...")];
-    [[_profilePopup lastItem] setTarget: self];
-    [[_profilePopup lastItem] setAction: @selector(addAudioEffectsProfile:)];
-
-    if ([profileNames count] > 1) {
-        [_profilePopup addItemWithTitle:_NS("Organize Profiles...")];
-        [[_profilePopup lastItem] setTarget: self];
-        [[_profilePopup lastItem] setAction: @selector(removeAudioEffectsProfile:)];
-    }
-
-    [_profilePopup selectItemAtIndex:[defaults integerForKey:@"AudioEffectSelectedProfile"]];
-    [self profileSelectorAction:self];
-}
-
-#pragma mark -
-#pragma mark generic code
-- (void)updateCocoaWindowLevel:(NSInteger)i_level
-{
-    if (self.isWindowLoaded && [self.window isVisible] && [self.window level] != i_level)
-        [self.window setLevel: i_level];
-}
-
-- (IBAction)toggleWindow:(id)sender
-{
-    if ([self.window isKeyWindow])
-        [self.window orderOut:sender];
-    else {
-        [self.window setLevel: [[[VLCMain sharedInstance] voutController] currentStatusWindowLevel]];
-        [self.window makeKeyAndOrderFront:sender];
-    }
-}
-
-- (NSString *)generateProfileString
-{
-    intf_thread_t *p_intf = getIntf();
-    vlc_object_t *p_object = VLC_OBJECT(getAout());
-    if (p_object == NULL)
-        p_object = vlc_object_hold(pl_Get(p_intf));
-
-    NSString *o_str = [NSString stringWithFormat:@"%@;%@;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%lli",
-                       B64EncAndFree(var_GetNonEmptyString(p_object, "equalizer-preset")),
-                       B64EncAndFree(config_GetPsz(p_intf, "audio-filter")),
-                       config_GetFloat(p_intf, "compressor-rms-peak"),
-                       config_GetFloat(p_intf, "compressor-attack"),
-                       config_GetFloat(p_intf, "compressor-release"),
-                       config_GetFloat(p_intf, "compressor-threshold"),
-                       config_GetFloat(p_intf, "compressor-ratio"),
-                       config_GetFloat(p_intf, "compressor-knee"),
-                       config_GetFloat(p_intf, "compressor-makeup-gain"),
-                       config_GetFloat(p_intf, "spatializer-roomsize"),
-                       config_GetFloat(p_intf, "spatializer-width"),
-                       config_GetFloat(p_intf, "spatializer-wet"),
-                       config_GetFloat(p_intf, "spatializer-dry"),
-                       config_GetFloat(p_intf, "spatializer-damp"),
-                       config_GetFloat(p_intf, "norm-max-level"),
-                       config_GetInt(p_intf,"equalizer-2pass")];
-
-    vlc_object_release(p_object);
-    return o_str;
-}
-
-- (void)saveCurrentProfile
-{
-    if (i_old_profile_index == -1)
-        return;
-
-    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-    /* fetch all the current settings in a uniform string */
-    NSString *newProfile = [self generateProfileString];
-
-    NSMutableArray *workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"AudioEffectProfiles"]];
-    if (i_old_profile_index >= [workArray count])
-        return;
-
-    [workArray replaceObjectAtIndex:i_old_profile_index withObject:newProfile];
-    [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"AudioEffectProfiles"];
-    [defaults synchronize];
-}
-
-- (IBAction)profileSelectorAction:(id)sender
-{
-    intf_thread_t *p_intf = getIntf();
-    [self saveCurrentProfile];
-    i_old_profile_index = [_profilePopup indexOfSelectedItem];
-
-    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-    NSInteger selectedProfile = [_profilePopup indexOfSelectedItem];
-    if (selectedProfile < 0)
-        return;
-
-    audio_output_t *p_aout = getAout();
-    playlist_t *p_playlist = pl_Get(p_intf);
-
-    if (p_aout) {
-        /* disable existing filters */
-        playlist_EnableAudioFilter(p_playlist, "equalizer", false);
-        playlist_EnableAudioFilter(p_playlist, "compressor", false);
-        playlist_EnableAudioFilter(p_playlist, "spatializer", false);
-        playlist_EnableAudioFilter(p_playlist, "compressor", false);
-        playlist_EnableAudioFilter(p_playlist, "headphone", false);
-        playlist_EnableAudioFilter(p_playlist, "normvol", false);
-        playlist_EnableAudioFilter(p_playlist, "karaoke", false);
-    }
-
-    /* fetch preset */
-    NSArray *items = [[[defaults objectForKey:@"AudioEffectProfiles"] objectAtIndex:(NSUInteger) selectedProfile] componentsSeparatedByString:@";"];
-
-    /* eq preset */
-    vlc_object_t *p_object = VLC_OBJECT(getAout());
-    if (p_object == NULL)
-        p_object = vlc_object_hold(pl_Get(p_intf));
-    var_SetString(p_object, "equalizer-preset", [B64DecNSStr([items firstObject]) UTF8String]);
-    vlc_object_release(p_object);
-
-    /* filter handling */
-    NSString *tempString = B64DecNSStr([items objectAtIndex:1]);
-    NSArray *tempArray;
-    NSUInteger count;
-    /* enable the new filters, if we have an aout */
-    if (p_aout) {
-        if ([tempString length] > 0) {
-            tempArray = [tempString componentsSeparatedByString:@":"];
-            count = [tempArray count];
-            for (NSUInteger x = 0; x < count; x++)
-                playlist_EnableAudioFilter(p_playlist, [[tempArray objectAtIndex:x] UTF8String], true);
-        }
-    }
-    config_PutPsz(p_intf,"audio-filter",[tempString UTF8String]);
-
-    /* values */
-    config_PutFloat(p_intf, "compressor-rms-peak",[[items objectAtIndex:2] floatValue]);
-    config_PutFloat(p_intf, "compressor-attack",[[items objectAtIndex:3] floatValue]);
-    config_PutFloat(p_intf, "compressor-release",[[items objectAtIndex:4] floatValue]);
-    config_PutFloat(p_intf, "compressor-threshold",[[items objectAtIndex:5] floatValue]);
-    config_PutFloat(p_intf, "compressor-ratio",[[items objectAtIndex:6] floatValue]);
-    config_PutFloat(p_intf, "compressor-knee",[[items objectAtIndex:7] floatValue]);
-    config_PutFloat(p_intf, "compressor-makeup-gain",[[items objectAtIndex:8] floatValue]);
-    config_PutFloat(p_intf, "spatializer-roomsize",[[items objectAtIndex:9] floatValue]);
-    config_PutFloat(p_intf, "spatializer-width",[[items objectAtIndex:10] floatValue]);
-    config_PutFloat(p_intf, "spatializer-wet",[[items objectAtIndex:11] floatValue]);
-    config_PutFloat(p_intf, "spatializer-dry",[[items objectAtIndex:12] floatValue]);
-    config_PutFloat(p_intf, "spatializer-damp",[[items objectAtIndex:13] floatValue]);
-    config_PutFloat(p_intf, "norm-max-level",[[items objectAtIndex:14] floatValue]);
-    config_PutInt(p_intf, "equalizer-2pass",[[items objectAtIndex:15] intValue]);
-
-    /* set values on-the-fly if we have an aout */
-    if (p_aout) {
-        var_SetFloat(p_aout, "compressor-rms-peak", [[items objectAtIndex:2] floatValue]);
-        var_SetFloat(p_aout, "compressor-attack", [[items objectAtIndex:3] floatValue]);
-        var_SetFloat(p_aout, "compressor-release", [[items objectAtIndex:4] floatValue]);
-        var_SetFloat(p_aout, "compressor-threshold", [[items objectAtIndex:5] floatValue]);
-        var_SetFloat(p_aout, "compressor-ratio", [[items objectAtIndex:6] floatValue]);
-        var_SetFloat(p_aout, "compressor-knee", [[items objectAtIndex:7] floatValue]);
-        var_SetFloat(p_aout, "compressor-makeup-gain", [[items objectAtIndex:8] floatValue]);
-        var_SetFloat(p_aout, "spatializer-roomsize", [[items objectAtIndex:9] floatValue]);
-        var_SetFloat(p_aout, "spatializer-width", [[items objectAtIndex:10] floatValue]);
-        var_SetFloat(p_aout, "spatializer-wet", [[items objectAtIndex:11] floatValue]);
-        var_SetFloat(p_aout, "spatializer-dry", [[items objectAtIndex:12] floatValue]);
-        var_SetFloat(p_aout, "spatializer-damp", [[items objectAtIndex:13] floatValue]);
-        var_SetFloat(p_aout, "norm-max-level", [[items objectAtIndex:14] floatValue]);
-        var_SetBool(p_aout, "equalizer-2pass", (BOOL)[[items objectAtIndex:15] intValue]);
-    }
-
-    /* update UI */
-    BOOL b_equalizerEnabled = [tempString rangeOfString:@"equalizer"].location != NSNotFound;
-    [_equalizerView enableSubviews:b_equalizerEnabled];
-    [_equalizerEnableCheckbox setState:(b_equalizerEnabled ? NSOnState : NSOffState)];
-
-    [_equalizerTwoPassCheckbox setState:[[items objectAtIndex:15] intValue]];
-    [self resetCompressor];
-    [self resetSpatializer];
-    [self resetAudioFilters];
-    [self updatePresetSelector];
-
-    /* store current profile selection */
-    [defaults setInteger:selectedProfile forKey:@"AudioEffectSelectedProfile"];
-    [defaults synchronize];
-
-    if (p_aout)
-        vlc_object_release(p_aout);
-}
-
-- (void)addAudioEffectsProfile:(id)sender
-{
-    /* show panel */
-    [_textfieldPanel setTitleString:_NS("Duplicate current profile for a new profile")];
-    [_textfieldPanel setSubTitleString:_NS("Enter a name for the new profile:")];
-    [_textfieldPanel setCancelButtonString:_NS("Cancel")];
-    [_textfieldPanel setOkButtonString:_NS("Save")];
-
-    __weak typeof(self) _self = self;
-    [_textfieldPanel runModalForWindow:self.window completionHandler:^(NSInteger returnCode, NSString *resultingText) {
-
-        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-        if (returnCode != NSOKButton) {
-            [_profilePopup selectItemAtIndex:[defaults integerForKey:@"AudioEffectSelectedProfile"]];
-            return;
-        }
-
-        NSArray *profileNames = [defaults objectForKey:@"AudioEffectProfileNames"];
-
-        // duplicate names are not allowed in the popup control
-        if ([resultingText length] == 0 || [profileNames containsObject:resultingText]) {
-            [_profilePopup selectItemAtIndex:[defaults integerForKey:@"AudioEffectSelectedProfile"]];
-
-            NSAlert *alert = [[NSAlert alloc] init];
-            [alert setAlertStyle:NSCriticalAlertStyle];
-            [alert setMessageText:_NS("Please enter a unique name for the new profile.")];
-            [alert setInformativeText:_NS("Multiple profiles with the same name are not allowed.")];
-
-            [alert beginSheetModalForWindow:_self.window
-                              modalDelegate:nil
-                             didEndSelector:nil
-                                contextInfo:nil];
-            return;
-        }
-
-        NSString *newProfile = [_self generateProfileString];
-
-        /* add string to user defaults as well as a label */
-        NSMutableArray *workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"AudioEffectProfiles"]];
-        [workArray addObject:newProfile];
-        [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"AudioEffectProfiles"];
-        [defaults setInteger:[workArray count] - 1 forKey:@"AudioEffectSelectedProfile"];
-        workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"AudioEffectProfileNames"]];
-        [workArray addObject:resultingText];
-        [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"AudioEffectProfileNames"];
-
-        /* save defaults */
-        [defaults synchronize];
-        [_self resetProfileSelector];
-
-    }];
-}
-
-- (void)removeAudioEffectsProfile:(id)sender
-{
-    /* show panel */
-    [_popupPanel setTitleString:_NS("Remove a preset")];
-    [_popupPanel setSubTitleString:_NS("Select the preset you would like to remove:")];
-    [_popupPanel setOkButtonString:_NS("Remove")];
-    [_popupPanel setCancelButtonString:_NS("Cancel")];
-    [_popupPanel setPopupButtonContent:[[NSUserDefaults standardUserDefaults] objectForKey:@"AudioEffectProfileNames"]];
-
-    __weak typeof(self) _self = self;
-    [_popupPanel runModalForWindow:self.window completionHandler:^(NSInteger returnCode, NSInteger selectedIndex) {
-
-        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-        if (returnCode != NSOKButton) {
-            [_profilePopup selectItemAtIndex:[defaults integerForKey:@"AudioEffectSelectedProfile"]];
-            return;
-        }
-
-        /* remove selected profile from settings */
-        NSMutableArray *workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"AudioEffectProfiles"]];
-        [workArray removeObjectAtIndex:selectedIndex];
-        [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"AudioEffectProfiles"];
-        workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"AudioEffectProfileNames"]];
-        [workArray removeObjectAtIndex:selectedIndex];
-        [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"AudioEffectProfileNames"];
-
-        if (i_old_profile_index >= selectedIndex)
-            [defaults setInteger:i_old_profile_index - 1 forKey:@"AudioEffectSelectedProfile"];
-
-        /* save defaults */
-        [defaults synchronize];
-        [_self resetProfileSelector];
-    }];
-}
-
-#pragma mark -
-#pragma mark Equalizer
-static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
-                               char *psz_name)
-{
-    char *psz_parser, *psz_string = NULL;
-    audio_output_t *p_aout = getAout();
-    if (!p_aout)
-        return false;
-
-    psz_string = config_GetPsz(p_custom_intf, "audio-filter");
-
-    if (!psz_string)
-        psz_string = var_GetNonEmptyString(p_aout, "audio-filter");
-
-    vlc_object_release(p_aout);
-
-    if (!psz_string)
-        return false;
-
-    psz_parser = strstr(psz_string, psz_name);
-
-    free(psz_string);
-
-    if (psz_parser)
-        return true;
-    else
-        return false;
-}
-
-- (void)updatePresetSelector
-{
-    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-    NSArray *presets = [defaults objectForKey:@"EQNames"];
-
-    [_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) {
-        [_equalizerPresetsPopup addItemWithTitle:_NS("Organize Presets...")];
-        [[_equalizerPresetsPopup lastItem] setTarget: self];
-        [[_equalizerPresetsPopup lastItem] setAction: @selector(deletePresetAction:)];
-    }
-
-    audio_output_t *p_aout = getAout();
-
-    NSString *currentPreset = nil;
-    if (p_aout) {
-        char *psz_preset_string = var_GetNonEmptyString(p_aout, "equalizer-preset");
-        currentPreset = toNSStr(psz_preset_string);
-        free(psz_preset_string);
-        vlc_object_release(p_aout);
-    }
-
-    NSUInteger currentPresetIndex = 0;
-    if (currentPreset && [currentPreset length] > 0) {
-        currentPresetIndex = [presets indexOfObject:currentPreset];
-
-        if (currentPresetIndex == NSNotFound)
-            currentPresetIndex = [presets count] - 1;
-    }    
-
-    [_equalizerPresetsPopup selectItemAtIndex:currentPresetIndex];
-    [self equalizerChangePreset:_equalizerPresetsPopup];
-
-    
-    [_equalizerPreampSlider setFloatValue:[[[defaults objectForKey:@"EQPreampValues"] objectAtIndex:currentPresetIndex] floatValue]];
-    [self setBandSliderValuesForPreset:currentPresetIndex];
-}
-
-- (void)equalizerUpdated
-{
-    intf_thread_t *p_intf = getIntf();
-    float fPreamp = config_GetFloat(p_intf, "equalizer-preamp");
-    bool b_2p = (BOOL)config_GetInt(p_intf, "equalizer-2pass");
-    bool bEnabled = GetEqualizerStatus(p_intf, (char *)"equalizer");
-
-    /* Setup sliders */
-    [self updatePresetSelector];
-
-    /* Set the the checkboxes */
-    [_equalizerView enableSubviews: bEnabled];
-    [_equalizerEnableCheckbox setState: bEnabled];
-    [_equalizerTwoPassCheckbox setState: b_2p];
-}
-
-- (id)sliderByIndex:(int)index
-{
-    switch(index) {
-        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;
-    }
-}
-
-- (void)setBandSliderValuesForPreset:(NSInteger)presetID
-{
-    NSString *preset = [[[NSUserDefaults standardUserDefaults] objectForKey:@"EQValues"] objectAtIndex:presetID];
-    NSArray *values = [preset componentsSeparatedByString:@" "];
-    NSUInteger count = [values count];
-    for (NSUInteger x = 0; x < count; x++)
-        [self setValue:[[values objectAtIndex:x] floatValue] forSlider:x];
-}
-
-- (NSString *)generatePresetString
-{
-    return [NSString stringWithFormat:@"%.1f %.1f %.1f %.1f %.1f %.1f %.1f %.1f %.1f %.1f",
-            [_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
-{
-    id slider = [self sliderByIndex:index];
-
-    if (slider != nil)
-        [slider setFloatValue:value];
-}
-
-- (IBAction)equalizerEnable:(id)sender
-{
-    [_equalizerView enableSubviews:[sender state]];
-    [self setAudioFilter: "equalizer" on:[sender state]];
-}
-
-- (IBAction)equalizerBandSliderUpdated:(id)sender
-{
-    audio_output_t *p_aout = getAout();
-    if (p_aout) {
-        var_SetString(p_aout, "equalizer-bands", [[self generatePresetString] UTF8String]);
-        vlc_object_release(p_aout);
-    }
-
-    /* save changed to config */
-    config_PutPsz(getIntf(), "equalizer-bands", [[self generatePresetString] UTF8String]);
-
-}
-
-- (IBAction)equalizerChangePreset:(id)sender
-{
-    intf_thread_t *p_intf = getIntf();
-    NSInteger numberOfChosenPreset = [sender indexOfSelectedItem];
-    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-
-    NSString *preset = [[defaults objectForKey:@"EQValues"] objectAtIndex:numberOfChosenPreset];
-    NSString *preamp = [[defaults objectForKey:@"EQPreampValues"] objectAtIndex:numberOfChosenPreset];
-
-    audio_output_t *p_aout = getAout();
-    if (p_aout) {
-        var_SetString(p_aout, "equalizer-bands", [preset UTF8String]);
-        var_SetFloat(p_aout, "equalizer-preamp", [preamp floatValue]);
-        var_SetString(p_aout, "equalizer-preset" , [[[defaults objectForKey:@"EQNames"] objectAtIndex:numberOfChosenPreset] UTF8String]);
-        vlc_object_release(p_aout);
-    }
-
-    [_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)equalizerPreAmpSliderUpdated:(id)sender
-{
-    float fPreamp = [sender floatValue] ;
-
-    audio_output_t *p_aout = getAout();
-    if (p_aout) {
-        var_SetFloat(p_aout, "equalizer-preamp", fPreamp);
-        vlc_object_release(p_aout);
-    }
-    
-    /* save changed to config */
-    config_PutFloat(getIntf(), "equalizer-preamp", fPreamp);
-}
-
-- (IBAction)equalizerTwoPass:(id)sender
-{
-    bool b_2p = [sender state] ? true : false;
-
-    audio_output_t *p_aout = getAout();
-    if (p_aout) {
-        var_SetBool(p_aout, "equalizer-2pass", b_2p);
-        vlc_object_release(p_aout);
-    }
-
-    /* save changed to config */
-    config_PutInt(getIntf(), "equalizer-2pass", (int)b_2p);
-}
-
-- (IBAction)addPresetAction:(id)sender
-{
-    /* show panel */
-    [_textfieldPanel setTitleString:_NS("Save current selection as new preset")];
-    [_textfieldPanel setSubTitleString:_NS("Enter a name for the new preset:")];
-    [_textfieldPanel setCancelButtonString:_NS("Cancel")];
-    [_textfieldPanel setOkButtonString:_NS("Save")];
-
-    __weak typeof(self) _self = self;
-    [_textfieldPanel runModalForWindow:self.window completionHandler:^(NSInteger returnCode, NSString *resultingText) {
-        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-
-        // EQ settings
-        if (returnCode != NSOKButton || [resultingText length] == 0)
-            return;
-
-        NSMutableArray *workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQValues"]];
-        [workArray addObject:[self generatePresetString]];
-        [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQValues"];
-        workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQTitles"]];
-        [workArray addObject:resultingText];
-        [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQTitles"];
-        workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQPreampValues"]];
-        [workArray addObject:[NSString stringWithFormat:@"%.1f", [_equalizerPreampSlider floatValue]]];
-        [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQPreampValues"];
-        workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQNames"]];
-        [workArray addObject:[resultingText decomposedStringWithCanonicalMapping]];
-        [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQNames"];
-        [defaults synchronize];
-
-        /* update VLC internals */
-        audio_output_t *p_aout = getAout();
-        if (p_aout) {
-            var_SetString(p_aout, "equalizer-preset", [[resultingText decomposedStringWithCanonicalMapping] UTF8String]);
-            vlc_object_release(p_aout);
-        }
-
-        config_PutPsz(getIntf(), "equalizer-preset", [[resultingText decomposedStringWithCanonicalMapping] UTF8String]);
-
-        /* update UI */
-        [_self updatePresetSelector];
-    }];
-}
-
-- (IBAction)deletePresetAction:(id)sender
-{
-    [_popupPanel setTitleString:_NS("Remove a preset")];
-    [_popupPanel setSubTitleString:_NS("Select the preset you would like to remove:")];
-    [_popupPanel setOkButtonString:_NS("Remove")];
-    [_popupPanel setCancelButtonString:_NS("Cancel")];
-    [_popupPanel setPopupButtonContent:[[NSUserDefaults standardUserDefaults] objectForKey:@"EQTitles"]];
-
-    __weak typeof(self) _self = self;
-    [_popupPanel runModalForWindow:self.window completionHandler:^(NSInteger returnCode, NSInteger selectedIndex) {
-
-        if (returnCode != NSOKButton)
-            return;
-
-        /* remove requested profile from the arrays */
-        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-        NSMutableArray *workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQValues"]];
-        [workArray removeObjectAtIndex:selectedIndex];
-        [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQValues"];
-        workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQTitles"]];
-        [workArray removeObjectAtIndex:selectedIndex];
-        [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQTitles"];
-        workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQPreampValues"]];
-        [workArray removeObjectAtIndex:selectedIndex];
-        [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQPreampValues"];
-        workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQNames"]];
-        [workArray removeObjectAtIndex:selectedIndex];
-        [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQNames"];
-        [defaults synchronize];
-
-        /* update UI */
-        [_self updatePresetSelector];
-    }];
-}
-
-#pragma mark -
-#pragma mark Compressor
-- (void)resetCompressor
-{
-    intf_thread_t *p_intf = getIntf();
-    BOOL bEnable_compressor = NO;
-    char *psz_afilters;
-    psz_afilters = config_GetPsz(p_intf, "audio-filter");
-    if (psz_afilters) {
-        bEnable_compressor = strstr(psz_afilters, "compressor") != NULL;
-        [_compressorEnableCheckbox setState: (NSInteger)strstr(psz_afilters, "compressor") ];
-        free(psz_afilters);
-    }
-
-    [_compressorView enableSubviews:bEnable_compressor];
-    [_compressorEnableCheckbox setState:(bEnable_compressor ? NSOnState : NSOffState)];
-
-    [_compressorBand1Slider setFloatValue: config_GetFloat(p_intf, "compressor-rms-peak")];
-    [_compressorBand1TextField setStringValue:[NSString localizedStringWithFormat:@"%1.1f", [_compressorBand1Slider floatValue]]];
-    [_compressorBand2Slider setFloatValue: config_GetFloat(p_intf, "compressor-attack")];
-    [_compressorBand2TextField setStringValue:[NSString localizedStringWithFormat:@"%2.1f ms", [_compressorBand2Slider floatValue]]];
-    [_compressorBand3Slider setFloatValue: config_GetFloat(p_intf, "compressor-release")];
-    [_compressorBand3TextField setStringValue:[NSString localizedStringWithFormat:@"%3.1f ms", [_compressorBand3Slider floatValue]]];
-    [_compressorBand4Slider setFloatValue: config_GetFloat(p_intf, "compressor-threshold")];
-    [_compressorBand4TextField setStringValue:[NSString localizedStringWithFormat:@"%2.1f dB", [_compressorBand4Slider floatValue]]];
-    [_compressorBand5Slider setFloatValue: config_GetFloat(p_intf, "compressor-ratio")];
-    [_compressorBand5TextField setStringValue:[NSString localizedStringWithFormat:@"%1.1f:1", [_compressorBand5Slider floatValue]]];
-    [_compressorBand6Slider setFloatValue: config_GetFloat(p_intf, "compressor-knee")];
-    [_compressorBand6TextField setStringValue:[NSString localizedStringWithFormat:@"%1.1f dB", [_compressorBand6Slider floatValue]]];
-    [_compressorBand7Slider setFloatValue: config_GetFloat(p_intf, "compressor-makeup-gain")];
-    [_compressorBand7TextField setStringValue:[NSString localizedStringWithFormat:@"%1.1f dB", [_compressorBand7Slider floatValue]]];
-}
-
-- (IBAction)resetCompressorValues:(id)sender
-{
-    intf_thread_t *p_intf = getIntf();
-    config_PutFloat(p_intf, "compressor-rms-peak", 0.000000);
-    config_PutFloat(p_intf, "compressor-attack", 25.000000);
-    config_PutFloat(p_intf, "compressor-release", 100.000000);
-    config_PutFloat(p_intf, "compressor-threshold", -11.000000);
-    config_PutFloat(p_intf, "compressor-ratio", 8.000000);
-    config_PutFloat(p_intf, "compressor-knee", 2.500000);
-    config_PutFloat(p_intf, "compressor-makeup-gain", 7.000000);
-
-    audio_output_t *p_aout = getAout();
-    if (p_aout) {
-        var_SetFloat(p_aout, "compressor-rms-peak", 0.000000);
-        var_SetFloat(p_aout, "compressor-attack", 25.000000);
-        var_SetFloat(p_aout, "compressor-release", 100.000000);
-        var_SetFloat(p_aout, "compressor-threshold", -11.000000);
-        var_SetFloat(p_aout, "compressor-ratio", 8.000000);
-        var_SetFloat(p_aout, "compressor-knee", 2.500000);
-        var_SetFloat(p_aout, "compressor-makeup-gain", 7.000000);
-        vlc_object_release(p_aout);
-    }
-    [self resetCompressor];
-}
-
-- (IBAction)compressorEnable:(id)sender
-{
-    [_compressorView enableSubviews:[sender state]];
-    [self setAudioFilter:"compressor" on:[sender state]];
-}
-
-- (IBAction)compressorSliderUpdated:(id)sender
-{
-    audio_output_t *p_aout = getAout();
-    char *value;
-    if (sender == _compressorBand1Slider)
-        value = "compressor-rms-peak";
-    else if (sender == _compressorBand2Slider)
-        value = "compressor-attack";
-    else if (sender == _compressorBand3Slider)
-        value = "compressor-release";
-    else if (sender == _compressorBand4Slider)
-        value = "compressor-threshold";
-    else if (sender == _compressorBand5Slider)
-        value = "compressor-ratio";
-    else if (sender == _compressorBand6Slider)
-        value = "compressor-knee";
-    else if (sender == _compressorBand7Slider)
-        value = "compressor-makeup-gain";
-
-    if (p_aout) {
-        var_SetFloat(p_aout, value, [sender floatValue]);
-        vlc_object_release(p_aout);
-    }
-    config_PutFloat(getIntf(), value, [sender floatValue]);
-
-    if (sender == _compressorBand1Slider)
-        [_compressorBand1TextField setStringValue:[NSString localizedStringWithFormat:@"%1.1f", [sender floatValue]]];
-    else if (sender == _compressorBand2Slider)
-        [_compressorBand2TextField setStringValue:[NSString localizedStringWithFormat:@"%2.1f ms", [sender floatValue]]];
-    else if (sender == _compressorBand3Slider)
-        [_compressorBand3TextField setStringValue:[NSString localizedStringWithFormat:@"%3.1f ms", [sender floatValue]]];
-    else if (sender == _compressorBand4Slider)
-        [_compressorBand4TextField setStringValue:[NSString localizedStringWithFormat:@"%2.1f dB", [sender floatValue]]];
-    else if (sender == _compressorBand5Slider)
-        [_compressorBand5TextField setStringValue:[NSString localizedStringWithFormat:@"%1.1f:1", [sender floatValue]]];
-    else if (sender == _compressorBand6Slider)
-        [_compressorBand6TextField setStringValue:[NSString localizedStringWithFormat:@"%1.1f dB", [sender floatValue]]];
-    else if (sender == _compressorBand7Slider)
-        [_compressorBand7TextField setStringValue:[NSString localizedStringWithFormat:@"%1.1f dB", [sender floatValue]]];
-}
-
-#pragma mark -
-#pragma mark Spatializer
-- (void)resetSpatializer
-{
-    intf_thread_t *p_intf = getIntf();
-    BOOL bEnable_spatializer = NO;
-    char *psz_afilters;
-    psz_afilters = config_GetPsz(p_intf, "audio-filter");
-    if (psz_afilters) {
-        bEnable_spatializer = strstr(psz_afilters, "spatializer") != NULL;
-        free(psz_afilters);
-    }
-
-    [_spatializerView enableSubviews:bEnable_spatializer];
-    [_spatializerEnableCheckbox setState:(bEnable_spatializer ? NSOnState : NSOffState)];
-
-
-#define setSlider(bandsld, bandfld, var) \
-[bandsld setFloatValue: config_GetFloat(p_intf, var) * 10.]; \
-[bandfld setStringValue:[NSString localizedStringWithFormat:@"%1.1f", [bandsld floatValue]]]
-
-    setSlider(_spatializerBand1Slider, _spatializerBand1TextField, "spatializer-roomsize");
-    setSlider(_spatializerBand2Slider, _spatializerBand2TextField, "spatializer-width");
-    setSlider(_spatializerBand3Slider, _spatializerBand3TextField, "spatializer-wet");
-    setSlider(_spatializerBand4Slider, _spatializerBand4TextField, "spatializer-dry");
-    setSlider(_spatializerBand5Slider, _spatializerBand5TextField, "spatializer-damp");
-
-#undef setSlider
-}
-
-- (IBAction)resetSpatializerValues:(id)sender
-{
-    intf_thread_t *p_intf = getIntf();
-    config_PutFloat(p_intf, "spatializer-roomsize", .85);
-    config_PutFloat(p_intf, "spatializer-width", 1.);
-    config_PutFloat(p_intf, "spatializer-wet", .4);
-    config_PutFloat(p_intf, "spatializer-dry", .5);
-    config_PutFloat(p_intf, "spatializer-damp", .5);
-
-    audio_output_t *p_aout = getAout();
-    if (p_aout) {
-        var_SetFloat(p_aout, "spatializer-roomsize", .85);
-        var_SetFloat(p_aout, "spatializer-width", 1.);
-        var_SetFloat(p_aout, "spatializer-wet", .4);
-        var_SetFloat(p_aout, "spatializer-dry", .5);
-        var_SetFloat(p_aout, "spatializer-damp", .5);
-        vlc_object_release(p_aout);
-    }
-    [self resetSpatializer];
-}
-
-- (IBAction)spatializerEnable:(id)sender
-{
-    [_spatializerView enableSubviews:[sender state]];
-    [self setAudioFilter:"spatializer" on:[sender state]];
-}
-
-- (IBAction)spatializerSliderUpdated:(id)sender
-{
-    audio_output_t *p_aout = getAout();
-    char *value = NULL;
-    if (sender == _spatializerBand1Slider)
-        value = "spatializer-roomsize";
-    else if (sender == _spatializerBand2Slider)
-        value = "spatializer-width";
-    else if (sender == _spatializerBand3Slider)
-        value = "spatializer-wet";
-    else if (sender == _spatializerBand4Slider)
-        value = "spatializer-dry";
-    else if (sender == _spatializerBand5Slider)
-        value = "spatializer-damp";
-
-    if (p_aout) {
-        var_SetFloat(p_aout, value, [sender floatValue] / 10.);
-        vlc_object_release(p_aout);
-    }
-    config_PutFloat(getIntf(), value, [sender floatValue] / 10.);
-
-    if (sender == _spatializerBand1Slider)
-        [_spatializerBand1TextField setStringValue:[NSString localizedStringWithFormat:@"%1.1f", [sender floatValue]]];
-    else if (sender == _spatializerBand2Slider)
-        [_spatializerBand2TextField setStringValue:[NSString localizedStringWithFormat:@"%1.1f", [sender floatValue]]];
-    else if (sender == _spatializerBand3Slider)
-        [_spatializerBand3TextField setStringValue:[NSString localizedStringWithFormat:@"%1.1f", [sender floatValue]]];
-    else if (sender == _spatializerBand4Slider)
-        [_spatializerBand4TextField setStringValue:[NSString localizedStringWithFormat:@"%1.1f", [sender floatValue]]];
-    else if (sender == _spatializerBand5Slider)
-        [_spatializerBand5TextField setStringValue:[NSString localizedStringWithFormat:@"%1.1f", [sender floatValue]]];
-}
-
-#pragma mark -
-#pragma mark Filter
-- (void)resetAudioFilters
-{
-    intf_thread_t *p_intf = getIntf();
-    BOOL bEnable_normvol = NO;
-    char *psz_afilters;
-    psz_afilters = config_GetPsz(p_intf, "audio-filter");
-    if (psz_afilters) {
-        [_filterHeadPhoneCheckbox setState: (NSInteger)strstr(psz_afilters, "headphone") ];
-        [_filterKaraokeCheckbox setState: (NSInteger)strstr(psz_afilters, "karaoke") ];
-        bEnable_normvol = strstr(psz_afilters, "normvol") != NULL;
-        free(psz_afilters);
-    } else {
-        [_filterHeadPhoneCheckbox setState: NSOffState];
-        [_filterKaraokeCheckbox setState: NSOffState];
-    }
-
-    [_filterNormLevelSlider setEnabled:bEnable_normvol];
-    [_filterNormLevelLabel setEnabled:bEnable_normvol];
-    [_filterNormLevelCheckbox setState:(bEnable_normvol ? NSOnState : NSOffState)];
-
-    [_filterNormLevelSlider setFloatValue: config_GetFloat(p_intf, "norm-max-level")];
-}
-
-- (IBAction)filterEnableHeadPhoneVirt:(id)sender
-{
-    [self setAudioFilter: "headphone" on:[sender state]];
-}
-
-- (IBAction)filterEnableVolumeNorm:(id)sender
-{
-    [_filterNormLevelSlider setEnabled:[sender state]];
-    [_filterNormLevelLabel setEnabled:[sender state]];
-    [self setAudioFilter: "normvol" on:[sender state]];
-}
-
-- (IBAction)filterVolumeNormSliderUpdated:(id)sender
-{
-    audio_output_t *p_aout = getAout();
-
-    if (p_aout) {
-        var_SetFloat(p_aout, "norm-max-level", [_filterNormLevelSlider floatValue]);
-        vlc_object_release(p_aout);
-    }
-
-    config_PutFloat(getIntf(), "norm-max-level", [_filterNormLevelSlider floatValue]);
-}
-
-- (IBAction)filterEnableKaraoke:(id)sender
-{
-    [self setAudioFilter: "karaoke" on:[sender state]];
-}
-
-@end
index d30ca0a..55e20c6 100644 (file)
@@ -30,7 +30,7 @@
 
 #import "AboutWindowController.h"
 #import "open.h"
-#import "AudioEffects.h"
+#import "VLCAudioEffectsWindowController.h"
 #import "TrackSynchronization.h"
 #import "HelpWindowController.h"
 #import "VideoEffects.h"
index db8c971..b42e9f9 100644 (file)
@@ -29,7 +29,7 @@
 #import "CompatibilityFixes.h"
 #import "MainWindow.h"
 #import "CoreInteraction.h"
-#import "AudioEffects.h"
+#import "VLCAudioEffectsWindowController.h"
 #import "MainMenu.h"
 #import "open.h"
 #import "VLCPlaylist.h"
index 94b4dbc..c7e9ff8 100644 (file)
@@ -25,7 +25,6 @@ libmacosx_plugin_la_SOURCES = \
        AddonsWindowController.h AddonsWindowController.m \
        applescript.h applescript.m \
        AppleRemote.h AppleRemote.m \
-       AudioEffects.h AudioEffects.m \
        BWQuincyManager.h BWQuincyManager.m \
        BWQuincyUI.h BWQuincyUI.m \
        CompatibilityFixes.h \
@@ -75,6 +74,7 @@ libmacosx_plugin_la_SOURCES = \
        VLCStatusBarIcon.h VLCStatusBarIcon.m \
        VLCVoutWindowController.h VLCVoutWindowController.m \
        Windows.h Windows.m \
+       VLCAudioEffectsWindowController.h VLCAudioEffectsWindowController.m \
        VLCBookmarksWindowController.h VLCBookmarksWindowController.m \
        VLCCoreDialogProvider.h VLCCoreDialogProvider.m \
        VLCEyeTvController.h VLCEyeTvController.m \
diff --git a/modules/gui/macosx/VLCAudioEffectsWindowController.h b/modules/gui/macosx/VLCAudioEffectsWindowController.h
new file mode 100644 (file)
index 0000000..b7ae823
--- /dev/null
@@ -0,0 +1,140 @@
+/*****************************************************************************
+ * VLCAudioEffectsWindowController.h: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2004-2015 VLC authors and VideoLAN
+ * $Id$
+ *
+ * Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
+ *          Jérôme Decoodt <djc@videolan.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#import <Cocoa/Cocoa.h>
+
+@class VLCPopupPanelController;
+@class VLCTextfieldPanelController;
+
+@interface VLCAudioEffectsWindowController : NSWindowController
+
+/* generic */
+@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 */
+@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 */
+@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 */
+@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;
+
+@property (strong) VLCPopupPanelController *popupPanel;
+@property (strong) VLCTextfieldPanelController *textfieldPanel;
+
+/* generic */
+- (IBAction)profileSelectorAction:(id)sender;
+
+- (void)toggleWindow:(id)sender;
+- (void)updateCocoaWindowLevel:(NSInteger)i_level;
+- (void)saveCurrentProfile;
+
+/* Equalizer */
+- (IBAction)equalizerBandSliderUpdated:(id)sender;
+- (IBAction)equalizerChangePreset:(id)sender;
+- (IBAction)equalizerEnable:(id)sender;
+- (IBAction)equalizerPreAmpSliderUpdated:(id)sender;
+- (IBAction)equalizerTwoPass:(id)sender;
+
+/* Compressor */
+- (IBAction)resetCompressorValues:(id)sender;
+- (IBAction)compressorEnable:(id)sender;
+- (IBAction)compressorSliderUpdated:(id)sender;
+
+/* Spatializer */
+- (IBAction)resetSpatializerValues:(id)sender;
+- (IBAction)spatializerEnable:(id)sender;
+- (IBAction)spatializerSliderUpdated:(id)sender;
+
+/* Filter */
+- (IBAction)filterEnableHeadPhoneVirt:(id)sender;
+- (IBAction)filterEnableVolumeNorm:(id)sender;
+- (IBAction)filterVolumeNormSliderUpdated:(id)sender;
+- (IBAction)filterEnableKaraoke:(id)sender;
+
+@end
diff --git a/modules/gui/macosx/VLCAudioEffectsWindowController.m b/modules/gui/macosx/VLCAudioEffectsWindowController.m
new file mode 100644 (file)
index 0000000..56cac04
--- /dev/null
@@ -0,0 +1,989 @@
+/*****************************************************************************
+ * VLCAudioEffectsWindowController.m: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2004-2015 VLC authors and VideoLAN
+ * $Id$
+ *
+ * Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
+ *          Jérôme Decoodt <djc@videolan.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# import "config.h"
+#endif
+
+#import "intf.h"
+#import "VLCAudioEffectsWindowController.h"
+#import "../../audio_filter/equalizer_presets.h"
+#import "CompatibilityFixes.h"
+#import "SharedDialogs.h"
+
+#import <vlc_common.h>
+
+#import <math.h>
+
+@interface VLCAudioEffectsWindowController ()
+{
+    NSInteger i_old_profile_index;
+}
+- (void)resetProfileSelector;
+- (void)updatePresetSelector;
+- (void)setBandSliderValuesForPreset:(NSInteger)presetID;
+@end
+
+#pragma mark -
+#pragma mark Initialization
+
+@implementation VLCAudioEffectsWindowController
+
++ (void)initialize
+{
+    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+
+    NSString *workString;
+    NSMutableArray *workValues = [[NSMutableArray alloc] initWithCapacity:NB_PRESETS];
+    NSMutableArray *workPreamp = [[NSMutableArray alloc] initWithCapacity:NB_PRESETS];
+    NSMutableArray *workTitles = [[NSMutableArray alloc] initWithCapacity:NB_PRESETS];
+    NSMutableArray *workNames = [[NSMutableArray alloc] initWithCapacity:NB_PRESETS];
+
+    for (int i = 0 ; i < NB_PRESETS ; i++) {
+        workString = [NSString stringWithFormat:@"%.1f %.1f %.1f %.1f %.1f %.1f %.1f %.1f %.1f %.1f",
+                      eqz_preset_10b[i].f_amp[0],
+                      eqz_preset_10b[i].f_amp[1],
+                      eqz_preset_10b[i].f_amp[2],
+                      eqz_preset_10b[i].f_amp[3],
+                      eqz_preset_10b[i].f_amp[4],
+                      eqz_preset_10b[i].f_amp[5],
+                      eqz_preset_10b[i].f_amp[6],
+                      eqz_preset_10b[i].f_amp[7],
+                      eqz_preset_10b[i].f_amp[8],
+                      eqz_preset_10b[i].f_amp[9]];
+        [workValues addObject:workString];
+        [workPreamp addObject:[NSString stringWithFormat:@"%1.f", eqz_preset_10b[i].f_preamp]];
+        [workTitles addObject:toNSStr(preset_list_text[i])];
+        [workNames addObject:toNSStr(preset_list[i])];
+    }
+
+    NSString *defaultProfile = [NSString stringWithFormat:@"ZmxhdA==;;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%i",
+                                .0,25.,100.,-11.,8.,2.5,7.,.85,1.,.4,.5,.5,2.,0];
+
+    NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithArray:workValues], @"EQValues", [NSArray arrayWithArray:workPreamp], @"EQPreampValues", [NSArray arrayWithArray:workTitles], @"EQTitles", [NSArray arrayWithArray:workNames], @"EQNames", [NSArray arrayWithObject:defaultProfile], @"AudioEffectProfiles", [NSArray arrayWithObject:_NS("Default")], @"AudioEffectProfileNames", nil];
+    [defaults registerDefaults:appDefaults];
+}
+
+- (id)init
+{
+    self = [super initWithWindowNibName:@"AudioEffects"];
+    if (self) {
+        i_old_profile_index = -1;
+
+        self.popupPanel = [[VLCPopupPanelController alloc] init];
+        self.textfieldPanel = [[VLCTextfieldPanelController alloc] init];
+    }
+
+    return self;
+}
+
+- (void)windowDidLoad
+{
+    /* setup the user's language */
+    /* Equalizer */
+    [_equalizerEnableCheckbox setTitle:_NS("Enable")];
+    [_equalizerTwoPassCheckbox setTitle:_NS("2 Pass")];
+    [_equalizerPreampLabel setStringValue:_NS("Preamp")];
+
+    /* Compressor */
+    [_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 */
+    [_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 */
+    [_filterHeadPhoneCheckbox setTitle:_NS("Headphone virtualization")];
+    [_filterNormLevelCheckbox setTitle:_NS("Volume normalization")];
+    [_filterNormLevelLabel setStringValue:_NS("Maximum level")];
+    [_filterKaraokeCheckbox setTitle:_NS("Karaoke")];
+
+    /* generic */
+    [[_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")];
+    [self.window setTitle:_NS("Audio Effects")];
+    [self.window setExcludedFromWindowsMenu:YES];
+    [self.window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
+
+    [self equalizerUpdated];
+    [self resetCompressor];
+    [self resetSpatializer];
+    [self resetAudioFilters];
+    [self resetProfileSelector];
+}
+
+#pragma mark -
+#pragma mark internal functions
+
+- (void)setAudioFilter: (char *)psz_name on:(BOOL)b_on
+{
+    audio_output_t *p_aout = getAout();
+    intf_thread_t *p_intf = getIntf();
+    playlist_EnableAudioFilter(pl_Get(p_intf), psz_name, b_on);
+
+    if (p_aout) {
+        char *psz_new = var_GetNonEmptyString(p_aout, "audio-filter");
+        config_PutPsz(p_intf, "audio-filter", psz_new);
+        free(psz_new);
+
+        vlc_object_release(p_aout);
+    }
+}
+
+- (void)resetProfileSelector
+{
+    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+    [_profilePopup removeAllItems];
+
+    NSArray *profileNames = [defaults objectForKey:@"AudioEffectProfileNames"];
+    [_profilePopup addItemsWithTitles:profileNames];
+
+    [[_profilePopup menu] addItem:[NSMenuItem separatorItem]];
+    [_profilePopup addItemWithTitle:_NS("Duplicate current profile...")];
+    [[_profilePopup lastItem] setTarget: self];
+    [[_profilePopup lastItem] setAction: @selector(addAudioEffectsProfile:)];
+
+    if ([profileNames count] > 1) {
+        [_profilePopup addItemWithTitle:_NS("Organize Profiles...")];
+        [[_profilePopup lastItem] setTarget: self];
+        [[_profilePopup lastItem] setAction: @selector(removeAudioEffectsProfile:)];
+    }
+
+    [_profilePopup selectItemAtIndex:[defaults integerForKey:@"AudioEffectSelectedProfile"]];
+    [self profileSelectorAction:self];
+}
+
+#pragma mark -
+#pragma mark generic code
+- (void)updateCocoaWindowLevel:(NSInteger)i_level
+{
+    if (self.isWindowLoaded && [self.window isVisible] && [self.window level] != i_level)
+        [self.window setLevel: i_level];
+}
+
+- (IBAction)toggleWindow:(id)sender
+{
+    if ([self.window isKeyWindow])
+        [self.window orderOut:sender];
+    else {
+        [self.window setLevel: [[[VLCMain sharedInstance] voutController] currentStatusWindowLevel]];
+        [self.window makeKeyAndOrderFront:sender];
+    }
+}
+
+- (NSString *)generateProfileString
+{
+    intf_thread_t *p_intf = getIntf();
+    vlc_object_t *p_object = VLC_OBJECT(getAout());
+    if (p_object == NULL)
+        p_object = vlc_object_hold(pl_Get(p_intf));
+
+    NSString *o_str = [NSString stringWithFormat:@"%@;%@;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%lli",
+                       B64EncAndFree(var_GetNonEmptyString(p_object, "equalizer-preset")),
+                       B64EncAndFree(config_GetPsz(p_intf, "audio-filter")),
+                       config_GetFloat(p_intf, "compressor-rms-peak"),
+                       config_GetFloat(p_intf, "compressor-attack"),
+                       config_GetFloat(p_intf, "compressor-release"),
+                       config_GetFloat(p_intf, "compressor-threshold"),
+                       config_GetFloat(p_intf, "compressor-ratio"),
+                       config_GetFloat(p_intf, "compressor-knee"),
+                       config_GetFloat(p_intf, "compressor-makeup-gain"),
+                       config_GetFloat(p_intf, "spatializer-roomsize"),
+                       config_GetFloat(p_intf, "spatializer-width"),
+                       config_GetFloat(p_intf, "spatializer-wet"),
+                       config_GetFloat(p_intf, "spatializer-dry"),
+                       config_GetFloat(p_intf, "spatializer-damp"),
+                       config_GetFloat(p_intf, "norm-max-level"),
+                       config_GetInt(p_intf,"equalizer-2pass")];
+
+    vlc_object_release(p_object);
+    return o_str;
+}
+
+- (void)saveCurrentProfile
+{
+    if (i_old_profile_index == -1)
+        return;
+
+    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+    /* fetch all the current settings in a uniform string */
+    NSString *newProfile = [self generateProfileString];
+
+    NSMutableArray *workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"AudioEffectProfiles"]];
+    if (i_old_profile_index >= [workArray count])
+        return;
+
+    [workArray replaceObjectAtIndex:i_old_profile_index withObject:newProfile];
+    [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"AudioEffectProfiles"];
+    [defaults synchronize];
+}
+
+- (IBAction)profileSelectorAction:(id)sender
+{
+    intf_thread_t *p_intf = getIntf();
+    [self saveCurrentProfile];
+    i_old_profile_index = [_profilePopup indexOfSelectedItem];
+
+    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+    NSInteger selectedProfile = [_profilePopup indexOfSelectedItem];
+    if (selectedProfile < 0)
+        return;
+
+    audio_output_t *p_aout = getAout();
+    playlist_t *p_playlist = pl_Get(p_intf);
+
+    if (p_aout) {
+        /* disable existing filters */
+        playlist_EnableAudioFilter(p_playlist, "equalizer", false);
+        playlist_EnableAudioFilter(p_playlist, "compressor", false);
+        playlist_EnableAudioFilter(p_playlist, "spatializer", false);
+        playlist_EnableAudioFilter(p_playlist, "compressor", false);
+        playlist_EnableAudioFilter(p_playlist, "headphone", false);
+        playlist_EnableAudioFilter(p_playlist, "normvol", false);
+        playlist_EnableAudioFilter(p_playlist, "karaoke", false);
+    }
+
+    /* fetch preset */
+    NSArray *items = [[[defaults objectForKey:@"AudioEffectProfiles"] objectAtIndex:(NSUInteger) selectedProfile] componentsSeparatedByString:@";"];
+
+    /* eq preset */
+    vlc_object_t *p_object = VLC_OBJECT(getAout());
+    if (p_object == NULL)
+        p_object = vlc_object_hold(pl_Get(p_intf));
+    var_SetString(p_object, "equalizer-preset", [B64DecNSStr([items firstObject]) UTF8String]);
+    vlc_object_release(p_object);
+
+    /* filter handling */
+    NSString *tempString = B64DecNSStr([items objectAtIndex:1]);
+    NSArray *tempArray;
+    NSUInteger count;
+    /* enable the new filters, if we have an aout */
+    if (p_aout) {
+        if ([tempString length] > 0) {
+            tempArray = [tempString componentsSeparatedByString:@":"];
+            count = [tempArray count];
+            for (NSUInteger x = 0; x < count; x++)
+                playlist_EnableAudioFilter(p_playlist, [[tempArray objectAtIndex:x] UTF8String], true);
+        }
+    }
+    config_PutPsz(p_intf,"audio-filter",[tempString UTF8String]);
+
+    /* values */
+    config_PutFloat(p_intf, "compressor-rms-peak",[[items objectAtIndex:2] floatValue]);
+    config_PutFloat(p_intf, "compressor-attack",[[items objectAtIndex:3] floatValue]);
+    config_PutFloat(p_intf, "compressor-release",[[items objectAtIndex:4] floatValue]);
+    config_PutFloat(p_intf, "compressor-threshold",[[items objectAtIndex:5] floatValue]);
+    config_PutFloat(p_intf, "compressor-ratio",[[items objectAtIndex:6] floatValue]);
+    config_PutFloat(p_intf, "compressor-knee",[[items objectAtIndex:7] floatValue]);
+    config_PutFloat(p_intf, "compressor-makeup-gain",[[items objectAtIndex:8] floatValue]);
+    config_PutFloat(p_intf, "spatializer-roomsize",[[items objectAtIndex:9] floatValue]);
+    config_PutFloat(p_intf, "spatializer-width",[[items objectAtIndex:10] floatValue]);
+    config_PutFloat(p_intf, "spatializer-wet",[[items objectAtIndex:11] floatValue]);
+    config_PutFloat(p_intf, "spatializer-dry",[[items objectAtIndex:12] floatValue]);
+    config_PutFloat(p_intf, "spatializer-damp",[[items objectAtIndex:13] floatValue]);
+    config_PutFloat(p_intf, "norm-max-level",[[items objectAtIndex:14] floatValue]);
+    config_PutInt(p_intf, "equalizer-2pass",[[items objectAtIndex:15] intValue]);
+
+    /* set values on-the-fly if we have an aout */
+    if (p_aout) {
+        var_SetFloat(p_aout, "compressor-rms-peak", [[items objectAtIndex:2] floatValue]);
+        var_SetFloat(p_aout, "compressor-attack", [[items objectAtIndex:3] floatValue]);
+        var_SetFloat(p_aout, "compressor-release", [[items objectAtIndex:4] floatValue]);
+        var_SetFloat(p_aout, "compressor-threshold", [[items objectAtIndex:5] floatValue]);
+        var_SetFloat(p_aout, "compressor-ratio", [[items objectAtIndex:6] floatValue]);
+        var_SetFloat(p_aout, "compressor-knee", [[items objectAtIndex:7] floatValue]);
+        var_SetFloat(p_aout, "compressor-makeup-gain", [[items objectAtIndex:8] floatValue]);
+        var_SetFloat(p_aout, "spatializer-roomsize", [[items objectAtIndex:9] floatValue]);
+        var_SetFloat(p_aout, "spatializer-width", [[items objectAtIndex:10] floatValue]);
+        var_SetFloat(p_aout, "spatializer-wet", [[items objectAtIndex:11] floatValue]);
+        var_SetFloat(p_aout, "spatializer-dry", [[items objectAtIndex:12] floatValue]);
+        var_SetFloat(p_aout, "spatializer-damp", [[items objectAtIndex:13] floatValue]);
+        var_SetFloat(p_aout, "norm-max-level", [[items objectAtIndex:14] floatValue]);
+        var_SetBool(p_aout, "equalizer-2pass", (BOOL)[[items objectAtIndex:15] intValue]);
+    }
+
+    /* update UI */
+    BOOL b_equalizerEnabled = [tempString rangeOfString:@"equalizer"].location != NSNotFound;
+    [_equalizerView enableSubviews:b_equalizerEnabled];
+    [_equalizerEnableCheckbox setState:(b_equalizerEnabled ? NSOnState : NSOffState)];
+
+    [_equalizerTwoPassCheckbox setState:[[items objectAtIndex:15] intValue]];
+    [self resetCompressor];
+    [self resetSpatializer];
+    [self resetAudioFilters];
+    [self updatePresetSelector];
+
+    /* store current profile selection */
+    [defaults setInteger:selectedProfile forKey:@"AudioEffectSelectedProfile"];
+    [defaults synchronize];
+
+    if (p_aout)
+        vlc_object_release(p_aout);
+}
+
+- (void)addAudioEffectsProfile:(id)sender
+{
+    /* show panel */
+    [_textfieldPanel setTitleString:_NS("Duplicate current profile for a new profile")];
+    [_textfieldPanel setSubTitleString:_NS("Enter a name for the new profile:")];
+    [_textfieldPanel setCancelButtonString:_NS("Cancel")];
+    [_textfieldPanel setOkButtonString:_NS("Save")];
+
+    __weak typeof(self) _self = self;
+    [_textfieldPanel runModalForWindow:self.window completionHandler:^(NSInteger returnCode, NSString *resultingText) {
+
+        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+        if (returnCode != NSOKButton) {
+            [_profilePopup selectItemAtIndex:[defaults integerForKey:@"AudioEffectSelectedProfile"]];
+            return;
+        }
+
+        NSArray *profileNames = [defaults objectForKey:@"AudioEffectProfileNames"];
+
+        // duplicate names are not allowed in the popup control
+        if ([resultingText length] == 0 || [profileNames containsObject:resultingText]) {
+            [_profilePopup selectItemAtIndex:[defaults integerForKey:@"AudioEffectSelectedProfile"]];
+
+            NSAlert *alert = [[NSAlert alloc] init];
+            [alert setAlertStyle:NSCriticalAlertStyle];
+            [alert setMessageText:_NS("Please enter a unique name for the new profile.")];
+            [alert setInformativeText:_NS("Multiple profiles with the same name are not allowed.")];
+
+            [alert beginSheetModalForWindow:_self.window
+                              modalDelegate:nil
+                             didEndSelector:nil
+                                contextInfo:nil];
+            return;
+        }
+
+        NSString *newProfile = [_self generateProfileString];
+
+        /* add string to user defaults as well as a label */
+        NSMutableArray *workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"AudioEffectProfiles"]];
+        [workArray addObject:newProfile];
+        [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"AudioEffectProfiles"];
+        [defaults setInteger:[workArray count] - 1 forKey:@"AudioEffectSelectedProfile"];
+        workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"AudioEffectProfileNames"]];
+        [workArray addObject:resultingText];
+        [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"AudioEffectProfileNames"];
+
+        /* save defaults */
+        [defaults synchronize];
+        [_self resetProfileSelector];
+
+    }];
+}
+
+- (void)removeAudioEffectsProfile:(id)sender
+{
+    /* show panel */
+    [_popupPanel setTitleString:_NS("Remove a preset")];
+    [_popupPanel setSubTitleString:_NS("Select the preset you would like to remove:")];
+    [_popupPanel setOkButtonString:_NS("Remove")];
+    [_popupPanel setCancelButtonString:_NS("Cancel")];
+    [_popupPanel setPopupButtonContent:[[NSUserDefaults standardUserDefaults] objectForKey:@"AudioEffectProfileNames"]];
+
+    __weak typeof(self) _self = self;
+    [_popupPanel runModalForWindow:self.window completionHandler:^(NSInteger returnCode, NSInteger selectedIndex) {
+
+        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+        if (returnCode != NSOKButton) {
+            [_profilePopup selectItemAtIndex:[defaults integerForKey:@"AudioEffectSelectedProfile"]];
+            return;
+        }
+
+        /* remove selected profile from settings */
+        NSMutableArray *workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"AudioEffectProfiles"]];
+        [workArray removeObjectAtIndex:selectedIndex];
+        [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"AudioEffectProfiles"];
+        workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"AudioEffectProfileNames"]];
+        [workArray removeObjectAtIndex:selectedIndex];
+        [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"AudioEffectProfileNames"];
+
+        if (i_old_profile_index >= selectedIndex)
+            [defaults setInteger:i_old_profile_index - 1 forKey:@"AudioEffectSelectedProfile"];
+
+        /* save defaults */
+        [defaults synchronize];
+        [_self resetProfileSelector];
+    }];
+}
+
+#pragma mark -
+#pragma mark Equalizer
+static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
+                               char *psz_name)
+{
+    char *psz_parser, *psz_string = NULL;
+    audio_output_t *p_aout = getAout();
+    if (!p_aout)
+        return false;
+
+    psz_string = config_GetPsz(p_custom_intf, "audio-filter");
+
+    if (!psz_string)
+        psz_string = var_GetNonEmptyString(p_aout, "audio-filter");
+
+    vlc_object_release(p_aout);
+
+    if (!psz_string)
+        return false;
+
+    psz_parser = strstr(psz_string, psz_name);
+
+    free(psz_string);
+
+    if (psz_parser)
+        return true;
+    else
+        return false;
+}
+
+- (void)updatePresetSelector
+{
+    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+    NSArray *presets = [defaults objectForKey:@"EQNames"];
+
+    [_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) {
+        [_equalizerPresetsPopup addItemWithTitle:_NS("Organize Presets...")];
+        [[_equalizerPresetsPopup lastItem] setTarget: self];
+        [[_equalizerPresetsPopup lastItem] setAction: @selector(deletePresetAction:)];
+    }
+
+    audio_output_t *p_aout = getAout();
+
+    NSString *currentPreset = nil;
+    if (p_aout) {
+        char *psz_preset_string = var_GetNonEmptyString(p_aout, "equalizer-preset");
+        currentPreset = toNSStr(psz_preset_string);
+        free(psz_preset_string);
+        vlc_object_release(p_aout);
+    }
+
+    NSUInteger currentPresetIndex = 0;
+    if (currentPreset && [currentPreset length] > 0) {
+        currentPresetIndex = [presets indexOfObject:currentPreset];
+
+        if (currentPresetIndex == NSNotFound)
+            currentPresetIndex = [presets count] - 1;
+    }    
+
+    [_equalizerPresetsPopup selectItemAtIndex:currentPresetIndex];
+    [self equalizerChangePreset:_equalizerPresetsPopup];
+
+    
+    [_equalizerPreampSlider setFloatValue:[[[defaults objectForKey:@"EQPreampValues"] objectAtIndex:currentPresetIndex] floatValue]];
+    [self setBandSliderValuesForPreset:currentPresetIndex];
+}
+
+- (void)equalizerUpdated
+{
+    intf_thread_t *p_intf = getIntf();
+    float fPreamp = config_GetFloat(p_intf, "equalizer-preamp");
+    bool b_2p = (BOOL)config_GetInt(p_intf, "equalizer-2pass");
+    bool bEnabled = GetEqualizerStatus(p_intf, (char *)"equalizer");
+
+    /* Setup sliders */
+    [self updatePresetSelector];
+
+    /* Set the the checkboxes */
+    [_equalizerView enableSubviews: bEnabled];
+    [_equalizerEnableCheckbox setState: bEnabled];
+    [_equalizerTwoPassCheckbox setState: b_2p];
+}
+
+- (id)sliderByIndex:(int)index
+{
+    switch(index) {
+        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;
+    }
+}
+
+- (void)setBandSliderValuesForPreset:(NSInteger)presetID
+{
+    NSString *preset = [[[NSUserDefaults standardUserDefaults] objectForKey:@"EQValues"] objectAtIndex:presetID];
+    NSArray *values = [preset componentsSeparatedByString:@" "];
+    NSUInteger count = [values count];
+    for (NSUInteger x = 0; x < count; x++)
+        [self setValue:[[values objectAtIndex:x] floatValue] forSlider:x];
+}
+
+- (NSString *)generatePresetString
+{
+    return [NSString stringWithFormat:@"%.1f %.1f %.1f %.1f %.1f %.1f %.1f %.1f %.1f %.1f",
+            [_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
+{
+    id slider = [self sliderByIndex:index];
+
+    if (slider != nil)
+        [slider setFloatValue:value];
+}
+
+- (IBAction)equalizerEnable:(id)sender
+{
+    [_equalizerView enableSubviews:[sender state]];
+    [self setAudioFilter: "equalizer" on:[sender state]];
+}
+
+- (IBAction)equalizerBandSliderUpdated:(id)sender
+{
+    audio_output_t *p_aout = getAout();
+    if (p_aout) {
+        var_SetString(p_aout, "equalizer-bands", [[self generatePresetString] UTF8String]);
+        vlc_object_release(p_aout);
+    }
+
+    /* save changed to config */
+    config_PutPsz(getIntf(), "equalizer-bands", [[self generatePresetString] UTF8String]);
+
+}
+
+- (IBAction)equalizerChangePreset:(id)sender
+{
+    intf_thread_t *p_intf = getIntf();
+    NSInteger numberOfChosenPreset = [sender indexOfSelectedItem];
+    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+
+    NSString *preset = [[defaults objectForKey:@"EQValues"] objectAtIndex:numberOfChosenPreset];
+    NSString *preamp = [[defaults objectForKey:@"EQPreampValues"] objectAtIndex:numberOfChosenPreset];
+
+    audio_output_t *p_aout = getAout();
+    if (p_aout) {
+        var_SetString(p_aout, "equalizer-bands", [preset UTF8String]);
+        var_SetFloat(p_aout, "equalizer-preamp", [preamp floatValue]);
+        var_SetString(p_aout, "equalizer-preset" , [[[defaults objectForKey:@"EQNames"] objectAtIndex:numberOfChosenPreset] UTF8String]);
+        vlc_object_release(p_aout);
+    }
+
+    [_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)equalizerPreAmpSliderUpdated:(id)sender
+{
+    float fPreamp = [sender floatValue] ;
+
+    audio_output_t *p_aout = getAout();
+    if (p_aout) {
+        var_SetFloat(p_aout, "equalizer-preamp", fPreamp);
+        vlc_object_release(p_aout);
+    }
+    
+    /* save changed to config */
+    config_PutFloat(getIntf(), "equalizer-preamp", fPreamp);
+}
+
+- (IBAction)equalizerTwoPass:(id)sender
+{
+    bool b_2p = [sender state] ? true : false;
+
+    audio_output_t *p_aout = getAout();
+    if (p_aout) {
+        var_SetBool(p_aout, "equalizer-2pass", b_2p);
+        vlc_object_release(p_aout);
+    }
+
+    /* save changed to config */
+    config_PutInt(getIntf(), "equalizer-2pass", (int)b_2p);
+}
+
+- (IBAction)addPresetAction:(id)sender
+{
+    /* show panel */
+    [_textfieldPanel setTitleString:_NS("Save current selection as new preset")];
+    [_textfieldPanel setSubTitleString:_NS("Enter a name for the new preset:")];
+    [_textfieldPanel setCancelButtonString:_NS("Cancel")];
+    [_textfieldPanel setOkButtonString:_NS("Save")];
+
+    __weak typeof(self) _self = self;
+    [_textfieldPanel runModalForWindow:self.window completionHandler:^(NSInteger returnCode, NSString *resultingText) {
+        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+
+        // EQ settings
+        if (returnCode != NSOKButton || [resultingText length] == 0)
+            return;
+
+        NSMutableArray *workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQValues"]];
+        [workArray addObject:[self generatePresetString]];
+        [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQValues"];
+        workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQTitles"]];
+        [workArray addObject:resultingText];
+        [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQTitles"];
+        workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQPreampValues"]];
+        [workArray addObject:[NSString stringWithFormat:@"%.1f", [_equalizerPreampSlider floatValue]]];
+        [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQPreampValues"];
+        workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQNames"]];
+        [workArray addObject:[resultingText decomposedStringWithCanonicalMapping]];
+        [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQNames"];
+        [defaults synchronize];
+
+        /* update VLC internals */
+        audio_output_t *p_aout = getAout();
+        if (p_aout) {
+            var_SetString(p_aout, "equalizer-preset", [[resultingText decomposedStringWithCanonicalMapping] UTF8String]);
+            vlc_object_release(p_aout);
+        }
+
+        config_PutPsz(getIntf(), "equalizer-preset", [[resultingText decomposedStringWithCanonicalMapping] UTF8String]);
+
+        /* update UI */
+        [_self updatePresetSelector];
+    }];
+}
+
+- (IBAction)deletePresetAction:(id)sender
+{
+    [_popupPanel setTitleString:_NS("Remove a preset")];
+    [_popupPanel setSubTitleString:_NS("Select the preset you would like to remove:")];
+    [_popupPanel setOkButtonString:_NS("Remove")];
+    [_popupPanel setCancelButtonString:_NS("Cancel")];
+    [_popupPanel setPopupButtonContent:[[NSUserDefaults standardUserDefaults] objectForKey:@"EQTitles"]];
+
+    __weak typeof(self) _self = self;
+    [_popupPanel runModalForWindow:self.window completionHandler:^(NSInteger returnCode, NSInteger selectedIndex) {
+
+        if (returnCode != NSOKButton)
+            return;
+
+        /* remove requested profile from the arrays */
+        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+        NSMutableArray *workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQValues"]];
+        [workArray removeObjectAtIndex:selectedIndex];
+        [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQValues"];
+        workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQTitles"]];
+        [workArray removeObjectAtIndex:selectedIndex];
+        [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQTitles"];
+        workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQPreampValues"]];
+        [workArray removeObjectAtIndex:selectedIndex];
+        [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQPreampValues"];
+        workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQNames"]];
+        [workArray removeObjectAtIndex:selectedIndex];
+        [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQNames"];
+        [defaults synchronize];
+
+        /* update UI */
+        [_self updatePresetSelector];
+    }];
+}
+
+#pragma mark -
+#pragma mark Compressor
+- (void)resetCompressor
+{
+    intf_thread_t *p_intf = getIntf();
+    BOOL bEnable_compressor = NO;
+    char *psz_afilters;
+    psz_afilters = config_GetPsz(p_intf, "audio-filter");
+    if (psz_afilters) {
+        bEnable_compressor = strstr(psz_afilters, "compressor") != NULL;
+        [_compressorEnableCheckbox setState: (NSInteger)strstr(psz_afilters, "compressor") ];
+        free(psz_afilters);
+    }
+
+    [_compressorView enableSubviews:bEnable_compressor];
+    [_compressorEnableCheckbox setState:(bEnable_compressor ? NSOnState : NSOffState)];
+
+    [_compressorBand1Slider setFloatValue: config_GetFloat(p_intf, "compressor-rms-peak")];
+    [_compressorBand1TextField setStringValue:[NSString localizedStringWithFormat:@"%1.1f", [_compressorBand1Slider floatValue]]];
+    [_compressorBand2Slider setFloatValue: config_GetFloat(p_intf, "compressor-attack")];
+    [_compressorBand2TextField setStringValue:[NSString localizedStringWithFormat:@"%2.1f ms", [_compressorBand2Slider floatValue]]];
+    [_compressorBand3Slider setFloatValue: config_GetFloat(p_intf, "compressor-release")];
+    [_compressorBand3TextField setStringValue:[NSString localizedStringWithFormat:@"%3.1f ms", [_compressorBand3Slider floatValue]]];
+    [_compressorBand4Slider setFloatValue: config_GetFloat(p_intf, "compressor-threshold")];
+    [_compressorBand4TextField setStringValue:[NSString localizedStringWithFormat:@"%2.1f dB", [_compressorBand4Slider floatValue]]];
+    [_compressorBand5Slider setFloatValue: config_GetFloat(p_intf, "compressor-ratio")];
+    [_compressorBand5TextField setStringValue:[NSString localizedStringWithFormat:@"%1.1f:1", [_compressorBand5Slider floatValue]]];
+    [_compressorBand6Slider setFloatValue: config_GetFloat(p_intf, "compressor-knee")];
+    [_compressorBand6TextField setStringValue:[NSString localizedStringWithFormat:@"%1.1f dB", [_compressorBand6Slider floatValue]]];
+    [_compressorBand7Slider setFloatValue: config_GetFloat(p_intf, "compressor-makeup-gain")];
+    [_compressorBand7TextField setStringValue:[NSString localizedStringWithFormat:@"%1.1f dB", [_compressorBand7Slider floatValue]]];
+}
+
+- (IBAction)resetCompressorValues:(id)sender
+{
+    intf_thread_t *p_intf = getIntf();
+    config_PutFloat(p_intf, "compressor-rms-peak", 0.000000);
+    config_PutFloat(p_intf, "compressor-attack", 25.000000);
+    config_PutFloat(p_intf, "compressor-release", 100.000000);
+    config_PutFloat(p_intf, "compressor-threshold", -11.000000);
+    config_PutFloat(p_intf, "compressor-ratio", 8.000000);
+    config_PutFloat(p_intf, "compressor-knee", 2.500000);
+    config_PutFloat(p_intf, "compressor-makeup-gain", 7.000000);
+
+    audio_output_t *p_aout = getAout();
+    if (p_aout) {
+        var_SetFloat(p_aout, "compressor-rms-peak", 0.000000);
+        var_SetFloat(p_aout, "compressor-attack", 25.000000);
+        var_SetFloat(p_aout, "compressor-release", 100.000000);
+        var_SetFloat(p_aout, "compressor-threshold", -11.000000);
+        var_SetFloat(p_aout, "compressor-ratio", 8.000000);
+        var_SetFloat(p_aout, "compressor-knee", 2.500000);
+        var_SetFloat(p_aout, "compressor-makeup-gain", 7.000000);
+        vlc_object_release(p_aout);
+    }
+    [self resetCompressor];
+}
+
+- (IBAction)compressorEnable:(id)sender
+{
+    [_compressorView enableSubviews:[sender state]];
+    [self setAudioFilter:"compressor" on:[sender state]];
+}
+
+- (IBAction)compressorSliderUpdated:(id)sender
+{
+    audio_output_t *p_aout = getAout();
+    char *value;
+    if (sender == _compressorBand1Slider)
+        value = "compressor-rms-peak";
+    else if (sender == _compressorBand2Slider)
+        value = "compressor-attack";
+    else if (sender == _compressorBand3Slider)
+        value = "compressor-release";
+    else if (sender == _compressorBand4Slider)
+        value = "compressor-threshold";
+    else if (sender == _compressorBand5Slider)
+        value = "compressor-ratio";
+    else if (sender == _compressorBand6Slider)
+        value = "compressor-knee";
+    else if (sender == _compressorBand7Slider)
+        value = "compressor-makeup-gain";
+
+    if (p_aout) {
+        var_SetFloat(p_aout, value, [sender floatValue]);
+        vlc_object_release(p_aout);
+    }
+    config_PutFloat(getIntf(), value, [sender floatValue]);
+
+    if (sender == _compressorBand1Slider)
+        [_compressorBand1TextField setStringValue:[NSString localizedStringWithFormat:@"%1.1f", [sender floatValue]]];
+    else if (sender == _compressorBand2Slider)
+        [_compressorBand2TextField setStringValue:[NSString localizedStringWithFormat:@"%2.1f ms", [sender floatValue]]];
+    else if (sender == _compressorBand3Slider)
+        [_compressorBand3TextField setStringValue:[NSString localizedStringWithFormat:@"%3.1f ms", [sender floatValue]]];
+    else if (sender == _compressorBand4Slider)
+        [_compressorBand4TextField setStringValue:[NSString localizedStringWithFormat:@"%2.1f dB", [sender floatValue]]];
+    else if (sender == _compressorBand5Slider)
+        [_compressorBand5TextField setStringValue:[NSString localizedStringWithFormat:@"%1.1f:1", [sender floatValue]]];
+    else if (sender == _compressorBand6Slider)
+        [_compressorBand6TextField setStringValue:[NSString localizedStringWithFormat:@"%1.1f dB", [sender floatValue]]];
+    else if (sender == _compressorBand7Slider)
+        [_compressorBand7TextField setStringValue:[NSString localizedStringWithFormat:@"%1.1f dB", [sender floatValue]]];
+}
+
+#pragma mark -
+#pragma mark Spatializer
+- (void)resetSpatializer
+{
+    intf_thread_t *p_intf = getIntf();
+    BOOL bEnable_spatializer = NO;
+    char *psz_afilters;
+    psz_afilters = config_GetPsz(p_intf, "audio-filter");
+    if (psz_afilters) {
+        bEnable_spatializer = strstr(psz_afilters, "spatializer") != NULL;
+        free(psz_afilters);
+    }
+
+    [_spatializerView enableSubviews:bEnable_spatializer];
+    [_spatializerEnableCheckbox setState:(bEnable_spatializer ? NSOnState : NSOffState)];
+
+
+#define setSlider(bandsld, bandfld, var) \
+[bandsld setFloatValue: config_GetFloat(p_intf, var) * 10.]; \
+[bandfld setStringValue:[NSString localizedStringWithFormat:@"%1.1f", [bandsld floatValue]]]
+
+    setSlider(_spatializerBand1Slider, _spatializerBand1TextField, "spatializer-roomsize");
+    setSlider(_spatializerBand2Slider, _spatializerBand2TextField, "spatializer-width");
+    setSlider(_spatializerBand3Slider, _spatializerBand3TextField, "spatializer-wet");
+    setSlider(_spatializerBand4Slider, _spatializerBand4TextField, "spatializer-dry");
+    setSlider(_spatializerBand5Slider, _spatializerBand5TextField, "spatializer-damp");
+
+#undef setSlider
+}
+
+- (IBAction)resetSpatializerValues:(id)sender
+{
+    intf_thread_t *p_intf = getIntf();
+    config_PutFloat(p_intf, "spatializer-roomsize", .85);
+    config_PutFloat(p_intf, "spatializer-width", 1.);
+    config_PutFloat(p_intf, "spatializer-wet", .4);
+    config_PutFloat(p_intf, "spatializer-dry", .5);
+    config_PutFloat(p_intf, "spatializer-damp", .5);
+
+    audio_output_t *p_aout = getAout();
+    if (p_aout) {
+        var_SetFloat(p_aout, "spatializer-roomsize", .85);
+        var_SetFloat(p_aout, "spatializer-width", 1.);
+        var_SetFloat(p_aout, "spatializer-wet", .4);
+        var_SetFloat(p_aout, "spatializer-dry", .5);
+        var_SetFloat(p_aout, "spatializer-damp", .5);
+        vlc_object_release(p_aout);
+    }
+    [self resetSpatializer];
+}
+
+- (IBAction)spatializerEnable:(id)sender
+{
+    [_spatializerView enableSubviews:[sender state]];
+    [self setAudioFilter:"spatializer" on:[sender state]];
+}
+
+- (IBAction)spatializerSliderUpdated:(id)sender
+{
+    audio_output_t *p_aout = getAout();
+    char *value = NULL;
+    if (sender == _spatializerBand1Slider)
+        value = "spatializer-roomsize";
+    else if (sender == _spatializerBand2Slider)
+        value = "spatializer-width";
+    else if (sender == _spatializerBand3Slider)
+        value = "spatializer-wet";
+    else if (sender == _spatializerBand4Slider)
+        value = "spatializer-dry";
+    else if (sender == _spatializerBand5Slider)
+        value = "spatializer-damp";
+
+    if (p_aout) {
+        var_SetFloat(p_aout, value, [sender floatValue] / 10.);
+        vlc_object_release(p_aout);
+    }
+    config_PutFloat(getIntf(), value, [sender floatValue] / 10.);
+
+    if (sender == _spatializerBand1Slider)
+        [_spatializerBand1TextField setStringValue:[NSString localizedStringWithFormat:@"%1.1f", [sender floatValue]]];
+    else if (sender == _spatializerBand2Slider)
+        [_spatializerBand2TextField setStringValue:[NSString localizedStringWithFormat:@"%1.1f", [sender floatValue]]];
+    else if (sender == _spatializerBand3Slider)
+        [_spatializerBand3TextField setStringValue:[NSString localizedStringWithFormat:@"%1.1f", [sender floatValue]]];
+    else if (sender == _spatializerBand4Slider)
+        [_spatializerBand4TextField setStringValue:[NSString localizedStringWithFormat:@"%1.1f", [sender floatValue]]];
+    else if (sender == _spatializerBand5Slider)
+        [_spatializerBand5TextField setStringValue:[NSString localizedStringWithFormat:@"%1.1f", [sender floatValue]]];
+}
+
+#pragma mark -
+#pragma mark Filter
+- (void)resetAudioFilters
+{
+    intf_thread_t *p_intf = getIntf();
+    BOOL bEnable_normvol = NO;
+    char *psz_afilters;
+    psz_afilters = config_GetPsz(p_intf, "audio-filter");
+    if (psz_afilters) {
+        [_filterHeadPhoneCheckbox setState: (NSInteger)strstr(psz_afilters, "headphone") ];
+        [_filterKaraokeCheckbox setState: (NSInteger)strstr(psz_afilters, "karaoke") ];
+        bEnable_normvol = strstr(psz_afilters, "normvol") != NULL;
+        free(psz_afilters);
+    } else {
+        [_filterHeadPhoneCheckbox setState: NSOffState];
+        [_filterKaraokeCheckbox setState: NSOffState];
+    }
+
+    [_filterNormLevelSlider setEnabled:bEnable_normvol];
+    [_filterNormLevelLabel setEnabled:bEnable_normvol];
+    [_filterNormLevelCheckbox setState:(bEnable_normvol ? NSOnState : NSOffState)];
+
+    [_filterNormLevelSlider setFloatValue: config_GetFloat(p_intf, "norm-max-level")];
+}
+
+- (IBAction)filterEnableHeadPhoneVirt:(id)sender
+{
+    [self setAudioFilter: "headphone" on:[sender state]];
+}
+
+- (IBAction)filterEnableVolumeNorm:(id)sender
+{
+    [_filterNormLevelSlider setEnabled:[sender state]];
+    [_filterNormLevelLabel setEnabled:[sender state]];
+    [self setAudioFilter: "normvol" on:[sender state]];
+}
+
+- (IBAction)filterVolumeNormSliderUpdated:(id)sender
+{
+    audio_output_t *p_aout = getAout();
+
+    if (p_aout) {
+        var_SetFloat(p_aout, "norm-max-level", [_filterNormLevelSlider floatValue]);
+        vlc_object_release(p_aout);
+    }
+
+    config_PutFloat(getIntf(), "norm-max-level", [_filterNormLevelSlider floatValue]);
+}
+
+- (IBAction)filterEnableKaraoke:(id)sender
+{
+    [self setAudioFilter: "karaoke" on:[sender state]];
+}
+
+@end
index f0ba100..6347d56 100644 (file)
@@ -31,7 +31,7 @@
 #import "VideoView.h"
 
 #import "VideoEffects.h"
-#import "AudioEffects.h"
+#import "VLCAudioEffectsWindowController.h"
 #import "VLCPlaylistInfo.h"
 #import "VLCBookmarksWindowController.h"
 #import "TrackSynchronization.h"
index 6ea11e7..a322cbf 100644 (file)
@@ -68,7 +68,7 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification";
 @class VLCOpen;
 @class VLCDebugMessageVisualizer;
 @class VLCTrackSynchronization;
-@class VLCAudioEffects;
+@class VLCAudioEffectsWindowController;
 @class VLCVideoEffects;
 @class VLCConvertAndSave;
 @class ExtensionsManager;
@@ -100,7 +100,7 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification";
 - (VLCDebugMessageVisualizer *)debugMsgPanel;
 
 - (VLCTrackSynchronization *)trackSyncPanel;
-- (VLCAudioEffects *)audioEffectsPanel;
+- (VLCAudioEffectsWindowController *)audioEffectsPanel;
 - (VLCVideoEffects *)videoEffectsPanel;
 
 - (VLCInfo *)currentMediaInfoPanel;
index 69216c1..eb5f290 100644 (file)
@@ -63,7 +63,7 @@
 #import "ConvertAndSave.h"
 
 #import "VideoEffects.h"
-#import "AudioEffects.h"
+#import "VLCAudioEffectsWindowController.h"
 #import "intf-prefs.h"
 
 #ifdef HAVE_SPARKLE
@@ -177,7 +177,7 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
     VLCDebugMessageVisualizer *_messagePanelController;
     VLCStatusBarIcon *_statusBarIcon;
     VLCTrackSynchronization *_trackSyncPanel;
-    VLCAudioEffects *_audioEffectsPanel;
+    VLCAudioEffectsWindowController *_audioEffectsPanel;
     VLCVideoEffects *_videoEffectsPanel;
     VLCConvertAndSave *_convertAndSaveWindow;
     ExtensionsManager *_extensionsManager;
@@ -552,10 +552,10 @@ static VLCMain *sharedInstance = nil;
     return _trackSyncPanel;
 }
 
-- (VLCAudioEffects *)audioEffectsPanel
+- (VLCAudioEffectsWindowController *)audioEffectsPanel
 {
     if (!_audioEffectsPanel)
-        _audioEffectsPanel = [[VLCAudioEffects alloc] init];
+        _audioEffectsPanel = [[VLCAudioEffectsWindowController alloc] init];
 
     return _audioEffectsPanel;
 }