Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
7f762a5c
Commit
7f762a5c
authored
Mar 27, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pulse_mixer: return if mixer is offline
Eliminate one indent level. Also remove several debug useless debug messages.
parent
13319e0b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
29 deletions
+27
-29
pulse_mixer.c
src/mixer/pulse_mixer.c
+27
-29
No files found.
src/mixer/pulse_mixer.c
View file @
7f762a5c
...
...
@@ -314,49 +314,47 @@ pulse_mixer_get_volume(struct mixer *mixer)
int
ret
;
pa_operation
*
o
;
g_debug
(
"get_volume %s"
,
pm
->
online
==
TRUE
?
"online"
:
"offline"
);
if
(
pm
->
online
)
{
o
=
pa_context_get_sink_input_info
(
pm
->
context
,
pm
->
index
,
sink_input_vol
,
pm
);
if
(
o
==
NULL
)
{
g_debug
(
"pa_context_get_sink_input_info() failed"
);
return
false
;
}
if
(
!
pulse_wait_for_operation
(
pm
->
mainloop
,
o
))
return
false
;
if
(
!
pm
->
online
)
{
return
false
;
}
ret
=
(
int
)((
100
*
(
pa_cvolume_avg
(
&
pm
->
volume
)
+
1
))
/
PA_VOLUME_NORM
);
g_debug
(
"volume %d"
,
ret
);
return
ret
;
o
=
pa_context_get_sink_input_info
(
pm
->
context
,
pm
->
index
,
sink_input_vol
,
pm
);
if
(
o
==
NULL
)
{
g_debug
(
"pa_context_get_sink_input_info() failed"
);
return
false
;
}
return
false
;
if
(
!
pulse_wait_for_operation
(
pm
->
mainloop
,
o
))
return
false
;
ret
=
(
int
)((
100
*
(
pa_cvolume_avg
(
&
pm
->
volume
)
+
1
))
/
PA_VOLUME_NORM
);
return
ret
;
}
static
bool
pulse_mixer_set_volume
(
struct
mixer
*
mixer
,
unsigned
volume
)
{
struct
pulse_mixer
*
pm
=
(
struct
pulse_mixer
*
)
mixer
;
struct
pa_cvolume
cvolume
;
pa_operation
*
o
;
if
(
pm
->
online
)
{
pa_operation
*
o
;
struct
pa_cvolume
cvolume
;
pa_cvolume_set
(
&
cvolume
,
pm
->
volume
.
channels
,
(
pa_volume_t
)
volume
*
PA_VOLUME_NORM
/
100
+
0
.
5
);
if
(
!
pm
->
online
)
{
return
false
;
}
o
=
pa_context_set_sink_input_volume
(
pm
->
context
,
pm
->
index
,
&
cvolume
,
NULL
,
NULL
);
if
(
o
==
NULL
)
{
g_debug
(
"pa_context_set_sink_input_volume() failed"
);
return
false
;
}
pa_cvolume_set
(
&
cvolume
,
pm
->
volume
.
channels
,
(
pa_volume_t
)
volume
*
PA_VOLUME_NORM
/
100
+
0
.
5
);
pa_operation_unref
(
o
);
o
=
pa_context_set_sink_input_volume
(
pm
->
context
,
pm
->
index
,
&
cvolume
,
NULL
,
NULL
);
if
(
o
==
NULL
)
{
g_debug
(
"pa_context_set_sink_input_volume() failed"
);
return
false
;
}
pa_operation_unref
(
o
);
return
true
;
}
...
...
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