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
0c9799ba
Commit
0c9799ba
authored
Mar 26, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
alsa_mixer: removed superfluous checks
The MPD core guarantees that methods are always invoked in a consistent state. This means we can remove lots of checks from the volume methods.
parent
331b714a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
10 deletions
+6
-10
alsa_mixer.c
src/mixer/alsa_mixer.c
+6
-10
No files found.
src/mixer/alsa_mixer.c
View file @
0c9799ba
...
...
@@ -52,10 +52,6 @@ alsa_mixer_init(const struct config_param *param)
am
->
control
=
config_get_block_string
(
param
,
"mixer_control"
,
VOLUME_MIXER_ALSA_CONTROL_DEFAULT
);
am
->
handle
=
NULL
;
am
->
elem
=
NULL
;
am
->
volume_min
=
0
;
am
->
volume_max
=
0
;
am
->
volume_set
=
-
1
;
return
&
am
->
base
;
...
...
@@ -73,8 +69,10 @@ static void
alsa_mixer_close
(
struct
mixer
*
data
)
{
struct
alsa_mixer
*
am
=
(
struct
alsa_mixer
*
)
data
;
if
(
am
->
handle
)
snd_mixer_close
(
am
->
handle
);
am
->
handle
=
NULL
;
assert
(
am
->
handle
!=
NULL
);
snd_mixer_close
(
am
->
handle
);
}
static
bool
...
...
@@ -147,8 +145,7 @@ alsa_mixer_get_volume(struct mixer *mixer)
int
ret
;
long
level
;
if
(
am
->
handle
==
NULL
&&
!
alsa_mixer_open
(
mixer
))
return
-
1
;
assert
(
am
->
handle
!=
NULL
);
err
=
snd_mixer_handle_events
(
am
->
handle
);
if
(
err
<
0
)
{
...
...
@@ -186,8 +183,7 @@ alsa_mixer_set_volume(struct mixer *mixer, unsigned volume)
long
level
;
int
err
;
if
(
am
->
handle
==
NULL
&&
!
alsa_mixer_open
(
mixer
))
return
false
;
assert
(
am
->
handle
!=
NULL
);
vol
=
volume
;
...
...
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