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
c285701c
Commit
c285701c
authored
Sep 03, 2010
by
Ronald Wright
Committed by
Jean-Baptiste Kempf
Sep 03, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: Add control to the compressor module
Modified by jb@videolan.org
parent
b14b1885
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
200 additions
and
0 deletions
+200
-0
modules/gui/qt4/components/extended_panels.cpp
modules/gui/qt4/components/extended_panels.cpp
+170
-0
modules/gui/qt4/components/extended_panels.hpp
modules/gui/qt4/components/extended_panels.hpp
+27
-0
modules/gui/qt4/dialogs/extended.cpp
modules/gui/qt4/dialogs/extended.cpp
+3
-0
No files found.
modules/gui/qt4/components/extended_panels.cpp
View file @
c285701c
...
...
@@ -1119,6 +1119,176 @@ void Equalizer::addCallbacks( aout_instance_t *p_aout )
* Audio filters
**********************************************************************/
/**********************************************************************
* 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
[]
=
{
"RMS/peak"
,
"Attack"
,
"Release"
,
"Threshold"
,
"Ratio"
,
"Knee
\n
radius"
,
"Makeup
\n
gain"
};
static
const
char
*
psz_comp_control_units
[]
=
{
""
,
" ms"
,
" ms"
,
" dB"
,
":1"
,
" dB"
,
" dB"
};
static
const
float
f_comp_min_max_val_res_data
[]
=
{
// min max value resolution
//---- ------ ------ ----------
0.0
f
,
1.0
f
,
0.00
f
,
0.001
f
,
// RMS/peak
1.5
f
,
400.0
f
,
25.00
f
,
0.100
f
,
// Attack
2.0
f
,
800.0
f
,
100.00
f
,
0.100
f
,
// Release
-
30.0
f
,
0.0
f
,
-
11.00
f
,
0.010
f
,
// Threshold
1.0
f
,
20.0
f
,
8.00
f
,
0.010
f
,
// Ratio
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
)
:
QWidget
(
_parent
)
,
p_intf
(
_p_intf
)
{
QFont
smallFont
=
QApplication
::
font
(
static_cast
<
QWidget
*>
(
0
)
);
smallFont
.
setPointSize
(
smallFont
.
pointSize
()
-
3
);
QGridLayout
*
layout
=
new
QGridLayout
(
this
);
layout
->
setMargin
(
0
);
enableCheck
=
new
QCheckBox
(
qtr
(
"Enable dynamic range compressor"
)
);
layout
->
addWidget
(
enableCheck
,
0
,
0
,
1
,
NUM_CP_CTRL
);
for
(
int
i
=
0
;
i
<
NUM_CP_CTRL
;
i
++
)
{
compCtrl
[
i
]
=
new
QSlider
(
Qt
::
Vertical
);
const
int
i_min
=
(
int
)(
f_comp_min_max_val_res_data
[
4
*
i
+
0
]
/
f_comp_min_max_val_res_data
[
4
*
i
+
3
]
);
const
int
i_max
=
(
int
)(
f_comp_min_max_val_res_data
[
4
*
i
+
1
]
/
f_comp_min_max_val_res_data
[
4
*
i
+
3
]
);
const
int
i_val
=
(
int
)(
f_comp_min_max_val_res_data
[
4
*
i
+
2
]
/
f_comp_min_max_val_res_data
[
4
*
i
+
3
]
);
compCtrl
[
i
]
->
setMinimum
(
i_min
);
compCtrl
[
i
]
->
setMaximum
(
i_max
);
compCtrl
[
i
]
->
setValue
(
i_val
);
oldControlVars
[
i
]
=
f_comp_min_max_val_res_data
[
4
*
i
+
2
];
CONNECT
(
compCtrl
[
i
],
valueChanged
(
int
),
this
,
setInitValues
()
);
ctrl_texts
[
i
]
=
new
QLabel
(
qtr
(
psz_comp_control_descs
[
i
]
)
+
qtr
(
"
\n
"
)
);
ctrl_texts
[
i
]
->
setFont
(
smallFont
);
ctrl_texts
[
i
]
->
setAlignment
(
Qt
::
AlignHCenter
);
ctrl_readout
[
i
]
=
new
QLabel
(
qtr
(
""
)
);
ctrl_readout
[
i
]
->
setFont
(
smallFont
);
ctrl_readout
[
i
]
->
setAlignment
(
Qt
::
AlignHCenter
);
layout
->
addWidget
(
compCtrl
[
i
],
1
,
i
,
Qt
::
AlignHCenter
);
layout
->
addWidget
(
ctrl_readout
[
i
],
2
,
i
,
Qt
::
AlignHCenter
);
layout
->
addWidget
(
ctrl_texts
[
i
],
3
,
i
,
Qt
::
AlignHCenter
);
}
BUTTONACT
(
enableCheck
,
enable
()
);
/* Write down initial values */
aout_instance_t
*
p_aout
=
THEMIM
->
getAout
();
char
*
psz_af
;
if
(
p_aout
)
{
psz_af
=
var_GetNonEmptyString
(
p_aout
,
"audio-filter"
);
for
(
int
i
=
0
;
i
<
NUM_CP_CTRL
;
i
++
)
{
controlVars
[
i
]
=
var_GetFloat
(
p_aout
,
psz_comp_control_names
[
i
]
);
}
vlc_object_release
(
p_aout
);
}
else
{
psz_af
=
config_GetPsz
(
p_intf
,
"audio-filter"
);
for
(
int
i
=
0
;
i
<
NUM_CP_CTRL
;
i
++
)
{
controlVars
[
i
]
=
config_GetFloat
(
p_intf
,
psz_comp_control_names
[
i
]
);
}
}
if
(
psz_af
&&
strstr
(
psz_af
,
"compressor"
)
!=
NULL
)
{
enableCheck
->
setChecked
(
true
);
}
free
(
psz_af
);
enable
(
enableCheck
->
isChecked
()
);
updateSliders
(
controlVars
);
setValues
(
controlVars
);
}
void
Compressor
::
enable
()
{
bool
en
=
enableCheck
->
isChecked
();
aout_EnableFilter
(
THEPL
,
"compressor"
,
en
);
enable
(
en
);
}
void
Compressor
::
enable
(
bool
en
)
{
for
(
int
i
=
0
;
i
<
NUM_CP_CTRL
;
i
++
)
{
compCtrl
[
i
]
->
setEnabled
(
en
);
ctrl_texts
[
i
]
->
setEnabled
(
en
);
ctrl_readout
[
i
]
->
setEnabled
(
en
);
}
}
void
Compressor
::
updateSliders
(
float
*
controlVars
)
{
for
(
int
i
=
0
;
i
<
NUM_CP_CTRL
;
i
++
)
{
if
(
oldControlVars
[
i
]
!=
controlVars
[
i
]
)
{
const
int
i_val
=
(
int
)(
controlVars
[
i
]
/
f_comp_min_max_val_res_data
[
4
*
i
+
3
]
);
compCtrl
[
i
]
->
setValue
(
i_val
);
}
}
}
void
Compressor
::
setInitValues
()
{
setValues
(
controlVars
);
}
void
Compressor
::
setValues
(
float
*
controlVars
)
{
aout_instance_t
*
p_aout
=
THEMIM
->
getAout
();
for
(
int
i
=
0
;
i
<
NUM_CP_CTRL
;
i
++
)
{
float
f
=
(
float
)(
compCtrl
[
i
]
->
value
()
)
*
(
f_comp_min_max_val_res_data
[
4
*
i
+
3
]
);
ctrl_readout
[
i
]
->
setText
(
QString
::
number
(
f
,
'f'
,
1
)
+
qtr
(
psz_comp_control_units
[
i
]
)
);
if
(
oldControlVars
[
i
]
!=
f
)
{
if
(
p_aout
)
{
var_SetFloat
(
p_aout
,
psz_comp_control_names
[
i
],
f
);
}
config_PutFloat
(
p_intf
,
psz_comp_control_names
[
i
],
f
);
oldControlVars
[
i
]
=
f
;
}
}
if
(
p_aout
)
{
vlc_object_release
(
p_aout
);
}
}
/**********************************************************************
* Spatializer
**********************************************************************/
...
...
modules/gui/qt4/components/extended_panels.hpp
View file @
c285701c
...
...
@@ -38,6 +38,7 @@
#include <QTabWidget>
#define BANDS 10
#define NUM_CP_CTRL 7
#define NUM_SP_CTRL 5
class
QSignalMapper
;
...
...
@@ -115,6 +116,32 @@ private slots:
void
setCorePreset
(
int
);
};
class
Compressor
:
public
QWidget
{
Q_OBJECT
public:
Compressor
(
intf_thread_t
*
,
QWidget
*
);
private:
QSlider
*
compCtrl
[
NUM_CP_CTRL
];
QLabel
*
ctrl_texts
[
NUM_CP_CTRL
];
QLabel
*
ctrl_readout
[
NUM_CP_CTRL
];
float
controlVars
[
NUM_CP_CTRL
];
float
oldControlVars
[
NUM_CP_CTRL
];
QCheckBox
*
enableCheck
;
void
delCallbacks
(
aout_instance_t
*
);
void
addCallbacks
(
aout_instance_t
*
);
intf_thread_t
*
p_intf
;
private
slots
:
void
enable
(
bool
);
void
enable
();
void
updateSliders
(
float
*
);
void
setValues
(
float
*
);
void
setInitValues
();
};
class
Spatializer
:
public
QWidget
{
Q_OBJECT
...
...
modules/gui/qt4/dialogs/extended.cpp
View file @
c285701c
...
...
@@ -55,6 +55,9 @@ ExtendedDialog::ExtendedDialog( intf_thread_t *_p_intf ): QVLCFrame( _p_intf )
equal
=
new
Equalizer
(
p_intf
,
audioTab
);
audioTab
->
addTab
(
equal
,
qtr
(
"Graphic Equalizer"
)
);
Compressor
*
compres
=
new
Compressor
(
p_intf
,
audioTab
);
audioTab
->
addTab
(
compres
,
qtr
(
"Compressor"
)
);
Spatializer
*
spatial
=
new
Spatializer
(
p_intf
,
audioTab
);
audioTab
->
addTab
(
spatial
,
qtr
(
"Spatializer"
)
);
audioLayout
->
addWidget
(
audioTab
);
...
...
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