aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcm/Traits.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/pcm/Traits.hxx')
-rw-r--r--src/pcm/Traits.hxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/pcm/Traits.hxx b/src/pcm/Traits.hxx
index 17bcfee85..b102b41ab 100644
--- a/src/pcm/Traits.hxx
+++ b/src/pcm/Traits.hxx
@@ -25,16 +25,40 @@
#include <stdint.h>
+/**
+ * This template describes the specified #SampleFormat. This is an
+ * empty prototype; the specializations contain the real definitions.
+ * See SampleTraits<uint8_t> for more documentation.
+ */
template<SampleFormat F>
struct SampleTraits {};
template<>
struct SampleTraits<SampleFormat::S8> {
+ /**
+ * The type used for one sample value.
+ */
typedef int8_t value_type;
+
+ /**
+ * A writable pointer.
+ */
typedef value_type *pointer_type;
+
+ /**
+ * A read-only pointer.
+ */
typedef const value_type *const_pointer_type;
+ /**
+ * The size of one sample in bytes.
+ */
static constexpr size_t SAMPLE_SIZE = sizeof(value_type);
+
+ /**
+ * The integer bit depth of one sample. This attribute may
+ * not exist if this is not an integer sample format.
+ */
static constexpr unsigned BITS = sizeof(value_type) * 8;
};