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
1b889c52
Commit
1b889c52
authored
Jan 05, 2012
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mixer/alsa: move code to alsa_mixer_lookup_elem()
parent
9937ff8a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
20 deletions
+23
-20
alsa_mixer_plugin.c
src/mixer/alsa_mixer_plugin.c
+23
-20
No files found.
src/mixer/alsa_mixer_plugin.c
View file @
1b889c52
...
@@ -91,12 +91,28 @@ alsa_mixer_close(struct mixer *data)
...
@@ -91,12 +91,28 @@ alsa_mixer_close(struct mixer *data)
snd_mixer_close
(
am
->
handle
);
snd_mixer_close
(
am
->
handle
);
}
}
G_GNUC_PURE
static
snd_mixer_elem_t
*
alsa_mixer_lookup_elem
(
snd_mixer_t
*
handle
,
const
char
*
name
,
unsigned
idx
)
{
for
(
snd_mixer_elem_t
*
elem
=
snd_mixer_first_elem
(
handle
);
elem
!=
NULL
;
elem
=
snd_mixer_elem_next
(
elem
))
{
if
(
snd_mixer_elem_get_type
(
elem
)
==
SND_MIXER_ELEM_SIMPLE
&&
g_ascii_strcasecmp
(
snd_mixer_selem_get_name
(
elem
),
name
)
==
0
&&
snd_mixer_selem_get_index
(
elem
)
==
idx
)
return
elem
;
}
return
NULL
;
}
static
bool
static
bool
alsa_mixer_open
(
struct
mixer
*
data
,
GError
**
error_r
)
alsa_mixer_open
(
struct
mixer
*
data
,
GError
**
error_r
)
{
{
struct
alsa_mixer
*
am
=
(
struct
alsa_mixer
*
)
data
;
struct
alsa_mixer
*
am
=
(
struct
alsa_mixer
*
)
data
;
int
err
;
int
err
;
snd_mixer_elem_t
*
elem
;
am
->
volume_set
=
-
1
;
am
->
volume_set
=
-
1
;
...
@@ -132,31 +148,18 @@ alsa_mixer_open(struct mixer *data, GError **error_r)
...
@@ -132,31 +148,18 @@ alsa_mixer_open(struct mixer *data, GError **error_r)
return
false
;
return
false
;
}
}
elem
=
snd_mixer_first_elem
(
am
->
handle
);
am
->
elem
=
alsa_mixer_lookup_elem
(
am
->
handle
,
am
->
control
,
am
->
index
);
if
(
am
->
elem
==
NULL
)
{
while
(
elem
)
{
alsa_mixer_close
(
data
);
if
(
snd_mixer_elem_get_type
(
elem
)
==
SND_MIXER_ELEM_SIMPLE
)
{
g_set_error
(
error_r
,
alsa_mixer_quark
(),
0
,
if
((
g_ascii_strcasecmp
(
am
->
control
,
"no such mixer control: %s"
,
am
->
control
);
snd_mixer_selem_get_name
(
elem
))
==
0
)
&&
return
false
;
(
am
->
index
==
snd_mixer_selem_get_index
(
elem
)))
{
break
;
}
}
elem
=
snd_mixer_elem_next
(
elem
);
}
}
if
(
elem
)
{
am
->
elem
=
elem
;
snd_mixer_selem_get_playback_volume_range
(
am
->
elem
,
snd_mixer_selem_get_playback_volume_range
(
am
->
elem
,
&
am
->
volume_min
,
&
am
->
volume_min
,
&
am
->
volume_max
);
&
am
->
volume_max
);
return
true
;
return
true
;
}
alsa_mixer_close
(
data
);
g_set_error
(
error_r
,
alsa_mixer_quark
(),
0
,
"no such mixer control: %s"
,
am
->
control
);
return
false
;
}
}
static
int
static
int
...
...
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