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
20fbfbaf
Commit
20fbfbaf
authored
Jan 03, 2013
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: Compressor: create base class for factorization
parent
79ece335
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
113 additions
and
87 deletions
+113
-87
modules/gui/qt4/components/extended_panels.cpp
modules/gui/qt4/components/extended_panels.cpp
+86
-70
modules/gui/qt4/components/extended_panels.hpp
modules/gui/qt4/components/extended_panels.hpp
+27
-17
No files found.
modules/gui/qt4/components/extended_panels.cpp
View file @
20fbfbaf
...
...
@@ -928,7 +928,7 @@ FilterSliderData::FilterSliderData( QObject *parent,
{
slider
->
setMinimum
(
p_data
->
f_min
/
p_data
->
f_resolution
);
slider
->
setMaximum
(
p_data
->
f_max
/
p_data
->
f_resolution
);
nameLabel
->
setText
(
qfu
(
p_data
->
psz_descs
)
);
nameLabel
->
setText
(
p_data
->
descs
);
CONNECT
(
slider
,
valueChanged
(
int
),
this
,
updateText
(
int
)
);
setValue
(
initialValue
()
);
/* In case current == min|max text would not be first updated */
...
...
@@ -946,7 +946,7 @@ void FilterSliderData::setValue( float f )
void
FilterSliderData
::
updateText
(
int
i
)
{
float
f
=
((
float
)
i
)
*
p_data
->
f_resolution
;
valueLabel
->
setText
(
qfu
(
p_data
->
psz_
units
)
valueLabel
->
setText
(
QString
(
p_data
->
units
)
.
prepend
(
"%1"
)
.
arg
(
QString
::
number
(
f
,
'f'
,
1
)
)
);
}
...
...
@@ -957,23 +957,23 @@ float FilterSliderData::initialValue()
float
f
=
p_data
->
f_value
;
if
(
p_aout
)
{
if
(
var_Type
(
p_aout
,
p_data
->
psz_name
)
==
0
)
if
(
var_Type
(
p_aout
,
qtu
(
p_data
->
name
)
)
==
0
)
{
vlc_object_release
(
p_aout
);
/* Not found, will try in config */
}
else
{
f
=
var_GetFloat
(
p_aout
,
p_data
->
psz_name
);
f
=
var_GetFloat
(
p_aout
,
qtu
(
p_data
->
name
)
);
vlc_object_release
(
p_aout
);
return
f
;
}
}
if
(
!
config_FindConfig
(
VLC_OBJECT
(
p_intf
),
p_data
->
psz_name
)
)
if
(
!
config_FindConfig
(
VLC_OBJECT
(
p_intf
),
qtu
(
p_data
->
name
)
)
)
return
f
;
f
=
config_GetFloat
(
p_intf
,
p_data
->
psz_name
);
f
=
config_GetFloat
(
p_intf
,
qtu
(
p_data
->
name
)
);
return
f
;
}
...
...
@@ -983,7 +983,7 @@ void FilterSliderData::onValueChanged( int i )
vlc_object_t
*
p_aout
=
(
vlc_object_t
*
)
THEMIM
->
getAout
();
if
(
p_aout
)
{
var_SetFloat
(
p_aout
,
p_data
->
psz_name
,
f
);
var_SetFloat
(
p_aout
,
qtu
(
p_data
->
name
)
,
f
);
vlc_object_release
(
p_aout
);
}
writeToConfig
();
...
...
@@ -992,7 +992,72 @@ void FilterSliderData::onValueChanged( int i )
void
FilterSliderData
::
writeToConfig
()
{
float
f
=
((
float
)
slider
->
value
())
*
p_data
->
f_resolution
;
config_PutFloat
(
p_intf
,
p_data
->
psz_name
,
f
);
config_PutFloat
(
p_intf
,
qtu
(
p_data
->
name
),
f
);
}
AudioFilterControlWidget
::
AudioFilterControlWidget
(
intf_thread_t
*
_p_intf
,
QWidget
*
parent
,
const
char
*
_name
)
:
QWidget
(
parent
),
p_intf
(
_p_intf
),
name
(
_name
)
{}
void
AudioFilterControlWidget
::
build
()
{
QFont
smallFont
=
QApplication
::
font
();
smallFont
.
setPointSize
(
smallFont
.
pointSize
()
-
2
);
QVBoxLayout
*
layout
=
new
QVBoxLayout
(
this
);
slidersBox
=
new
QGroupBox
(
qtr
(
"Enable"
)
);
slidersBox
->
setCheckable
(
true
);
layout
->
addWidget
(
slidersBox
);
QGridLayout
*
ctrlLayout
=
new
QGridLayout
(
slidersBox
);
int
i
=
0
;
foreach
(
const
FilterSliderData
::
slider_data_t
&
data
,
controls
)
{
QSlider
*
slider
=
new
QSlider
(
Qt
::
Vertical
);
QLabel
*
valueLabel
=
new
QLabel
();
valueLabel
->
setFont
(
smallFont
);
valueLabel
->
setAlignment
(
Qt
::
AlignHCenter
);
QLabel
*
nameLabel
=
new
QLabel
();
nameLabel
->
setFont
(
smallFont
);
nameLabel
->
setAlignment
(
Qt
::
AlignHCenter
);
FilterSliderData
*
filter
=
new
FilterSliderData
(
this
,
p_intf
,
slider
,
valueLabel
,
nameLabel
,
&
data
);
ctrlLayout
->
addWidget
(
slider
,
0
,
i
,
Qt
::
AlignHCenter
);
ctrlLayout
->
addWidget
(
valueLabel
,
1
,
i
,
Qt
::
AlignHCenter
);
ctrlLayout
->
addWidget
(
nameLabel
,
2
,
i
,
Qt
::
AlignHCenter
);
i
++
;
}
vlc_object_t
*
p_aout
=
(
vlc_object_t
*
)
THEMIM
->
getAout
();
char
*
psz_af
;
if
(
p_aout
)
{
psz_af
=
var_GetNonEmptyString
(
p_aout
,
"audio-filter"
);
vlc_object_release
(
p_aout
);
}
else
psz_af
=
config_GetPsz
(
p_intf
,
"audio-filter"
);
if
(
psz_af
&&
strstr
(
psz_af
,
qtu
(
name
)
)
!=
NULL
)
slidersBox
->
setChecked
(
true
);
else
slidersBox
->
setChecked
(
false
);
CONNECT
(
slidersBox
,
toggled
(
bool
),
this
,
enable
()
);
free
(
psz_af
);
}
AudioFilterControlWidget
::~
AudioFilterControlWidget
()
{
}
void
AudioFilterControlWidget
::
enable
()
{
playlist_EnableAudioFilter
(
THEPL
,
qtu
(
name
),
slidersBox
->
isChecked
()
);
}
/**********************************************************************
...
...
@@ -1311,72 +1376,23 @@ void Equalizer::addCallbacks( vlc_object_t *p_aout )
* Dynamic range compressor
**********************************************************************/
const
FilterSliderData
::
slider_data_t
Compressor
::
comp_controls
[]
=
{
{
"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
},
{
"compressor-release"
,
_
(
"Release"
),
_
(
" ms"
),
2.0
f
,
800.0
f
,
100.00
f
,
0.100
f
},
{
"compressor-threshold"
,
_
(
"Threshold"
),
_
(
" dB"
),
-
30.0
f
,
0.0
f
,
-
11.00
f
,
0.010
f
},
{
"compressor-ratio"
,
_
(
"Ratio"
),
":1"
,
1.0
f
,
20.0
f
,
8.00
f
,
0.010
f
},
{
"compressor-knee"
,
_
(
"Knee
\n
radius"
),
_
(
" dB"
),
1.0
f
,
10.0
f
,
2.50
f
,
0.010
f
},
{
"compressor-makeup-gain"
,
_
(
"Makeup
\n
gain"
),
_
(
" dB"
),
0.0
f
,
24.0
f
,
7.00
f
,
0.010
f
},
};
Compressor
::
Compressor
(
intf_thread_t
*
_p_intf
,
QWidget
*
_parent
)
:
QWidget
(
_parent
)
,
p_intf
(
_p_intf
)
Compressor
::
Compressor
(
intf_thread_t
*
p_intf
,
QWidget
*
parent
)
:
AudioFilterControlWidget
(
p_intf
,
parent
,
"compressor"
)
{
QFont
smallFont
=
QApplication
::
font
();
smallFont
.
setPointSize
(
smallFont
.
pointSize
()
-
2
);
QVBoxLayout
*
layout
=
new
QVBoxLayout
(
this
);
compressorBox
=
new
QGroupBox
(
qtr
(
"Enable"
)
);
compressorBox
->
setCheckable
(
true
);
layout
->
addWidget
(
compressorBox
);
QGridLayout
*
ctrlLayout
=
new
QGridLayout
(
compressorBox
);
for
(
int
i
=
0
;
i
<
NUM_CP_CTRL
;
i
++
)
{
QSlider
*
slider
=
new
QSlider
(
Qt
::
Vertical
);
QLabel
*
valueLabel
=
new
QLabel
();
valueLabel
->
setFont
(
smallFont
);
valueLabel
->
setAlignment
(
Qt
::
AlignHCenter
);
QLabel
*
nameLabel
=
new
QLabel
();
nameLabel
->
setFont
(
smallFont
);
nameLabel
->
setAlignment
(
Qt
::
AlignHCenter
);
FilterSliderData
*
filter
=
new
FilterSliderData
(
this
,
p_intf
,
slider
,
valueLabel
,
nameLabel
,
&
comp_controls
[
i
]
);
ctrlLayout
->
addWidget
(
slider
,
0
,
i
,
Qt
::
AlignHCenter
);
ctrlLayout
->
addWidget
(
valueLabel
,
1
,
i
,
Qt
::
AlignHCenter
);
ctrlLayout
->
addWidget
(
nameLabel
,
2
,
i
,
Qt
::
AlignHCenter
);
}
vlc_object_t
*
p_aout
=
(
vlc_object_t
*
)
THEMIM
->
getAout
();
char
*
psz_af
;
if
(
p_aout
)
{
psz_af
=
var_GetNonEmptyString
(
p_aout
,
"audio-filter"
);
vlc_object_release
(
p_aout
);
}
else
psz_af
=
config_GetPsz
(
p_intf
,
"audio-filter"
);
if
(
psz_af
&&
strstr
(
psz_af
,
"compressor"
)
!=
NULL
)
compressorBox
->
setChecked
(
true
);
else
compressorBox
->
setChecked
(
false
);
CONNECT
(
compressorBox
,
toggled
(
bool
),
this
,
enable
()
);
free
(
psz_af
);
const
FilterSliderData
::
slider_data_t
a
[
7
]
=
{
{
"compressor-rms-peak"
,
qtr
(
"RMS/peak"
),
""
,
0.0
f
,
1.0
f
,
0.00
f
,
0.001
f
},
{
"compressor-attack"
,
qtr
(
"Attack"
),
qtr
(
" ms"
),
1.5
f
,
400.0
f
,
25.00
f
,
0.100
f
},
{
"compressor-release"
,
qtr
(
"Release"
),
qtr
(
" ms"
),
2.0
f
,
800.0
f
,
100.00
f
,
0.100
f
},
{
"compressor-threshold"
,
qtr
(
"Threshold"
),
qtr
(
" dB"
),
-
30.0
f
,
0.0
f
,
-
11.00
f
,
0.010
f
},
{
"compressor-ratio"
,
qtr
(
"Ratio"
),
":1"
,
1.0
f
,
20.0
f
,
8.00
f
,
0.010
f
},
{
"compressor-knee"
,
qtr
(
"Knee
\n
radius"
),
qtr
(
" dB"
),
1.0
f
,
10.0
f
,
2.50
f
,
0.010
f
},
{
"compressor-makeup-gain"
,
qtr
(
"Makeup
\n
gain"
),
qtr
(
" dB"
),
0.0
f
,
24.0
f
,
7.00
f
,
0.010
f
},
};
for
(
int
i
=
0
;
i
<
7
;
i
++
)
controls
.
append
(
a
[
i
]
);
build
();
}
void
Compressor
::
enable
()
{
playlist_EnableAudioFilter
(
THEPL
,
"compressor"
,
compressorBox
->
isChecked
()
);
}
/**********************************************************************
* Spatializer
**********************************************************************/
...
...
modules/gui/qt4/components/extended_panels.hpp
View file @
20fbfbaf
...
...
@@ -37,7 +37,6 @@
#include <QTabWidget>
#define BANDS 10
#define NUM_CP_CTRL 7
#define NUM_SP_CTRL 5
class
QSignalMapper
;
...
...
@@ -90,13 +89,13 @@ class FilterSliderData : public QObject
public:
typedef
struct
{
const
char
*
psz_
name
;
const
char
*
psz_
descs
;
const
char
*
psz_
units
;
const
float
f_min
;
// min
const
float
f_max
;
// max
const
float
f_value
;
// value
const
float
f_resolution
;
// resolution
QString
name
;
QString
descs
;
QString
units
;
float
f_min
;
// min
float
f_max
;
// max
float
f_value
;
// value
float
f_resolution
;
// resolution
}
slider_data_t
;
FilterSliderData
(
QObject
*
parent
,
intf_thread_t
*
p_intf
,
QSlider
*
slider
,
...
...
@@ -120,6 +119,25 @@ private:
const
slider_data_t
*
p_data
;
}
;
class
AudioFilterControlWidget
:
public
QWidget
{
Q_OBJECT
public:
AudioFilterControlWidget
(
intf_thread_t
*
,
QWidget
*
,
const
char
*
name
);
virtual
~
AudioFilterControlWidget
();
protected:
virtual
void
build
();
QVector
<
FilterSliderData
::
slider_data_t
>
controls
;
QGroupBox
*
slidersBox
;
intf_thread_t
*
p_intf
;
QString
name
;
// filter's module name
protected
slots
:
void
enable
();
};
class
Equalizer
:
public
QWidget
{
Q_OBJECT
...
...
@@ -151,20 +169,12 @@ private slots:
void
setCorePreset
(
int
);
};
class
Compressor
:
public
Q
Widget
class
Compressor
:
public
AudioFilterControl
Widget
{
Q_OBJECT
public:
Compressor
(
intf_thread_t
*
,
QWidget
*
);
private:
static
const
FilterSliderData
::
slider_data_t
comp_controls
[
NUM_CP_CTRL
];
QGroupBox
*
compressorBox
;
intf_thread_t
*
p_intf
;
private
slots
:
void
enable
();
};
class
Spatializer
:
public
QWidget
...
...
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