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
cb4f5d45
Commit
cb4f5d45
authored
Feb 26, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pcm/dsd: use std::array
parent
e5c6fe1b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
12 deletions
+11
-12
PcmDsd.cxx
src/pcm/PcmDsd.cxx
+8
-11
PcmDsd.hxx
src/pcm/PcmDsd.hxx
+3
-1
No files found.
src/pcm/PcmDsd.cxx
View file @
cb4f5d45
...
...
@@ -20,31 +20,28 @@
#include "config.h"
#include "PcmDsd.hxx"
#include "dsd2pcm/dsd2pcm.h"
#include "util/Macros.hxx"
#include "util/ConstBuffer.hxx"
#include <algorithm>
#include <assert.h>
PcmDsd
::
PcmDsd
()
{
std
::
fill_n
(
dsd2pcm
,
ARRAY_SIZE
(
dsd2pcm
),
nullptr
);
dsd2pcm
.
fill
(
nullptr
);
}
PcmDsd
::~
PcmDsd
()
{
for
(
unsigned
i
=
0
;
i
<
ARRAY_SIZE
(
dsd2pcm
);
++
i
)
if
(
dsd2pcm
[
i
]
!=
nullptr
)
dsd2pcm_destroy
(
dsd2pcm
[
i
]
);
for
(
auto
i
:
dsd2pcm
)
if
(
i
!=
nullptr
)
dsd2pcm_destroy
(
i
);
}
void
PcmDsd
::
Reset
()
{
for
(
unsigned
i
=
0
;
i
<
ARRAY_SIZE
(
dsd2pcm
);
++
i
)
if
(
dsd2pcm
[
i
]
!=
nullptr
)
dsd2pcm_reset
(
dsd2pcm
[
i
]
);
for
(
auto
i
:
dsd2pcm
)
if
(
i
!=
nullptr
)
dsd2pcm_reset
(
i
);
}
ConstBuffer
<
float
>
...
...
@@ -53,7 +50,7 @@ PcmDsd::ToFloat(unsigned channels, ConstBuffer<uint8_t> src)
assert
(
!
src
.
IsNull
());
assert
(
!
src
.
IsEmpty
());
assert
(
src
.
size
%
channels
==
0
);
assert
(
channels
<=
ARRAY_SIZE
(
dsd2pcm
));
assert
(
channels
<=
dsd2pcm
.
max_size
(
));
const
unsigned
num_samples
=
src
.
size
;
const
unsigned
num_frames
=
src
.
size
/
channels
;
...
...
src/pcm/PcmDsd.hxx
View file @
cb4f5d45
...
...
@@ -23,6 +23,8 @@
#include "check.h"
#include "PcmBuffer.hxx"
#include <array>
#include <stdint.h>
template
<
typename
T
>
struct
ConstBuffer
;
...
...
@@ -33,7 +35,7 @@ template<typename T> struct ConstBuffer;
class
PcmDsd
{
PcmBuffer
buffer
;
st
ruct
dsd2pcm_ctx_s
*
dsd2pcm
[
32
]
;
st
d
::
array
<
struct
dsd2pcm_ctx_s
*
,
32
>
dsd2pcm
;
public
:
PcmDsd
();
...
...
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