Commit 02ccf893 authored by Felix Paul Kühne's avatar Felix Paul Kühne Committed by Jean-Baptiste Kempf

macosx: fixed volume range (fix #5790)

(cherry picked from commit 2a1e9a20029d0c06693f200666934e70224cedb6)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 3338391d
......@@ -21,14 +21,15 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="4722"/>
<integer value="29"/>
<integer value="1617"/>
<integer value="4596"/>
<integer value="2730"/>
<integer value="4895"/>
<integer value="21"/>
<integer value="4756"/>
<integer value="915"/>
<integer value="4895"/>
<integer value="29"/>
<integer value="2770"/>
<integer value="2730"/>
<integer value="4596"/>
<integer value="4722"/>
<integer value="283"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
......@@ -914,9 +915,9 @@
</object>
<reference key="NSSupport" ref="340291444"/>
<reference key="NSControlView" ref="788281303"/>
<double key="NSMaxValue">32</double>
<double key="NSMaxValue">512</double>
<double key="NSMinValue">0.0</double>
<double key="NSValue">8</double>
<double key="NSValue">256</double>
<double key="NSAltIncValue">0.0</double>
<int key="NSNumberOfTickMarks">0</int>
<int key="NSTickMarkPosition">1</int>
......@@ -3431,7 +3432,7 @@
<nil key="NSUserInterfaceItemIdentifier"/>
<string key="NSWindowContentMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string>
<object class="NSView" key="NSWindowView" id="985395477">
<nil key="NSNextResponder"/>
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
......@@ -3821,6 +3822,7 @@
</object>
</object>
<string key="NSFrameSize">{549, 87}</string>
<reference key="NSSuperview"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
<string key="NSMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string>
......@@ -10555,6 +10557,7 @@ LCAuLi4</string>
<string>2807.IBPluginDependency</string>
<string>2807.ImportedFromIB2</string>
<string>2808.IBPluginDependency</string>
<string>2808.IBViewBoundsToFrameTransform</string>
<string>2808.ImportedFromIB2</string>
<string>282.IBEditorWindowLastContentRect</string>
<string>282.IBPluginDependency</string>
......@@ -11328,6 +11331,7 @@ LCAuLi4</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSAffineTransform"/>
<boolean value="YES"/>
<string>{{329, 372}, {599, 368}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
......
......@@ -12,10 +12,11 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="2537"/>
<integer value="2265"/>
<integer value="2332"/>
<integer value="1531"/>
<integer value="2311"/>
<integer value="2410"/>
<integer value="2537"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
......@@ -1024,7 +1025,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string key="NSExtension">NSResponder</string>
</object>
<object class="NSCustomView" id="1030708865">
<nil key="NSNextResponder"/>
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
......@@ -1094,9 +1095,9 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSfFlags">16</int>
</object>
<reference key="NSControlView" ref="581694147"/>
<double key="NSMaxValue">400</double>
<double key="NSMaxValue">512</double>
<double key="NSMinValue">0.0</double>
<double key="NSValue">50</double>
<double key="NSValue">256</double>
<double key="NSAltIncValue">0.0</double>
<int key="NSNumberOfTickMarks">0</int>
<int key="NSTickMarkPosition">1</int>
......@@ -1122,82 +1123,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<bytes key="NS.mantissa">BQAAAAAAAAAAAAAAAAAAAA</bytes>
</object>
<reference key="NSSupport" ref="96267115"/>
<object class="NSNumberFormatter" key="NSFormatter" id="377082188">
<object class="NSMutableDictionary" key="NS.attributes">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>allowsFloats</string>
<string>attributedStringForZero</string>
<string>decimalSeparator</string>
<string>formatterBehavior</string>
<string>groupingSeparator</string>
<string>maximum</string>
<string>minimum</string>
<string>negativeFormat</string>
<string>positiveFormat</string>
<string>usesGroupingSeparator</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<boolean value="YES"/>
<object class="NSAttributedString" id="836410833">
<string key="NSString">0%</string>
<object class="NSDictionary" key="NSAttributes" id="226083992">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
</object>
<string>,</string>
<integer value="1000"/>
<string>.</string>
<object class="NSDecimalNumberPlaceholder" id="806607793">
<int key="NS.exponent">2</int>
<int key="NS.length">1</int>
<bool key="NS.negative">NO</bool>
<bool key="NS.compact">YES</bool>
<int key="NS.mantissa.bo">1</int>
<bytes key="NS.mantissa">BAAAAAAAAAAAAAAAAAAAAA</bytes>
</object>
<object class="NSDecimalNumberPlaceholder" id="367276341">
<int key="NS.exponent">0</int>
<int key="NS.length">0</int>
<bool key="NS.negative">NO</bool>
<bool key="NS.compact">NO</bool>
<int key="NS.mantissa.bo">1</int>
<bytes key="NS.mantissa">AAAAAAAAAAAAAAAAAAAAAA</bytes>
</object>
<string/>
<string>##0%</string>
<boolean value="NO"/>
</object>
</object>
<string key="NS.positiveformat">##0%</string>
<string key="NS.negativeformat"/>
<nil key="NS.positiveattrs"/>
<nil key="NS.negativeattrs"/>
<reference key="NS.zero" ref="836410833"/>
<object class="NSAttributedString" key="NS.nil">
<string key="NSString"/>
</object>
<object class="NSAttributedString" key="NS.nan">
<string key="NSString">NaN</string>
<reference key="NSAttributes" ref="226083992"/>
</object>
<reference key="NS.min" ref="367276341"/>
<reference key="NS.max" ref="806607793"/>
<nil key="NS.rounding"/>
<string key="NS.decimal">,</string>
<string key="NS.thousand">.</string>
<bool key="NS.hasthousands">NO</bool>
<bool key="NS.localized">YES</bool>
<bool key="NS.allowsfloats">YES</bool>
</object>
<reference key="NSControlView" ref="307740745"/>
<bool key="NSDrawsBackground">YES</bool>
<reference key="NSBackgroundColor" ref="122952243"/>
......@@ -1621,6 +1546,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
</object>
<string key="NSFrameSize">{569, 402}</string>
<reference key="NSSuperview"/>
<string key="NSClassName">NSView</string>
<string key="NSExtension">NSResponder</string>
</object>
......@@ -3002,7 +2928,15 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<boolean value="YES"/>
<object class="NSAttributedString" id="952500097">
<string key="NSString">0</string>
<reference key="NSAttributes" ref="226083992"/>
<object class="NSDictionary" key="NSAttributes" id="672149009">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
</object>
<string>.</string>
<integer value="1000"/>
......@@ -3041,7 +2975,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
<object class="NSAttributedString" key="NS.nan">
<string key="NSString">NaN</string>
<reference key="NSAttributes" ref="226083992"/>
<reference key="NSAttributes" ref="672149009"/>
</object>
<reference key="NS.min" ref="783613974"/>
<reference key="NS.max" ref="752074440"/>
......@@ -6367,15 +6301,9 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<reference key="object" ref="996375599"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="377082188"/>
</object>
<reference key="parent" ref="307740745"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">2337</int>
<reference key="object" ref="377082188"/>
<reference key="parent" ref="996375599"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">2338</int>
<reference key="object" ref="895998750"/>
......@@ -7849,8 +7777,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string>2336.IBPluginDependency</string>
<string>2336.IBViewBoundsToFrameTransform</string>
<string>2336.ImportedFromIB2</string>
<string>2337.IBPluginDependency</string>
<string>2337.ImportedFromIB2</string>
<string>2338.IBPluginDependency</string>
<string>2338.ImportedFromIB2</string>
<string>2339.IBPluginDependency</string>
......@@ -8424,8 +8350,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">P4AAAL+AAABDfAAAwgAAAA</bytes>
</object>
......
......@@ -147,7 +147,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
else
{
playlist_t * p_playlist = pl_Get( VLCIntf );
NSLog( @"playlist rate = %f", f_rate );
f_rate = var_GetFloat( p_playlist, "rate" );
}
double value = 17 * log( f_rate ) / log( 2. );
......@@ -442,10 +442,8 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
{
intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = pl_Get( VLCIntf );
audio_volume_t i_volume = (audio_volume_t)i_value;
int i_volume_step;
i_volume_step = config_GetInt( VLCIntf->p_libvlc, "volume-step" );
aout_VolumeSet( p_playlist, i_volume * i_volume_step );
aout_VolumeSet( p_playlist, i_value );
}
#pragma mark -
......
......@@ -39,6 +39,7 @@
#import <vlc_url.h>
#import <vlc_strings.h>
#import <vlc_services_discovery.h>
#import <vlc_aout_intf.h>
@implementation VLCMainWindow
static VLCMainWindow *_o_sharedInstance = nil;
......@@ -665,7 +666,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
else if (sender == o_volume_down_btn)
[[VLCCoreInteraction sharedInstance] mute];
else
[[VLCCoreInteraction sharedInstance] setVolume: 400];
[[VLCCoreInteraction sharedInstance] setVolume: AOUT_VOLUME_MAX];
}
- (IBAction)effects:(id)sender
......@@ -896,11 +897,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
if( i_volume != i_lastShownVolume )
{
i_lastShownVolume = i_volume;
int i_volume_step = 0;
i_volume_step = config_GetInt( VLCIntf->p_libvlc, "volume-step" );
[o_volume_sld setFloatValue: (float)i_lastShownVolume / i_volume_step];
[o_fspanel setVolumeLevel: (float)i_lastShownVolume / i_volume_step];
[o_volume_sld setIntValue: i_volume];
[o_fspanel setVolumeLevel: i_volume];
}
}
......
......@@ -43,8 +43,8 @@
- (BOOL)scriptFullscreenMode;
- (void)setScriptFullscreenMode: (BOOL)mode;
- (double)audioVolume;
- (void)setAudioVolume: (double)mode;
- (int)audioVolume;
- (void)setAudioVolume: (int)mode;
- (int)currentTime;
- (void)setCurrentTime: (int)mode;
......
......@@ -226,27 +226,12 @@
return [[VLCCoreInteraction sharedInstance] isPlaying];
}
- (double) audioVolume {
return ( (double)[[VLCCoreInteraction sharedInstance] volume] / (double)AOUT_VOLUME_DEFAULT );
- (int) audioVolume {
return ( [[VLCCoreInteraction sharedInstance] volume] );
}
- (void) setAudioVolume: (double) d_audioVolume {
//1 = 100%, 4 = 400%; 0 <= d_audioVolume <= 4
//0-1024 (but AOUT_VOLUME_MAX == 512)???
//AOUT_VOLUME_DEFAULT = 256 = 100%
//somehow [[VLCCoreInteraction sharedInstance] setVolume:i_parameter] has 0-32 steps with 32 as stepWidth (0 - 1024)
if (d_audioVolume < 0)
d_audioVolume = 0;
if (d_audioVolume > 4)
d_audioVolume = 4;
intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = pl_Get( VLCIntf );
int i_volume_step = config_GetInt( VLCIntf->p_libvlc, "volume-step" );
int i_parameter = (int) ( d_audioVolume * i_volume_step / 4 );
[[VLCCoreInteraction sharedInstance] setVolume:i_parameter];
- (void) setAudioVolume: (int) i_audioVolume {
[[VLCCoreInteraction sharedInstance] setVolume:(int)i_audioVolume];
}
- (int) currentTime {
......
......@@ -51,7 +51,7 @@
- (void)setStreamTitle: (NSString *)o_title;
- (void)setStreamPos: (float)f_pos andTime: (NSString *)o_time;
- (void)setSeekable: (BOOL)b_seekable;
- (void)setVolumeLevel: (float)f_volumeLevel;
- (void)setVolumeLevel: (int)i_volumeLevel;
- (void)setNonActive: (id)noData;
- (void)setActive: (id)noData;
......@@ -93,7 +93,7 @@
- (void)setStreamTitle: (NSString *)o_title;
- (void)setStreamPos: (float)f_pos andTime: (NSString *)o_time;
- (void)setSeekable: (BOOL)b_seekable;
- (void)setVolumeLevel: (float)f_volumeLevel;
- (void)setVolumeLevel: (int)i_volumeLevel;
- (IBAction)play:(id)sender;
- (IBAction)prev:(id)sender;
- (IBAction)next:(id)sender;
......
......@@ -31,6 +31,7 @@
#import "misc.h"
#import "fspanel.h"
#import "CompatibilityFixes.h"
#import <vlc_aout_intf.h>
@interface VLCFSPanel ()
- (void)hideMouse;
......@@ -168,9 +169,9 @@
[[self contentView] setSeekable: b_seekable];
}
- (void)setVolumeLevel: (float)f_volumeLevel
- (void)setVolumeLevel: (int)i_volumeLevel
{
[[self contentView] setVolumeLevel: f_volumeLevel];
[[self contentView] setVolumeLevel: i_volumeLevel];
}
- (void)setNonActive:(id)noData
......@@ -490,8 +491,8 @@
s_rc.size.height = 10;
o_fs_volumeSlider = [[VLCFSVolumeSlider alloc] initWithFrame: s_rc];
[o_fs_volumeSlider setMinValue:0];
[o_fs_volumeSlider setMaxValue:32];
[o_fs_volumeSlider setFloatValue: 0];
[o_fs_volumeSlider setMaxValue:AOUT_VOLUME_MAX];
[o_fs_volumeSlider setIntValue:AOUT_VOLUME_DEFAULT];
[o_fs_volumeSlider setContinuous: YES];
[o_fs_volumeSlider setTarget: self];
[o_fs_volumeSlider setAction: @selector(fsVolumeSliderUpdate:)];
......@@ -573,9 +574,9 @@
[o_fs_timeSlider setEnabled: b_seekable];
}
- (void)setVolumeLevel: (float)f_volumeLevel
- (void)setVolumeLevel: (int)i_volumeLevel
{
[o_fs_volumeSlider setFloatValue: f_volumeLevel];
[o_fs_volumeSlider setIntValue: i_volumeLevel];
}
- (IBAction)play:(id)sender
......
......@@ -483,7 +483,7 @@ static inline char * __config_GetLabel( vlc_object_t *p_this, const char *psz_na
* audio settings *
******************/
[self setupButton: o_audio_enable_ckb forBoolValue: "audio"];
i = (config_GetInt( p_intf, "volume" ) * 0.390625);
i = config_GetInt( p_intf, "volume" );
[o_audio_vol_fld setToolTip: [NSString stringWithUTF8String: config_GetLabel( p_intf, "volume")]];
[o_audio_vol_fld setIntValue: i];
[o_audio_vol_sld setToolTip: [o_audio_vol_fld toolTip]];
......@@ -829,7 +829,7 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
if( b_audioSettingChanged )
{
config_PutInt( p_intf, "audio", [o_audio_enable_ckb state] );
config_PutInt( p_intf, "volume", ([o_audio_vol_sld intValue] * 2.56));
config_PutInt( p_intf, "volume", [o_audio_vol_sld intValue]);
config_PutInt( p_intf, "spdif", [o_audio_spdif_ckb state] );
SaveIntList( o_audio_dolby_pop, "force-dolby-surround" );
......
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