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
4a62cd4a
Commit
4a62cd4a
authored
Dec 23, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pcm/Volume: move code to template pcm_volume_sample()
parent
6d21b944
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
7 deletions
+16
-7
Volume.cxx
src/pcm/Volume.cxx
+16
-7
No files found.
src/pcm/Volume.cxx
View file @
4a62cd4a
...
...
@@ -27,19 +27,28 @@
#include <string.h>
template
<
SampleFormat
F
,
class
Traits
=
SampleTraits
<
F
>>
static
inline
typename
Traits
::
value_type
pcm_volume_sample
(
typename
Traits
::
value_type
_sample
,
int
volume
)
{
typename
Traits
::
long_type
sample
(
_sample
);
sample
=
(
sample
*
volume
+
pcm_volume_dither
()
+
PCM_VOLUME_1S
/
2
)
>>
PCM_VOLUME_BITS
;
return
PcmClamp
<
F
,
Traits
>
(
sample
);
}
template
<
SampleFormat
F
,
class
Traits
=
SampleTraits
<
F
>>
static
void
pcm_volume_change
(
typename
Traits
::
pointer_type
buffer
,
typename
Traits
::
const_pointer_type
end
,
int
volume
)
{
while
(
buffer
<
end
)
{
typename
Traits
::
long_type
sample
=
*
buffer
;
sample
=
(
sample
*
volume
+
pcm_volume_dither
()
+
PCM_VOLUME_1S
/
2
)
>>
PCM_VOLUME_BITS
;
*
buffer
++
=
PcmClamp
<
F
,
Traits
>
(
sample
);
const
auto
sample
=
*
buffer
;
*
buffer
++
=
pcm_volume_sample
<
F
,
Traits
>
(
sample
,
volume
);
}
}
...
...
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