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
82f58f32
Commit
82f58f32
authored
Jul 26, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PulseAudio: preserve balance when setting the volume
parent
7fe3cfee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
modules/audio_output/pulse.c
modules/audio_output/pulse.c
+11
-8
No files found.
modules/audio_output/pulse.c
View file @
82f58f32
...
@@ -341,13 +341,16 @@ static void sink_input_info_cb(pa_context *ctx, const pa_sink_input_info *i,
...
@@ -341,13 +341,16 @@ static void sink_input_info_cb(pa_context *ctx, const pa_sink_input_info *i,
int
eol
,
void
*
userdata
)
int
eol
,
void
*
userdata
)
{
{
audio_output_t
*
aout
=
userdata
;
audio_output_t
*
aout
=
userdata
;
aout_sys_t
*
sys
=
aout
->
sys
;
float
volume
;
if
(
eol
)
if
(
eol
)
return
;
return
;
(
void
)
ctx
;
const
float
volume
=
pa_sw_volume_to_linear
(
pa_cvolume_avg
(
&
i
->
volume
));
sys
->
cvolume
=
i
->
volume
;
volume
=
pa_sw_volume_to_linear
(
pa_cvolume_max
(
&
i
->
volume
));
aout_VolumeHardSet
(
aout
,
volume
,
i
->
mute
);
aout_VolumeHardSet
(
aout
,
volume
,
i
->
mute
);
(
void
)
ctx
;
}
}
...
@@ -491,14 +494,14 @@ static int VolumeSet(audio_output_t *aout, float vol, bool mute)
...
@@ -491,14 +494,14 @@ static int VolumeSet(audio_output_t *aout, float vol, bool mute)
{
{
aout_sys_t
*
sys
=
aout
->
sys
;
aout_sys_t
*
sys
=
aout
->
sys
;
pa_operation
*
op
;
pa_operation
*
op
;
uint32_t
idx
=
pa_stream_get_index
(
sys
->
stream
);
uint32_t
idx
=
pa_stream_get_index
(
sys
->
stream
);
pa_volume_t
volume
=
pa_sw_volume_from_linear
(
vol
);
pa_cvolume
cvolume
;
/* TODO: do not ruin the channel balance (if set outside VLC) */
pa_cvolume
cvolume
=
sys
->
cvolume
;
pa_cvolume_set
(
&
sys
->
cvolume
,
sys
->
cvolume
.
channels
,
volume
);
pa_volume_t
volume
=
pa_sw_volume_multiply
(
pa_sw_volume_from_linear
(
vol
),
pa_sw_cvolume_multiply_scalar
(
&
cvolume
,
&
sys
->
cvolume
,
sys
->
base_volume
);
sys
->
base_volume
);
pa_cvolume_scale
(
&
cvolume
,
PA_VOLUME_NORM
);
/* preserve balance */
pa_sw_cvolume_multiply_scalar
(
&
cvolume
,
&
cvolume
,
volume
);
assert
(
pa_cvolume_valid
(
&
cvolume
));
assert
(
pa_cvolume_valid
(
&
cvolume
));
vlc_pa_lock
();
vlc_pa_lock
();
...
...
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