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
a822a430
Commit
a822a430
authored
May 31, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass mixer multiplier as argument
parent
600240e2
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
21 additions
and
38 deletions
+21
-38
include/vlc_aout_mixer.h
include/vlc_aout_mixer.h
+1
-6
modules/audio_mixer/float32.c
modules/audio_mixer/float32.c
+5
-3
modules/audio_mixer/spdif.c
modules/audio_mixer/spdif.c
+4
-3
modules/audio_mixer/trivial.c
modules/audio_mixer/trivial.c
+4
-2
src/audio_output/aout_internal.h
src/audio_output/aout_internal.h
+1
-2
src/audio_output/dec.c
src/audio_output/dec.c
+1
-3
src/audio_output/intf.c
src/audio_output/intf.c
+1
-1
src/audio_output/mixer.c
src/audio_output/mixer.c
+4
-18
No files found.
include/vlc_aout_mixer.h
View file @
a822a430
...
@@ -72,16 +72,11 @@ struct aout_mixer_t {
...
@@ -72,16 +72,11 @@ struct aout_mixer_t {
*/
*/
audio_sample_format_t
fmt
;
audio_sample_format_t
fmt
;
/* Multiplier used to raise or lower the volume of the sound in
* software.
*/
float
multiplier
;
/* Array of mixer inputs */
/* Array of mixer inputs */
aout_mixer_input_t
*
input
;
aout_mixer_input_t
*
input
;
/* Mix requested number of samples (mandatory) */
/* Mix requested number of samples (mandatory) */
aout_buffer_t
*
(
*
mix
)(
aout_mixer_t
*
,
unsigned
);
aout_buffer_t
*
(
*
mix
)(
aout_mixer_t
*
,
unsigned
,
float
);
/* Private place holder for the aout_mixer_t module (optional)
/* Private place holder for the aout_mixer_t module (optional)
*
*
...
...
modules/audio_mixer/float32.c
View file @
a822a430
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
* Local prototypes
* Local prototypes
*****************************************************************************/
*****************************************************************************/
static
int
Create
(
vlc_object_t
*
);
static
int
Create
(
vlc_object_t
*
);
static
aout_buffer_t
*
DoWork
(
aout_mixer_t
*
,
unsigned
);
static
aout_buffer_t
*
DoWork
(
aout_mixer_t
*
,
unsigned
,
float
);
/*****************************************************************************
/*****************************************************************************
* Module descriptor
* Module descriptor
...
@@ -88,10 +88,10 @@ static void ScaleWords( float * p_out, const float * p_in, size_t i_nb_words,
...
@@ -88,10 +88,10 @@ static void ScaleWords( float * p_out, const float * p_in, size_t i_nb_words,
* Terminology : in this function a word designates a single float32, eg.
* Terminology : in this function a word designates a single float32, eg.
* a stereo sample is consituted of two words.
* a stereo sample is consituted of two words.
*****************************************************************************/
*****************************************************************************/
static
aout_buffer_t
*
DoWork
(
aout_mixer_t
*
p_mixer
,
unsigned
samples
)
static
aout_buffer_t
*
DoWork
(
aout_mixer_t
*
p_mixer
,
unsigned
samples
,
float
f_multiplier
)
{
{
aout_mixer_input_t
*
p_input
=
p_mixer
->
input
;
aout_mixer_input_t
*
p_input
=
p_mixer
->
input
;
float
f_multiplier
=
p_mixer
->
multiplier
*
p_input
->
multiplier
;
const
int
i_nb_channels
=
aout_FormatNbChannels
(
&
p_mixer
->
fmt
);
const
int
i_nb_channels
=
aout_FormatNbChannels
(
&
p_mixer
->
fmt
);
int
i_nb_words
=
samples
*
i_nb_channels
;
int
i_nb_words
=
samples
*
i_nb_channels
;
...
@@ -103,6 +103,8 @@ static aout_buffer_t *DoWork( aout_mixer_t * p_mixer, unsigned samples )
...
@@ -103,6 +103,8 @@ static aout_buffer_t *DoWork( aout_mixer_t * p_mixer, unsigned samples )
float
*
p_out
=
(
float
*
)
p_buffer
->
p_buffer
;
float
*
p_out
=
(
float
*
)
p_buffer
->
p_buffer
;
float
*
p_in
=
(
float
*
)
p_input
->
begin
;
float
*
p_in
=
(
float
*
)
p_input
->
begin
;
f_multiplier
*=
p_input
->
multiplier
;
for
(
;
;
)
for
(
;
;
)
{
{
ptrdiff_t
i_available_words
=
(
ptrdiff_t
i_available_words
=
(
...
...
modules/audio_mixer/spdif.c
View file @
a822a430
...
@@ -41,7 +41,7 @@
...
@@ -41,7 +41,7 @@
*****************************************************************************/
*****************************************************************************/
static
int
Create
(
vlc_object_t
*
);
static
int
Create
(
vlc_object_t
*
);
static
aout_buffer_t
*
DoWork
(
aout_mixer_t
*
,
unsigned
);
static
aout_buffer_t
*
DoWork
(
aout_mixer_t
*
,
unsigned
,
float
);
/*****************************************************************************
/*****************************************************************************
* Module descriptor
* Module descriptor
...
@@ -71,11 +71,12 @@ static int Create( vlc_object_t *p_this )
...
@@ -71,11 +71,12 @@ static int Create( vlc_object_t *p_this )
/*****************************************************************************
/*****************************************************************************
* DoWork: mix a new output buffer - this does nothing, indeed
* DoWork: mix a new output buffer - this does nothing, indeed
*****************************************************************************/
*****************************************************************************/
static
aout_buffer_t
*
DoWork
(
aout_mixer_t
*
p_mixer
,
unsigned
samples
)
static
aout_buffer_t
*
DoWork
(
aout_mixer_t
*
p_mixer
,
unsigned
samples
,
float
multiplier
)
{
{
aout_mixer_input_t
*
p_input
=
p_mixer
->
input
;
aout_mixer_input_t
*
p_input
=
p_mixer
->
input
;
aout_buffer_t
*
p_old_buffer
=
aout_FifoPop
(
NULL
,
&
p_input
->
fifo
);
aout_buffer_t
*
p_old_buffer
=
aout_FifoPop
(
NULL
,
&
p_input
->
fifo
);
(
void
)
samples
;
(
void
)
samples
;
(
void
)
multiplier
;
return
p_old_buffer
;
return
p_old_buffer
;
}
}
modules/audio_mixer/trivial.c
View file @
a822a430
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
*****************************************************************************/
*****************************************************************************/
static
int
Create
(
vlc_object_t
*
);
static
int
Create
(
vlc_object_t
*
);
static
aout_buffer_t
*
DoWork
(
aout_mixer_t
*
,
unsigned
samples
);
static
aout_buffer_t
*
DoWork
(
aout_mixer_t
*
,
unsigned
samples
,
float
);
/*****************************************************************************
/*****************************************************************************
* Module descriptor
* Module descriptor
...
@@ -71,7 +71,8 @@ static int Create( vlc_object_t *p_this )
...
@@ -71,7 +71,8 @@ static int Create( vlc_object_t *p_this )
/*****************************************************************************
/*****************************************************************************
* DoWork: mix a new output buffer
* DoWork: mix a new output buffer
*****************************************************************************/
*****************************************************************************/
static
aout_buffer_t
*
DoWork
(
aout_mixer_t
*
p_mixer
,
unsigned
samples
)
static
aout_buffer_t
*
DoWork
(
aout_mixer_t
*
p_mixer
,
unsigned
samples
,
float
multiplier
)
{
{
aout_mixer_input_t
*
p_input
=
p_mixer
->
input
;
aout_mixer_input_t
*
p_input
=
p_mixer
->
input
;
int
i_nb_channels
=
aout_FormatNbChannels
(
&
p_mixer
->
fmt
);
int
i_nb_channels
=
aout_FormatNbChannels
(
&
p_mixer
->
fmt
);
...
@@ -118,5 +119,6 @@ static aout_buffer_t *DoWork( aout_mixer_t *p_mixer, unsigned samples )
...
@@ -118,5 +119,6 @@ static aout_buffer_t *DoWork( aout_mixer_t *p_mixer, unsigned samples )
break
;
break
;
}
}
}
}
(
void
)
multiplier
;
return
p_buffer
;
return
p_buffer
;
}
}
src/audio_output/aout_internal.h
View file @
a822a430
...
@@ -111,8 +111,7 @@ void aout_FiltersPlay( filter_t *const *, unsigned, aout_buffer_t ** );
...
@@ -111,8 +111,7 @@ void aout_FiltersPlay( filter_t *const *, unsigned, aout_buffer_t ** );
/* From mixer.c : */
/* From mixer.c : */
int
aout_MixerNew
(
aout_instance_t
*
p_aout
);
int
aout_MixerNew
(
aout_instance_t
*
p_aout
);
void
aout_MixerDelete
(
aout_instance_t
*
p_aout
);
void
aout_MixerDelete
(
aout_instance_t
*
p_aout
);
void
aout_MixerRun
(
aout_instance_t
*
p_aout
);
void
aout_MixerRun
(
aout_instance_t
*
p_aout
,
float
);
void
aout_MixerMultiplierSet
(
aout_instance_t
*
p_aout
,
float
f_multiplier
);
/* From output.c : */
/* From output.c : */
int
aout_OutputNew
(
aout_instance_t
*
p_aout
,
int
aout_OutputNew
(
aout_instance_t
*
p_aout
,
...
...
src/audio_output/dec.c
View file @
a822a430
...
@@ -293,9 +293,7 @@ int aout_DecPlay( aout_instance_t * p_aout, aout_input_t * p_input,
...
@@ -293,9 +293,7 @@ int aout_DecPlay( aout_instance_t * p_aout, aout_input_t * p_input,
/* Run the mixer if it is able to run. */
/* Run the mixer if it is able to run. */
aout_lock_mixer
(
p_aout
);
aout_lock_mixer
(
p_aout
);
aout_MixerRun
(
p_aout
,
p_aout
->
mixer_multiplier
);
aout_MixerRun
(
p_aout
);
aout_unlock_mixer
(
p_aout
);
aout_unlock_mixer
(
p_aout
);
return
0
;
return
0
;
...
...
src/audio_output/intf.c
View file @
a822a430
...
@@ -245,7 +245,7 @@ static int aout_VolumeSoftSet (aout_instance_t *aout, audio_volume_t volume,
...
@@ -245,7 +245,7 @@ static int aout_VolumeSoftSet (aout_instance_t *aout, audio_volume_t volume,
bool
mute
)
bool
mute
)
{
{
float
f
=
mute
?
0
.
:
(
volume
/
(
float
)
AOUT_VOLUME_DEFAULT
);
float
f
=
mute
?
0
.
:
(
volume
/
(
float
)
AOUT_VOLUME_DEFAULT
);
aout
_MixerMultiplierSet
(
aout
,
f
)
;
aout
->
mixer_multiplier
=
f
;
return
0
;
return
0
;
}
}
...
...
src/audio_output/mixer.c
View file @
a822a430
...
@@ -51,7 +51,6 @@ int aout_MixerNew( aout_instance_t * p_aout )
...
@@ -51,7 +51,6 @@ int aout_MixerNew( aout_instance_t * p_aout )
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
p_mixer
->
fmt
=
p_aout
->
mixer_format
;
p_mixer
->
fmt
=
p_aout
->
mixer_format
;
p_mixer
->
multiplier
=
p_aout
->
mixer_multiplier
;
p_mixer
->
input
=
&
p_aout
->
pp_inputs
[
0
]
->
mixer
;
p_mixer
->
input
=
&
p_aout
->
pp_inputs
[
0
]
->
mixer
;
p_mixer
->
mix
=
NULL
;
p_mixer
->
mix
=
NULL
;
p_mixer
->
sys
=
NULL
;
p_mixer
->
sys
=
NULL
;
...
@@ -92,7 +91,7 @@ void aout_MixerDelete( aout_instance_t * p_aout )
...
@@ -92,7 +91,7 @@ void aout_MixerDelete( aout_instance_t * p_aout )
*****************************************************************************
*****************************************************************************
* Please note that you must hold the mixer lock.
* Please note that you must hold the mixer lock.
*****************************************************************************/
*****************************************************************************/
static
int
MixBuffer
(
aout_instance_t
*
p_aout
)
static
int
MixBuffer
(
aout_instance_t
*
p_aout
,
float
volume
)
{
{
int
i
,
i_first_input
=
0
;
int
i
,
i_first_input
=
0
;
mtime_t
start_date
,
end_date
;
mtime_t
start_date
,
end_date
;
...
@@ -322,7 +321,7 @@ static int MixBuffer( aout_instance_t * p_aout )
...
@@ -322,7 +321,7 @@ static int MixBuffer( aout_instance_t * p_aout )
/* Run the mixer. */
/* Run the mixer. */
aout_buffer_t
*
p_outbuf
;
aout_buffer_t
*
p_outbuf
;
p_outbuf
=
p_aout
->
p_mixer
->
mix
(
p_aout
->
p_mixer
,
p_outbuf
=
p_aout
->
p_mixer
->
mix
(
p_aout
->
p_mixer
,
p_aout
->
output
.
i_nb_samples
);
p_aout
->
output
.
i_nb_samples
,
volume
);
aout_unlock_input_fifos
(
p_aout
);
aout_unlock_input_fifos
(
p_aout
);
if
(
unlikely
(
p_outbuf
==
NULL
)
)
if
(
unlikely
(
p_outbuf
==
NULL
)
)
...
@@ -339,20 +338,7 @@ static int MixBuffer( aout_instance_t * p_aout )
...
@@ -339,20 +338,7 @@ static int MixBuffer( aout_instance_t * p_aout )
*****************************************************************************
*****************************************************************************
* Please note that you must hold the mixer lock.
* Please note that you must hold the mixer lock.
*****************************************************************************/
*****************************************************************************/
void
aout_MixerRun
(
aout_instance_t
*
p_aout
)
void
aout_MixerRun
(
aout_instance_t
*
p_aout
,
float
volume
)
{
{
while
(
MixBuffer
(
p_aout
)
!=
-
1
);
while
(
MixBuffer
(
p_aout
,
volume
)
!=
-
1
);
}
/*****************************************************************************
* aout_MixerMultiplierSet: set p_aout->mixer.f_multiplier
*****************************************************************************
* Please note that we assume that you own the mixer lock when entering this
* function. This function returns -1 on error.
*****************************************************************************/
void
aout_MixerMultiplierSet
(
aout_instance_t
*
p_aout
,
float
f_multiplier
)
{
p_aout
->
mixer_multiplier
=
f_multiplier
;
if
(
p_aout
->
p_mixer
)
p_aout
->
p_mixer
->
multiplier
=
f_multiplier
;
}
}
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