MPD: pcm/dsd2pcm/dsd2pcm.h Source File

MPD 0.20.18

dsd2pcm.h
Go to the documentation of this file.
1 /*
2
3 Copyright 2009, 2011 Sebastian Gesemann. All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without modification, are
6 permitted provided that the following conditions are met:
7
8 1. Redistributions of source code must retain the above copyright notice, this list of
9 conditions and the following disclaimer.
10
11 2. Redistributions in binary form must reproduce the above copyright notice, this list
12 of conditions and the following disclaimer in the documentation and/or other materials
13 provided with the distribution.
14
15 THIS SOFTWARE IS PROVIDED BY SEBASTIAN GESEMANN ''AS IS'' AND ANY EXPRESS OR IMPLIED
16 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
17 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEBASTIAN GESEMANN OR
18 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
21 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
23 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
25 The views and conclusions contained in the software and documentation are those of the
26 authors and should not be interpreted as representing official policies, either expressed
27 or implied, of Sebastian Gesemann.
28
29 */
30
31 #ifndef DSD2PCM_H_INCLUDED
32 #define DSD2PCM_H_INCLUDED
33
34 #include <stddef.h>
35 #include <string.h>
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40
41 struct dsd2pcm_ctx_s;
42
43 typedef struct dsd2pcm_ctx_s dsd2pcm_ctx;
44
53 extern dsd2pcm_ctx* dsd2pcm_init(void);
54
59 extern void dsd2pcm_destroy(dsd2pcm_ctx *ctx);
60
65 extern dsd2pcm_ctx* dsd2pcm_clone(dsd2pcm_ctx *ctx);
66
70 extern void dsd2pcm_reset(dsd2pcm_ctx *ctx);
71
83 extern void dsd2pcm_translate(dsd2pcm_ctx *ctx,
84 size_t samples,
85 const unsigned char *src, ptrdiff_t src_stride,
86 int lsbitfirst,
87 float *dst, ptrdiff_t dst_stride);
88
89 #ifdef __cplusplus
90 } /* extern "C" */
91 #endif
92
93 #endif /* include guard DSD2PCM_H_INCLUDED */
94
dsd2pcm_destroy
void dsd2pcm_destroy(dsd2pcm_ctx *ctx)
deinitializes a "dsd2pcm engine" (releases memory, don&#39;t forget!)
dsd2pcm_ctx
struct dsd2pcm_ctx_s dsd2pcm_ctx
Definition: dsd2pcm.h:43
dsd2pcm_init
dsd2pcm_ctx * dsd2pcm_init(void)
initializes a "dsd2pcm engine" for one channel (precomputes tables and allocates memory) ...
dsd2pcm_reset
void dsd2pcm_reset(dsd2pcm_ctx *ctx)
resets the internal state for a fresh new stream
dsd2pcm_translate
void dsd2pcm_translate(dsd2pcm_ctx *ctx, size_t samples, const unsigned char *src, ptrdiff_t src_stride, int lsbitfirst, float *dst, ptrdiff_t dst_stride)
"translates" a stream of octets to a stream of floats (8:1 decimation)
dsd2pcm_clone
dsd2pcm_ctx * dsd2pcm_clone(dsd2pcm_ctx *ctx)
clones the context and returns a pointer to the newly allocated copy