Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
622be830
Commit
622be830
authored
Jan 03, 2013
by
David Fuhrmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx: audio effects panel: migrate autosave and bugfixes from video effects panel
parent
a3915ceb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
147 additions
and
92 deletions
+147
-92
modules/gui/macosx/AudioEffects.h
modules/gui/macosx/AudioEffects.h
+4
-0
modules/gui/macosx/AudioEffects.m
modules/gui/macosx/AudioEffects.m
+139
-91
modules/gui/macosx/intf.m
modules/gui/macosx/intf.m
+4
-1
No files found.
modules/gui/macosx/AudioEffects.h
View file @
622be830
...
@@ -99,6 +99,8 @@
...
@@ -99,6 +99,8 @@
IBOutlet
id
o_filter_normLevel_sld
;
IBOutlet
id
o_filter_normLevel_sld
;
IBOutlet
id
o_filter_normLevel_lbl
;
IBOutlet
id
o_filter_normLevel_lbl
;
IBOutlet
id
o_filter_karaoke_ckb
;
IBOutlet
id
o_filter_karaoke_ckb
;
NSInteger
i_old_profile_index
;
}
}
/* generic */
/* generic */
...
@@ -109,6 +111,8 @@
...
@@ -109,6 +111,8 @@
-
(
IBAction
)
addAudioEffectsProfile
:(
id
)
sender
;
-
(
IBAction
)
addAudioEffectsProfile
:(
id
)
sender
;
-
(
IBAction
)
removeAudioEffectsProfile
:(
id
)
sender
;
-
(
IBAction
)
removeAudioEffectsProfile
:(
id
)
sender
;
-
(
void
)
saveCurrentProfile
;
/* Equalizer */
/* Equalizer */
-
(
void
)
setupEqualizer
;
-
(
void
)
setupEqualizer
;
-
(
void
)
equalizerUpdated
;
-
(
void
)
equalizerUpdated
;
...
...
modules/gui/macosx/AudioEffects.m
View file @
622be830
...
@@ -99,6 +99,7 @@ static VLCAudioEffects *_o_sharedInstance = nil;
...
@@ -99,6 +99,7 @@ static VLCAudioEffects *_o_sharedInstance = nil;
[
self
dealloc
];
[
self
dealloc
];
else
{
else
{
p_intf
=
VLCIntf
;
p_intf
=
VLCIntf
;
i_old_profile_index
=
-
1
;
_o_sharedInstance
=
[
super
init
];
_o_sharedInstance
=
[
super
init
];
}
}
...
@@ -199,7 +200,7 @@ static VLCAudioEffects *_o_sharedInstance = nil;
...
@@ -199,7 +200,7 @@ static VLCAudioEffects *_o_sharedInstance = nil;
[
o_profile_pop
addItemsWithTitles
:
profileNames
];
[
o_profile_pop
addItemsWithTitles
:
profileNames
];
[[
o_profile_pop
menu
]
addItem
:[
NSMenuItem
separatorItem
]];
[[
o_profile_pop
menu
]
addItem
:[
NSMenuItem
separatorItem
]];
[
o_profile_pop
addItemWithTitle
:
_NS
(
"
Save selection as new
profile..."
)];
[
o_profile_pop
addItemWithTitle
:
_NS
(
"
Duplicate current
profile..."
)];
[[
o_profile_pop
lastItem
]
setTarget
:
self
];
[[
o_profile_pop
lastItem
]
setTarget
:
self
];
[[
o_profile_pop
lastItem
]
setAction
:
@selector
(
addAudioEffectsProfile
:)];
[[
o_profile_pop
lastItem
]
setAction
:
@selector
(
addAudioEffectsProfile
:)];
...
@@ -223,8 +224,58 @@ static VLCAudioEffects *_o_sharedInstance = nil;
...
@@ -223,8 +224,58 @@ static VLCAudioEffects *_o_sharedInstance = nil;
[
o_window
makeKeyAndOrderFront
:
sender
];
[
o_window
makeKeyAndOrderFront
:
sender
];
}
}
-
(
NSString
*
)
generateProfileString
{
vlc_object_t
*
p_object
=
VLC_OBJECT
(
getAout
());
if
(
p_object
==
NULL
)
p_object
=
vlc_object_hold
(
pl_Get
(
p_intf
));
NSString
*
o_str
=
[
NSString
stringWithFormat
:
@"%s;%s;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%lli"
,
vlc_b64_encode
(
var_GetNonEmptyString
(
p_object
,
"equalizer-preset"
)),
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"
)];
vlc_object_release
(
p_object
);
return
o_str
;
}
-
(
void
)
saveCurrentProfile
{
if
(
i_old_profile_index
==
-
1
)
return
;
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
/* fetch all the current settings in a uniform string */
NSString
*
newProfile
=
[
self
generateProfileString
];
NSMutableArray
*
workArray
=
[[
NSMutableArray
alloc
]
initWithArray
:[
defaults
objectForKey
:
@"AudioEffectProfiles"
]];
if
(
i_old_profile_index
>=
[
workArray
count
])
return
;
[
workArray
replaceObjectAtIndex
:
i_old_profile_index
withObject
:
newProfile
];
[
defaults
setObject
:[
NSArray
arrayWithArray
:
workArray
]
forKey
:
@"AudioEffectProfiles"
];
[
workArray
release
];
[
defaults
synchronize
];
}
-
(
IBAction
)
profileSelectorAction
:(
id
)
sender
-
(
IBAction
)
profileSelectorAction
:(
id
)
sender
{
{
[
self
saveCurrentProfile
];
i_old_profile_index
=
[
o_profile_pop
indexOfSelectedItem
];
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
NSUInteger
selectedProfile
=
[
o_profile_pop
indexOfSelectedItem
];
NSUInteger
selectedProfile
=
[
o_profile_pop
indexOfSelectedItem
];
...
@@ -256,7 +307,6 @@ static VLCAudioEffects *_o_sharedInstance = nil;
...
@@ -256,7 +307,6 @@ static VLCAudioEffects *_o_sharedInstance = nil;
NSString
*
tempString
=
[
NSString
stringWithFormat
:
@"%s"
,
vlc_b64_decode
([[
items
objectAtIndex
:
1
]
UTF8String
])];
NSString
*
tempString
=
[
NSString
stringWithFormat
:
@"%s"
,
vlc_b64_decode
([[
items
objectAtIndex
:
1
]
UTF8String
])];
NSArray
*
tempArray
;
NSArray
*
tempArray
;
NSUInteger
count
;
NSUInteger
count
;
NSLog
(
@"enable audio filters: %@"
,
tempString
);
/* enable the new filters, if we have an aout */
/* enable the new filters, if we have an aout */
if
(
p_aout
)
{
if
(
p_aout
)
{
if
([
tempString
length
]
>
0
)
{
if
([
tempString
length
]
>
0
)
{
...
@@ -325,7 +375,7 @@ static VLCAudioEffects *_o_sharedInstance = nil;
...
@@ -325,7 +375,7 @@ static VLCAudioEffects *_o_sharedInstance = nil;
{
{
/* show panel */
/* show panel */
VLCEnterTextPanel
*
panel
=
[
VLCEnterTextPanel
sharedInstance
];
VLCEnterTextPanel
*
panel
=
[
VLCEnterTextPanel
sharedInstance
];
[
panel
setTitle
:
_NS
(
"
Save current selection as
new profile"
)];
[
panel
setTitle
:
_NS
(
"
Duplicate current profile for a
new profile"
)];
[
panel
setSubTitle
:
_NS
(
"Enter a name for the new profile:"
)];
[
panel
setSubTitle
:
_NS
(
"Enter a name for the new profile:"
)];
[
panel
setCancelButtonLabel
:
_NS
(
"Cancel"
)];
[
panel
setCancelButtonLabel
:
_NS
(
"Cancel"
)];
[
panel
setOKButtonLabel
:
_NS
(
"Save"
)];
[
panel
setOKButtonLabel
:
_NS
(
"Save"
)];
...
@@ -645,12 +695,12 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
...
@@ -645,12 +695,12 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
-
(
void
)
panel
:(
VLCEnterTextPanel
*
)
panel
returnValue
:(
NSUInteger
)
value
text
:(
NSString
*
)
text
-
(
void
)
panel
:(
VLCEnterTextPanel
*
)
panel
returnValue
:(
NSUInteger
)
value
text
:(
NSString
*
)
text
{
{
if
(
value
==
NSOKButton
)
{
if
([
text
length
]
>
0
)
{
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
// EQ settings
if
(
!
b_genericAudioProfileInInteraction
)
{
if
(
!
b_genericAudioProfileInInteraction
)
{
if
(
value
==
NSOKButton
&&
[
text
length
]
>
0
)
{
NSMutableArray
*
workArray
=
[[
NSMutableArray
alloc
]
initWithArray
:[
defaults
objectForKey
:
@"EQValues"
]];
NSMutableArray
*
workArray
=
[[
NSMutableArray
alloc
]
initWithArray
:[
defaults
objectForKey
:
@"EQValues"
]];
[
workArray
addObject
:[
self
generatePresetString
]];
[
workArray
addObject
:[
self
generatePresetString
]];
[
defaults
setObject
:[
NSArray
arrayWithArray
:
workArray
]
forKey
:
@"EQValues"
];
[
defaults
setObject
:[
NSArray
arrayWithArray
:
workArray
]
forKey
:
@"EQValues"
];
...
@@ -681,36 +731,35 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
...
@@ -681,36 +731,35 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
/* update UI */
/* update UI */
[
self
updatePresetSelector
];
[
self
updatePresetSelector
];
}
// profile settings
}
else
{
}
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"
];
if
(
value
!=
NSOKButton
)
{
NSString
*
currentPreset
=
[
NSString
stringWithFormat
:
@"%s"
,
var_GetNonEmptyString
(
p_object
,
"equalizer-preset"
)];
[
o_profile_pop
selectItemAtIndex
:[
defaults
integerForKey
:
@"AudioEffectSelectedProfile"
]];
NSInteger
currentPresetIndex
=
0
;
return
;
if
([
currentPreset
length
]
>
0
)
{
currentPresetIndex
=
[
presets
indexOfObjectPassingTest
:
^
(
id
obj
,
NSUInteger
idx
,
BOOL
*
stop
)
{
return
[
obj
isEqualToString
:
currentPreset
];
}];
}
}
NSString
*
newProfile
=
[
NSString
stringWithFormat
:
@"%s;%s;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%lli"
,
vlc_b64_encode
(
var_GetNonEmptyString
(
p_object
,
"equalizer-preset"
)),
NSArray
*
profileNames
=
[
defaults
objectForKey
:
@"AudioEffectProfileNames"
];
vlc_b64_encode
(
config_GetPsz
(
p_intf
,
"audio-filter"
)),
config_GetFloat
(
p_intf
,
"compressor-rms-peak"
),
// duplicate names are not allowed in the popup control
config_GetFloat
(
p_intf
,
"compressor-attack"
),
if
([
text
length
]
==
0
||
[
profileNames
containsObject
:
text
])
{
config_GetFloat
(
p_intf
,
"compressor-release"
),
[
o_profile_pop
selectItemAtIndex
:[
defaults
integerForKey
:
@"AudioEffectSelectedProfile"
]];
config_GetFloat
(
p_intf
,
"compressor-threshold"
),
config_GetFloat
(
p_intf
,
"compressor-ratio"
),
NSAlert
*
alert
=
[[[
NSAlert
alloc
]
init
]
autorelease
];
config_GetFloat
(
p_intf
,
"compressor-knee"
),
[
alert
setAlertStyle
:
NSCriticalAlertStyle
];
config_GetFloat
(
p_intf
,
"compressor-makeup-gain"
),
[
alert
setMessageText
:
_NS
(
"Please enter a unique name for the new profile."
)];
config_GetFloat
(
p_intf
,
"spatializer-roomsize"
),
[
alert
setInformativeText
:
_NS
(
"Multiple profiles with the same name are not allowed."
)];
config_GetFloat
(
p_intf
,
"spatializer-width"
),
config_GetFloat
(
p_intf
,
"spatializer-wet"
),
[
alert
beginSheetModalForWindow
:
o_window
config_GetFloat
(
p_intf
,
"spatializer-dry"
),
modalDelegate:
nil
config_GetFloat
(
p_intf
,
"spatializer-damp"
),
didEndSelector:
nil
config_GetFloat
(
p_intf
,
"norm-max-level"
),
contextInfo:
nil
];
config_GetInt
(
p_intf
,
"equalizer-2pass"
)];
return
;
}
NSString
*
newProfile
=
[
self
generateProfileString
];
/* add string to user defaults as well as a label */
/* add string to user defaults as well as a label */
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
...
@@ -726,12 +775,8 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
...
@@ -726,12 +775,8 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
/* save defaults */
/* save defaults */
[
defaults
synchronize
];
[
defaults
synchronize
];
vlc_object_release
(
p_object
);
}
}
}
[
self
resetProfileSelector
];
[
self
resetProfileSelector
];
}
}
}
-
(
IBAction
)
deletePresetAction
:(
id
)
sender
-
(
IBAction
)
deletePresetAction
:(
id
)
sender
...
@@ -786,6 +831,9 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
...
@@ -786,6 +831,9 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
[
defaults
setObject
:[
NSArray
arrayWithArray
:
workArray
]
forKey
:
@"AudioEffectProfileNames"
];
[
defaults
setObject
:[
NSArray
arrayWithArray
:
workArray
]
forKey
:
@"AudioEffectProfileNames"
];
[
workArray
release
];
[
workArray
release
];
if
(
i_old_profile_index
>=
item
)
[
defaults
setInteger
:
i_old_profile_index
-
1
forKey
:
@"AudioEffectSelectedProfile"
];
/* save defaults */
/* save defaults */
[
defaults
synchronize
];
[
defaults
synchronize
];
[
self
resetProfileSelector
];
[
self
resetProfileSelector
];
...
@@ -906,8 +954,8 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
...
@@ -906,8 +954,8 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
[
o_spat_enable_ckb
setState
:
NSOffState
];
[
o_spat_enable_ckb
setState
:
NSOffState
];
#define setSlider(bandsld, bandfld, var) \
#define setSlider(bandsld, bandfld, var) \
[bandsld setFloatValue: config_GetFloat(p_intf, var) * 10.]; \
[bandsld setFloatValue: config_GetFloat(p_intf, var) * 10.]; \
[bandfld setStringValue:[NSString localizedStringWithFormat:@"%1.1f", [bandsld floatValue]]]
[bandfld setStringValue:[NSString localizedStringWithFormat:@"%1.1f", [bandsld floatValue]]]
setSlider
(
o_spat_band1_sld
,
o_spat_band1_fld
,
"spatializer-roomsize"
);
setSlider
(
o_spat_band1_sld
,
o_spat_band1_fld
,
"spatializer-roomsize"
);
setSlider
(
o_spat_band2_sld
,
o_spat_band2_fld
,
"spatializer-width"
);
setSlider
(
o_spat_band2_sld
,
o_spat_band2_fld
,
"spatializer-width"
);
...
...
modules/gui/macosx/intf.m
View file @
622be830
...
@@ -62,7 +62,9 @@
...
@@ -62,7 +62,9 @@
#import "CoreInteraction.h"
#import "CoreInteraction.h"
#import "TrackSynchronization.h"
#import "TrackSynchronization.h"
#import "VLCVoutWindowController.h"
#import "VLCVoutWindowController.h"
#import "VideoEffects.h"
#import "VideoEffects.h"
#import "AudioEffects.h"
#import <AddressBook/AddressBook.h>
/* for crashlog send mechanism */
#import <AddressBook/AddressBook.h>
/* for crashlog send mechanism */
#import <Sparkle/Sparkle.h>
/* we're the update delegate */
#import <Sparkle/Sparkle.h>
/* we're the update delegate */
...
@@ -797,8 +799,9 @@ static VLCMain *_o_sharedMainInstance = nil;
...
@@ -797,8 +799,9 @@ static VLCMain *_o_sharedMainInstance = nil;
[
NSApp
setPresentationOptions
:(
NSApplicationPresentationDefault
)];
[
NSApp
setPresentationOptions
:(
NSApplicationPresentationDefault
)];
}
}
/* save current video
profile
*/
/* save current video
and audio profiles
*/
[[
VLCVideoEffects
sharedInstance
]
saveCurrentProfile
];
[[
VLCVideoEffects
sharedInstance
]
saveCurrentProfile
];
[[
VLCAudioEffects
sharedInstance
]
saveCurrentProfile
];
/* Save some interface state in configuration, at module quit */
/* Save some interface state in configuration, at module quit */
config_PutInt
(
p_intf
,
"random"
,
var_GetBool
(
p_playlist
,
"random"
));
config_PutInt
(
p_intf
,
"random"
,
var_GetBool
(
p_playlist
,
"random"
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment