summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorritsuka <[email protected]>2014-08-10 15:15:10 +0000
committerritsuka <[email protected]>2014-08-10 15:15:10 +0000
commitc50899dd7361801c04463fe1630392500608ebab (patch)
tree557dc901bd1f50294ff7953cf5726216c918dbe9
parentc7c2aa9ee6c73dcb6b693471945aeadb6ed09983 (diff)
MacGui: fixed gain validation in the audio panel. Remove the drc validation because it’s not possible to insert the value manually.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6284 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--macosx/Controller.m8
-rw-r--r--macosx/English.lproj/Audio.xib14
-rw-r--r--macosx/English.lproj/AudioDefaults.xib14
-rw-r--r--macosx/HBAudio.m29
-rw-r--r--macosx/HBAudioTrackPreset.m26
5 files changed, 30 insertions, 61 deletions
diff --git a/macosx/Controller.m b/macosx/Controller.m
index d8c12b36c..83d7d06c0 100644
--- a/macosx/Controller.m
+++ b/macosx/Controller.m
@@ -3154,8 +3154,8 @@ fWorkingCount = 0;
audio->out.normalize_mix_level = 0;
audio->out.bitrate = [audioDict[@"JobBitrate"] intValue];
audio->out.samplerate = [audioDict[@"JobSamplerate"] intValue];
- audio->out.dynamic_range_compression = [audioDict[@"TrackDRCSlider"] intValue];
- audio->out.gain = [audioDict[@"TrackGainSlider"] intValue];
+ audio->out.dynamic_range_compression = [audioDict[@"TrackDRCSlider"] floatValue];
+ audio->out.gain = [audioDict[@"TrackGainSlider"] floatValue];
audio->out.dither_method = hb_audio_dither_get_default();
hb_audio_add(job, audio);
@@ -5441,7 +5441,9 @@ the user is using "Custom" settings by determining the sender*/
}];
}
- /* We use this method to recreate new, updated factory presets */
+/**
+ * We use this method to recreate new, updated factory presets
+ */
- (IBAction)addFactoryPresets:(id)sender
{
[presetManager generateBuiltInPresets];
diff --git a/macosx/English.lproj/Audio.xib b/macosx/English.lproj/Audio.xib
index 68d58e5e6..01ca6091b 100644
--- a/macosx/English.lproj/Audio.xib
+++ b/macosx/English.lproj/Audio.xib
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13F7" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13F12" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment version="1060" defaultVersion="1090" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/>
@@ -230,7 +230,11 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<connections>
<binding destination="rzb-Si-Kpf" name="enabled" keyPath="arrangedObjects.PassThruDisabled" id="L5Z-ZJ-Zjq"/>
- <binding destination="rzb-Si-Kpf" name="value" keyPath="arrangedObjects.gain" id="gkE-Na-A2j"/>
+ <binding destination="rzb-Si-Kpf" name="value" keyPath="arrangedObjects.gain" id="AwB-52-7Cm">
+ <dictionary key="options">
+ <bool key="NSValidatesImmediately" value="YES"/>
+ </dictionary>
+ </binding>
</connections>
</tableColumn>
<tableColumn identifier="drc" width="35" minWidth="10" maxWidth="3.4028229999999999e+38" id="whw-Me-VIU">
@@ -243,11 +247,7 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<connections>
<binding destination="rzb-Si-Kpf" name="enabled" keyPath="arrangedObjects.DRCEnabled" id="uRE-B4-yzg"/>
- <binding destination="rzb-Si-Kpf" name="value" keyPath="arrangedObjects.drc" id="Not-zD-uE1">
- <dictionary key="options">
- <bool key="NSValidatesImmediately" value="YES"/>
- </dictionary>
- </binding>
+ <binding destination="rzb-Si-Kpf" name="value" keyPath="arrangedObjects.drc" id="nOq-9s-eHF"/>
</connections>
</tableColumn>
<tableColumn identifier="drctext" editable="NO" width="27" minWidth="10" maxWidth="3.4028229999999999e+38" id="ASp-Mc-vG6">
diff --git a/macosx/English.lproj/AudioDefaults.xib b/macosx/English.lproj/AudioDefaults.xib
index 69460a0ca..1775ae7ff 100644
--- a/macosx/English.lproj/AudioDefaults.xib
+++ b/macosx/English.lproj/AudioDefaults.xib
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13F7" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13F12" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment defaultVersion="1090" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/>
@@ -441,8 +441,9 @@ DQ
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<connections>
- <binding destination="I6S-EX-Dvu" name="value" keyPath="arrangedObjects.gain" id="3I5-Lc-Tqe">
+ <binding destination="I6S-EX-Dvu" name="value" keyPath="arrangedObjects.gain" id="vWH-Cd-dKZ">
<dictionary key="options">
+ <bool key="NSValidatesImmediately" value="YES"/>
<string key="NSValueTransformerName">HBIntegerTrasformer</string>
</dictionary>
</binding>
@@ -458,12 +459,8 @@ DQ
<sliderCell key="dataCell" controlSize="small" continuous="YES" state="on" alignment="left" maxValue="4" tickMarkPosition="below" numberOfTickMarks="16" allowsTickMarkValuesOnly="YES" sliderType="circular" id="say-2a-x5G"/>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<connections>
- <binding destination="I6S-EX-Dvu" name="value" keyPath="arrangedObjects.drc" id="4cX-g9-eBy">
- <dictionary key="options">
- <bool key="NSValidatesImmediately" value="YES"/>
- </dictionary>
- </binding>
<binding destination="I6S-EX-Dvu" name="enabled" keyPath="arrangedObjects.passThruDisabled" id="q8u-5E-Adj"/>
+ <binding destination="I6S-EX-Dvu" name="value" keyPath="arrangedObjects.drc" id="3lI-ks-4a5"/>
</connections>
</tableColumn>
<tableColumn identifier="drctext" editable="NO" width="25" minWidth="10" maxWidth="3.4028229999999999e+38" id="eLM-kL-FjB">
@@ -479,10 +476,9 @@ DQ
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<connections>
- <binding destination="I6S-EX-Dvu" name="value" keyPath="arrangedObjects.drc" id="KdR-3K-LXL">
+ <binding destination="I6S-EX-Dvu" name="value" keyPath="arrangedObjects.drc" id="TKR-FO-JR4">
<dictionary key="options">
<bool key="NSConditionallySetsEditable" value="YES"/>
- <string key="NSValueTransformerName">HBIntegerTrasformer</string>
</dictionary>
</binding>
<binding destination="I6S-EX-Dvu" name="enabled" keyPath="arrangedObjects.passThruDisabled" id="IIO-pS-nND"/>
diff --git a/macosx/HBAudio.m b/macosx/HBAudio.m
index 4de313324..bdafebf0d 100644
--- a/macosx/HBAudio.m
+++ b/macosx/HBAudio.m
@@ -448,36 +448,21 @@ static NSMutableArray *masterBitRateArray = nil;
#pragma mark -
#pragma mark Validation
-// Because we have indicated that the binding for the drc validates immediately we can implement the
-// key value binding method to ensure the drc stays in our accepted range.
-- (BOOL) validateDrc: (id *) ioValue error: (NSError *) outError
-
+// Because we have indicated that the binding for the gain validates immediately we can implement the
+// key value binding method to ensure the gain stays in our accepted range.
+- (BOOL)validateGain:(id *)ioValue error:(NSError *)outError
{
BOOL retval = YES;
if (nil != *ioValue)
{
- if (0.0 < [*ioValue floatValue] && 1.0 > [*ioValue floatValue])
+ if ([*ioValue intValue] < -20)
{
- *ioValue = @1.0f;
+ *ioValue = @(-20);
}
- }
-
- return retval;
-}
-
-// Because we have indicated that the binding for the gain validates immediately we can implement the
-// key value binding method to ensure the gain stays in our accepted range.
-
-- (BOOL) validateGain: (id *) ioValue error: (NSError *) outError
-{
- BOOL retval = YES;
-
- if (nil != *ioValue)
- {
- if (0.0 < [*ioValue floatValue] && 1.0 > [*ioValue floatValue])
+ else if ([*ioValue intValue] > 20)
{
- *ioValue = @0.0f;
+ *ioValue = @20;
}
}
diff --git a/macosx/HBAudioTrackPreset.m b/macosx/HBAudioTrackPreset.m
index dc829874b..099cb6045 100644
--- a/macosx/HBAudioTrackPreset.m
+++ b/macosx/HBAudioTrackPreset.m
@@ -115,35 +115,21 @@ static void *HBAudioEncoderContex = &HBAudioEncoderContex;
return retval;
}
-// Because we have indicated that the binding for the drc validates immediately we can implement the
-// key value binding method to ensure the drc stays in our accepted range.
-- (BOOL)validateDrc:(id *)ioValue error:(NSError *)outError
-{
- BOOL retval = YES;
-
- if (nil != *ioValue)
- {
- if (0.0 < [*ioValue floatValue] && 1.0 > [*ioValue floatValue])
- {
- *ioValue = @(1.0);
- }
- }
-
- return retval;
-}
-
// Because we have indicated that the binding for the gain validates immediately we can implement the
// key value binding method to ensure the gain stays in our accepted range.
-
- (BOOL)validateGain:(id *)ioValue error:(NSError *)outError
{
BOOL retval = YES;
if (nil != *ioValue)
{
- if (0.0 < [*ioValue floatValue] && 1.0 > [*ioValue floatValue])
+ if ([*ioValue intValue] < -20)
+ {
+ *ioValue = @(-20);
+ }
+ else if ([*ioValue intValue] > 20)
{
- *ioValue = @(0.0);
+ *ioValue = @20;
}
}