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
33352675
Commit
33352675
authored
Jan 03, 2013
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: Spatializer: factorize
parent
20fbfbaf
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
142 deletions
+17
-142
modules/gui/qt4/components/extended_panels.cpp
modules/gui/qt4/components/extended_panels.cpp
+15
-117
modules/gui/qt4/components/extended_panels.hpp
modules/gui/qt4/components/extended_panels.hpp
+2
-25
No files found.
modules/gui/qt4/components/extended_panels.cpp
View file @
33352675
...
@@ -997,13 +997,13 @@ void FilterSliderData::writeToConfig()
...
@@ -997,13 +997,13 @@ void FilterSliderData::writeToConfig()
AudioFilterControlWidget
::
AudioFilterControlWidget
AudioFilterControlWidget
::
AudioFilterControlWidget
(
intf_thread_t
*
_p_intf
,
QWidget
*
parent
,
const
char
*
_name
)
:
(
intf_thread_t
*
_p_intf
,
QWidget
*
parent
,
const
char
*
_name
)
:
QWidget
(
parent
),
p_intf
(
_p_intf
),
name
(
_name
)
QWidget
(
parent
),
p_intf
(
_p_intf
),
name
(
_name
)
,
i_smallfont
(
0
)
{}
{}
void
AudioFilterControlWidget
::
build
()
void
AudioFilterControlWidget
::
build
()
{
{
QFont
smallFont
=
QApplication
::
font
();
QFont
smallFont
=
QApplication
::
font
();
smallFont
.
setPointSize
(
smallFont
.
pointSize
()
-
2
);
smallFont
.
setPointSize
(
smallFont
.
pointSize
()
+
i_smallfont
);
QVBoxLayout
*
layout
=
new
QVBoxLayout
(
this
);
QVBoxLayout
*
layout
=
new
QVBoxLayout
(
this
);
slidersBox
=
new
QGroupBox
(
qtr
(
"Enable"
)
);
slidersBox
=
new
QGroupBox
(
qtr
(
"Enable"
)
);
...
@@ -1379,6 +1379,7 @@ void Equalizer::addCallbacks( vlc_object_t *p_aout )
...
@@ -1379,6 +1379,7 @@ void Equalizer::addCallbacks( vlc_object_t *p_aout )
Compressor
::
Compressor
(
intf_thread_t
*
p_intf
,
QWidget
*
parent
)
Compressor
::
Compressor
(
intf_thread_t
*
p_intf
,
QWidget
*
parent
)
:
AudioFilterControlWidget
(
p_intf
,
parent
,
"compressor"
)
:
AudioFilterControlWidget
(
p_intf
,
parent
,
"compressor"
)
{
{
i_smallfont
=
-
2
;
const
FilterSliderData
::
slider_data_t
a
[
7
]
=
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-rms-peak"
,
qtr
(
"RMS/peak"
),
""
,
0.0
f
,
1.0
f
,
0.00
f
,
0.001
f
},
...
@@ -1396,124 +1397,21 @@ Compressor::Compressor( intf_thread_t *p_intf, QWidget *parent )
...
@@ -1396,124 +1397,21 @@ Compressor::Compressor( intf_thread_t *p_intf, QWidget *parent )
/**********************************************************************
/**********************************************************************
* Spatializer
* Spatializer
**********************************************************************/
**********************************************************************/
const
Spatializer
::
spat_controls_t
Spatializer
::
spat_controls
[]
=
{
{
"spatializer-roomsize"
,
_
(
"Size"
)
},
{
"spatializer-width"
,
_
(
"Width"
)
},
{
"spatializer-wet"
,
_
(
"Wet"
)
},
{
"spatializer-dry"
,
_
(
"Dry"
)
},
{
"spatializer-damp"
,
_
(
"Damp"
)
},
};
Spatializer
::
Spatializer
(
intf_thread_t
*
_p_intf
,
QWidget
*
_
parent
)
Spatializer
::
Spatializer
(
intf_thread_t
*
p_intf
,
QWidget
*
parent
)
:
QWidget
(
_parent
)
,
p_intf
(
_p_intf
)
:
AudioFilterControlWidget
(
p_intf
,
parent
,
"spatializer"
)
{
{
QFont
smallFont
=
QApplication
::
font
();
i_smallfont
=
-
1
;
smallFont
.
setPointSize
(
smallFont
.
pointSize
()
-
1
);
const
FilterSliderData
::
slider_data_t
a
[
5
]
=
QVBoxLayout
*
layout
=
new
QVBoxLayout
(
this
);
spatializerBox
=
new
QGroupBox
(
qtr
(
"Enable"
)
);
spatializerBox
->
setCheckable
(
true
);
layout
->
addWidget
(
spatializerBox
);
QGridLayout
*
ctrlLayout
=
new
QGridLayout
(
spatializerBox
);
for
(
int
i
=
0
;
i
<
NUM_SP_CTRL
;
i
++
)
{
spatCtrl
[
i
]
=
new
QSlider
(
Qt
::
Vertical
);
spatCtrl
[
i
]
->
setValue
(
(
int
)
var_InheritFloat
(
p_intf
,
spat_controls
[
i
].
psz_name
)
*
10.
);
oldControlVars
[
i
]
=
spatCtrl
[
i
]
->
value
();
ctrl_texts
[
i
]
=
new
QLabel
(
qtr
(
spat_controls
[
i
].
psz_desc
)
+
"
\n
"
);
ctrl_texts
[
i
]
->
setFont
(
smallFont
);
ctrl_readout
[
i
]
=
new
QLabel
;
ctrl_readout
[
i
]
->
setFont
(
smallFont
);
ctrlLayout
->
addWidget
(
spatCtrl
[
i
],
0
,
i
,
Qt
::
AlignHCenter
);
ctrlLayout
->
addWidget
(
ctrl_readout
[
i
],
1
,
i
,
Qt
::
AlignHCenter
);
ctrlLayout
->
addWidget
(
ctrl_texts
[
i
],
2
,
i
,
Qt
::
AlignHCenter
);
spatCtrl
[
i
]
->
setRange
(
0
,
10
);
}
spatCtrl
[
0
]
->
setRange
(
0
,
11
);
for
(
int
i
=
0
;
i
<
NUM_SP_CTRL
;
i
++
)
CONNECT
(
spatCtrl
[
i
],
valueChanged
(
int
),
this
,
setValues
()
);
/* Write down initial values */
vlc_object_t
*
p_aout
=
(
vlc_object_t
*
)
THEMIM
->
getAout
();
char
*
psz_af
;
if
(
p_aout
)
{
psz_af
=
var_GetNonEmptyString
(
p_aout
,
"audio-filter"
);
for
(
int
i
=
0
;
i
<
NUM_SP_CTRL
;
i
++
)
{
{
controlVars
[
i
]
=
var_GetFloat
(
p_aout
,
spat_controls
[
i
].
psz_name
);
{
"spatializer-roomsize"
,
qtr
(
"Size"
),
""
,
0.0
f
,
11.0
f
,
0.0
f
,
1.0
f
},
}
{
"spatializer-width"
,
qtr
(
"Width"
),
""
,
0.0
f
,
10.0
f
,
0.0
f
,
1.0
f
},
vlc_object_release
(
p_aout
);
{
"spatializer-wet"
,
qtr
(
"Wet"
),
""
,
0.0
f
,
10.0
f
,
0.0
f
,
1.0
f
},
}
{
"spatializer-dry"
,
qtr
(
"Dry"
),
""
,
0.0
f
,
10.0
f
,
0.0
f
,
1.0
f
},
else
{
"spatializer-damp"
,
qtr
(
"Damp"
),
""
,
0.0
f
,
10.0
f
,
0.0
f
,
1.0
f
},
{
};
psz_af
=
config_GetPsz
(
p_intf
,
"audio-filter"
);
for
(
int
i
=
0
;
i
<
5
;
i
++
)
controls
.
append
(
a
[
i
]
);
for
(
int
i
=
0
;
i
<
NUM_SP_CTRL
;
i
++
)
build
();
{
controlVars
[
i
]
=
config_GetFloat
(
p_intf
,
spat_controls
[
i
].
psz_name
);
}
}
if
(
psz_af
&&
strstr
(
psz_af
,
"spatializer"
)
!=
NULL
)
spatializerBox
->
setChecked
(
true
);
else
spatializerBox
->
setChecked
(
false
);
CONNECT
(
spatializerBox
,
toggled
(
bool
),
this
,
enable
()
);
free
(
psz_af
);
setValues
();
}
void
Spatializer
::
enable
()
{
playlist_EnableAudioFilter
(
THEPL
,
"spatializer"
,
spatializerBox
->
isChecked
()
);
}
void
Spatializer
::
setValues
()
{
vlc_object_t
*
p_aout
=
(
vlc_object_t
*
)
THEMIM
->
getAout
();
for
(
int
i
=
0
;
i
<
NUM_SP_CTRL
;
i
++
)
{
float
f
=
(
float
)(
spatCtrl
[
i
]
->
value
()
)
/
10
;
ctrl_readout
[
i
]
->
setText
(
QString
::
number
(
f
,
'f'
,
1
)
);
}
if
(
p_aout
)
{
for
(
int
i
=
0
;
i
<
NUM_SP_CTRL
;
i
++
)
{
float
f
=
(
float
)(
spatCtrl
[
i
]
->
value
()
)
/
10
;
if
(
oldControlVars
[
i
]
!=
spatCtrl
[
i
]
->
value
()
)
{
var_SetFloat
(
p_aout
,
spat_controls
[
i
].
psz_name
,
f
);
config_PutFloat
(
p_intf
,
spat_controls
[
i
].
psz_name
,
f
);
oldControlVars
[
i
]
=
spatCtrl
[
i
]
->
value
();
}
}
vlc_object_release
(
p_aout
);
}
}
void
Spatializer
::
delCallbacks
(
vlc_object_t
*
p_aout
)
{
VLC_UNUSED
(
p_aout
);
// var_DelCallback( p_aout, "Spatializer-bands", EqzCallback, this );
// var_DelCallback( p_aout, "Spatializer-preamp", EqzCallback, this );
}
void
Spatializer
::
addCallbacks
(
vlc_object_t
*
p_aout
)
{
VLC_UNUSED
(
p_aout
);
// var_AddCallback( p_aout, "Spatializer-bands", EqzCallback, this );
// var_AddCallback( p_aout, "Spatializer-preamp", EqzCallback, this );
}
}
#include <QToolButton>
#include <QToolButton>
...
...
modules/gui/qt4/components/extended_panels.hpp
View file @
33352675
...
@@ -37,7 +37,6 @@
...
@@ -37,7 +37,6 @@
#include <QTabWidget>
#include <QTabWidget>
#define BANDS 10
#define BANDS 10
#define NUM_SP_CTRL 5
class
QSignalMapper
;
class
QSignalMapper
;
...
@@ -133,6 +132,7 @@ protected:
...
@@ -133,6 +132,7 @@ protected:
QGroupBox
*
slidersBox
;
QGroupBox
*
slidersBox
;
intf_thread_t
*
p_intf
;
intf_thread_t
*
p_intf
;
QString
name
;
// filter's module name
QString
name
;
// filter's module name
int
i_smallfont
;
protected
slots
:
protected
slots
:
void
enable
();
void
enable
();
...
@@ -177,35 +177,12 @@ public:
...
@@ -177,35 +177,12 @@ public:
Compressor
(
intf_thread_t
*
,
QWidget
*
);
Compressor
(
intf_thread_t
*
,
QWidget
*
);
};
};
class
Spatializer
:
public
Q
Widget
class
Spatializer
:
public
AudioFilterControl
Widget
{
{
Q_OBJECT
Q_OBJECT
public:
public:
Spatializer
(
intf_thread_t
*
,
QWidget
*
);
Spatializer
(
intf_thread_t
*
,
QWidget
*
);
private:
typedef
struct
{
const
char
*
psz_name
;
const
char
*
psz_desc
;
}
spat_controls_t
;
static
const
spat_controls_t
spat_controls
[
NUM_SP_CTRL
];
QSlider
*
spatCtrl
[
NUM_SP_CTRL
];
QLabel
*
ctrl_texts
[
NUM_SP_CTRL
];
QLabel
*
ctrl_readout
[
NUM_SP_CTRL
];
float
controlVars
[
NUM_SP_CTRL
];
float
oldControlVars
[
NUM_SP_CTRL
];
QGroupBox
*
spatializerBox
;
void
delCallbacks
(
vlc_object_t
*
);
void
addCallbacks
(
vlc_object_t
*
);
intf_thread_t
*
p_intf
;
private
slots
:
void
enable
();
void
setValues
();
};
};
class
SyncWidget
:
public
QWidget
class
SyncWidget
:
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