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
d27ed2ce
Commit
d27ed2ce
authored
Feb 22, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt4: complete default volume lookup function
parent
7898d424
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
29 deletions
+65
-29
modules/gui/qt4/components/simple_preferences.cpp
modules/gui/qt4/components/simple_preferences.cpp
+65
-29
No files found.
modules/gui/qt4/components/simple_preferences.cpp
View file @
d27ed2ce
...
...
@@ -184,6 +184,58 @@ static const char *const ppsz_language_text[] =
"Walon"
,
};
static
int
getDefaultAudioVolume
(
vlc_object_t
*
obj
,
const
char
*
aout
)
{
if
(
!
strcmp
(
aout
,
""
)
||
!
strcmp
(
aout
,
"any"
))
return
-
1
;
else
/* Note: For hysterical raisins, this is sorted by decreasing priority
* order (then alphabetical order). */
if
(
!
strcmp
(
aout
,
"pulse"
))
return
-
1
;
else
#ifdef __linux__
if
(
!
strcmp
(
aout
,
"alsa"
)
&&
module_exists
(
"alsa"
))
return
cbrtf
(
config_GetFloat
(
obj
,
"alsa-gain"
))
*
100.
f
+
.5
f
;
else
#endif
#ifdef _WIN32
if
(
!
strcmp
(
aout
,
"mmdevice"
))
return
-
1
;
else
#endif
if
(
!
strcmp
(
aout
,
"sndio"
))
return
-
1
;
else
#ifdef __APPLE__
if
(
!
strcmp
(
"auhal"
)
&&
module_exists
(
"auhal"
))
return
(
config_GetFloat
(
obj
,
"auhal-volume"
)
*
100.
f
+
.5
f
)
/
AOUT_VOLUME_DEFAULT
;
else
#endif
#ifdef _WIN32
if
(
!
strcmp
(
aout
,
"directsound"
)
&&
module_exists
(
"directsound"
))
return
config_GetFloat
(
obj
,
"directx-volume"
)
*
100.
f
+
.5
f
;
else
#endif
if
(
!
strcmp
(
aout
,
"jack"
))
return
cbrtf
(
config_GetFloat
(
obj
,
"jack-gain"
))
*
100.
f
+
0.5
f
;
else
#ifdef __OS2__
if
(
!
strcmp
(
aout
,
"kai"
))
return
cbrtf
(
config_GetFloat
(
obj
,
"kai-gain"
))
*
100.
f
+
.5
f
;
else
#endif
if
(
!
strcmp
(
aout
,
"oss"
))
return
-
1
;
else
#ifdef _WIN32
if
(
!
strcmp
(
aout
,
"waveout"
))
return
config_GetFloat
(
obj
,
"waveout-volume"
)
*
100.
f
+
.5
f
;
else
#endif
return
-
1
;
}
/*********************************************************************
* The List of categories
...
...
@@ -472,38 +524,22 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
ui
.
volumeValue
->
setMaximum
(
i_max_volume
);
ui
.
defaultVolume
->
setMaximum
(
i_max_volume
);
bool
b_enabled
=
config_GetInt
(
p_intf
,
"volume-save"
);
ui
.
resetVolumeCheckbox
->
setChecked
(
!
b_enabled
);
p_config
=
config_FindConfig
(
VLC_OBJECT
(
p_intf
),
"aout"
);
char
*
psz_aout
=
p_config
->
value
.
psz
;
int
i_volume
=
100
;
//FIXME not foolproof
#define get_vol_aout( name ) \
module_exists( name ) && ( !psz_aout || !strcmp( psz_aout, name ) || !strcmp( psz_aout, "any" ) )
#if defined( _WIN32 )
if
(
get_vol_aout
(
"directsound"
)
)
i_volume
=
config_GetFloat
(
p_intf
,
"directx-volume"
)
*
100
+
0.5
;
else
if
(
get_vol_aout
(
"waveout"
)
)
i_volume
=
config_GetFloat
(
p_intf
,
"waveout-volume"
)
*
100
+
0.5
;
#elif defined( Q_OS_MAC )
if
(
get_vol_aout
(
"auhal"
)
)
i_volume
=
(
config_GetFloat
(
p_intf
,
"auhal-volume"
)
*
100
+
0.5
)
/
AOUT_VOLUME_DEFAULT
;
#elif defined( __OS2__ )
if
(
get_vol_aout
(
"kai"
)
)
i_volume
=
cbrtf
(
config_GetFloat
(
p_intf
,
"kai-gain"
)
)
*
100
+
0.5
;
#else
if
(
get_vol_aout
(
"alsa"
)
)
i_volume
=
cbrtf
(
config_GetFloat
(
p_intf
,
"alsa-gain"
)
)
*
100
+
0.5
;
else
if
(
get_vol_aout
(
"jack"
)
)
i_volume
=
cbrtf
(
config_GetFloat
(
p_intf
,
"jack-gain"
)
)
*
100
+
0.5
;
#endif
#undef get_vol_aout
int
i_volume
=
getDefaultAudioVolume
(
VLC_OBJECT
(
p_intf
),
psz_aout
);
if
(
i_volume
>=
0
)
{
bool
b_enabled
=
config_GetInt
(
p_intf
,
"volume-save"
);
ui
.
defaultVolume
->
setValue
(
i_volume
);
ui
.
resetVolumeCheckbox
->
setChecked
(
!
b_enabled
);
ui
.
defaultVolume
->
setValue
(
i_volume
);
}
else
{
ui
.
resetVolumeCheckbox
->
setChecked
(
false
);
ui
.
defaultVolume
->
setValue
(
100
);
}
CONNECT
(
ui
.
defaultVolume
,
valueChanged
(
int
),
this
,
updateAudioVolume
(
int
)
);
...
...
@@ -583,7 +619,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
qs_filter
=
qfu
(
psz
).
split
(
':'
,
QString
::
SkipEmptyParts
);
free
(
psz
);
b_enabled
=
(
qs_filter
.
contains
(
"normvol"
)
);
b
ool
b
_enabled
=
(
qs_filter
.
contains
(
"normvol"
)
);
ui
.
volNormBox
->
setChecked
(
b_enabled
);
ui
.
volNormSpin
->
setEnabled
(
b_enabled
);
...
...
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