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
b41f5405
Commit
b41f5405
authored
Apr 01, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
for alsa mixer default to Master element, not the first element
git-svn-id:
https://svn.musicpd.org/mpd/trunk@583
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
8216f304
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
33 deletions
+25
-33
volume.c
src/volume.c
+25
-33
No files found.
src/volume.c
View file @
b41f5405
...
...
@@ -36,13 +36,14 @@
#include <alsa/asoundlib.h>
#endif
#define VOLUME_MIXER_TYPE_SOFTWARE 0
#define VOLUME_MIXER_TYPE_OSS 1
#define VOLUME_MIXER_TYPE_ALSA 2
#define VOLUME_MIXER_TYPE_SOFTWARE
0
#define VOLUME_MIXER_TYPE_OSS
1
#define VOLUME_MIXER_TYPE_ALSA
2
#define VOLUME_MIXER_SOFTWARE_DEFAULT ""
#define VOLUME_MIXER_OSS_DEFAULT "/dev/mixer"
#define VOLUME_MIXER_ALSA_DEFAULT "default"
#define VOLUME_MIXER_SOFTWARE_DEFAULT ""
#define VOLUME_MIXER_OSS_DEFAULT "/dev/mixer"
#define VOLUME_MIXER_ALSA_DEFAULT "default"
#define VOLUME_MIXER_ALSA_CONTROL_DEFAULT "Master"
int
volume_mixerType
=
VOLUME_MIXER_TYPE_SOFTWARE
;
char
*
volume_mixerDevice
;
...
...
@@ -170,6 +171,7 @@ int changeOssVolumeLevel(FILE * fp, int change, int rel) {
int
prepAlsaMixer
(
char
*
card
)
{
int
err
;
snd_mixer_elem_t
*
elem
;
char
*
controlName
=
VOLUME_MIXER_ALSA_CONTROL_DEFAULT
;
if
((
err
=
snd_mixer_open
(
&
volume_alsaMixerHandle
,
0
))
<
0
)
{
ERROR
(
"problems opening alsa mixer: %s
\n
"
,
snd_strerror
(
err
));
...
...
@@ -199,40 +201,30 @@ int prepAlsaMixer(char * card) {
elem
=
snd_mixer_first_elem
(
volume_alsaMixerHandle
);
if
(
getConf
()[
CONF_MIXER_CONTROL
])
{
while
(
elem
)
{
if
(
snd_mixer_elem_get_type
(
elem
)
==
SND_MIXER_ELEM_SIMPLE
)
controlName
=
getConf
()[
CONF_MIXER_CONTROL
];
}
while
(
elem
)
{
if
(
snd_mixer_elem_get_type
(
elem
)
==
SND_MIXER_ELEM_SIMPLE
)
{
if
(
strcasecmp
(
controlName
,
snd_mixer_selem_get_name
(
elem
))
==
0
)
{
if
(
strcasecmp
(
getConf
()[
CONF_MIXER_CONTROL
],
snd_mixer_selem_get_name
(
elem
))
==
0
)
{
break
;
}
break
;
}
elem
=
snd_mixer_elem_next
(
elem
);
}
if
(
elem
)
{
volume_alsaElem
=
elem
;
snd_mixer_selem_get_playback_volume_range
(
volume_alsaElem
,
&
volume_alsaMin
,
&
volume_alsaMax
);
return
0
;
}
elem
=
snd_mixer_elem_next
(
elem
);
}
else
{
if
(
elem
)
{
volume_alsaElem
=
elem
;
if
(
snd_mixer_elem_get_type
(
volume_alsaElem
)
==
SND_MIXER_ELEM_SIMPLE
)
{
snd_mixer_selem_get_playback_volume_range
(
volume_alsaElem
,
&
volume_alsaMin
,
&
volume_alsaMax
);
return
0
;
}
snd_mixer_selem_get_playback_volume_range
(
volume_alsaElem
,
&
volume_alsaMin
,
&
volume_alsaMax
);
return
0
;
}
ERROR
(
"can't find alsa mixer_control
\"
%s
\"\n
"
,
controlName
);
snd_mixer_close
(
volume_alsaMixerHandle
);
return
-
1
;
}
...
...
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