Commit 40d2df75 authored by Sylver Bruneau's avatar Sylver Bruneau Committed by Felix Paul Kühne

Finish Equalizer support (closes #9032)

Signed-off-by: Felix Paul Kühne's avatarFelix Paul Kühne <fkuehne@videolan.org>
parent 674f3221
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="3.0" toolsVersion="6254" systemVersion="14B25" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="3.0" toolsVersion="6254" systemVersion="14C109" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none">
<dependencies>
<deployment identifier="iOS"/>
<development version="5100" identifier="xcode"/>
......@@ -24,6 +24,7 @@
<outlet property="contrastSlider" destination="145" id="161"/>
<outlet property="controllerPanel" destination="272" id="298"/>
<outlet property="currentScrubSpeedLabel" destination="244" id="246"/>
<outlet property="equalizerButton" destination="iAS-0C-clq" id="hu9-uh-EsK"/>
<outlet property="fwdButton" destination="274" id="286"/>
<outlet property="gammaLabel" destination="152" id="171"/>
<outlet property="gammaSlider" destination="151" id="169"/>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6254" systemVersion="14B25" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6254" systemVersion="14C109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment identifier="iOS"/>
<development version="5100" identifier="xcode"/>
......@@ -26,6 +26,7 @@
<outlet property="controllerPanel" destination="92" id="104"/>
<outlet property="controllerPanelLandscape" destination="e7l-vK-ape" id="uR7-Ks-KKV"/>
<outlet property="currentScrubSpeedLabel" destination="244" id="248"/>
<outlet property="equalizerButton" destination="qRr-cf-Zcx" id="wnd-pw-c4Z"/>
<outlet property="fwdButton" destination="75" id="102"/>
<outlet property="fwdButtonLandscape" destination="jl2-cB-KOM" id="D5T-2S-hbf"/>
<outlet property="gammaLabel" destination="138" id="156"/>
......@@ -681,7 +682,7 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="5Ty-RA-fET">
<rect key="frame" x="378" y="6" width="32" height="40"/>
<rect key="frame" x="378" y="6" width="19" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="22"/>
......@@ -692,7 +693,7 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="aJZ-AB-35L">
<rect key="frame" x="409" y="7" width="32" height="40"/>
<rect key="frame" x="427" y="6" width="14" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="22"/>
......@@ -702,6 +703,17 @@
<action selector="switchChapter:" destination="-1" eventType="touchUpInside" id="t1w-mV-9wH"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" showsTouchWhenHighlighted="YES" lineBreakMode="middleTruncation" id="qRr-cf-Zcx">
<rect key="frame" x="400" y="6" width="19" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="22"/>
<inset key="contentEdgeInsets" minX="0.0" minY="4" maxX="0.0" maxY="4"/>
<state key="normal" title="E"/>
<connections>
<action selector="equalizer:" destination="-2" eventType="touchUpInside" id="oG9-a0-Gxz"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="0.1215686275" green="0.1215686275" blue="0.1215686275" alpha="1" colorSpace="calibratedRGB"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
......
......@@ -56,7 +56,7 @@
else
skipLoopFilterDefaultValue = kVLCSettingSkipLoopFilterNonRef;
NSDictionary *appDefaults = @{kVLCSettingPasscodeKey : @"", kVLCSettingPasscodeOnKey : @(NO), kVLCSettingContinueAudioInBackgroundKey : @(YES), kVLCSettingStretchAudio : @(NO), kVLCSettingTextEncoding : kVLCSettingTextEncodingDefaultValue, kVLCSettingSkipLoopFilter : skipLoopFilterDefaultValue, kVLCSettingSubtitlesFont : kVLCSettingSubtitlesFontDefaultValue, kVLCSettingSubtitlesFontColor : kVLCSettingSubtitlesFontColorDefaultValue, kVLCSettingSubtitlesFontSize : kVLCSettingSubtitlesFontSizeDefaultValue, kVLCSettingSubtitlesBoldFont: kVLCSettingSubtitlesBoldFontDefaulValue, kVLCSettingDeinterlace : kVLCSettingDeinterlaceDefaultValue, kVLCSettingNetworkCaching : kVLCSettingNetworkCachingDefaultValue, kVLCSettingPlaybackGestures : [NSNumber numberWithBool:YES], kVLCSettingFTPTextEncoding : kVLCSettingFTPTextEncodingDefaultValue, kVLCSettingWiFiSharingIPv6 : kVLCSettingWiFiSharingIPv6DefaultValue };
NSDictionary *appDefaults = @{kVLCSettingPasscodeKey : @"", kVLCSettingPasscodeOnKey : @(NO), kVLCSettingContinueAudioInBackgroundKey : @(YES), kVLCSettingStretchAudio : @(NO), kVLCSettingTextEncoding : kVLCSettingTextEncodingDefaultValue, kVLCSettingSkipLoopFilter : skipLoopFilterDefaultValue, kVLCSettingSubtitlesFont : kVLCSettingSubtitlesFontDefaultValue, kVLCSettingSubtitlesFontColor : kVLCSettingSubtitlesFontColorDefaultValue, kVLCSettingSubtitlesFontSize : kVLCSettingSubtitlesFontSizeDefaultValue, kVLCSettingSubtitlesBoldFont: kVLCSettingSubtitlesBoldFontDefaulValue, kVLCSettingDeinterlace : kVLCSettingDeinterlaceDefaultValue, kVLCSettingNetworkCaching : kVLCSettingNetworkCachingDefaultValue, kVLCSettingPlaybackGestures : [NSNumber numberWithBool:YES], kVLCSettingFTPTextEncoding : kVLCSettingFTPTextEncodingDefaultValue, kVLCSettingWiFiSharingIPv6 : kVLCSettingWiFiSharingIPv6DefaultValue, kVLCSettingEqualizerProfile : kVLCSettingEqualizerProfileDefaultValue};
[defaults registerDefaults:appDefaults];
}
......
......@@ -46,6 +46,8 @@
#define kVLCSettingPlaybackSpeedDefaultValue @"playback-speed"
#define kVLCSettingWiFiSharingIPv6 @"wifi-sharing-ipv6"
#define kVLCSettingWiFiSharingIPv6DefaultValue @(NO)
#define kVLCSettingEqualizerProfile @"EqualizerProfile"
#define kVLCSettingEqualizerProfileDefaultValue @(0)
#define kVLCShowRemainingTime @"show-remaining-time"
#define kVLCRecentURLs @"recent-urls"
......
......@@ -12,6 +12,7 @@
#import <UIKit/UIKit.h>
#import "VLCFrostedGlasView.h"
#import "VLCSlider.h"
@protocol VLCEqualizerViewDelegate <NSObject>
......@@ -24,8 +25,9 @@
@end
@interface VLCEqualizerView : VLCFrostedGlasView
@interface VLCEqualizerView : VLCFrostedGlasView <UITableViewDataSource,UITableViewDelegate>
@property (nonatomic, strong) UITableView *tableView;
@property (weak) id <VLCEqualizerViewDelegate>delegate;
- (void)reloadData;
......
......@@ -11,20 +11,25 @@
*****************************************************************************/
#import "VLCEqualizerView.h"
#import "VLCTrackSelectorTableViewCell.h"
#import "VLCTrackSelectorHeaderView.h"
#define PROFILE_SELECTOR_TABLEVIEW_SECTIONHEADER @"profile selector table section header"
#define PROFILE_SELECTOR_TABLEVIEW_CELL @"profile selector table view cell"
@interface VLCEqualizerView ()
{
UISlider *_preAmp_slider;
UISlider *_60_slider;
UISlider *_170_slider;
UISlider *_310_slider;
UISlider *_600_slider;
UISlider *_1K_slider;
UISlider *_3K_slider;
UISlider *_6K_slider;
UISlider *_12K_slider;
UISlider *_14K_slider;
UISlider *_16K_slider;
VLCSlider *_preAmp_slider;
VLCSlider *_60_slider;
VLCSlider *_170_slider;
VLCSlider *_310_slider;
VLCSlider *_600_slider;
VLCSlider *_1K_slider;
VLCSlider *_3K_slider;
VLCSlider *_6K_slider;
VLCSlider *_12K_slider;
VLCSlider *_14K_slider;
VLCSlider *_16K_slider;
}
@end
......@@ -39,21 +44,57 @@
return self;
#define horizontal_padding 6.
#define vertical_padding 8.
#define vertical_padding_up 8.
#define vertical_padding_down 135.
#define spacer 8.
CGFloat sliderHeight = frame.size.height - (vertical_padding * 2.);
CGFloat sliderWidth = (frame.size.width - (spacer * 10.)) / 11.;
UITextView *textView = nil;
CGFloat sliderHeight = frame.size.height - (vertical_padding_up + vertical_padding_down);
CGFloat sliderWidth = (frame.size.width - (spacer * 11.)) / 12.;
CGFloat sliderY = (sliderHeight / 2.) - horizontal_padding;
_preAmp_slider = [[UISlider alloc] initWithFrame:CGRectMake(-sliderWidth + horizontal_padding, sliderY, sliderHeight, sliderWidth)];
_preAmp_slider = [[VLCSlider alloc] initWithFrame:CGRectMake(-sliderWidth + horizontal_padding, sliderY, sliderHeight, sliderWidth)];
_preAmp_slider.transform = CGAffineTransformMakeRotation(-M_PI_2);
_preAmp_slider.minimumValue = -20.;
_preAmp_slider.maximumValue = 20.;
[_preAmp_slider addTarget:self action:@selector(preampSliderChangedValue:) forControlEvents:UIControlEventValueChanged];
[self addSubview:_preAmp_slider];
_60_slider = [[UISlider alloc] initWithFrame:CGRectMake(horizontal_padding * 2., sliderY, sliderHeight, sliderWidth)];
textView = [[UITextView alloc] initWithFrame:CGRectMake(0, frame.size.height - vertical_padding_down, 55, 25)];
textView.text = NSLocalizedString(@"PREAMP", nil);
textView.backgroundColor = [UIColor clearColor];
textView.textColor = [UIColor whiteColor];
textView.userInteractionEnabled = NO;
[self addSubview:textView];
// Info
textView = [[UITextView alloc] initWithFrame:CGRectMake(sliderWidth, vertical_padding_up - 10, 55, 20)];
textView.text = NSLocalizedString(@"20DB", nil);
textView.textAlignment = NSTextAlignmentRight;
textView.backgroundColor = [UIColor clearColor];
textView.textColor = [UIColor whiteColor];
textView.userInteractionEnabled = NO;
[self addSubview:textView];
textView = [[UITextView alloc] initWithFrame:CGRectMake(sliderWidth, vertical_padding_up + sliderHeight / 2 - 15, 55, 20)];
textView.text = NSLocalizedString(@"0DB", nil);
textView.textAlignment = NSTextAlignmentRight;
textView.backgroundColor = [UIColor clearColor];
textView.textColor = [UIColor whiteColor];
textView.userInteractionEnabled = NO;
[self addSubview:textView];
textView = [[UITextView alloc] initWithFrame:CGRectMake(sliderWidth, frame.size.height - vertical_padding_down - 20, 55, 20)];
textView.text = NSLocalizedString(@"-20DB", nil);
textView.textAlignment = NSTextAlignmentRight;
textView.backgroundColor = [UIColor clearColor];
textView.textColor = [UIColor whiteColor];
textView.userInteractionEnabled = NO;
[self addSubview:textView];
_60_slider = [[VLCSlider alloc] initWithFrame:CGRectMake(horizontal_padding * 3. + sliderWidth, sliderY, sliderHeight, sliderWidth)];
_60_slider.transform = CGAffineTransformMakeRotation(-M_PI_2);
_60_slider.tag = 0;
_60_slider.minimumValue = -20.;
......@@ -61,7 +102,14 @@
[_60_slider addTarget:self action:@selector(sliderChangedValue:) forControlEvents:UIControlEventValueChanged];
[self addSubview:_60_slider];
_170_slider = [[UISlider alloc] initWithFrame:CGRectMake(horizontal_padding * 3. + sliderWidth, sliderY, sliderHeight, sliderWidth)];
textView = [[UITextView alloc] initWithFrame:CGRectMake(horizontal_padding * 2. + sliderWidth * 2.5, frame.size.height - vertical_padding_down, 25, 25)];
textView.text = @"60";
textView.backgroundColor = [UIColor clearColor];
textView.textColor = [UIColor whiteColor];
textView.userInteractionEnabled = NO;
[self addSubview:textView];
_170_slider = [[VLCSlider alloc] initWithFrame:CGRectMake(horizontal_padding * 4. + sliderWidth * 2, sliderY, sliderHeight, sliderWidth)];
_170_slider.transform = CGAffineTransformMakeRotation(-M_PI_2);
_170_slider.tag = 1;
_170_slider.minimumValue = -20.;
......@@ -69,7 +117,14 @@
[_170_slider addTarget:self action:@selector(sliderChangedValue:) forControlEvents:UIControlEventValueChanged];
[self addSubview:_170_slider];
_310_slider = [[UISlider alloc] initWithFrame:CGRectMake(horizontal_padding * 4. + sliderWidth * 2., sliderY, sliderHeight, sliderWidth)];
textView = [[UITextView alloc] initWithFrame:CGRectMake(horizontal_padding * 3. + sliderWidth * 3.5, frame.size.height - vertical_padding_down, 35, 25)];
textView.text = @"170";
textView.backgroundColor = [UIColor clearColor];
textView.textColor = [UIColor whiteColor];
textView.userInteractionEnabled = NO;
[self addSubview:textView];
_310_slider = [[VLCSlider alloc] initWithFrame:CGRectMake(horizontal_padding * 5. + sliderWidth * 3., sliderY, sliderHeight, sliderWidth)];
_310_slider.transform = CGAffineTransformMakeRotation(-M_PI_2);
_310_slider.tag = 2;
_310_slider.minimumValue = -20.;
......@@ -77,7 +132,14 @@
[_310_slider addTarget:self action:@selector(sliderChangedValue:) forControlEvents:UIControlEventValueChanged];
[self addSubview:_310_slider];
_600_slider = [[UISlider alloc] initWithFrame:CGRectMake(horizontal_padding * 5. + sliderWidth * 3., sliderY, sliderHeight, sliderWidth)];
textView = [[UITextView alloc] initWithFrame:CGRectMake(horizontal_padding * 4. + sliderWidth * 4.5, frame.size.height - vertical_padding_down, 35, 25)];
textView.text = @"310";
textView.backgroundColor = [UIColor clearColor];
textView.textColor = [UIColor whiteColor];
textView.userInteractionEnabled = NO;
[self addSubview:textView];
_600_slider = [[VLCSlider alloc] initWithFrame:CGRectMake(horizontal_padding * 6. + sliderWidth * 4., sliderY, sliderHeight, sliderWidth)];
_600_slider.transform = CGAffineTransformMakeRotation(-M_PI_2);
_600_slider.tag = 3;
_600_slider.minimumValue = -20.;
......@@ -85,7 +147,14 @@
[_600_slider addTarget:self action:@selector(sliderChangedValue:) forControlEvents:UIControlEventValueChanged];
[self addSubview:_600_slider];
_1K_slider = [[UISlider alloc] initWithFrame:CGRectMake(horizontal_padding * 6. + sliderWidth * 4., sliderY, sliderHeight, sliderWidth)];
textView = [[UITextView alloc] initWithFrame:CGRectMake(horizontal_padding * 5. + sliderWidth * 5.5, frame.size.height - vertical_padding_down, 35, 25)];
textView.text = @"600";
textView.backgroundColor = [UIColor clearColor];
textView.textColor = [UIColor whiteColor];
textView.userInteractionEnabled = NO;
[self addSubview:textView];
_1K_slider = [[VLCSlider alloc] initWithFrame:CGRectMake(horizontal_padding * 7. + sliderWidth * 5., sliderY, sliderHeight, sliderWidth)];
_1K_slider.transform = CGAffineTransformMakeRotation(-M_PI_2);
_1K_slider.tag = 4;
_1K_slider.minimumValue = -20.;
......@@ -93,7 +162,14 @@
[_1K_slider addTarget:self action:@selector(sliderChangedValue:) forControlEvents:UIControlEventValueChanged];
[self addSubview:_1K_slider];
_3K_slider = [[UISlider alloc] initWithFrame:CGRectMake(horizontal_padding * 7. + sliderWidth * 5., sliderY, sliderHeight, sliderWidth)];
textView = [[UITextView alloc] initWithFrame:CGRectMake(horizontal_padding * 6. + sliderWidth * 6.5, frame.size.height - vertical_padding_down, 35, 25)];
textView.text = @"1K";
textView.backgroundColor = [UIColor clearColor];
textView.textColor = [UIColor whiteColor];
textView.userInteractionEnabled = NO;
[self addSubview:textView];
_3K_slider = [[VLCSlider alloc] initWithFrame:CGRectMake(horizontal_padding * 8. + sliderWidth * 6., sliderY, sliderHeight, sliderWidth)];
_3K_slider.transform = CGAffineTransformMakeRotation(-M_PI_2);
_3K_slider.tag = 5;
_3K_slider.minimumValue = -20.;
......@@ -101,7 +177,14 @@
[_3K_slider addTarget:self action:@selector(sliderChangedValue:) forControlEvents:UIControlEventValueChanged];
[self addSubview:_3K_slider];
_6K_slider = [[UISlider alloc] initWithFrame:CGRectMake(horizontal_padding * 8. + sliderWidth * 6., sliderY, sliderHeight, sliderWidth)];
textView = [[UITextView alloc] initWithFrame:CGRectMake(horizontal_padding * 7. + sliderWidth * 7.5, frame.size.height - vertical_padding_down, 35, 25)];
textView.text = @"3K";
textView.backgroundColor = [UIColor clearColor];
textView.textColor = [UIColor whiteColor];
textView.userInteractionEnabled = NO;
[self addSubview:textView];
_6K_slider = [[VLCSlider alloc] initWithFrame:CGRectMake(horizontal_padding * 9. + sliderWidth * 7., sliderY, sliderHeight, sliderWidth)];
_6K_slider.transform = CGAffineTransformMakeRotation(-M_PI_2);
_6K_slider.tag = 6;
_6K_slider.minimumValue = -20.;
......@@ -109,7 +192,14 @@
[_6K_slider addTarget:self action:@selector(sliderChangedValue:) forControlEvents:UIControlEventValueChanged];
[self addSubview:_6K_slider];
_12K_slider = [[UISlider alloc] initWithFrame:CGRectMake(horizontal_padding * 9. + sliderWidth * 7., sliderY, sliderHeight, sliderWidth)];
textView = [[UITextView alloc] initWithFrame:CGRectMake(horizontal_padding * 8. + sliderWidth * 8.5, frame.size.height - vertical_padding_down, 35, 25)];
textView.text = @"6K";
textView.backgroundColor = [UIColor clearColor];
textView.textColor = [UIColor whiteColor];
textView.userInteractionEnabled = NO;
[self addSubview:textView];
_12K_slider = [[VLCSlider alloc] initWithFrame:CGRectMake(horizontal_padding * 10. + sliderWidth * 8., sliderY, sliderHeight, sliderWidth)];
_12K_slider.transform = CGAffineTransformMakeRotation(-M_PI_2);
_12K_slider.tag = 7;
_12K_slider.minimumValue = -20.;
......@@ -117,7 +207,14 @@
[_12K_slider addTarget:self action:@selector(sliderChangedValue:) forControlEvents:UIControlEventValueChanged];
[self addSubview:_12K_slider],
_14K_slider = [[UISlider alloc] initWithFrame:CGRectMake(horizontal_padding * 10. + sliderWidth * 8., sliderY, sliderHeight, sliderWidth)];
textView = [[UITextView alloc] initWithFrame:CGRectMake(horizontal_padding * 9. + sliderWidth * 9.5, frame.size.height - vertical_padding_down, 35, 25)];
textView.text = @"12K";
textView.backgroundColor = [UIColor clearColor];
textView.textColor = [UIColor whiteColor];
textView.userInteractionEnabled = NO;
[self addSubview:textView];
_14K_slider = [[VLCSlider alloc] initWithFrame:CGRectMake(horizontal_padding * 11. + sliderWidth * 9., sliderY, sliderHeight, sliderWidth)];
_14K_slider.transform = CGAffineTransformMakeRotation(-M_PI_2);
_14K_slider.tag = 8;
_14K_slider.minimumValue = -20.;
......@@ -125,7 +222,14 @@
[_14K_slider addTarget:self action:@selector(sliderChangedValue:) forControlEvents:UIControlEventValueChanged];
[self addSubview:_14K_slider];
_16K_slider = [[UISlider alloc] initWithFrame:CGRectMake(horizontal_padding * 11. + sliderWidth * 9., sliderY, sliderHeight, sliderWidth)];
textView = [[UITextView alloc] initWithFrame:CGRectMake(horizontal_padding * 10. + sliderWidth * 10.5, frame.size.height - vertical_padding_down, 35, 25)];
textView.text = @"14K";
textView.backgroundColor = [UIColor clearColor];
textView.textColor = [UIColor whiteColor];
textView.userInteractionEnabled = NO;
[self addSubview:textView];
_16K_slider = [[VLCSlider alloc] initWithFrame:CGRectMake(horizontal_padding * 12. + sliderWidth * 10., sliderY, sliderHeight, sliderWidth)];
_16K_slider.transform = CGAffineTransformMakeRotation(-M_PI_2);
_16K_slider.tag = 9;
_16K_slider.minimumValue = -20.;
......@@ -133,16 +237,29 @@
[_16K_slider addTarget:self action:@selector(sliderChangedValue:) forControlEvents:UIControlEventValueChanged];
[self addSubview:_16K_slider];
textView = [[UITextView alloc] initWithFrame:CGRectMake(horizontal_padding * 11. + sliderWidth * 11.5, frame.size.height - vertical_padding_down, 35, 25)];
textView.text = @"16K";
textView.backgroundColor = [UIColor clearColor];
textView.textColor = [UIColor whiteColor];
textView.userInteractionEnabled = NO;
[self addSubview:textView];
// TableView
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0,frame.size.height - vertical_padding_down + 25,frame.size.width,145)
style:UITableViewStyleGrouped];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self addSubview:self.tableView];
return self;
}
- (IBAction)sliderChangedValue:(UISlider *)sender
- (IBAction)sliderChangedValue:(VLCSlider *)sender
{
if (self.delegate)
[self.delegate setAmplification:[sender value] forBand:[sender tag]];
[self.delegate setAmplification:[sender value] forBand:(unsigned)[sender tag]];
}
- (IBAction)preampSliderChangedValue:(UISlider *)sender
- (IBAction)preampSliderChangedValue:(VLCSlider *)sender
{
if (self.delegate)
[self.delegate setPreAmplification:sender.value];
......@@ -165,4 +282,63 @@
}
}
#pragma mark - track selector table view
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UITableViewHeaderFooterView *view = [tableView dequeueReusableHeaderFooterViewWithIdentifier:PROFILE_SELECTOR_TABLEVIEW_SECTIONHEADER];
if (!view)
view = [[VLCTrackSelectorHeaderView alloc] initWithReuseIdentifier:PROFILE_SELECTOR_TABLEVIEW_SECTIONHEADER];
return view;
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
return NSLocalizedString(@"CHOOSE_EQUALIZER_PROFILES", nil);
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
VLCTrackSelectorTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:PROFILE_SELECTOR_TABLEVIEW_CELL];
if (!cell)
cell = [[VLCTrackSelectorTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:PROFILE_SELECTOR_TABLEVIEW_CELL];
NSInteger row = indexPath.row;
cell.textLabel.text = [[self.delegate equalizerProfiles] objectAtIndex:row];
unsigned int profile = (unsigned int)[[[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingEqualizerProfile] integerValue];
if (profile == row)
{
[cell setShowsCurrentTrack:YES];
}
else
{
[cell setShowsCurrentTrack:NO];
}
return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [self.delegate equalizerProfiles].count;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:NO];
NSInteger index = indexPath.row;
[self.delegate resetEqualizerFromProfile:(unsigned)index];
[self reloadData];
[self.tableView reloadData];
}
@end
......@@ -401,7 +401,11 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
[self.view addSubview:_trackSelectorContainer];
_equalizerView = [[VLCEqualizerView alloc] initWithFrame:CGRectMake((rect.size.width - 450.) / 2., self.controllerPanel.frame.origin.y - 120., 450., 120.)];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
_equalizerView = [[VLCEqualizerView alloc] initWithFrame:CGRectMake((rect.size.width - 450.) / 2., self.controllerPanel.frame.origin.y - 200., 450., 240.)];
} else {
_equalizerView = [[VLCEqualizerView alloc] initWithFrame:CGRectMake((rect.size.width - 450.) / 2., self.controllerPanel.frame.origin.y - 240., 450., 240.)];
}
_equalizerView.delegate = self;
_equalizerView.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin;
_equalizerView.hidden = YES;
......@@ -625,6 +629,12 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
NSInteger duration = 0;
MLFile *matchedFile;
// Set last selected equalizer profile
unsigned int profile = (unsigned int)[[[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingEqualizerProfile] integerValue];
[_mediaPlayer resetEqualizerFromProfile:profile];
[_mediaPlayer setPreAmplification:[_mediaPlayer preAmplification]];
[_equalizerView reloadData];
if (self.fileFromMediaLibrary)
matchedFile = self.fileFromMediaLibrary;
else if (self.mediaList) {
......@@ -1598,6 +1608,9 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
[_mediaPlayer setEqualizerEnabled:YES];
[_mediaPlayer setAmplification:amplification forBand:index];
// For some reason we have to apply again preamp to apply change
[_mediaPlayer setPreAmplification:[_mediaPlayer preAmplification]];
}
- (CGFloat)amplificationOfBand:(unsigned int)index
......@@ -1612,11 +1625,15 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
- (void)resetEqualizerFromProfile:(unsigned int)profile
{
[[NSUserDefaults standardUserDefaults] setObject:@(profile) forKey:kVLCSettingEqualizerProfile];
[_mediaPlayer resetEqualizerFromProfile:profile];
}
- (void)setPreAmplification:(CGFloat)preAmplification
{
if (!_mediaPlayer.equalizerEnabled)
[_mediaPlayer setEqualizerEnabled:YES];
[self _resetIdleTimer];
[_mediaPlayer setPreAmplification:preAmplification];
}
......@@ -1913,6 +1930,9 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
if (self.artworkImageView.image)
self.trackNameLabel.hidden = UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
if (!_equalizerView.hidden)
_equalizerView.hidden = YES;
}
}
......
......@@ -45,6 +45,14 @@
@implementation VLCSlider
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self)
[self setThumbImage:[UIImage imageNamed:@"modernSliderKnob"] forState:UIControlStateNormal];
return self;
}
- (void)awakeFromNib
{
if (SYSTEM_RUNS_IOS7_OR_LATER)
......
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