aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcm/dsd2pcm/dsd2pcm.hpp
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-04-09 01:24:52 +0200
committerMax Kellermann <max@duempel.org>2013-04-09 01:24:52 +0200
commitc654c7630aad220a4935c34b076e107b6b0561a5 (patch)
tree7ca6e4e30bee7153ed54f302467140180d77490d /src/pcm/dsd2pcm/dsd2pcm.hpp
parent3f3b26fb0ee090bfc1321572904aa94deca42a84 (diff)
downloadmpd-c654c7630aad220a4935c34b076e107b6b0561a5.tar.gz
mpd-c654c7630aad220a4935c34b076e107b6b0561a5.tar.xz
mpd-c654c7630aad220a4935c34b076e107b6b0561a5.zip
pcm_*: move to src/pcm/
Diffstat (limited to 'src/pcm/dsd2pcm/dsd2pcm.hpp')
-rw-r--r--src/pcm/dsd2pcm/dsd2pcm.hpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/pcm/dsd2pcm/dsd2pcm.hpp b/src/pcm/dsd2pcm/dsd2pcm.hpp
new file mode 100644
index 000000000..8f3f55197
--- /dev/null
+++ b/src/pcm/dsd2pcm/dsd2pcm.hpp
@@ -0,0 +1,39 @@
+#ifndef DSD2PCM_HXX_INCLUDED
+#define DSD2PCM_HXX_INCLUDED
+
+#include <algorithm>
+#include <stdexcept>
+#include "dsd2pcm.h"
+
+/**
+ * C++ PImpl Wrapper for the dsd2pcm C library
+ */
+
+class dxd
+{
+ dsd2pcm_ctx *handle;
+public:
+ dxd() : handle(dsd2pcm_init()) {}
+
+ dxd(dxd const& x) : handle(dsd2pcm_clone(x.handle)) {}
+
+ ~dxd() { dsd2pcm_destroy(handle); }
+
+ friend void swap(dxd & a, dxd & b)
+ { std::swap(a.handle,b.handle); }
+
+ dxd& operator=(dxd x)
+ { swap(*this,x); return *this; }
+
+ void translate(size_t samples,
+ const unsigned char *src, ptrdiff_t src_stride,
+ bool lsbitfirst,
+ float *dst, ptrdiff_t dst_stride)
+ {
+ dsd2pcm_translate(handle,samples,src,src_stride,
+ lsbitfirst,dst,dst_stride);
+ }
+};
+
+#endif // DSD2PCM_HXX_INCLUDED
+