Fix incorrect conversion of audio from DCP sources (#642).
authorCarl Hetherington <cth@carlh.net>
Tue, 21 Jul 2015 21:28:15 +0000 (22:28 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 21 Jul 2015 21:28:15 +0000 (22:28 +0100)
ChangeLog
src/lib/dcp_decoder.cc

index 40b78743c67b8abd8473e8ef53915d56e7115661..fd0466ffccf98ebb67480a9be4e4f49a662d4d86 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2015-07-21  Carl Hetherington  <cth@carlh.net>
+
+       * Fix incorrect conversion of audio from DCP sources (#642).
+
 2015-07-20  Carl Hetherington  <cth@carlh.net>
 
        * Version 2.1.26 released.
index 531a33c03491bb4c05991f97c4f6853c5c8f3a13..44450f7d9fb450173c4232b964472640e90e511d 100644 (file)
@@ -96,7 +96,7 @@ DCPDecoder::pass ()
                shared_ptr<AudioBuffers> data (new AudioBuffers (channels, frames));
                for (int i = 0; i < frames; ++i) {
                        for (int j = 0; j < channels; ++j) {
-                               data->data()[j][i] = float (from[0] | (from[1] << 8) | (from[2] << 16)) / (1 << 23);
+                               data->data()[j][i] = static_cast<int> ((from[0] << 8) | (from[1] << 16) | (from[2] << 24)) / static_cast<float> (INT_MAX - 256);
                                from += 3;
                        }
                }