Commit 2a1e9a20 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: fixed volume range (fix #5790)

parent a80cde4d
......@@ -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>
......
......@@ -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