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
f001a156
Commit
f001a156
authored
Jun 18, 2009
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No need to create an object to handle the lock is such a simple case.
parent
3e10d0e6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
51 deletions
+51
-51
modules/audio_filter/spatializer/spatializer.cpp
modules/audio_filter/spatializer/spatializer.cpp
+51
-51
No files found.
modules/audio_filter/spatializer/spatializer.cpp
View file @
f001a156
...
@@ -9,19 +9,19 @@
...
@@ -9,19 +9,19 @@
*
*
* Mentor : Jean-Baptiste Kempf <jb@videolan.org>
* Mentor : Jean-Baptiste Kempf <jb@videolan.org>
*
*
* This program is free software; you can redistribute it and/or modify
* This program is free software; you can redistribute it and/or modify
it
*
it under the terms of the GNU General Public License as published by
*
under the terms of the GNU General Public License as published by the Free
*
the Free Software Foundation; either version 2 of the License, or
*
Software Foundation; either version 2 of the License, or (at your option)
*
(at your option)
any later version.
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* This program is distributed in the hope that it will be useful,
but WITHOUT
*
but WITHOUT ANY WARRANTY; without even the implied warranty of
*
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
*
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
*
GNU General Public License for
more details.
* more details.
*
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU General Public License
along with
*
along with this program; if not, write to the Free Software
*
this program; if not, write to the Free Software Foundation, Inc., 51
* F
oundation, Inc., 51 F
ranklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
*****************************************************************************/
/*****************************************************************************
/*****************************************************************************
...
@@ -90,21 +90,6 @@ struct aout_filter_sys_t
...
@@ -90,21 +90,6 @@ struct aout_filter_sys_t
};
};
class
CLocker
{
public:
CLocker
(
vlc_mutex_t
*
p_lock_to_manage
)
:
p_lock
(
p_lock_to_manage
)
{
vlc_mutex_lock
(
p_lock
);
}
virtual
~
CLocker
()
{
vlc_mutex_unlock
(
p_lock
);
}
private:
vlc_mutex_t
*
p_lock
;
};
static
const
char
*
psz_control_names
[]
=
static
const
char
*
psz_control_names
[]
=
{
{
"spatializer-roomsize"
,
"spatializer-width"
,
"spatializer-roomsize"
,
"spatializer-width"
,
...
@@ -173,10 +158,10 @@ static int Open( vlc_object_t *p_this )
...
@@ -173,10 +158,10 @@ static int Open( vlc_object_t *p_this )
/* Init the variables */
/* Init the variables */
p_sys
->
p_reverbm
=
new
revmodel
();
p_sys
->
p_reverbm
=
new
revmodel
();
p_sys
->
p_reverbm
->
setroomsize
(
var_CreateGetFloatCommand
(
p_aout
,
psz_control_names
[
0
]
)
);
p_sys
->
p_reverbm
->
setroomsize
(
var_CreateGetFloatCommand
(
p_aout
,
psz_control_names
[
0
]
)
);
p_sys
->
p_reverbm
->
setwidth
(
var_CreateGetFloatCommand
(
p_aout
,
psz_control_names
[
1
]
)
);
p_sys
->
p_reverbm
->
setwidth
(
var_CreateGetFloatCommand
(
p_aout
,
psz_control_names
[
1
]
)
);
p_sys
->
p_reverbm
->
setwet
(
var_CreateGetFloatCommand
(
p_aout
,
psz_control_names
[
2
]
)
);
p_sys
->
p_reverbm
->
setwet
(
var_CreateGetFloatCommand
(
p_aout
,
psz_control_names
[
2
]
)
);
p_sys
->
p_reverbm
->
setdry
(
var_CreateGetFloatCommand
(
p_aout
,
psz_control_names
[
3
]
)
);
p_sys
->
p_reverbm
->
setdry
(
var_CreateGetFloatCommand
(
p_aout
,
psz_control_names
[
3
]
)
);
p_sys
->
p_reverbm
->
setdamp
(
var_CreateGetFloatCommand
(
p_aout
,
psz_control_names
[
4
]
));
p_sys
->
p_reverbm
->
setdamp
(
var_CreateGetFloatCommand
(
p_aout
,
psz_control_names
[
4
]
));
/* Add the callbacks */
/* Add the callbacks */
var_AddCallback
(
p_aout
,
psz_control_names
[
0
],
RoomCallback
,
p_sys
);
var_AddCallback
(
p_aout
,
psz_control_names
[
0
],
RoomCallback
,
p_sys
);
...
@@ -228,13 +213,13 @@ static void SpatFilter( aout_instance_t *p_aout,
...
@@ -228,13 +213,13 @@ static void SpatFilter( aout_instance_t *p_aout,
aout_filter_t
*
p_filter
,
float
*
out
,
float
*
in
,
aout_filter_t
*
p_filter
,
float
*
out
,
float
*
in
,
int
i_samples
,
int
i_channels
)
int
i_samples
,
int
i_channels
)
{
{
(
void
)
p_aout
;
aout_filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
aout_filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
CLocker
locker
(
&
p_sys
->
lock
);
int
i
,
ch
;
vlc_mutex_lock
(
&
p_sys
->
lock
)
;
for
(
i
=
0
;
i
<
i_samples
;
i
++
)
for
(
i
nt
i
=
0
;
i
<
i_samples
;
i
++
)
{
{
for
(
ch
=
0
;
ch
<
2
;
ch
++
)
for
(
int
ch
=
0
;
ch
<
2
;
ch
++
)
{
{
in
[
ch
]
=
in
[
ch
]
*
SPAT_AMP
;
in
[
ch
]
=
in
[
ch
]
*
SPAT_AMP
;
}
}
...
@@ -242,22 +227,25 @@ static void SpatFilter( aout_instance_t *p_aout,
...
@@ -242,22 +227,25 @@ static void SpatFilter( aout_instance_t *p_aout,
in
+=
i_channels
;
in
+=
i_channels
;
out
+=
i_channels
;
out
+=
i_channels
;
}
}
vlc_mutex_unlock
(
&
p_sys
->
lock
);
}
}
/*****************************************************************************
/*****************************************************************************
* Variables callbacks
* Variables callbacks
*****************************************************************************/
*****************************************************************************/
static
int
RoomCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
static
int
RoomCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
)
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
)
{
{
(
void
)
psz_cmd
;
(
void
)
oldval
;
(
void
)
psz_cmd
;
(
void
)
oldval
;
aout_filter_sys_t
*
p_sys
=
(
aout_filter_sys_t
*
)
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 size is now %3.1f"
,
newval
.
f_float
);
msg_Dbg
(
p_this
,
"room size is now %3.1f"
,
newval
.
f_float
);
vlc_mutex_lock
(
&
p_sys
->
lock
);
p_sys
->
p_reverbm
->
setroomsize
(
newval
.
f_float
);
vlc_mutex_unlock
(
&
p_sys
->
lock
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -266,10 +254,13 @@ static int WidthCallback( vlc_object_t *p_this, char const *psz_cmd,
...
@@ -266,10 +254,13 @@ static int WidthCallback( vlc_object_t *p_this, char const *psz_cmd,
{
{
(
void
)
psz_cmd
;
(
void
)
oldval
;
(
void
)
psz_cmd
;
(
void
)
oldval
;
aout_filter_sys_t
*
p_sys
=
(
aout_filter_sys_t
*
)
p_data
;
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 is now %3.1f"
,
newval
.
f_float
);
msg_Dbg
(
p_this
,
"width is now %3.1f"
,
newval
.
f_float
);
vlc_mutex_lock
(
&
p_sys
->
lock
);
p_sys
->
p_reverbm
->
setwidth
(
newval
.
f_float
);
vlc_mutex_unlock
(
&
p_sys
->
lock
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
static
int
WetCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
static
int
WetCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
...
@@ -277,10 +268,13 @@ static int WetCallback( vlc_object_t *p_this, char const *psz_cmd,
...
@@ -277,10 +268,13 @@ static int WetCallback( vlc_object_t *p_this, char const *psz_cmd,
{
{
(
void
)
psz_cmd
;
(
void
)
oldval
;
(
void
)
psz_cmd
;
(
void
)
oldval
;
aout_filter_sys_t
*
p_sys
=
(
aout_filter_sys_t
*
)
p_data
;
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' value is now %3.1f"
,
newval
.
f_float
);
msg_Dbg
(
p_this
,
"'wet' value is now %3.1f"
,
newval
.
f_float
);
vlc_mutex_lock
(
&
p_sys
->
lock
);
p_sys
->
p_reverbm
->
setwet
(
newval
.
f_float
);
vlc_mutex_unlock
(
&
p_sys
->
lock
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
static
int
DryCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
static
int
DryCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
...
@@ -288,10 +282,13 @@ static int DryCallback( vlc_object_t *p_this, char const *psz_cmd,
...
@@ -288,10 +282,13 @@ static int DryCallback( vlc_object_t *p_this, char const *psz_cmd,
{
{
(
void
)
psz_cmd
;
(
void
)
oldval
;
(
void
)
psz_cmd
;
(
void
)
oldval
;
aout_filter_sys_t
*
p_sys
=
(
aout_filter_sys_t
*
)
p_data
;
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' value is now %3.1f"
,
newval
.
f_float
);
msg_Dbg
(
p_this
,
"'dry' value is now %3.1f"
,
newval
.
f_float
);
vlc_mutex_lock
(
&
p_sys
->
lock
);
p_sys
->
p_reverbm
->
setdry
(
newval
.
f_float
);
vlc_mutex_unlock
(
&
p_sys
->
lock
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
static
int
DampCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
static
int
DampCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
...
@@ -299,10 +296,13 @@ static int DampCallback( vlc_object_t *p_this, char const *psz_cmd,
...
@@ -299,10 +296,13 @@ static int DampCallback( vlc_object_t *p_this, char const *psz_cmd,
{
{
(
void
)
psz_cmd
;
(
void
)
oldval
;
(
void
)
psz_cmd
;
(
void
)
oldval
;
aout_filter_sys_t
*
p_sys
=
(
aout_filter_sys_t
*
)
p_data
;
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' value is now %3.1f"
,
newval
.
f_float
);
msg_Dbg
(
p_this
,
"'damp' value is now %3.1f"
,
newval
.
f_float
);
vlc_mutex_lock
(
&
p_sys
->
lock
);
p_sys
->
p_reverbm
->
setdamp
(
newval
.
f_float
);
vlc_mutex_unlock
(
&
p_sys
->
lock
);
return
VLC_SUCCESS
;
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