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
ad77a3e0
Commit
ad77a3e0
authored
Nov 11, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pcm_utils: added inline function pcm_float_to_volume()
parent
5ddde0aa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
pcm_utils.h
src/pcm_utils.h
+10
-0
volume.c
src/volume.c
+3
-2
No files found.
src/pcm_utils.h
View file @
ad77a3e0
...
...
@@ -36,6 +36,16 @@ struct pcm_convert_state {
int
error
;
};
/**
* Converts a float value (0.0 = silence, 1.0 = 100% volume) to an
* integer volume value (1000 = 100%).
*/
static
inline
int
pcm_float_to_volume
(
float
volume
)
{
return
volume
*
1000
.
0
+
0
.
5
;
}
void
pcm_volume
(
char
*
buffer
,
int
bufferSize
,
const
struct
audio_format
*
format
,
int
volume
);
...
...
src/volume.c
View file @
ad77a3e0
...
...
@@ -22,6 +22,7 @@
#include "player_control.h"
#include "utils.h"
#include "idle.h"
#include "pcm_utils.h"
#include "os_compat.h"
#include "../config.h"
...
...
@@ -483,8 +484,8 @@ static int changeSoftwareVolume(int change, int rel)
else
if
(
new
<=
0
)
new
=
0
;
else
new
=
1000
.
0
*
(
exp
(
new
/
25
.
0
)
-
1
)
/
(
54
.
5981500331
F
-
1
)
+
0
.
5
;
new
=
pcm_float_to_volume
((
exp
(
new
/
25
.
0
)
-
1
)
/
(
54
.
5981500331
F
-
1
))
;
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