summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordynaflash <[email protected]>2010-09-20 16:15:23 +0000
committerdynaflash <[email protected]>2010-09-20 16:15:23 +0000
commitfaeba9157d45934526bbfc2aed1ec6cbc4cf64a3 (patch)
tree92201eb6cc09cd0f4eb3199cc99abfb7fb25aa2b
parentd78142595cf23721be92ef63f4cb538ee5d9dc84 (diff)
MacGui: Audio Fixes and Enhancements ... patch by circleone.
Fixes issue where changing to custom from a preset then changing titles will cause an empty audio tab. Also: - Added the ability for HandBrake's language preference to be honored when it occurs in the title's tracks. - Ensured the limit (currently 24) is not passed when adding audios using presets. - If no preset is chosen, when a new title loads, one track is added (based on the language preference or the first if that is not met). - Reinitializing the audio array is now KVO-friendly, making the UI refresh more pleasant. - The "Add All Tracks" button has been made mini in size. - The audio table view no longer attempts to keep the selection. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3549 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--macosx/Controller.h3
-rw-r--r--macosx/Controller.m22
-rw-r--r--macosx/English.lproj/MainMenu.xib43
-rw-r--r--macosx/HBAudioController.m130
4 files changed, 111 insertions, 87 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h
index f9634abe9..7bdc3c37b 100644
--- a/macosx/Controller.h
+++ b/macosx/Controller.h
@@ -244,7 +244,6 @@ BOOL fIsDragging;
NSString * browsedSourceDisplayName;
double dockIconProgress;
- BOOL hasValidPresetSelected;
}
- (int) getPidnum;
- (IBAction) showAboutPanel:(id)sender;
@@ -417,7 +416,7 @@ BOOL fIsDragging;
returnCode: (int) returnCode contextInfo: (void *) contextInfo;
+ (unsigned int) maximumNumberOfAllowedAudioTracks;
-@property (nonatomic, assign) BOOL hasValidPresetSelected;
+@property (nonatomic, readonly) BOOL hasValidPresetSelected;
- (IBAction) addAllAudioTracks: (id) sender;
@end
diff --git a/macosx/Controller.m b/macosx/Controller.m
index 92d31a822..7fbd5f280 100644
--- a/macosx/Controller.m
+++ b/macosx/Controller.m
@@ -4958,7 +4958,11 @@ the user is using "Custom" settings by determining the sender*/
#pragma mark -
-@synthesize hasValidPresetSelected;
+- (BOOL) hasValidPresetSelected
+
+{
+ return ([fPresetsOutlineView selectedRow] >= 0 && [[[fPresetsOutlineView itemAtRow:[fPresetsOutlineView selectedRow]] objectForKey:@"Folder"] intValue] != 1);
+}
// This causes all audio tracks from the title to be used based on the current preset
- (IBAction) addAllAudioTracks: (id) sender
@@ -5315,6 +5319,14 @@ return YES;
//}
}
+- (void) outlineViewSelectionDidChange: (NSNotification *) ignored
+
+{
+ [self willChangeValueForKey: @"hasValidPresetSelected"];
+ [self didChangeValueForKey: @"hasValidPresetSelected"];
+ return;
+}
+
#pragma mark -
#pragma mark Preset Outline View Methods (dragging related)
@@ -5429,9 +5441,8 @@ return YES;
- (IBAction)selectPreset:(id)sender
{
- if ([fPresetsOutlineView selectedRow] >= 0 && [[[fPresetsOutlineView itemAtRow:[fPresetsOutlineView selectedRow]] objectForKey:@"Folder"] intValue] != 1)
+ if (YES == [self hasValidPresetSelected])
{
- [self setHasValidPresetSelected: YES];
chosenPreset = [fPresetsOutlineView itemAtRow:[fPresetsOutlineView selectedRow]];
[fPresetSelectedDisplay setStringValue:[chosenPreset objectForKey:@"PresetName"]];
@@ -5752,9 +5763,6 @@ return YES;
[fPictureController SetTitle:fTitle];
[self calculatePictureSizing:nil];
}
- else {
- [self setHasValidPresetSelected: NO];
- }
}
@@ -6136,7 +6144,7 @@ return YES;
/* now get and add selected presets to export */
}
- if ([fPresetsOutlineView selectedRow] >= 0 && [[[fPresetsOutlineView itemAtRow:[fPresetsOutlineView selectedRow]] objectForKey:@"Folder"] intValue] != 1)
+ if (YES == [self hasValidPresetSelected])
{
[presetsToExport addObject:[fPresetsOutlineView itemAtRow:[fPresetsOutlineView selectedRow]]];
[presetsToExport writeToFile:exportPresetsFile atomically:YES];
diff --git a/macosx/English.lproj/MainMenu.xib b/macosx/English.lproj/MainMenu.xib
index 5f6f04a53..62ae0d961 100644
--- a/macosx/English.lproj/MainMenu.xib
+++ b/macosx/English.lproj/MainMenu.xib
@@ -672,13 +672,13 @@
<object class="NSTableView" id="792464451">
<reference key="NSNextResponder" ref="528259747"/>
<int key="NSvFlags">256</int>
- <string key="NSFrameSize">{682, 241}</string>
+ <string key="NSFrameSize">{678, 241}</string>
<reference key="NSSuperview" ref="528259747"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTableHeaderView" key="NSHeaderView" id="146611085">
<reference key="NSNextResponder" ref="230332532"/>
<int key="NSvFlags">256</int>
- <string key="NSFrameSize">{682, 17}</string>
+ <string key="NSFrameSize">{678, 17}</string>
<reference key="NSSuperview" ref="230332532"/>
<reference key="NSTableView" ref="792464451"/>
</object>
@@ -1011,7 +1011,7 @@
</object>
<object class="NSTableColumn" id="581296833">
<string key="NSIdentifier">drctext</string>
- <double key="NSWidth">32</double>
+ <double key="NSWidth">28</double>
<double key="NSMinWidth">10</double>
<double key="NSMaxWidth">3.4028229999999999e+38</double>
<object class="NSTableHeaderCell" key="NSHeaderCell">
@@ -1086,7 +1086,6 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{-100, -100}, {685, 15}}</string>
<reference key="NSSuperview" ref="933946879"/>
- <bool key="NSEnabled">YES</bool>
<int key="NSsFlags">1</int>
<reference key="NSTarget" ref="933946879"/>
<string key="NSAction">_doScroller:</string>
@@ -1111,7 +1110,7 @@
<string key="NSFrame">{{17, 17}, {680, 259}}</string>
<reference key="NSSuperview" ref="577274772"/>
<reference key="NSNextKeyView" ref="528259747"/>
- <int key="NSsFlags">658</int>
+ <int key="NSsFlags">530</int>
<reference key="NSVScroller" ref="496546489"/>
<reference key="NSHScroller" ref="821562152"/>
<reference key="NSContentView" ref="528259747"/>
@@ -1122,14 +1121,14 @@
<object class="NSButton" id="883603583">
<reference key="NSNextResponder" ref="577274772"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{12, 277}, {116, 28}}</string>
+ <string key="NSFrame">{{16, 282}, {116, 16}}</string>
<reference key="NSSuperview" ref="577274772"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="327570663">
<int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">134348800</int>
+ <int key="NSCellFlags2">134479872</int>
<string key="NSContents">Add All Tracks</string>
- <reference key="NSSupport" ref="26"/>
+ <reference key="NSSupport" ref="22"/>
<reference key="NSControlView" ref="883603583"/>
<int key="NSButtonFlags">-2038284033</int>
<int key="NSButtonFlags2">129</int>
@@ -1145,7 +1144,6 @@
</object>
</object>
<string key="NSFrame">{{10, 25}, {714, 305}}</string>
- <reference key="NSNextKeyView"/>
</object>
<string key="NSLabel">Audio</string>
<reference key="NSColor" ref="242973447"/>
@@ -3694,7 +3692,7 @@
<string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
<string key="NSWindowContentMinSize">{338, 232}</string>
<object class="NSView" key="NSWindowView" id="69290042">
- <reference key="NSNextResponder"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -3703,7 +3701,6 @@
<int key="NSvFlags">289</int>
<string key="NSFrame">{{239, 12}, {85, 32}}</string>
<reference key="NSSuperview" ref="69290042"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="107603394">
<int key="NSCellFlags">67239424</int>
@@ -3729,7 +3726,6 @@
<int key="NSvFlags">289</int>
<string key="NSFrame">{{155, 12}, {84, 32}}</string>
<reference key="NSSuperview" ref="69290042"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="231870318">
<int key="NSCellFlags">67239424</int>
@@ -3751,7 +3747,6 @@
<int key="NSvFlags">266</int>
<string key="NSFrame">{{20, 264}, {298, 19}}</string>
<reference key="NSSuperview" ref="69290042"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="479246832">
<int key="NSCellFlags">-1804468671</int>
@@ -3769,7 +3764,6 @@
<int key="NSvFlags">266</int>
<string key="NSFrame">{{128, 193}, {193, 22}}</string>
<reference key="NSSuperview" ref="69290042"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="17688962">
<int key="NSCellFlags">-2076049856</int>
@@ -3840,7 +3834,6 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{17, 286}, {114, 17}}</string>
<reference key="NSSuperview" ref="69290042"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="658438349">
<int key="NSCellFlags">67239424</int>
@@ -3857,7 +3850,6 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{17, 217}, {91, 14}}</string>
<reference key="NSSuperview" ref="69290042"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="70981869">
<int key="NSCellFlags">67239424</int>
@@ -3874,7 +3866,6 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{17, 100}, {114, 14}}</string>
<reference key="NSSuperview" ref="69290042"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="207651610">
<int key="NSCellFlags">67239424</int>
@@ -3891,7 +3882,6 @@
<int key="NSvFlags">274</int>
<string key="NSFrame">{{20, 51}, {298, 41}}</string>
<reference key="NSSuperview" ref="69290042"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="855042909">
<int key="NSCellFlags">-1805517311</int>
@@ -3909,7 +3899,6 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{27, 195}, {99, 14}}</string>
<reference key="NSSuperview" ref="69290042"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="31665321">
<int key="NSCellFlags">67239424</int>
@@ -3926,7 +3915,6 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{128, 142}, {24, 18}}</string>
<reference key="NSSuperview" ref="69290042"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="625635488">
<int key="NSCellFlags">-2080244224</int>
@@ -3949,7 +3937,6 @@
<int key="NSvFlags">-2147483380</int>
<string key="NSFrame">{{17, 240}, {303, 18}}</string>
<reference key="NSSuperview" ref="69290042"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="977106207">
<int key="NSCellFlags">67239424</int>
@@ -3972,7 +3959,6 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{113, 220}, {205, 5}}</string>
<reference key="NSSuperview" ref="69290042"/>
- <reference key="NSWindow"/>
<string key="NSOffsets">{0, 0}</string>
<object class="NSTextFieldCell" key="NSTitleCell">
<int key="NSCellFlags">67239424</int>
@@ -3995,7 +3981,6 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{12, 120}, {298, 5}}</string>
<reference key="NSSuperview" ref="69290042"/>
- <reference key="NSWindow"/>
<string key="NSOffsets">{0, 0}</string>
<object class="NSTextFieldCell" key="NSTitleCell">
<int key="NSCellFlags">67239424</int>
@@ -4018,7 +4003,6 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{17, 144}, {109, 15}}</string>
<reference key="NSSuperview" ref="69290042"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="155469085">
<int key="NSCellFlags">67239424</int>
@@ -4045,7 +4029,6 @@
<int key="NSvFlags">266</int>
<string key="NSFrame">{{11, 10}, {52, 16}}</string>
<reference key="NSSuperview" ref="956968044"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="862361869">
<int key="NSCellFlags">-1804468671</int>
@@ -4063,7 +4046,6 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{61, 10}, {29, 15}}</string>
<reference key="NSSuperview" ref="956968044"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="14541127">
<int key="NSCellFlags">67239424</int>
@@ -4080,7 +4062,6 @@
<int key="NSvFlags">266</int>
<string key="NSFrame">{{90, 10}, {52, 16}}</string>
<reference key="NSSuperview" ref="956968044"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="945554305">
<int key="NSCellFlags">-1804468671</int>
@@ -4096,12 +4077,10 @@
</object>
<string key="NSFrameSize">{155, 32}</string>
<reference key="NSSuperview" ref="277759901"/>
- <reference key="NSWindow"/>
</object>
</object>
<string key="NSFrame">{{128, 163}, {155, 32}}</string>
<reference key="NSSuperview" ref="69290042"/>
- <reference key="NSWindow"/>
<string key="NSOffsets">{0, 0}</string>
<object class="NSTextFieldCell" key="NSTitleCell">
<int key="NSCellFlags">67239424</int>
@@ -4122,8 +4101,6 @@
</object>
</object>
<string key="NSFrameSize">{338, 318}</string>
- <reference key="NSSuperview"/>
- <reference key="NSWindow"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
<string key="NSMinSize">{338, 254}</string>
@@ -4345,8 +4322,6 @@
</object>
<bool key="NSEditable">YES</bool>
<object class="_NSManagedProxy" key="_NSManagedProxy"/>
- <bool key="NSAvoidsEmptySelection">YES</bool>
- <bool key="NSPreservesSelection">YES</bool>
<bool key="NSSelectsInsertedObjects">YES</bool>
<bool key="NSFilterRestrictsInsertion">YES</bool>
<bool key="NSClearsFilterPredicateOnInsertion">YES</bool>
@@ -8741,8 +8716,8 @@
<reference key="object" ref="577274772"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="883603583"/>
<reference ref="933946879"/>
+ <reference ref="883603583"/>
</object>
<reference key="parent" ref="738554558"/>
</object>
diff --git a/macosx/HBAudioController.m b/macosx/HBAudioController.m
index ccd6363c7..da58cfbc1 100644
--- a/macosx/HBAudioController.m
+++ b/macosx/HBAudioController.m
@@ -32,6 +32,7 @@ NSString *HBMixdownChangedNotification = @"HBMixdownChangedNotification";
{
if (self = [super init]) {
[self setVideoContainerTag: [NSNumber numberWithInt: HB_MUX_MP4]];
+ audioArray = [[NSMutableArray alloc] init];
}
return self;
}
@@ -60,6 +61,15 @@ NSString *HBMixdownChangedNotification = @"HBMixdownChangedNotification";
return;
}
+- (void) _clearAudioArray
+
+{
+ while (0 < [self countOfAudioArray]) {
+ [self removeObjectFromAudioArrayAtIndex: 0];
+ }
+ return;
+}
+
#pragma mark -
#pragma mark HBController Support
@@ -165,8 +175,7 @@ NSString *HBMixdownChangedNotification = @"HBMixdownChangedNotification";
int maximumNumberOfAllowedAudioTracks = [HBController maximumNumberOfAllowedAudioTracks];
// Reinitialize the configured list of audio tracks
- [audioArray release];
- audioArray = [[NSMutableArray alloc] init];
+ [self _clearAudioArray];
// The following is the pattern to follow, but with Audio%dTrack being the key to seek...
// Can we assume that there will be no skip in the data?
@@ -228,68 +237,95 @@ NSString *HBMixdownChangedNotification = @"HBMixdownChangedNotification";
NSEnumerator *enumerator = [templateAudioArray objectEnumerator];
NSDictionary *dict;
NSString *key;
+ int maximumNumberOfAllowedAudioTracks = [HBController maximumNumberOfAllowedAudioTracks];
while (nil != (dict = [enumerator nextObject])) {
- HBAudio *newAudio = [[HBAudio alloc] init];
- [newAudio setController: self];
- [self insertObject: newAudio inAudioArrayAtIndex: [self countOfAudioArray]];
- [newAudio setVideoContainerTag: [self videoContainerTag]];
- [newAudio setTrackFromIndex: trackIndex];
- key = [dict objectForKey: @"AudioEncoder"];
- if (0 == aType &&
- YES == [[NSUserDefaults standardUserDefaults] boolForKey: @"UseCoreAudio"] &&
- YES == [key isEqualToString: @"AAC (faac)"]
- ) {
- key = @"AAC (CoreAudio)";
- }
- // If our preset wants us to support a codec that the track does not support, instead
- // of changing the codec we remove the audio instead.
- if (YES == [newAudio setCodecFromName: key]) {
- [newAudio setMixdownFromName: [dict objectForKey: @"AudioMixdown"]];
- [newAudio setSampleRateFromName: [dict objectForKey: @"AudioSamplerate"]];
- [newAudio setBitRateFromName: [dict objectForKey: @"AudioBitrate"]];
- [newAudio setDrc: [dict objectForKey: @"AudioTrackDRCSlider"]];
- }
- else {
- [self removeObjectFromAudioArrayAtIndex: [self countOfAudioArray] - 1];
+ if ([self countOfAudioArray] < maximumNumberOfAllowedAudioTracks) {
+ HBAudio *newAudio = [[HBAudio alloc] init];
+ [newAudio setController: self];
+ [self insertObject: newAudio inAudioArrayAtIndex: [self countOfAudioArray]];
+ [newAudio setVideoContainerTag: [self videoContainerTag]];
+ [newAudio setTrackFromIndex: trackIndex];
+ key = [dict objectForKey: @"AudioEncoder"];
+ if (0 == aType &&
+ YES == [[NSUserDefaults standardUserDefaults] boolForKey: @"UseCoreAudio"] &&
+ YES == [key isEqualToString: @"AAC (faac)"]
+ ) {
+ key = @"AAC (CoreAudio)";
+ }
+ // If our preset wants us to support a codec that the track does not support, instead
+ // of changing the codec we remove the audio instead.
+ if (YES == [newAudio setCodecFromName: key]) {
+ [newAudio setMixdownFromName: [dict objectForKey: @"AudioMixdown"]];
+ [newAudio setSampleRateFromName: [dict objectForKey: @"AudioSamplerate"]];
+ [newAudio setBitRateFromName: [dict objectForKey: @"AudioBitrate"]];
+ [newAudio setDrc: [dict objectForKey: @"AudioTrackDRCSlider"]];
+ }
+ else {
+ [self removeObjectFromAudioArrayAtIndex: [self countOfAudioArray] - 1];
+ }
+ [newAudio release];
}
- [newAudio release];
}
return;
}
-- (void) addTracksFromPreset: (NSMutableDictionary *) aPreset
+// This matches the FIRST track with the specified prefix, otherwise it uses the defaultIfNotFound value
+- (unsigned int) _trackWithTitlePrefix: (NSString *) prefix defaultIfNotFound: (unsigned int) defaultIfNotFound
+
+{
+ unsigned int retval = defaultIfNotFound;
+ int count = [masterTrackArray count];
+ NSString *languageTitle;
+ BOOL found = NO;
+
+ // We search for the prefix noting that our titles have the format %d: %s where the %s is the prefix
+ for (unsigned int i = 1; i < count && NO == found; i++) { // Note that we skip the "None" track
+ languageTitle = [[masterTrackArray objectAtIndex: i] objectForKey: keyAudioTrackName];
+ if (YES == [[languageTitle substringFromIndex: [languageTitle rangeOfString: @" "].location + 1] hasPrefix: prefix]) {
+ retval = i;
+ found = YES;
+ }
+ }
+ return retval;
+}
+
+- (void) addTracksFromPreset: (NSMutableDictionary *) aPreset allTracks: (BOOL) allTracks
{
id whatToUse = [self _presetAudioArrayFromPreset: aPreset];
+ NSString *preferredLanguageName = [[NSUserDefaults standardUserDefaults] stringForKey: @"DefaultLanguage"];
+ int preferredLanguage = [self _trackWithTitlePrefix: preferredLanguageName defaultIfNotFound: 1];
// Reinitialize the configured list of audio tracks
- [audioArray release];
- audioArray = [[NSMutableArray alloc] init];
+ [self _clearAudioArray];
- [self _processPresetAudioArray: whatToUse forTrack: 1 andType: [[aPreset objectForKey: @"Type"] intValue]];
+ [self _processPresetAudioArray: whatToUse forTrack: preferredLanguage andType: [[aPreset objectForKey: @"Type"] intValue]];
+ if (YES == allTracks) {
+ unsigned int count = [masterTrackArray count];
+ for (unsigned int i = 1; i < count; i++) {
+ if (i != preferredLanguage) {
+ [self _processPresetAudioArray: whatToUse forTrack: i andType: [[aPreset objectForKey: @"Type"] intValue]];
+ }
+ }
+ }
[self switchingTrackFromNone: nil]; // see if we need to add one to the list
return;
}
-- (void) addAllTracksFromPreset: (NSMutableDictionary *) aPreset
+- (void) addTracksFromPreset: (NSMutableDictionary *) aPreset
{
- id whatToUse = [self _presetAudioArrayFromPreset: aPreset];
-
- // Reinitialize the configured list of audio tracks
- [audioArray release];
- audioArray = [[NSMutableArray alloc] init];
-
- for (unsigned int i = 1; i < [masterTrackArray count]; i++) {
- [self _processPresetAudioArray: whatToUse forTrack: i andType: [[aPreset objectForKey: @"Type"] intValue]];
- }
-
- [self switchingTrackFromNone: nil]; // see if we need to add one to the list
-
+ [self addTracksFromPreset: aPreset allTracks: NO];
return;
+}
+
+- (void) addAllTracksFromPreset: (NSMutableDictionary *) aPreset
+
+{
+ [self addTracksFromPreset: aPreset allTracks: YES];
return;
}
@@ -419,9 +455,15 @@ NSString *HBMixdownChangedNotification = @"HBMixdownChangedNotification";
}
// Reinitialize the configured list of audio tracks
- [audioArray release];
- audioArray = [[NSMutableArray alloc] init];
+ [self _clearAudioArray];
+ if (NO == [myController hasValidPresetSelected]) {
+ NSString *preferredLanguageName = [[NSUserDefaults standardUserDefaults] stringForKey: @"DefaultLanguage"];
+ int preferredLanguage = [self _trackWithTitlePrefix: preferredLanguageName defaultIfNotFound: 1];
+ [self addNewAudioTrack];
+ HBAudio *anAudio = [self objectInAudioArrayAtIndex: 0];
+ [anAudio setTrackFromIndex: preferredLanguage];
+ }
return;
}