Commit 9e7821d9 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: store EQ preset name instead of its internal ID within the audio effects profiles

simplifies code and is more precise
parent 22e3dd24
...@@ -76,8 +76,8 @@ static VLCAudioEffects *_o_sharedInstance = nil; ...@@ -76,8 +76,8 @@ static VLCAudioEffects *_o_sharedInstance = nil;
[workNames addObject:[NSString stringWithUTF8String:preset_list[i]]]; [workNames addObject:[NSString stringWithUTF8String:preset_list[i]]];
} }
NSString *defaultProfile = [NSString stringWithFormat:@"%i;;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%i", NSString *defaultProfile = [NSString stringWithFormat:@"ZmxhdA==;;%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]; .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]; 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]; [defaults registerDefaults:appDefaults];
...@@ -242,11 +242,7 @@ static VLCAudioEffects *_o_sharedInstance = nil; ...@@ -242,11 +242,7 @@ static VLCAudioEffects *_o_sharedInstance = nil;
vlc_object_t *p_object = VLC_OBJECT(getAout()); vlc_object_t *p_object = VLC_OBJECT(getAout());
if (p_object == NULL) if (p_object == NULL)
p_object = vlc_object_hold(pl_Get(p_intf)); 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 */ var_SetString(p_object,"equalizer-preset",vlc_b64_decode([[items objectAtIndex:0] UTF8String]));
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); vlc_object_release(p_object);
/* filter handling */ /* filter handling */
...@@ -690,8 +686,8 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf, ...@@ -690,8 +686,8 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
return [obj isEqualToString:currentPreset]; return [obj isEqualToString:currentPreset];
}]; }];
} }
NSString *newProfile = [NSString stringWithFormat:@"%li;%s;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%lli", NSString *newProfile = [NSString stringWithFormat:@"%s;%s;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%lli",
currentPresetIndex, vlc_b64_encode(var_GetNonEmptyString(p_object, "equalizer-preset")),
vlc_b64_encode(config_GetPsz(p_intf, "audio-filter")), vlc_b64_encode(config_GetPsz(p_intf, "audio-filter")),
config_GetFloat(p_intf, "compressor-rms-peak"), config_GetFloat(p_intf, "compressor-rms-peak"),
config_GetFloat(p_intf, "compressor-attack"), config_GetFloat(p_intf, "compressor-attack"),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment