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
df9a6659
Commit
df9a6659
authored
Jan 19, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pcm/Traits: add "SILENCE" attribute
parent
7a098ca0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
Silence.cxx
src/pcm/Silence.cxx
+2
-1
Traits.hxx
src/pcm/Traits.hxx
+11
-0
No files found.
src/pcm/Silence.cxx
View file @
df9a6659
...
...
@@ -19,6 +19,7 @@
#include "config.h"
#include "Silence.hxx"
#include "Traits.hxx"
#include "SampleFormat.hxx"
#include "util/WritableBuffer.hxx"
...
...
@@ -29,7 +30,7 @@ PcmSilence(WritableBuffer<void> dest, SampleFormat format)
{
uint8_t
pattern
=
0
;
if
(
format
==
SampleFormat
::
DSD
)
pattern
=
0x69
;
pattern
=
SampleTraits
<
SampleFormat
::
DSD
>::
SILENCE
;
memset
(
dest
.
data
,
pattern
,
dest
.
size
);
}
src/pcm/Traits.hxx
View file @
df9a6659
...
...
@@ -85,6 +85,11 @@ struct SampleTraits<SampleFormat::S8> {
* The maximum sample value.
*/
static
constexpr
value_type
MAX
=
(
sum_type
(
1
)
<<
(
BITS
-
1
))
-
1
;
/**
* A value which represents "silence".
*/
static
constexpr
value_type
SILENCE
=
0
;
};
template
<>
...
...
@@ -101,6 +106,7 @@ struct SampleTraits<SampleFormat::S16> {
static
constexpr
value_type
MIN
=
-
(
sum_type
(
1
)
<<
(
BITS
-
1
));
static
constexpr
value_type
MAX
=
(
sum_type
(
1
)
<<
(
BITS
-
1
))
-
1
;
static
constexpr
value_type
SILENCE
=
0
;
};
template
<>
...
...
@@ -117,6 +123,7 @@ struct SampleTraits<SampleFormat::S32> {
static
constexpr
value_type
MIN
=
-
(
sum_type
(
1
)
<<
(
BITS
-
1
));
static
constexpr
value_type
MAX
=
(
sum_type
(
1
)
<<
(
BITS
-
1
))
-
1
;
static
constexpr
value_type
SILENCE
=
0
;
};
template
<>
...
...
@@ -133,6 +140,7 @@ struct SampleTraits<SampleFormat::S24_P32> {
static
constexpr
value_type
MIN
=
-
(
sum_type
(
1
)
<<
(
BITS
-
1
));
static
constexpr
value_type
MAX
=
(
sum_type
(
1
)
<<
(
BITS
-
1
))
-
1
;
static
constexpr
value_type
SILENCE
=
0
;
};
template
<>
...
...
@@ -148,6 +156,7 @@ struct SampleTraits<SampleFormat::FLOAT> {
static
constexpr
value_type
MIN
=
-
1
;
static
constexpr
value_type
MAX
=
1
;
static
constexpr
value_type
SILENCE
=
0
;
};
template
<>
...
...
@@ -157,6 +166,8 @@ struct SampleTraits<SampleFormat::DSD> {
typedef
const
value_type
*
const_pointer_type
;
static
constexpr
size_t
SAMPLE_SIZE
=
sizeof
(
value_type
);
static
constexpr
value_type
SILENCE
=
0x69
;
};
#endif
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