Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
3fb0adb3
Commit
3fb0adb3
authored
Aug 03, 2008
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed static variable and added proper locking scheme.
parent
ec9c851b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
29 deletions
+58
-29
modules/audio_filter/spatializer/spatializer.cpp
modules/audio_filter/spatializer/spatializer.cpp
+58
-29
No files found.
modules/audio_filter/spatializer/spatializer.cpp
View file @
3fb0adb3
...
...
@@ -66,12 +66,23 @@ vlc_module_end();
*****************************************************************************/
typedef
struct
aout_filter_sys_t
{
/* reverb static config */
bool
b_first
;
vlc_mutex_t
lock
;
revmodel
*
p_reverbm
;
}
aout_filter_sys_t
;
static
revmodel
reverbm
;
class
CLocker
{
public:
CLocker
(
vlc_mutex_t
*
p_lock
)
:
p_lock
(
p_lock
)
{
vlc_mutex_lock
(
p_lock
);
}
virtual
~
CLocker
()
{
vlc_mutex_unlock
(
p_lock
);
}
private:
vlc_mutex_t
*
p_lock
;
};
static
const
char
*
psz_control_names
[]
=
{
...
...
@@ -131,11 +142,14 @@ static int Open( vlc_object_t *p_this )
/* Allocate structure */
p_sys
=
p_filter
->
p_sys
=
(
aout_filter_sys_t
*
)
malloc
(
sizeof
(
aout_filter_sys_t
)
);
reverbm
.
setroomsize
(
1.05
);
reverbm
.
setwet
(
10.0
f
);
reverbm
.
setdry
(
1.0
f
);
reverbm
.
setdamp
(
0.3
);
reverbm
.
setwidth
(
0.9
);
vlc_mutex_init
(
&
p_sys
->
lock
);
p_sys
->
p_reverbm
=
new
revmodel
();
p_sys
->
p_reverbm
->
setroomsize
(
1.05
);
p_sys
->
p_reverbm
->
setwet
(
10.0
f
);
p_sys
->
p_reverbm
->
setdry
(
1.0
f
);
p_sys
->
p_reverbm
->
setdamp
(
0.3
);
p_sys
->
p_reverbm
->
setwidth
(
0.9
);
SpatInit
(
p_filter
);
return
VLC_SUCCESS
;
...
...
@@ -149,6 +163,8 @@ static void Close( vlc_object_t *p_this )
aout_filter_t
*
p_filter
=
(
aout_filter_t
*
)
p_this
;
aout_filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
SpatClean
(
p_filter
);
delete
p_sys
->
p_reverbm
;
vlc_mutex_destroy
(
&
p_sys
->
lock
);
free
(
p_sys
);
msg_Dbg
(
p_this
,
"Closing filter spatializer %s %s %d
\n
"
,
__FILE__
,
__func__
,
__LINE__
);
}
...
...
@@ -176,9 +192,9 @@ static int SpatInit( aout_filter_t *p_filter )
vlc_value_t
val1
,
val2
,
val3
,
val4
,
val5
;
aout_instance_t
*
p_aout
=
(
aout_instance_t
*
)
p_filter
->
p_parent
;
for
(
i
nt
i
=
0
;
i
<
5
;
i
++
)
for
(
i
=
0
;
i
<
5
;
i
++
)
{
var_CreateGetFloatCommand
(
p_aout
,
psz_control_names
[
i
]
);
var_CreateGetFloatCommand
(
p_aout
,
psz_control_names
[
i
]
);
}
/* Get initial values */
...
...
@@ -209,6 +225,9 @@ static void SpatFilter( aout_instance_t *p_aout,
aout_filter_t
*
p_filter
,
float
*
out
,
float
*
in
,
int
i_samples
,
int
i_channels
)
{
aout_filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
CLocker
locker
(
&
p_sys
->
lock
);
int
i
,
ch
,
j
;
for
(
i
=
0
;
i
<
i_samples
;
i
++
)
{
...
...
@@ -216,62 +235,72 @@ static void SpatFilter( aout_instance_t *p_aout,
{
in
[
ch
]
=
in
[
ch
]
*
SPAT_AMP
;
}
reverbm
.
processreplace
(
in
,
out
,
1
,
i_channels
);
in
+=
i_channels
;
out
+=
i_channels
;
p_sys
->
p_reverbm
->
processreplace
(
in
,
out
,
1
,
i_channels
);
in
+=
i_channels
;
out
+=
i_channels
;
}
}
static
void
SpatClean
(
aout_filter_t
*
p_filter
)
{
aout_instance_t
*
p_aout
=
(
aout_instance_t
*
)
p_filter
->
p_parent
;
aout_filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
var_DelCallback
(
(
aout_instance_t
*
)
p_filter
->
p_parent
,
"Roomsize"
,
RoomCallback
,
p_sys
);
var_DelCallback
(
(
aout_instance_t
*
)
p_filter
->
p_parent
,
"Width"
,
WidthCallback
,
p_sys
);
var_DelCallback
(
(
aout_instance_t
*
)
p_filter
->
p_parent
,
"Wet"
,
WetCallback
,
p_sys
);
var_DelCallback
(
(
aout_instance_t
*
)
p_filter
->
p_parent
,
"Dry"
,
DryCallback
,
p_sys
);
var_DelCallback
(
(
aout_instance_t
*
)
p_filter
->
p_parent
,
"Damp"
,
DampCallback
,
p_sys
);
var_DelCallback
(
p_aout
,
psz_control_names
[
0
],
RoomCallback
,
p_sys
);
var_DelCallback
(
p_aout
,
psz_control_names
[
1
],
WidthCallback
,
p_sys
);
var_DelCallback
(
p_aout
,
psz_control_names
[
2
],
WetCallback
,
p_sys
);
var_DelCallback
(
p_aout
,
psz_control_names
[
3
],
DryCallback
,
p_sys
);
var_DelCallback
(
p_aout
,
psz_control_names
[
4
],
DampCallback
,
p_sys
);
}
static
int
RoomCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
)
{
aout_filter_sys_t
*
p_sys
=
(
aout_filter_sys_t
*
)
p_data
;
CLocker
locker
(
&
p_sys
->
lock
);
p_sys
->
p_reverbm
->
setroomsize
(
newval
.
f_float
);
msg_Dbg
(
p_this
,
"room callback %3.1f %s %s %d
\n
"
,
newval
.
f_float
,
__FILE__
,
__func__
,
__LINE__
);
reverbm
.
setroomsize
(
newval
.
f_float
);
return
VLC_SUCCESS
;
}
static
int
WidthCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
)
{
reverbm
.
setwidth
(
newval
.
f_float
);
aout_filter_sys_t
*
p_sys
=
(
aout_filter_sys_t
*
)
p_data
;
CLocker
locker
(
&
p_sys
->
lock
);
p_sys
->
p_reverbm
->
setwidth
(
newval
.
f_float
);
msg_Dbg
(
p_this
,
"width callback %3.1f %s %s %d
\n
"
,
newval
.
f_float
,
__FILE__
,
__func__
,
__LINE__
);
return
VLC_SUCCESS
;
}
static
int
WetCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
)
{
reverbm
.
setwet
(
newval
.
f_float
);
aout_filter_sys_t
*
p_sys
=
(
aout_filter_sys_t
*
)
p_data
;
CLocker
locker
(
&
p_sys
->
lock
);
p_sys
->
p_reverbm
->
setwet
(
newval
.
f_float
);
msg_Dbg
(
p_this
,
"wet callback %3.1f %s %s %d
\n
"
,
newval
.
f_float
,
__FILE__
,
__func__
,
__LINE__
);
return
VLC_SUCCESS
;
}
static
int
DryCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
)
{
reverbm
.
setdry
(
newval
.
f_float
);
aout_filter_sys_t
*
p_sys
=
(
aout_filter_sys_t
*
)
p_data
;
CLocker
locker
(
&
p_sys
->
lock
);
p_sys
->
p_reverbm
->
setdry
(
newval
.
f_float
);
msg_Dbg
(
p_this
,
"dry callback %3.1f %s %s %d
\n
"
,
newval
.
f_float
,
__FILE__
,
__func__
,
__LINE__
);
return
VLC_SUCCESS
;
}
static
int
DampCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
)
{
reverbm
.
setdamp
(
newval
.
f_float
);
aout_filter_sys_t
*
p_sys
=
(
aout_filter_sys_t
*
)
p_data
;
CLocker
locker
(
&
p_sys
->
lock
);
p_sys
->
p_reverbm
->
setdamp
(
newval
.
f_float
);
msg_Dbg
(
p_this
,
"damp callback %3.1f %s %s %d
\n
"
,
newval
.
f_float
,
__FILE__
,
__func__
,
__LINE__
);
return
VLC_SUCCESS
;
}
...
...
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