<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1050</int>
- <string key="IBDocument.SystemVersion">11C74</string>
+ <string key="IBDocument.SystemVersion">11G45</string>
<string key="IBDocument.InterfaceBuilderVersion">851</string>
- <string key="IBDocument.AppKitVersion">1138.23</string>
- <string key="IBDocument.HIToolboxVersion">567.00</string>
+ <string key="IBDocument.AppKitVersion">1138.51</string>
+ <string key="IBDocument.HIToolboxVersion">569.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="1"/>
+ <integer value="2"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSWindowTemplate" id="1005">
<int key="NSWindowStyleMask">8211</int>
<int key="NSWindowBacking">2</int>
- <string key="NSWindowRect">{{196, 289}, {409, 220}}</string>
+ <string key="NSWindowRect">{{196, 254}, {409, 255}}</string>
<int key="NSWTFlags">-260571136</int>
<string key="NSWindowTitle">Audio Effects</string>
<string key="NSWindowClass">NSPanel</string>
<object class="BGHUDTabView" id="876119583">
<reference key="NSNextResponder" ref="1006"/>
<int key="NSvFlags">18</int>
- <string key="NSFrame">{{-7, -10}, {424, 223}}</string>
+ <string key="NSFrame">{{-7, 25}, {424, 223}}</string>
<reference key="NSSuperview" ref="1006"/>
<object class="NSMutableArray" key="NSTabViewItems">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="195046814"/>
</object>
</object>
+ <object class="NSPopUpButton" id="158673502">
+ <reference key="NSNextResponder" ref="1006"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{110, 6}, {190, 22}}</string>
+ <reference key="NSSuperview" ref="1006"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="BGHUDPopUpButtonCell" key="NSCell" id="847287566">
+ <int key="NSCellFlags">-2076049856</int>
+ <int key="NSCellFlags2">133120</int>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="158673502"/>
+ <int key="NSButtonFlags">109199360</int>
+ <int key="NSButtonFlags2">1</int>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">400</int>
+ <int key="NSPeriodicInterval">75</int>
+ <object class="NSMenuItem" key="NSMenuItem" id="121725632">
+ <reference key="NSMenu" ref="580552820"/>
+ <string key="NSTitle">Item 1</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <int key="NSState">1</int>
+ <reference key="NSOnImage" ref="179255878"/>
+ <reference key="NSMixedImage" ref="542579139"/>
+ <string key="NSAction">_popUpItemAction:</string>
+ <reference key="NSTarget" ref="847287566"/>
+ </object>
+ <bool key="NSMenuItemRespectAlignment">YES</bool>
+ <object class="NSMenu" key="NSMenu" id="580552820">
+ <string key="NSTitle">OtherViews</string>
+ <object class="NSMutableArray" key="NSMenuItems">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="121725632"/>
+ <object class="NSMenuItem" id="210678812">
+ <reference key="NSMenu" ref="580552820"/>
+ <string key="NSTitle">Item 2</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="179255878"/>
+ <reference key="NSMixedImage" ref="542579139"/>
+ <string key="NSAction">_popUpItemAction:</string>
+ <reference key="NSTarget" ref="847287566"/>
+ </object>
+ <object class="NSMenuItem" id="403143245">
+ <reference key="NSMenu" ref="580552820"/>
+ <string key="NSTitle">Item 3</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="179255878"/>
+ <reference key="NSMixedImage" ref="542579139"/>
+ <string key="NSAction">_popUpItemAction:</string>
+ <reference key="NSTarget" ref="847287566"/>
+ </object>
+ </object>
+ </object>
+ <int key="NSPreferredEdge">1</int>
+ <bool key="NSUsesItemFromMenu">YES</bool>
+ <bool key="NSAltersState">YES</bool>
+ <int key="NSArrowPosition">2</int>
+ <string key="themeKey">gradientTheme</string>
+ </object>
+ </object>
</object>
- <string key="NSFrameSize">{409, 220}</string>
+ <string key="NSFrameSize">{409, 255}</string>
<reference key="NSSuperview"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
</object>
<int key="connectionID">663</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">o_profile_pop</string>
+ <reference key="source" ref="687991793"/>
+ <reference key="destination" ref="158673502"/>
+ </object>
+ <int key="connectionID">707</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">profileSelectorAction:</string>
+ <reference key="source" ref="687991793"/>
+ <reference key="destination" ref="158673502"/>
+ </object>
+ <int key="connectionID">708</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="876119583"/>
+ <reference ref="158673502"/>
</object>
<reference key="parent" ref="1005"/>
</object>
<reference key="object" ref="846216840"/>
<reference key="parent" ref="235290804"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">701</int>
+ <reference key="object" ref="158673502"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="847287566"/>
+ </object>
+ <reference key="parent" ref="1006"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">702</int>
+ <reference key="object" ref="847287566"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="580552820"/>
+ </object>
+ <reference key="parent" ref="158673502"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">703</int>
+ <reference key="object" ref="580552820"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="403143245"/>
+ <reference ref="210678812"/>
+ <reference ref="121725632"/>
+ </object>
+ <reference key="parent" ref="847287566"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">704</int>
+ <reference key="object" ref="403143245"/>
+ <reference key="parent" ref="580552820"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">705</int>
+ <reference key="object" ref="210678812"/>
+ <reference key="parent" ref="580552820"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">706</int>
+ <reference key="object" ref="121725632"/>
+ <reference key="parent" ref="580552820"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<string>621.IBPluginDependency</string>
<string>621.IBViewBoundsToFrameTransform</string>
<string>622.IBPluginDependency</string>
+ <string>701.IBPluginDependency</string>
+ <string>701.IBViewBoundsToFrameTransform</string>
+ <string>702.IBPluginDependency</string>
+ <string>703.IBPluginDependency</string>
+ <string>704.IBPluginDependency</string>
+ <string>705.IBPluginDependency</string>
+ <string>706.IBPluginDependency</string>
<string>80.IBAttributePlaceholdersKey</string>
<string>80.IBPluginDependency</string>
<string>80.IBViewBoundsToFrameTransform</string>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{531, 398}, {409, 220}}</string>
+ <string>{{531, 363}, {409, 255}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{531, 398}, {409, 220}}</string>
+ <string>{{531, 363}, {409, 255}}</string>
<boolean value="NO"/>
<string>{196, 240}</string>
<string>{{357, 418}, {480, 270}}</string>
<bytes key="NSTransformStruct">P4AAAL+AAABDsAAAwxcAAA</bytes>
</object>
<string>com.binarymethod.BGHUDAppKitPlugin</string>
+ <string>com.binarymethod.BGHUDAppKitPlugin</string>
+ <object class="NSAffineTransform">
+ <bytes key="NSTransformStruct">P4AAAL+AAABCHAAAwbgAAA</bytes>
+ </object>
+ <string>com.binarymethod.BGHUDAppKitPlugin</string>
+ <string>com.binarymethod.BGHUDAppKitPlugin</string>
+ <string>com.binarymethod.BGHUDAppKitPlugin</string>
+ <string>com.binarymethod.BGHUDAppKitPlugin</string>
+ <string>com.binarymethod.BGHUDAppKitPlugin</string>
<object class="NSMutableDictionary">
<string key="NS.key.0">InitialTabViewItem</string>
<object class="IBInitialTabViewItemAttribute" key="NS.object.0">
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">700</int>
+ <int key="maxID">708</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+">
<string>filter_enableHeadPhoneVirt:</string>
<string>filter_enableVolumeNorm:</string>
<string>filter_volNormSliderUpdated:</string>
+ <string>profileSelectorAction:</string>
<string>resetCompressorValues:</string>
<string>resetSpatializerValues:</string>
<string>spat_enable:</string>
<string>id</string>
<string>id</string>
<string>id</string>
+ <string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<string>filter_enableHeadPhoneVirt:</string>
<string>filter_enableVolumeNorm:</string>
<string>filter_volNormSliderUpdated:</string>
+ <string>profileSelectorAction:</string>
<string>resetCompressorValues:</string>
<string>resetSpatializerValues:</string>
<string>spat_enable:</string>
<string key="name">filter_volNormSliderUpdated:</string>
<string key="candidateClassName">id</string>
</object>
+ <object class="IBActionInfo">
+ <string key="name">profileSelectorAction:</string>
+ <string key="candidateClassName">id</string>
+ </object>
<object class="IBActionInfo">
<string key="name">resetCompressorValues:</string>
<string key="candidateClassName">id</string>
<string>o_filter_normLevel_ckb</string>
<string>o_filter_normLevel_lbl</string>
<string>o_filter_normLevel_sld</string>
+ <string>o_profile_pop</string>
<string>o_spat_band1_fld</string>
<string>o_spat_band1_lbl</string>
<string>o_spat_band1_sld</string>
<string>id</string>
<string>id</string>
<string>id</string>
+ <string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string>o_filter_normLevel_ckb</string>
<string>o_filter_normLevel_lbl</string>
<string>o_filter_normLevel_sld</string>
+ <string>o_profile_pop</string>
<string>o_spat_band1_fld</string>
<string>o_spat_band1_lbl</string>
<string>o_spat_band1_sld</string>
<string key="name">o_filter_normLevel_sld</string>
<string key="candidateClassName">id</string>
</object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">o_profile_pop</string>
+ <string key="candidateClassName">id</string>
+ </object>
<object class="IBToOneOutletInfo">
<string key="name">o_spat_band1_fld</string>
<string key="candidateClassName">id</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
- <string>{9, 8}</string>
- <string>{7, 2}</string>
+ <string>{11, 11}</string>
+ <string>{10, 3}</string>
<string>{15, 15}</string>
</object>
</object>
#import <vlc_common.h>
#import <vlc_aout_intf.h>
+#import <vlc_strings.h>
#import <math.h>
#pragma mark -
-#pragma mark Initialization & Generic code
+#pragma mark Initialization
@implementation VLCAudioEffects
static VLCAudioEffects *_o_sharedInstance = nil;
[workNames addObject:[NSString stringWithUTF8String:preset_list[i]]];
}
- NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithArray:workValues], @"EQValues", [NSArray arrayWithArray:workPreamp], @"EQPreampValues", [NSArray arrayWithArray:workTitles], @"EQTitles", [NSArray arrayWithArray:workNames], @"EQNames", nil];
+ NSString *defaultProfile = [NSString stringWithFormat:@"%i;;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%i",
+ 0,.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];
[workValues release];
[self resetCompressor];
[self resetSpatializer];
[self resetAudioFilters];
+ [self resetProfileSelector];
}
-- (IBAction)toggleWindow:(id)sender
-{
- if ([o_window isVisible])
- [o_window orderOut:sender];
- else
- [o_window makeKeyAndOrderFront:sender];
-}
+#pragma mark -
+#pragma mark internal functions
- (void)setAudioFilter: (char *)psz_name on:(BOOL)b_on
{
}
}
+- (void)resetProfileSelector
+{
+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+ [o_profile_pop removeAllItems];
+
+ NSArray * profileNames = [defaults objectForKey:@"AudioEffectProfileNames"];
+ [o_profile_pop addItemsWithTitles:profileNames];
+
+ [[o_profile_pop menu] addItem:[NSMenuItem separatorItem]];
+ [o_profile_pop addItemWithTitle:_NS("Save selection as new profile...")];
+ [[o_profile_pop lastItem] setTarget: self];
+ [[o_profile_pop lastItem] setAction: @selector(addAudioEffectsProfile:)];
+
+ if ([profileNames count] > 1) {
+ [o_profile_pop addItemWithTitle:_NS("Organize Profiles...")];
+ [[o_profile_pop lastItem] setTarget: self];
+ [[o_profile_pop lastItem] setAction: @selector(removeAudioEffectsProfile:)];
+ }
+
+ [o_profile_pop selectItemAtIndex:[defaults integerForKey:@"AudioEffectSelectedProfile"]];
+ [self profileSelectorAction:self];
+}
+
+#pragma mark -
+#pragma mark generic code
+- (IBAction)toggleWindow:(id)sender
+{
+ if ([o_window isVisible])
+ [o_window orderOut:sender];
+ else
+ [o_window makeKeyAndOrderFront:sender];
+}
+
+- (IBAction)profileSelectorAction:(id)sender
+{
+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+ NSUInteger selectedProfile = [o_profile_pop indexOfSelectedItem];
+
+ audio_output_t * p_aout = getAout();
+ playlist_t * p_playlist = pl_Get(p_intf);
+
+ if (p_aout) {
+ /* disable existing filters */
+ aout_EnableFilter(p_playlist, "equalizer", false);
+ aout_EnableFilter(p_playlist, "compressor", false);
+ aout_EnableFilter(p_playlist, "spatializer", false);
+ aout_EnableFilter(p_playlist, "compressor", false);
+ aout_EnableFilter(p_playlist, "headphone", false);
+ aout_EnableFilter(p_playlist, "normvol", false);
+ }
+
+ /* fetch preset */
+ NSArray *items = [[[defaults objectForKey:@"AudioEffectProfiles"] objectAtIndex: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));
+ /* sanity check here, since the user may have removed the custom preset in the mean time */
+ if ([[items objectAtIndex:0] intValue] < [[defaults objectForKey:@"EQNames"] count])
+ var_SetString(p_object,"equalizer-preset",[[[defaults objectForKey:@"EQNames"] objectAtIndex:[[items objectAtIndex:0] intValue]]UTF8String]);
+ else
+ var_SetString(p_object,"equalizer-preset","flat");
+ vlc_object_release(p_object);
+
+ /* filter handling */
+ NSString *tempString = [NSString stringWithFormat:@"%s", vlc_b64_decode([[items objectAtIndex:1] UTF8String])];
+ 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++)
+ aout_EnableFilter(p_playlist, (char *)[[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 */
+ if ([tempString rangeOfString:@"equalizer"].location == NSNotFound)
+ [o_eq_enable_ckb setState:NSOffState];
+ else
+ [o_eq_enable_ckb setState:NSOnState];
+ [o_eq_twopass_ckb 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);
+}
+
+- (IBAction)addAudioEffectsProfile:(id)sender
+{
+ /* show panel */
+ VLCEnterTextPanel * panel = [VLCEnterTextPanel sharedInstance];
+ [panel setTitle: _NS("Save current selection as new profile")];
+ [panel setSubTitle: _NS("Enter a name for the new profile:")];
+ [panel setCancelButtonLabel: _NS("Cancel")];
+ [panel setOKButtonLabel: _NS("Save")];
+ [panel setTarget:self];
+ b_genericAudioProfileInInteraction = YES;
+
+ [panel runModalForWindow:o_window];
+}
+
+- (IBAction)removeAudioEffectsProfile:(id)sender
+{
+ /* show panel */
+ VLCSelectItemInPopupPanel * panel = [VLCSelectItemInPopupPanel sharedInstance];
+ [panel setTitle:_NS("Remove a preset")];
+ [panel setSubTitle:_NS("Select the preset you would like to remove:")];
+ [panel setOKButtonLabel:_NS("Remove")];
+ [panel setCancelButtonLabel:_NS("Cancel")];
+ [panel setPopupButtonContent:[[NSUserDefaults standardUserDefaults] objectForKey:@"AudioEffectProfileNames"]];
+ [panel setTarget:self];
+ b_genericAudioProfileInInteraction = YES;
+
+ [panel runModalForWindow:o_window];
+}
+
#pragma mark -
#pragma mark Equalizer
static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
NSArray * presets = [defaults objectForKey:@"EQNames"];
- NSString * currentPreset = [NSString stringWithUTF8String:var_GetNonEmptyString(p_object, "equalizer-preset")];
- NSInteger currentPresetIndex = [presets indexOfObjectPassingTest:^(id obj, NSUInteger idx, BOOL *stop) {
- return [obj isEqualToString:currentPreset];
- }];
+ NSString * currentPreset = [NSString stringWithFormat:@"%s",var_GetNonEmptyString(p_object, "equalizer-preset")];
+ NSInteger currentPresetIndex = 0;
+ if ([currentPreset length] > 0) {
+ currentPresetIndex = [presets indexOfObjectPassingTest:^(id obj, NSUInteger idx, BOOL *stop) {
+ return [obj isEqualToString:currentPreset];
+ }];
+ }
char psz_bands[100];
snprintf(psz_bands, sizeof(psz_bands),
NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
NSArray * presets = [defaults objectForKey:@"EQNames"];
- NSString * currentPreset = [NSString stringWithUTF8String:var_GetNonEmptyString(p_object, "equalizer-preset")];
- NSInteger currentPresetIndex = [presets indexOfObjectPassingTest:^(id obj, NSUInteger idx, BOOL *stop) {
- return [obj isEqualToString:currentPreset];
- }];
+ NSString * currentPreset = [NSString stringWithFormat:@"%s",var_GetNonEmptyString(p_object, "equalizer-preset")];
+ NSInteger currentPresetIndex = 0;
+ if ([currentPreset length] > 0) {
+ currentPresetIndex = [presets indexOfObjectPassingTest:^(id obj, NSUInteger idx, BOOL *stop) {
+ return [obj isEqualToString:currentPreset];
+ }];
+ }
[o_eq_presets_popup selectItemAtIndex:currentPresetIndex];
[o_eq_preamp_sld setFloatValue:[[[defaults objectForKey:@"EQPreampValues"] objectAtIndex:currentPresetIndex] floatValue]];
[panel setCancelButtonLabel: _NS("Cancel")];
[panel setOKButtonLabel: _NS("Save")];
[panel setTarget:self];
+ b_genericAudioProfileInInteraction = NO;
[panel runModalForWindow:o_window];
}
if (value == NSOKButton) {
if ([text length] > 0) {
NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
- NSMutableArray * workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQValues"]];
- [workArray addObject:[self generatePresetString]];
- [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQValues"];
- [workArray release];
- workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQTitles"]];
- [workArray addObject:text];
- [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQTitles"];
- [workArray release];
- workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQPreampValues"]];
- [workArray addObject:[NSString stringWithFormat:@"%.1f", [o_eq_preamp_sld floatValue]]];
- [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQPreampValues"];
- [workArray release];
- workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQNames"]];
- [workArray addObject:[text decomposedStringWithCanonicalMapping]];
- [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQNames"];
- [workArray release];
- [defaults synchronize];
-
- /* update VLC internals */
- 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", [[text decomposedStringWithCanonicalMapping] UTF8String]);
- config_PutPsz(p_object, "equalizer-preset", [[text decomposedStringWithCanonicalMapping] UTF8String]);
-
- vlc_object_release(p_object);
-
- /* update UI */
- [self updatePresetSelector];
+ if (!b_genericAudioProfileInInteraction) {
+
+ NSMutableArray * workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQValues"]];
+ [workArray addObject:[self generatePresetString]];
+ [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQValues"];
+ [workArray release];
+ workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQTitles"]];
+ [workArray addObject:text];
+ [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQTitles"];
+ [workArray release];
+ workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQPreampValues"]];
+ [workArray addObject:[NSString stringWithFormat:@"%.1f", [o_eq_preamp_sld floatValue]]];
+ [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQPreampValues"];
+ [workArray release];
+ workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQNames"]];
+ [workArray addObject:[text decomposedStringWithCanonicalMapping]];
+ [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQNames"];
+ [workArray release];
+ [defaults synchronize];
+
+ /* update VLC internals */
+ 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", [[text decomposedStringWithCanonicalMapping] UTF8String]);
+ config_PutPsz(p_object, "equalizer-preset", [[text decomposedStringWithCanonicalMapping] UTF8String]);
+
+ vlc_object_release(p_object);
+
+ /* update UI */
+ [self updatePresetSelector];
+ } else {
+ vlc_object_t *p_object = VLC_OBJECT(getAout());
+ if (p_object == NULL)
+ p_object = vlc_object_hold(pl_Get(p_intf));
+
+ NSArray * presets = [defaults objectForKey:@"EQNames"];
+ NSString * currentPreset = [NSString stringWithFormat:@"%s",var_GetNonEmptyString(p_object, "equalizer-preset")];
+ NSInteger currentPresetIndex = 0;
+ if ([currentPreset length] > 0) {
+ currentPresetIndex = [presets indexOfObjectPassingTest:^(id obj, NSUInteger idx, BOOL *stop) {
+ return [obj isEqualToString:currentPreset];
+ }];
+ }
+ NSString *newProfile = [NSString stringWithFormat:@"%li;%s;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%lli",
+ currentPresetIndex,
+ vlc_b64_encode(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")];
+
+ /* add string to user defaults as well as a label */
+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+ 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 release];
+ workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"AudioEffectProfileNames"]];
+ [workArray addObject:text];
+ [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"AudioEffectProfileNames"];
+ [workArray release];
+
+ /* save defaults */
+ [defaults synchronize];
+ vlc_object_release(p_object);
+ }
}
}
+
+ [self resetProfileSelector];
}
- (IBAction)deletePresetAction:(id)sender
[panel setCancelButtonLabel:_NS("Cancel")];
[panel setPopupButtonContent:[[NSUserDefaults standardUserDefaults] objectForKey:@"EQTitles"]];
[panel setTarget:self];
+ b_genericAudioProfileInInteraction = NO;
[panel runModalForWindow:o_window];
}
- (void)panel:(VLCSelectItemInPopupPanel *)panel returnValue:(NSUInteger)value item:(NSUInteger)item
{
if (value == NSOKButton) {
- /* remove requested profile from the arrays */
- NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
- NSMutableArray * workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQValues"]];
- [workArray removeObjectAtIndex:item];
- [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQValues"];
- [workArray release];
- workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQTitles"]];
- [workArray removeObjectAtIndex:item];
- [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQTitles"];
- [workArray release];
- workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQPreampValues"]];
- [workArray removeObjectAtIndex:item];
- [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQPreampValues"];
- [workArray release];
- workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQNames"]];
- [workArray removeObjectAtIndex:item];
- [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQNames"];
- [workArray release];
- [defaults synchronize];
-
- /* update UI */
- [self updatePresetSelector];
+ if (!b_genericAudioProfileInInteraction) {
+ /* remove requested profile from the arrays */
+ NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
+ NSMutableArray * workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQValues"]];
+ [workArray removeObjectAtIndex:item];
+ [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQValues"];
+ [workArray release];
+ workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQTitles"]];
+ [workArray removeObjectAtIndex:item];
+ [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQTitles"];
+ [workArray release];
+ workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQPreampValues"]];
+ [workArray removeObjectAtIndex:item];
+ [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQPreampValues"];
+ [workArray release];
+ workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"EQNames"]];
+ [workArray removeObjectAtIndex:item];
+ [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"EQNames"];
+ [workArray release];
+ [defaults synchronize];
+
+ /* update UI */
+ [self updatePresetSelector];
+ } else {
+ /* remove selected profile from settings */
+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+ NSMutableArray *workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"AudioEffectProfiles"]];
+ [workArray removeObjectAtIndex:item];
+ [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"AudioEffectProfiles"];
+ [workArray release];
+ workArray = [[NSMutableArray alloc] initWithArray:[defaults objectForKey:@"AudioEffectProfileNames"]];
+ [workArray removeObjectAtIndex:item];
+ [defaults setObject:[NSArray arrayWithArray:workArray] forKey:@"AudioEffectProfileNames"];
+ [workArray release];
+
+ /* save defaults */
+ [defaults synchronize];
+ [self resetProfileSelector];
+ }
}
}