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
6768581c
Commit
6768581c
authored
Jan 07, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pcm_volume: rename pcm_dither() to pcm_volume_dither()
parent
b7b5e3f9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
7 deletions
+13
-7
pcm_mix.c
src/pcm_mix.c
+6
-3
pcm_volume.c
src/pcm_volume.c
+6
-3
pcm_volume.h
src/pcm_volume.h
+1
-1
No files found.
src/pcm_mix.c
View file @
6768581c
...
@@ -37,7 +37,8 @@ pcm_add_8(int8_t *buffer1, const int8_t *buffer2,
...
@@ -37,7 +37,8 @@ pcm_add_8(int8_t *buffer1, const int8_t *buffer2,
int32_t
sample2
=
*
buffer2
++
;
int32_t
sample2
=
*
buffer2
++
;
sample1
=
((
sample1
*
volume1
+
sample2
*
volume2
)
+
sample1
=
((
sample1
*
volume1
+
sample2
*
volume2
)
+
pcm_dither
()
+
PCM_VOLUME_1
/
2
)
/
PCM_VOLUME_1
;
pcm_volume_dither
()
+
PCM_VOLUME_1
/
2
)
/
PCM_VOLUME_1
;
*
buffer1
++
=
pcm_range
(
sample1
,
8
);
*
buffer1
++
=
pcm_range
(
sample1
,
8
);
--
num_samples
;
--
num_samples
;
...
@@ -53,7 +54,8 @@ pcm_add_16(int16_t *buffer1, const int16_t *buffer2,
...
@@ -53,7 +54,8 @@ pcm_add_16(int16_t *buffer1, const int16_t *buffer2,
int32_t
sample2
=
*
buffer2
++
;
int32_t
sample2
=
*
buffer2
++
;
sample1
=
((
sample1
*
volume1
+
sample2
*
volume2
)
+
sample1
=
((
sample1
*
volume1
+
sample2
*
volume2
)
+
pcm_dither
()
+
PCM_VOLUME_1
/
2
)
/
PCM_VOLUME_1
;
pcm_volume_dither
()
+
PCM_VOLUME_1
/
2
)
/
PCM_VOLUME_1
;
*
buffer1
++
=
pcm_range
(
sample1
,
16
);
*
buffer1
++
=
pcm_range
(
sample1
,
16
);
--
num_samples
;
--
num_samples
;
...
@@ -69,7 +71,8 @@ pcm_add_24(int32_t *buffer1, const int32_t *buffer2,
...
@@ -69,7 +71,8 @@ pcm_add_24(int32_t *buffer1, const int32_t *buffer2,
int64_t
sample2
=
*
buffer2
++
;
int64_t
sample2
=
*
buffer2
++
;
sample1
=
((
sample1
*
volume1
+
sample2
*
volume2
)
+
sample1
=
((
sample1
*
volume1
+
sample2
*
volume2
)
+
pcm_dither
()
+
PCM_VOLUME_1
/
2
)
/
PCM_VOLUME_1
;
pcm_volume_dither
()
+
PCM_VOLUME_1
/
2
)
/
PCM_VOLUME_1
;
*
buffer1
++
=
pcm_range
(
sample1
,
24
);
*
buffer1
++
=
pcm_range
(
sample1
,
24
);
--
num_samples
;
--
num_samples
;
...
...
src/pcm_volume.c
View file @
6768581c
...
@@ -34,7 +34,8 @@ pcm_volume_change_8(int8_t *buffer, unsigned num_samples, int volume)
...
@@ -34,7 +34,8 @@ pcm_volume_change_8(int8_t *buffer, unsigned num_samples, int volume)
while
(
num_samples
>
0
)
{
while
(
num_samples
>
0
)
{
int32_t
sample
=
*
buffer
;
int32_t
sample
=
*
buffer
;
sample
=
(
sample
*
volume
+
pcm_dither
()
+
PCM_VOLUME_1
/
2
)
sample
=
(
sample
*
volume
+
pcm_volume_dither
()
+
PCM_VOLUME_1
/
2
)
/
PCM_VOLUME_1
;
/
PCM_VOLUME_1
;
*
buffer
++
=
pcm_range
(
sample
,
8
);
*
buffer
++
=
pcm_range
(
sample
,
8
);
...
@@ -48,7 +49,8 @@ pcm_volume_change_16(int16_t *buffer, unsigned num_samples, int volume)
...
@@ -48,7 +49,8 @@ pcm_volume_change_16(int16_t *buffer, unsigned num_samples, int volume)
while
(
num_samples
>
0
)
{
while
(
num_samples
>
0
)
{
int32_t
sample
=
*
buffer
;
int32_t
sample
=
*
buffer
;
sample
=
(
sample
*
volume
+
pcm_dither
()
+
PCM_VOLUME_1
/
2
)
sample
=
(
sample
*
volume
+
pcm_volume_dither
()
+
PCM_VOLUME_1
/
2
)
/
PCM_VOLUME_1
;
/
PCM_VOLUME_1
;
*
buffer
++
=
pcm_range
(
sample
,
16
);
*
buffer
++
=
pcm_range
(
sample
,
16
);
...
@@ -62,7 +64,8 @@ pcm_volume_change_24(int32_t *buffer, unsigned num_samples, int volume)
...
@@ -62,7 +64,8 @@ pcm_volume_change_24(int32_t *buffer, unsigned num_samples, int volume)
while
(
num_samples
>
0
)
{
while
(
num_samples
>
0
)
{
int64_t
sample
=
*
buffer
;
int64_t
sample
=
*
buffer
;
sample
=
(
sample
*
volume
+
pcm_dither
()
+
PCM_VOLUME_1
/
2
)
sample
=
(
sample
*
volume
+
pcm_volume_dither
()
+
PCM_VOLUME_1
/
2
)
/
PCM_VOLUME_1
;
/
PCM_VOLUME_1
;
*
buffer
++
=
pcm_range
(
sample
,
24
);
*
buffer
++
=
pcm_range
(
sample
,
24
);
...
...
src/pcm_volume.h
View file @
6768581c
...
@@ -41,7 +41,7 @@ pcm_float_to_volume(float volume)
...
@@ -41,7 +41,7 @@ pcm_float_to_volume(float volume)
}
}
static
inline
int
static
inline
int
pcm_dither
(
void
)
pcm_
volume_
dither
(
void
)
{
{
static
unsigned
long
state
;
static
unsigned
long
state
;
uint32_t
r
;
uint32_t
r
;
...
...
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