Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
35eeabbf
Commit
35eeabbf
authored
Sep 03, 2010
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: compressor UI, foolproofing the controls values
And translate strings
parent
c285701c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
41 deletions
+33
-41
modules/gui/qt4/components/extended_panels.cpp
modules/gui/qt4/components/extended_panels.cpp
+33
-41
No files found.
modules/gui/qt4/components/extended_panels.cpp
View file @
35eeabbf
...
@@ -1122,35 +1122,27 @@ void Equalizer::addCallbacks( aout_instance_t *p_aout )
...
@@ -1122,35 +1122,27 @@ void Equalizer::addCallbacks( aout_instance_t *p_aout )
/**********************************************************************
/**********************************************************************
* Dynamic range compressor
* Dynamic range compressor
**********************************************************************/
**********************************************************************/
static
const
char
*
psz_comp_control_names
[]
=
{
"compressor-rms-peak"
,
"compressor-attack"
,
"compressor-release"
,
"compressor-threshold"
,
"compressor-ratio"
,
"compressor-knee"
,
"compressor-makeup-gain"
};
static
const
char
*
psz_comp_control_descs
[]
=
typedef
struct
{
{
"RMS/peak"
,
"Attack"
,
const
char
*
psz_name
;
"Release"
,
"Threshold"
,
"Ratio"
,
"Knee
\n
radius"
,
"Makeup
\n
gain"
const
char
*
psz_descs
;
}
;
const
char
*
psz_units
;
const
float
f_min
;
// min
static
const
char
*
psz_comp_control_units
[]
=
const
float
f_max
;
// max
{
const
float
f_value
;
// value
""
,
" ms"
,
" ms"
,
" dB"
,
":1"
,
" dB"
,
" dB"
const
float
f_resolution
;
// resolution
};
}
comp_controls_t
;
static
const
float
f_comp_min_max_val_res_data
[]
=
static
const
comp_controls_t
controls
[]
=
{
{
// min max value resolution
{
"compressor-rms-peak"
,
_
(
"RMS/peak"
),
""
,
0.0
f
,
1.0
f
,
0.00
f
,
0.001
f
},
//---- ------ ------ ----------
{
"compressor-attack"
,
_
(
"Attack"
),
_
(
" ms"
),
1.5
f
,
400.0
f
,
25.00
f
,
0.100
f
},
0.0
f
,
1.0
f
,
0.00
f
,
0.001
f
,
// RMS/peak
{
"compressor-release"
,
_
(
"Release"
),
_
(
" ms"
),
2.0
f
,
800.0
f
,
100.00
f
,
0.100
f
},
1.5
f
,
400.0
f
,
25.00
f
,
0.100
f
,
// Attack
{
"compressor-threshold"
,
_
(
"Threshold"
),
_
(
" dB"
),
-
30.0
f
,
0.0
f
,
-
11.00
f
,
0.010
f
},
2.0
f
,
800.0
f
,
100.00
f
,
0.100
f
,
// Release
{
"compressor-ratio"
,
_
(
"Ratio"
),
":1"
,
1.0
f
,
20.0
f
,
8.00
f
,
0.010
f
},
-
30.0
f
,
0.0
f
,
-
11.00
f
,
0.010
f
,
// Threshold
{
"compressor-knee"
,
_
(
"Knee
\n
radius"
),
_
(
" dB"
),
1.0
f
,
10.0
f
,
2.50
f
,
0.010
f
},
1.0
f
,
20.0
f
,
8.00
f
,
0.010
f
,
// Ratio
{
"compressor-makeup-gain"
,
_
(
"Makeup
\n
gain"
),
_
(
" dB"
),
0.0
f
,
24.0
f
,
7.00
f
,
0.010
f
},
1.0
f
,
10.0
f
,
2.50
f
,
0.010
f
,
// Knee radius
0.0
f
,
24.0
f
,
7.00
f
,
0.010
f
// Makeup gain
};
};
Compressor
::
Compressor
(
intf_thread_t
*
_p_intf
,
QWidget
*
_parent
)
:
Compressor
::
Compressor
(
intf_thread_t
*
_p_intf
,
QWidget
*
_parent
)
:
...
@@ -1169,19 +1161,19 @@ Compressor::Compressor( intf_thread_t *_p_intf, QWidget *_parent ) :
...
@@ -1169,19 +1161,19 @@ Compressor::Compressor( intf_thread_t *_p_intf, QWidget *_parent ) :
{
{
compCtrl
[
i
]
=
new
QSlider
(
Qt
::
Vertical
);
compCtrl
[
i
]
=
new
QSlider
(
Qt
::
Vertical
);
const
int
i_min
=
(
int
)(
f_comp_min_max_val_res_data
[
4
*
i
+
0
]
const
int
i_min
=
(
int
)(
controls
[
i
].
f_min
/
f_comp_min_max_val_res_data
[
4
*
i
+
3
]
);
/
controls
[
i
].
f_resolution
);
const
int
i_max
=
(
int
)(
f_comp_min_max_val_res_data
[
4
*
i
+
1
]
const
int
i_max
=
(
int
)(
controls
[
i
].
f_max
/
f_comp_min_max_val_res_data
[
4
*
i
+
3
]
);
/
controls
[
i
].
f_resolution
);
const
int
i_val
=
(
int
)(
f_comp_min_max_val_res_data
[
4
*
i
+
2
]
const
int
i_val
=
(
int
)(
controls
[
i
].
f_value
/
f_comp_min_max_val_res_data
[
4
*
i
+
3
]
);
/
controls
[
i
].
f_resolution
);
compCtrl
[
i
]
->
setMinimum
(
i_min
);
compCtrl
[
i
]
->
setMinimum
(
i_min
);
compCtrl
[
i
]
->
setMaximum
(
i_max
);
compCtrl
[
i
]
->
setMaximum
(
i_max
);
compCtrl
[
i
]
->
setValue
(
i_val
);
compCtrl
[
i
]
->
setValue
(
i_val
);
oldControlVars
[
i
]
=
f_comp_min_max_val_res_data
[
4
*
i
+
2
]
;
oldControlVars
[
i
]
=
controls
[
i
].
f_value
;
CONNECT
(
compCtrl
[
i
],
valueChanged
(
int
),
this
,
setInitValues
()
);
CONNECT
(
compCtrl
[
i
],
valueChanged
(
int
),
this
,
setInitValues
()
);
ctrl_texts
[
i
]
=
new
QLabel
(
qtr
(
psz_comp_control_descs
[
i
]
)
ctrl_texts
[
i
]
=
new
QLabel
(
qtr
(
controls
[
i
].
psz_descs
)
+
qtr
(
"
\n
"
)
);
+
qtr
(
"
\n
"
)
);
ctrl_texts
[
i
]
->
setFont
(
smallFont
);
ctrl_texts
[
i
]
->
setFont
(
smallFont
);
ctrl_texts
[
i
]
->
setAlignment
(
Qt
::
AlignHCenter
);
ctrl_texts
[
i
]
->
setAlignment
(
Qt
::
AlignHCenter
);
...
@@ -1205,7 +1197,7 @@ Compressor::Compressor( intf_thread_t *_p_intf, QWidget *_parent ) :
...
@@ -1205,7 +1197,7 @@ Compressor::Compressor( intf_thread_t *_p_intf, QWidget *_parent ) :
for
(
int
i
=
0
;
i
<
NUM_CP_CTRL
;
i
++
)
for
(
int
i
=
0
;
i
<
NUM_CP_CTRL
;
i
++
)
{
{
controlVars
[
i
]
=
var_GetFloat
(
p_aout
,
controlVars
[
i
]
=
var_GetFloat
(
p_aout
,
psz_comp_control_names
[
i
]
);
controls
[
i
].
psz_name
);
}
}
vlc_object_release
(
p_aout
);
vlc_object_release
(
p_aout
);
}
}
...
@@ -1215,7 +1207,7 @@ Compressor::Compressor( intf_thread_t *_p_intf, QWidget *_parent ) :
...
@@ -1215,7 +1207,7 @@ Compressor::Compressor( intf_thread_t *_p_intf, QWidget *_parent ) :
for
(
int
i
=
0
;
i
<
NUM_CP_CTRL
;
i
++
)
for
(
int
i
=
0
;
i
<
NUM_CP_CTRL
;
i
++
)
{
{
controlVars
[
i
]
=
config_GetFloat
(
p_intf
,
controlVars
[
i
]
=
config_GetFloat
(
p_intf
,
psz_comp_control_names
[
i
]
);
controls
[
i
].
psz_name
);
}
}
}
}
if
(
psz_af
&&
strstr
(
psz_af
,
"compressor"
)
!=
NULL
)
if
(
psz_af
&&
strstr
(
psz_af
,
"compressor"
)
!=
NULL
)
...
@@ -1252,7 +1244,7 @@ void Compressor::updateSliders( float * controlVars )
...
@@ -1252,7 +1244,7 @@ void Compressor::updateSliders( float * controlVars )
if
(
oldControlVars
[
i
]
!=
controlVars
[
i
]
)
if
(
oldControlVars
[
i
]
!=
controlVars
[
i
]
)
{
{
const
int
i_val
=
(
int
)(
controlVars
[
i
]
const
int
i_val
=
(
int
)(
controlVars
[
i
]
/
f_comp_min_max_val_res_data
[
4
*
i
+
3
]
);
/
controls
[
i
].
f_resolution
);
compCtrl
[
i
]
->
setValue
(
i_val
);
compCtrl
[
i
]
->
setValue
(
i_val
);
}
}
}
}
...
@@ -1270,16 +1262,16 @@ void Compressor::setValues( float * controlVars )
...
@@ -1270,16 +1262,16 @@ void Compressor::setValues( float * controlVars )
for
(
int
i
=
0
;
i
<
NUM_CP_CTRL
;
i
++
)
for
(
int
i
=
0
;
i
<
NUM_CP_CTRL
;
i
++
)
{
{
float
f
=
(
float
)(
compCtrl
[
i
]
->
value
()
)
float
f
=
(
float
)(
compCtrl
[
i
]
->
value
()
)
*
(
f_comp_min_max_val_res_data
[
4
*
i
+
3
]
);
*
(
controls
[
i
].
f_resolution
);
ctrl_readout
[
i
]
->
setText
(
QString
::
number
(
f
,
'f'
,
1
)
ctrl_readout
[
i
]
->
setText
(
QString
::
number
(
f
,
'f'
,
1
)
+
qtr
(
psz_comp_control_units
[
i
]
)
);
+
qtr
(
controls
[
i
].
psz_units
)
);
if
(
oldControlVars
[
i
]
!=
f
)
if
(
oldControlVars
[
i
]
!=
f
)
{
{
if
(
p_aout
)
if
(
p_aout
)
{
{
var_SetFloat
(
p_aout
,
psz_comp_control_names
[
i
]
,
f
);
var_SetFloat
(
p_aout
,
controls
[
i
].
psz_name
,
f
);
}
}
config_PutFloat
(
p_intf
,
psz_comp_control_names
[
i
]
,
f
);
config_PutFloat
(
p_intf
,
controls
[
i
].
psz_name
,
f
);
oldControlVars
[
i
]
=
f
;
oldControlVars
[
i
]
=
f
;
}
}
}
}
...
...
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