From 3fcf463f9ef42aa0da0da4f9d0aed2e7aeda28bb Mon Sep 17 00:00:00 2001 From: Sebastian Gesemann Date: Mon, 3 Oct 2011 12:03:37 +0200 Subject: import dsd2pcm_src.zip [this is the code from dsd2pcm_src.zip, published on a forum by Sebastian Gesemann. Upon request, he has given permission to redistribute and modify his code, without referring to a specific license. - mk] --- src/dsd2pcm/dsd2pcm.hpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/dsd2pcm/dsd2pcm.hpp (limited to 'src/dsd2pcm/dsd2pcm.hpp') diff --git a/src/dsd2pcm/dsd2pcm.hpp b/src/dsd2pcm/dsd2pcm.hpp new file mode 100644 index 00000000..b1b2ae1c --- /dev/null +++ b/src/dsd2pcm/dsd2pcm.hpp @@ -0,0 +1,41 @@ +#ifndef DSD2PCM_HXX_INCLUDED +#define DSD2PCM_HXX_INCLUDED + +#include +#include +#include "dsd2pcm.h" + +/** + * C++ PImpl Wrapper for the dsd2pcm C library + */ + +class dxd +{ + dsd2pcm_ctx *handle; +public: + dxd() : handle(dsd2pcm_init()) + { if (!handle) throw std::runtime_error("wtf?!"); } + + dxd(dxd const& x) : handle(dsd2pcm_clone(x.handle)) + { if (!handle) throw std::runtime_error("wtf?!"); } + + ~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 + -- cgit v1.2.3