summaryrefslogtreecommitdiff
path: root/libs/audiographer/src/general/sample_format_converter.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2014-01-10 14:53:03 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2014-01-10 14:53:03 -0500
commitd15fda6d751a465d278f477923075d4783f3b1ca (patch)
tree99e36ff934f50d9c980dbeab09ad021cda3d098c /libs/audiographer/src/general/sample_format_converter.cc
parent22c303d8f6c355a7229eb459cedf4fbdf0eb3c1d (diff)
parent0bdf4c25cfee8cf2408d2b1367f2c5e5c8c509b1 (diff)
fix merge errors with master
Diffstat (limited to 'libs/audiographer/src/general/sample_format_converter.cc')
-rw-r--r--libs/audiographer/src/general/sample_format_converter.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/libs/audiographer/src/general/sample_format_converter.cc b/libs/audiographer/src/general/sample_format_converter.cc
index 5fe9a1185b..aaeda09477 100644
--- a/libs/audiographer/src/general/sample_format_converter.cc
+++ b/libs/audiographer/src/general/sample_format_converter.cc
@@ -54,10 +54,14 @@ template <>
void
SampleFormatConverter<int32_t>::init (framecnt_t max_frames, int type, int data_width)
{
- // 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");
+ if(throw_level (ThrowObject) && data_width > 32) {
+ throw Exception (*this, "Trying to use SampleFormatConverter<int32_t> with a data width > 32");
}
+
+ // GDither is broken with GDither32bit if the dither depth is bigger than 24.
+ // And since floats only have 24 bits of data, we are fine with this.
+ data_width = std::min(data_width, 24);
+
init_common (max_frames);
dither = gdither_new ((GDitherType) type, channels, GDither32bit, data_width);
}
@@ -68,7 +72,7 @@ SampleFormatConverter<int16_t>::init (framecnt_t max_frames, int type, int data_
{
if (throw_level (ThrowObject) && data_width > 16) {
throw Exception (*this, boost::str(boost::format
- ("Data width (%1) too large for int16_t")
+ ("Data width (%1%) too large for int16_t")
% data_width));
}
init_common (max_frames);
@@ -81,7 +85,7 @@ SampleFormatConverter<uint8_t>::init (framecnt_t max_frames, int type, int data_
{
if (throw_level (ThrowObject) && data_width > 8) {
throw Exception (*this, boost::str(boost::format
- ("Data width (%1) too large for uint8_t")
+ ("Data width (%1%) too large for uint8_t")
% data_width));
}
init_common (max_frames);