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
d6a37ba7
Commit
d6a37ba7
authored
Mar 23, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
volume fixes
git-svn-id:
https://svn.musicpd.org/mpd/trunk@420
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
fc84fa54
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletion
+21
-1
Makefile.am
src/Makefile.am
+1
-1
volume.c
src/volume.c
+20
-0
No files found.
src/Makefile.am
View file @
d6a37ba7
...
@@ -16,4 +16,4 @@ mpd_SOURCES = main.c buffer2array.c interface.c command.c playlist.c ls.c \
...
@@ -16,4 +16,4 @@ mpd_SOURCES = main.c buffer2array.c interface.c command.c playlist.c ls.c \
mpd_CFLAGS
=
$(MPD_CFLAGS)
mpd_CFLAGS
=
$(MPD_CFLAGS)
mpd_LDADD
=
$(MPD_LIBS)
$(ID3_LIB)
$(MAD_LIB)
$(MP4FF_LIB)
mpd_LDADD
=
$(MPD_LIBS)
$(ID3_LIB)
$(MAD_LIB)
$(MP4FF_LIB)
DIST_SUBDIRS
=
mp4ff
DIST_SUBDIRS
=
mp4ff
$(ID3_SUBDIR)
$(MAD_SUBDIR)
src/volume.c
View file @
d6a37ba7
...
@@ -47,6 +47,8 @@
...
@@ -47,6 +47,8 @@
int
volume_mixerType
=
VOLUME_MIXER_TYPE_SOFTWARE
;
int
volume_mixerType
=
VOLUME_MIXER_TYPE_SOFTWARE
;
char
*
volume_mixerDevice
;
char
*
volume_mixerDevice
;
int
volume_softwareSet
=
-
1
;
#ifndef NO_OSS_MIXER
#ifndef NO_OSS_MIXER
int
volume_ossFd
;
int
volume_ossFd
;
int
volume_ossControl
=
SOUND_MIXER_VOLUME
;
int
volume_ossControl
=
SOUND_MIXER_VOLUME
;
...
@@ -57,6 +59,7 @@ snd_mixer_t * volume_alsaMixerHandle = NULL;
...
@@ -57,6 +59,7 @@ snd_mixer_t * volume_alsaMixerHandle = NULL;
snd_mixer_elem_t
*
volume_alsaElem
;
snd_mixer_elem_t
*
volume_alsaElem
;
long
volume_alsaMin
;
long
volume_alsaMin
;
long
volume_alsaMax
;
long
volume_alsaMax
;
int
volume_alsaSet
=
-
1
;
#endif
#endif
#ifndef NO_OSS_MIXER
#ifndef NO_OSS_MIXER
...
@@ -261,6 +264,7 @@ int getAlsaVolumeLevel() {
...
@@ -261,6 +264,7 @@ int getAlsaVolumeLevel() {
int
changeAlsaVolumeLevel
(
FILE
*
fp
,
int
change
,
int
rel
)
{
int
changeAlsaVolumeLevel
(
FILE
*
fp
,
int
change
,
int
rel
)
{
float
vol
;
float
vol
;
long
level
;
long
level
;
long
test
;
long
max
=
volume_alsaMax
;
long
max
=
volume_alsaMax
;
long
min
=
volume_alsaMin
;
long
min
=
volume_alsaMin
;
int
err
;
int
err
;
...
@@ -274,12 +278,22 @@ int changeAlsaVolumeLevel(FILE * fp, int change, int rel) {
...
@@ -274,12 +278,22 @@ int changeAlsaVolumeLevel(FILE * fp, int change, int rel) {
}
}
if
(
rel
)
{
if
(
rel
)
{
test
=
((
volume_alsaSet
/
100
.
0
)
*
(
max
-
min
)
+
min
)
+
0
.
5
;
if
(
volume_alsaSet
>=
0
&&
level
==
test
)
{
vol
=
volume_alsaSet
;
}
else
{
vol
=
100
.
0
*
(((
float
)(
level
-
min
))
/
(
max
-
min
));
vol
=
100
.
0
*
(((
float
)(
level
-
min
))
/
(
max
-
min
));
}
vol
+=
change
;
vol
+=
change
;
}
}
else
else
vol
=
change
;
vol
=
change
;
volume_alsaSet
=
vol
+
0
.
5
;
volume_alsaSet
=
volume_alsaSet
>
100
?
100
:
(
volume_alsaSet
<
0
?
0
:
volume_alsaSet
);
level
=
(
long
)(((
vol
/
100
.
0
)
*
(
max
-
min
)
+
min
)
+
0
.
5
);
level
=
(
long
)(((
vol
/
100
.
0
)
*
(
max
-
min
)
+
min
)
+
0
.
5
);
level
=
level
>
max
?
max
:
level
;
level
=
level
>
max
?
max
:
level
;
level
=
level
<
min
?
min
:
level
;
level
=
level
<
min
?
min
:
level
;
...
@@ -361,6 +375,10 @@ void openVolumeDevice() {
...
@@ -361,6 +375,10 @@ void openVolumeDevice() {
}
}
int
getSoftwareVolume
()
{
int
getSoftwareVolume
()
{
if
(
volume_softwareSet
>=
0
)
{
return
volume_softwareSet
;
}
return
50
*
log
((
getPlayerSoftwareVolume
()
*
(
M_E
*
M_E
-
1
)
/
100
.
0
)
+
1
)
+
0
.
5
;
return
50
*
log
((
getPlayerSoftwareVolume
()
*
(
M_E
*
M_E
-
1
)
/
100
.
0
)
+
1
)
+
0
.
5
;
}
}
...
@@ -389,6 +407,8 @@ int changeSoftwareVolume(FILE * fp, int change, int rel) {
...
@@ -389,6 +407,8 @@ int changeSoftwareVolume(FILE * fp, int change, int rel) {
if
(
new
>
100
)
new
=
100
;
if
(
new
>
100
)
new
=
100
;
else
if
(
new
<
0
)
new
=
0
;
else
if
(
new
<
0
)
new
=
0
;
volume_softwareSet
=
new
;
new
=
100
.
0
*
(
exp
(
new
/
50
.
0
)
-
1
)
/
(
M_E
*
M_E
-
1
)
+
0
.
5
;
new
=
100
.
0
*
(
exp
(
new
/
50
.
0
)
-
1
)
/
(
M_E
*
M_E
-
1
)
+
0
.
5
;
setPlayerSoftwareVolume
(
new
);
setPlayerSoftwareVolume
(
new
);
...
...
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