#include "raw_convert.h"
#include "compose.hpp"
#include <libcxml/cxml.h>
+#include <libxml++/libxml++.h>
#include <boost/foreach.hpp>
+#include <iostream>
#include "i18n.h"
AudioContent::AudioContent (shared_ptr<const Film> film, cxml::ConstNodePtr node)
: Content (film, node)
{
- _audio_gain = node->number_child<float> ("AudioGain");
+ _audio_gain = node->number_child<double> ("AudioGain");
_audio_delay = node->number_child<int> ("AudioDelay");
}
}
AudioMapping merged (channels, MAX_DCP_AUDIO_CHANNELS);
+ merged.make_zero ();
int c = 0;
int s = 0;
AudioMapping mapping = i->mapping ();
for (int j = 0; j < mapping.input_channels(); ++j) {
for (int k = 0; k < MAX_DCP_AUDIO_CHANNELS; ++k) {
- merged.set (c, k, mapping.get (j, k));
+ if (k < mapping.output_channels()) {
+ merged.set (c, k, mapping.get (j, k));
+ }
}
++c;
}
int
AudioContent::resampled_audio_frame_rate () const
{
- shared_ptr<const Film> film = _film.lock ();
- DCPOMATIC_ASSERT (film);
-
/* Resample to a DCI-approved sample rate */
double t = has_rate_above_48k() ? 96000 : 48000;
- FrameRateChange frc = film->active_frame_rate_change (position ());
+ FrameRateChange frc = film()->active_frame_rate_change (position ());
/* Compensate if the DCP is being run at a different frame rate
to the source; that is, if the video is run such that it will
t /= frc.speed_up;
}
- return rint (t);
+ return lrint (t);
}
string