summaryrefslogtreecommitdiff
path: root/libs/audiographer
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-11-25 09:26:35 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2013-11-25 09:26:35 -0500
commitfa22520fd257f166c00615e7e40ec10c9e29b948 (patch)
tree7c4cb225fb66306001db6f60d01aecfcfd91d2ef /libs/audiographer
parent0cca2724311b8df9989dc46efad12bdbe05c3883 (diff)
parentf1db14923e5d14331d1bf869d32862a2cf3460bb (diff)
Merge branch 'master' into cairocanvas
Diffstat (limited to 'libs/audiographer')
-rw-r--r--libs/audiographer/src/general/sample_format_converter.cc25
1 files changed, 13 insertions, 12 deletions
diff --git a/libs/audiographer/src/general/sample_format_converter.cc b/libs/audiographer/src/general/sample_format_converter.cc
index ea70dc6094..5fe9a1185b 100644
--- a/libs/audiographer/src/general/sample_format_converter.cc
+++ b/libs/audiographer/src/general/sample_format_converter.cc
@@ -52,25 +52,24 @@ SampleFormatConverter<float>::init (framecnt_t max_frames, int /* type */, int d
template <>
void
-SampleFormatConverter<int32_t>::init (framecnt_t max_frames, int /*type*/, int data_width)
+SampleFormatConverter<int32_t>::init (framecnt_t max_frames, int type, int data_width)
{
- if(throw_level (ThrowObject) && data_width < 24) {
- throw Exception (*this, "Trying to use SampleFormatConverter<int32_t> for data widths < 24");
+ // GDither is broken with GDither32bit if the dither depth is bigger than 24
+ if(throw_level (ThrowObject) && data_width > 24) {
+ throw Exception (*this, "Trying to use SampleFormatConverter<int32_t> a data width > 24");
}
-
init_common (max_frames);
-
- // GDither is broken with GDither32bit if the dither depth
- // is bigger than 24, so lets just use that...
- dither = gdither_new (GDitherNone, channels, GDither32bit, 24);
+ dither = gdither_new ((GDitherType) type, channels, GDither32bit, data_width);
}
template <>
void
SampleFormatConverter<int16_t>::init (framecnt_t max_frames, int type, int data_width)
{
- if (throw_level (ThrowObject) && data_width != 16) {
- throw Exception (*this, "Unsupported data width");
+ if (throw_level (ThrowObject) && data_width > 16) {
+ throw Exception (*this, boost::str(boost::format
+ ("Data width (%1) too large for int16_t")
+ % data_width));
}
init_common (max_frames);
dither = gdither_new ((GDitherType) type, channels, GDither16bit, data_width);
@@ -80,8 +79,10 @@ template <>
void
SampleFormatConverter<uint8_t>::init (framecnt_t max_frames, int type, int data_width)
{
- if (throw_level (ThrowObject) && data_width != 8) {
- throw Exception (*this, "Unsupported data width");
+ if (throw_level (ThrowObject) && data_width > 8) {
+ throw Exception (*this, boost::str(boost::format
+ ("Data width (%1) too large for uint8_t")
+ % data_width));
}
init_common (max_frames);
dither = gdither_new ((GDitherType) type, channels, GDither8bit, data_width);