Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mediastreamer2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
External Wiki
External Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
BC
public
mediastreamer2
Commits
e03ee356
Commit
e03ee356
authored
Apr 15, 2016
by
François Grisez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a function to fill a MSEqualizerGain by parsing a string
parent
1d33765a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
9 deletions
+28
-9
msequalizer.h
include/mediastreamer2/msequalizer.h
+2
-0
equalizer.c
src/audiofilters/equalizer.c
+15
-0
audiostream.c
src/voip/audiostream.c
+11
-9
No files found.
include/mediastreamer2/msequalizer.h
View file @
e03ee356
...
...
@@ -28,6 +28,8 @@ typedef struct _MSEqualizerGain{
float
width
;
///< frequency band width around mid frequency for which the gain is applied, in Hz. Use 0 for the lowest frequency resolution.
}
MSEqualizerGain
;
MS2_PUBLIC
MSList
*
ms_parse_equalizer_string
(
const
char
*
str
);
#define MS_EQUALIZER_SET_GAIN MS_FILTER_METHOD(MS_EQUALIZER_ID,0,MSEqualizerGain)
#define MS_EQUALIZER_GET_GAIN MS_FILTER_METHOD(MS_EQUALIZER_ID,1,MSEqualizerGain)
#define MS_EQUALIZER_SET_ACTIVE MS_FILTER_METHOD(MS_EQUALIZER_ID,2,int)
...
...
src/audiofilters/equalizer.c
View file @
e03ee356
...
...
@@ -382,4 +382,19 @@ MSFilterDesc ms_equalizer_desc={
#endif
MSList
*
ms_parse_equalizer_string
(
const
char
*
str
)
{
MSList
*
eq_list
=
NULL
;
do
{
int
bytes
;
MSEqualizerGain
g
;
if
(
sscanf
(
str
,
"%f:%f:%f %n"
,
&
g
.
frequency
,
&
g
.
gain
,
&
g
.
width
,
&
bytes
)
==
3
)
{
MSEqualizerGain
*
gain
=
ms_new
(
MSEqualizerGain
,
1
);
*
gain
=
g
;
eq_list
=
ms_list_append
(
eq_list
,
gain
);
str
+=
bytes
;
}
else
break
;
}
while
(
1
);
return
eq_list
;
}
MS_FILTER_DESC_EXPORT
(
ms_equalizer_desc
)
src/voip/audiostream.c
View file @
e03ee356
...
...
@@ -1043,17 +1043,19 @@ int audio_stream_start_from_io(AudioStream *stream, RtpProfile *profile, const c
if
(
device
&&
device
->
hacks
)
{
const
char
*
gains
=
device
->
hacks
->
equalizer
;
if
(
gains
)
{
MSList
*
gains_list
;
stream
->
eq_loc
=
MSEqualizerMic
;
ms_message
(
"Found equalizer configuration in the devices table"
);
do
{
int
bytes
;
MSEqualizerGain
g
;
if
(
sscanf
(
gains
,
"%f:%f:%f %n"
,
&
g
.
frequency
,
&
g
.
gain
,
&
g
.
width
,
&
bytes
)
==
3
)
{
ms_message
(
"Read equalizer gains: %f(~%f) --> %f"
,
g
.
frequency
,
g
.
width
,
g
.
gain
);
ms_filter_call_method
(
stream
->
equalizer
,
MS_EQUALIZER_SET_GAIN
,
&
g
);
gains
+=
bytes
;
}
else
break
;
}
while
(
1
);
gains_list
=
ms_parse_equalizer_string
(
gains
);
if
(
gains_list
)
{
MSList
*
it
;
for
(
it
=
gains_list
;
it
;
it
++
)
{
MSEqualizerGain
*
g
=
(
MSEqualizerGain
*
)
it
->
data
;
ms_message
(
"Read equalizer gains: %f(~%f) --> %f"
,
g
->
frequency
,
g
->
width
,
g
->
gain
);
ms_filter_call_method
(
stream
->
equalizer
,
MS_EQUALIZER_SET_GAIN
,
g
);
}
ms_list_free_with_data
(
gains_list
,
ms_free
);
}
}
}
}
...
...
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