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
b8097eaf
Commit
b8097eaf
authored
Jul 05, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pcm/Volume: move silence pattern to Silence.cxx
parent
5eb0cbc8
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
5 deletions
+75
-5
Makefile.am
Makefile.am
+1
-0
Silence.cxx
src/pcm/Silence.cxx
+35
-0
Silence.hxx
src/pcm/Silence.hxx
+36
-0
Volume.cxx
src/pcm/Volume.cxx
+3
-5
No files found.
Makefile.am
View file @
b8097eaf
...
...
@@ -467,6 +467,7 @@ libpcm_a_SOURCES = \
src/pcm/PcmConvert.cxx src/pcm/PcmConvert.hxx
\
src/pcm/PcmDop.cxx src/pcm/PcmDop.hxx
\
src/pcm/Volume.cxx src/pcm/Volume.hxx
\
src/pcm/Silence.cxx src/pcm/Silence.hxx
\
src/pcm/PcmMix.cxx src/pcm/PcmMix.hxx
\
src/pcm/PcmChannels.cxx src/pcm/PcmChannels.hxx
\
src/pcm/PcmPack.cxx src/pcm/PcmPack.hxx
\
...
...
src/pcm/Silence.cxx
0 → 100644
View file @
b8097eaf
/*
* Copyright (C) 2003-2016 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "Silence.hxx"
#include "AudioFormat.hxx"
#include "util/WritableBuffer.hxx"
#include <string.h>
void
PcmSilence
(
WritableBuffer
<
void
>
dest
,
SampleFormat
format
)
{
uint8_t
pattern
=
0
;
if
(
format
==
SampleFormat
::
DSD
)
pattern
=
0x69
;
memset
(
dest
.
data
,
pattern
,
dest
.
size
);
}
src/pcm/Silence.hxx
0 → 100644
View file @
b8097eaf
/*
* Copyright (C) 2003-2016 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_PCM_SILENCE_HXX
#define MPD_PCM_SILENCE_HXX
#include "check.h"
#include <stdint.h>
template
<
typename
T
>
struct
WritableBuffer
;
enum
class
SampleFormat
:
uint8_t
;
/**
* Fill the given buffer with the format-specific silence pattern.
*/
void
PcmSilence
(
WritableBuffer
<
void
>
dest
,
SampleFormat
format
);
#endif
src/pcm/Volume.cxx
View file @
b8097eaf
...
...
@@ -19,10 +19,12 @@
#include "config.h"
#include "Volume.hxx"
#include "Silence.hxx"
#include "Domain.hxx"
#include "PcmUtils.hxx"
#include "Traits.hxx"
#include "util/ConstBuffer.hxx"
#include "util/WritableBuffer.hxx"
#include "util/Error.hxx"
#include "PcmDither.cxx" // including the .cxx file to get inlined templates
...
...
@@ -134,11 +136,7 @@ PcmVolume::Apply(ConstBuffer<void> src)
if
(
volume
==
0
)
{
/* optimized special case: 0% volume = memset(0) */
uint8_t
pattern
=
0
;
if
(
format
==
SampleFormat
::
DSD
)
pattern
=
0x69
;
memset
(
data
,
pattern
,
src
.
size
);
PcmSilence
({
data
,
src
.
size
},
format
);
return
{
data
,
src
.
size
};
}
...
...
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